Some improvements for ACL Support #157

This commit is contained in:
the-djmaze 2024-02-12 20:48:43 +01:00
parent a0f7114a39
commit b0d4b56cee
9 changed files with 160 additions and 20 deletions

View file

@ -27,6 +27,9 @@ import Remote from 'Remote/User/Fetch';
import { FileInfo } from 'Common/File';
import { FolderPopupView } from 'View/Popup/Folder';
import { showScreenPopup } from 'Knoin/Knoin';
const
// isPosNumeric = value => null != value && /^[0-9]*$/.test(value.toString()),
@ -481,7 +484,8 @@ export class FolderModel extends AbstractModel {
}
edit() {
this.canBeEdited() && this.editing(true);
// this.canBeEdited() && this.editing(true);
this.canBeEdited() && showScreenPopup(FolderPopupView, [this]);
}
unedit() {

View file

@ -15,6 +15,7 @@ import Remote from 'Remote/User/Fetch';
import { showScreenPopup } from 'Knoin/Knoin';
//import { FolderPopupView } from 'View/Popup/Folder';
import { FolderCreatePopupView } from 'View/Popup/FolderCreate';
import { FolderSystemPopupView } from 'View/Popup/FolderSystem';

44
dev/View/Popup/Folder.js Normal file
View file

@ -0,0 +1,44 @@
import { addObservablesTo } from 'External/ko';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
import Remote from 'Remote/User/Fetch';
export class FolderPopupView extends AbstractViewPopup {
constructor() {
super('Folder');
addObservablesTo(this, {
folder: null // FolderModel
});
this.ACL = ko.observableArray();
}
onClose() {
this.folder().unedit();
}
submitForm(form) {
this.folder().rename();
console.dir({form});
this.close();
}
beforeShow(folder) {
this.ACL([]);
folder.editing(true);
this.folder(folder);
Remote.request('FolderACL', (iError, data) => {
if (!iError && data.Result) {
this.ACL(
Object.entries(data.Result).map(([key, value]) => {
value.identifier = key;
return value;
})
);
}
}, {
folder: folder.fullName
});
}
}