1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-04 21:15:24 +02:00

EmberJS: FolderID to SpaceID

Co-Authored-By: Harvey Kandola <harvey@documize.com>
This commit is contained in:
sauls8t 2018-10-12 17:54:15 +01:00
parent 66d5e73ed1
commit e0457b40da
45 changed files with 170 additions and 99 deletions

View file

@ -127,7 +127,7 @@ export default Component.extend(ModalMixin, TooltipMixin, {
selection = {
context: '',
documentId: documentId,
folderId: folderId,
spaceId: folderId,
id: stringUtil.makeId(16),
linkType: 'network',
targetId: '',

View file

@ -147,7 +147,7 @@ export default Component.extend(ModalMixin, Tooltips, {
this.get('documentService').getPageMeta(this.get('document.id'), page.get('id')).then((pm) => {
let block = {
folderId: this.get('folder.id'),
spaceId: this.get('folder.id'),
contentType: page.get('contentType'),
pageType: page.get('pageType'),
title: blockTitle,

View file

@ -137,7 +137,7 @@ export default Component.extend(Notifier, {
// prepare links associated with document
link.forEach((l) => {
let t = {
folderId: folderId,
spaceId: folderId,
documentId: docId,
categoryId: l.get('id')
};
@ -148,7 +148,7 @@ export default Component.extend(Notifier, {
// prepare links no longer associated with document
unlink.forEach((l) => {
let t = {
folderId: folderId,
spaceId: folderId,
documentId: docId,
categoryId: l.get('id')
};

View file

@ -108,7 +108,7 @@ export default Component.extend(ModalMixin, TooltipMixin, Notifer, {
let c = {
category: cat,
folderId: this.get('space.id')
spaceId: this.get('space.id')
};
this.showWait();

View file

@ -41,11 +41,11 @@ export default Component.extend(AuthMixin, Notifier, {
let folder = this.get('space');
let spaceTypeOptions = A([]);
spaceTypeOptions.pushObject({id: constants.FolderType.Private, label: 'Private - viewable only by me'});
spaceTypeOptions.pushObject({id: constants.FolderType.Protected, label: 'Protected - access is restricted to selected users'});
spaceTypeOptions.pushObject({id: constants.FolderType.Public, label: 'Public - can be seen by everyone'});
spaceTypeOptions.pushObject({id: constants.SpaceType.Private, label: 'Private - viewable only by me'});
spaceTypeOptions.pushObject({id: constants.SpaceType.Protected, label: 'Protected - access is restricted to selected users'});
spaceTypeOptions.pushObject({id: constants.SpaceType.Public, label: 'Public - can be seen by everyone'});
this.set('spaceTypeOptions', spaceTypeOptions);
this.set('spaceType', spaceTypeOptions.findBy('id', folder.get('folderType')));
this.set('spaceType', spaceTypeOptions.findBy('id', folder.get('spaceType')));
this.set('allowLikes', folder.get('allowLikes'));
@ -75,7 +75,7 @@ export default Component.extend(AuthMixin, Notifier, {
if (!this.get('isSpaceAdmin')) return;
let space = this.get('space');
space.set('folderType', this.get('spaceType.id'));
space.set('spaceType', this.get('spaceType.id'));
let allowLikes = this.get('allowLikes');
space.set('likes', allowLikes ? this.get('likes') : '');

View file

@ -99,7 +99,7 @@ export default Component.extend(Notifier, Modals, {
let raw = {
id: stringUtil.makeId(16),
orgId: this.get('folder.orgId'),
folderId: this.get('folder.id'),
spaceId: this.get('folder.id'),
whoId: whoId,
who: who,
name: name,

View file

@ -92,7 +92,7 @@ export default Component.extend(ModalMixin, {
actions: {
jumpToPin(pin) {
let folderId = pin.get('folderId');
let folderId = pin.get('spaceId');
let documentId = pin.get('documentId');
if (_.isEmpty(documentId)) {

View file

@ -36,13 +36,13 @@ export default Component.extend(TooltipMixin, NotifierMixin, AuthMixin, {
let privateFolders = [];
_.each(folders, folder => {
if (folder.get('folderType') === constants.FolderType.Public) {
if (folder.get('spaceType') === constants.SpaceType.Public) {
publicFolders.pushObject(folder);
}
if (folder.get('folderType') === constants.FolderType.Private) {
if (folder.get('spaceType') === constants.SpaceType.Private) {
privateFolders.pushObject(folder);
}
if (folder.get('folderType') === constants.FolderType.Protected) {
if (folder.get('spaceType') === constants.SpaceType.Protected) {
protectedFolders.pushObject(folder);
}
});

View file

@ -92,7 +92,7 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, Notifier, {
let pin = {
pin: this.get('pinState.newName'),
documentId: this.get('document.id'),
folderId: this.get('space.id')
spaceId: this.get('space.id')
};
this.get('pinned').pinItem(pin).then((pin) => {

View file

@ -164,7 +164,7 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, Notifier, {
let pin = {
pin: this.get('pinState.newName'),
documentId: '',
folderId: this.get('space.id')
spaceId: this.get('space.id')
};
this.get('pinned').pinItem(pin).then((pin) => {

View file

@ -15,7 +15,7 @@ import EmberObject from "@ember/object";
// let constants = this.get('constants');
let constants = EmberObject.extend({
FolderType: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
SpaceType: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
Public: 1,
Private: 2,
Protected: 3

View file

@ -14,7 +14,7 @@ import attr from 'ember-data/attr';
export default Model.extend({
orgId: attr('string'),
folderId: attr('string'),
spaceId: attr('string'),
userId: attr('string'),
contentType: attr('string'),
pageType: attr('string'),

View file

@ -14,7 +14,7 @@ import attr from 'ember-data/attr';
export default Model.extend({
orgId: attr('string'),
folderId: attr('string'),
spaceId: attr('string'),
category: attr('string'),
created: attr(),
revised: attr(),

View file

@ -15,7 +15,7 @@ import attr from 'ember-data/attr';
export default Model.extend({
orgId: attr('string'),
folderId: attr('string'),
spaceId: attr('string'),
documentId: attr('string'),
pageId: attr('string'),
pageTitle: attr('string'),

View file

@ -20,7 +20,7 @@ export default Model.extend({
job: attr('string'),
location: attr('string'),
orgId: attr('string'),
folderId: attr('string'),
spaceId: attr('string'),
userId: attr('string'),
tags: attr('string'),
template: attr('boolean'),

View file

@ -18,7 +18,7 @@ export default Model.extend({
name: attr('string'),
orgId: attr('string'),
userId: attr('string'),
folderType: attr('number', { defaultValue: 2 }),
spaceType: attr('number', { defaultValue: 2 }),
lifecycle: attr('number', { defaultValue: 1 }),
likes: attr('string'),
@ -32,17 +32,17 @@ export default Model.extend({
markAsRestricted() {
let constants = this.get('constants');
this.set('folderType', constants.FolderType.Protected);
this.set('spaceType', constants.SpaceType.Protected);
},
markAsPrivate() {
let constants = this.get('constants');
this.set('folderType', constants.FolderType.Private);
this.set('spaceType', constants.SpaceType.Private);
},
markAsPublic() {
let constants = this.get('constants');
this.set('folderType', constants.FolderType.Public);
this.set('spaceType', constants.SpaceType.Public);
},
// client-side prop that holds who can see this folder

View file

@ -16,7 +16,7 @@ import { computed } from '@ember/object';
export default Model.extend({
orgId: attr('string'),
userId: attr('string'),
folderId: attr('string'),
spaceId: attr('string'),
documentId: attr('string'),
sequence: attr('number', { defaultValue: 99 }),
pin: attr('string'),

View file

@ -20,8 +20,8 @@ export default Model.extend({
firstname: attr('string'),
lastname: attr('string'),
name: attr('string'),
folderId: attr('string'),
folderType: attr('number', { defaultValue: 0 }),
spaceId: attr('string'),
spaceType: attr('number', { defaultValue: 0 }),
fullname: computed('firstname', 'lastname', function () {
return `${this.get('firstname')} ${this.get('lastname')}`;

View file

@ -14,7 +14,7 @@ import attr from 'ember-data/attr';
export default Model.extend({
orgId: attr('string'),
folderId: attr('string'),
spaceId: attr('string'),
whoId: attr('string'),
who: attr('string'),
spaceView: attr('boolean'),

View file

@ -16,7 +16,7 @@ import attr from 'ember-data/attr';
export default Model.extend({
documentName: attr('string'),
documentId: attr('string'),
folderId: attr('string'),
spaceId: attr('string'),
contributed: attr('string'),
viewed: attr('string'),
created: attr('string'),

View file

@ -20,6 +20,12 @@ export default Controller.extend({
if(this.get('session.isAdmin')) {
return this.get('global').backup(spec);
}
},
onRestore(spec, filedata) {
if(this.get('session.isAdmin')) {
return this.get('global').restore(spec, filedata);
}
}
}
});

View file

@ -1 +1 @@
{{customize/backup-restore onBackup=(action 'onBackup')}}
{{customize/backup-restore onBackup=(action 'onBackup') onRestore=(action 'onRestore')}}

View file

@ -65,7 +65,7 @@ export default Controller.extend(TooltipMixin, Notifier, {
this.set('deleteSpace.name', '');
this.get('folderService').adminList().then((folders) => {
let nonPrivateFolders = folders.rejectBy('folderType', 2);
let nonPrivateFolders = folders.rejectBy('spaceType', 2);
if (is.empty(nonPrivateFolders) || is.null(folders) || is.undefined(folders)) {
nonPrivateFolders = [];
}

View file

@ -27,7 +27,7 @@ export default Route.extend(AuthenticatedRouteMixin, {
},
setupController(controller, model) {
let nonPrivateFolders = model.rejectBy('folderType', 2);
let nonPrivateFolders = model.rejectBy('spaceType', 2);
if (is.empty(nonPrivateFolders) || is.null(model) || is.undefined(model)) {
nonPrivateFolders = [];
}

View file

@ -48,7 +48,7 @@ export default Controller.extend(NotifierMixin, {
all(promises1).then(() => {
promises1.forEach(function(doc, index) {
doc.then((d) => {
d.set('folderId', targetSpaceId);
d.set('spaceId', targetSpaceId);
d.set('selected', false);
promises2[index] = self.get('documentService').save(d);
});

View file

@ -410,7 +410,7 @@ export default Service.extend({
data.permissions = perms;
data.roles = roles;
data.folders = folders;
data.folder = folders.findBy('id', doc.get('folderId'));
data.folder = folders.findBy('id', doc.get('spaceId'));
data.links = response.links;
data.versions = response.versions;

View file

@ -82,7 +82,7 @@ export default Service.extend(Notifier, {
linkId: a.attributes["data-link-id"].value,
linkType: a.attributes["data-link-type"].value,
documentId: a.attributes["data-link-target-document-id"].value,
folderId: a.attributes["data-link-space-id"].value,
spaceId: a.attributes["data-link-space-id"].value,
targetId: a.attributes["data-link-target-id"].value,
externalId: is.undefined(a.attributes["data-link-external-id"]) ? '' : a.attributes["data-link-external-id"].value,
url: a.attributes["href"].value,

View file

@ -133,7 +133,7 @@ export default Service.extend({
return this.getUserPins().then((pins) => {
pins.forEach((pin) => {
if (pin.get('userId') === userId && pin.get('documentId') === '' && pin.get('folderId') === spaceId) {
if (pin.get('userId') === userId && pin.get('documentId') === '' && pin.get('spaceId') === spaceId) {
resolve(pin.get('id'));
}
});

View file

@ -8,17 +8,82 @@
</div>
<div class="view-customize">
<form class="mt-5 ">
<div class="form-group">
<p>It can take several minutes to complete the backup process &mdash; please be patient while the backup is running.</p>
<div class="btn btn-success my-5" {{action 'onBackup'}}>{{buttonLabel}}</div>
{{#if backupFailed}}
<p class="text-danger">Backup failed &mdash; please check server logs</p>
{{/if}}
{{#if backupSuccess}}
<p class="font-weight-bold">Backup successful ({{backupFilename}})</p>
{{/if}}
</div>
</form>
</div>
<div class="backup-restore">
<div class="backup-zone">
{{#if session.isGlobalAdmin}}
<div class="explain">
<p>
Documize is a multi-tenanted application enabling both "tech.mycompany.com" and "sales.mycompany.com" to run using the same executable/database.
As a Documize <b>Global</b> Administrator, you will be performing a complete system-wide backup across all tenants.
A regular Documize Administrator can login to perform just a tenant-level backup (e.g. marketing.mycompany.com).
</p>
</div>
{{/if}}
<p class="font-weight-bold">It can take several minutes to complete the backup process &mdash; please be patient while the backup operation is in progress</p>
<div class="margin-top-30 margin-bottom-20">
{{#ui/ui-checkbox selected=backupSpec.retain}}
Retain backup file on server
{{/ui/ui-checkbox}}
</div>
<button class="btn btn-success mb-3" {{action 'onBackup'}}>{{buttonLabel}}</button>
{{#if backupFailed}}
<div class="backup-fail">Backup failed &mdash; please check server logs</div>
{{/if}}
{{#if backupSuccess}}
<div class="backup-success">Backup successful ({{backupFilename}})</div>
{{/if}}
</div>
</div>
<div class="backup-restore">
<div class="restore-zone">
{{#if session.isGlobalAdmin}}
<div class="explain">
<p class="font-weight-bold">WARNING:</p>
<p>
You should only perform a restore on a <b>new Documize instance</b> and NOT on the original instance.
Duplicate data might exist if you restore onto the same instance without first removing previous data.
</p>
</div>
{{/if}}
<p class="font-weight-bold">It can take up to an hour to complete the restore process &mdash; please be patient while the restore operation is in progress</p>
<div class="margin-top-30 margin-bottom-20">
<div class="custom-file">
<input type="file" class="custom-file-input" id="restore-file" accept="application/zip" multiple=false onchange={{action "upload"}}>
<label class="custom-file-label" for="restore-file">Choose backup file</label>
</div>
<div class="restore-upload-busy">
{{#if restoreUploadReady}}
<div class="ready">Ready to start restore</div>
{{/if}}
{{#if restoreUploading}}
<img src="/assets/img/busy-gray.gif" />
<div class="wait">Uploading file</div>
{{/if}}
</div>
<div class="margin-top-20"></div>
{{#ui/ui-checkbox selected=restoreSpec.overwriteOrg}}
Overwrite settings &mdash; SMTP, authentication, integrations and other settings
{{/ui/ui-checkbox}}
{{#ui/ui-checkbox selected=restoreSpec.recreateUsers}}
Recreate user accounts &mdash; users, groups, permissions
{{/ui/ui-checkbox}}
</div>
{{#if restoreFailed}}
<div class="restore-fail">Restore failed &mdash; please check server logs</div>
{{else if restoreSuccess}}
<div class="restore-success">Restore completed &mdash; restart your browser and log in</div>
{{else}}
{{#if restoreUploadReady}}
<button class="btn btn-danger mb-3" {{action 'onRestore'}}>{{restoreButtonLabel}}</button>
{{/if}}
{{/if}}
</div>
</div>
</div>