[#43655] added tooltip for files in location picker (#11985)

pull/11991/head
Eric Schubert 2 years ago committed by GitHub
parent 21c9138da4
commit 945d1cedb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts
  2. 1
      modules/storages/config/locales/js-en.yml

@ -27,7 +27,11 @@
//++
import {
ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Inject,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ElementRef,
Inject,
} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
@ -63,6 +67,7 @@ export class LocationPickerModalComponent extends FilePickerBaseModalComponent {
},
tooltip: {
directory_not_writeable: this.i18n.t('js.storages.files.directory_not_writeable'),
file_not_selectable: this.i18n.t('js.storages.files.file_not_selectable_location'),
},
};
@ -108,12 +113,18 @@ export class LocationPickerModalComponent extends FilePickerBaseModalComponent {
!isDirectory(file),
index === 0,
this.enterDirectoryCallback(file),
this.isDirectoryWithoutWritePermission(file) ? this.text.tooltip.directory_not_writeable : undefined,
this.tooltip(file),
undefined,
);
}
private isDirectoryWithoutWritePermission(file:IStorageFile):boolean {
return isDirectory(file) && !file.permissions.some((permission) => permission === 'writeable');
private tooltip(file:IStorageFile):string|undefined {
if (isDirectory(file)) {
return file.permissions.some((permission) => permission === 'writeable')
? undefined
: this.text.tooltip.directory_not_writeable;
}
return this.text.tooltip.file_not_selectable;
}
}

@ -31,6 +31,7 @@ en:
files:
directory_not_writeable: "You do not have to permission to add files to this folder."
dragging_many_files: "The upload to %{storageType} supports only one file at once."
file_not_selectable_location: "Selecting a file is not possible in the process of choosing a location."
file_links:
empty: >

Loading…
Cancel
Save