From e0457b40da7d2ff5dfc4bd77e7444e63d35d8b0a Mon Sep 17 00:00:00 2001 From: sauls8t Date: Fri, 12 Oct 2018 17:54:15 +0100 Subject: [PATCH] EmberJS: FolderID to SpaceID Co-Authored-By: Harvey Kandola --- domain/block/endpoint.go | 8 +- domain/conversion/conversion.go | 10 +- domain/conversion/endpoint.go | 4 +- domain/link/endpoint.go | 10 +- domain/template/endpoint.go | 22 ++--- gui/app/components/document/content-linker.js | 2 +- gui/app/components/document/page-heading.js | 2 +- gui/app/components/document/settings-meta.js | 4 +- .../components/folder/settings-category.js | 2 +- gui/app/components/folder/settings-general.js | 10 +- .../components/folder/settings-permissions.js | 2 +- gui/app/components/layout/top-bar.js | 2 +- gui/app/components/spaces/space-list.js | 6 +- gui/app/components/toolbar/for-document.js | 2 +- gui/app/components/toolbar/for-space.js | 2 +- gui/app/constants/constants.js | 2 +- gui/app/models/block.js | 2 +- gui/app/models/category.js | 2 +- gui/app/models/document-activity.js | 2 +- gui/app/models/document.js | 2 +- gui/app/models/folder.js | 8 +- gui/app/models/pin.js | 2 +- .../models/protected-folder-participant.js | 4 +- gui/app/models/space-permission.js | 2 +- gui/app/models/user-activity.js | 2 +- gui/app/pods/customize/backup/controller.js | 6 ++ gui/app/pods/customize/backup/template.hbs | 2 +- gui/app/pods/customize/folders/controller.js | 2 +- gui/app/pods/customize/folders/route.js | 2 +- gui/app/pods/folder/index/controller.js | 2 +- gui/app/services/document.js | 2 +- gui/app/services/link.js | 2 +- gui/app/services/pinned.js | 2 +- .../components/customize/backup-restore.hbs | 91 ++++++++++++++++--- gui/mirage/config.js | 4 +- gui/mirage/factories/folder.js | 8 +- model/activity/activity.go | 4 +- model/block/block.go | 2 +- model/category/category.go | 4 +- model/doc/doc.go | 2 +- model/link/link.go | 4 +- model/org/meta.go | 2 +- model/permission/space.go | 4 +- model/pin/pin.go | 2 +- model/space/space.go | 6 +- 45 files changed, 170 insertions(+), 99 deletions(-) diff --git a/domain/block/endpoint.go b/domain/block/endpoint.go index c30a74a9..a0656e9e 100644 --- a/domain/block/endpoint.go +++ b/domain/block/endpoint.go @@ -121,16 +121,16 @@ func (h *Handler) GetBySpace(w http.ResponseWriter, r *http.Request) { method := "block.space" ctx := domain.GetRequestContext(r) - folderID := request.Param(r, "folderID") - if len(folderID) == 0 { - response.WriteMissingDataError(w, method, "folderID") + spaceID := request.Param(r, "spaceID") + if len(spaceID) == 0 { + response.WriteMissingDataError(w, method, "spaceID") return } var b []block.Block var err error - b, err = h.Store.Block.GetBySpace(ctx, folderID) + b, err = h.Store.Block.GetBySpace(ctx, spaceID) if len(b) == 0 { b = []block.Block{} diff --git a/domain/conversion/conversion.go b/domain/conversion/conversion.go index a1185ba5..6976980e 100644 --- a/domain/conversion/conversion.go +++ b/domain/conversion/conversion.go @@ -51,9 +51,9 @@ func (h *Handler) upload(w http.ResponseWriter, r *http.Request) (string, string method := "conversion.upload" ctx := domain.GetRequestContext(r) - folderID := request.Param(r, "folderID") + spaceID := request.Param(r, "spaceID") - if !permission.CanUploadDocument(ctx, *h.Store, folderID) { + if !permission.CanUploadDocument(ctx, *h.Store, spaceID) { response.WriteForbiddenError(w) return "", "", "" } @@ -92,10 +92,10 @@ func (h *Handler) upload(w http.ResponseWriter, r *http.Request) (string, string h.Runtime.Log.Info(fmt.Sprintf("Org %s (%s) [Uploaded] %s", ctx.OrgName, ctx.OrgID, filename.Filename)) - return job, folderID, ctx.OrgID + return job, spaceID, ctx.OrgID } -func (h *Handler) convert(w http.ResponseWriter, r *http.Request, job, folderID string, conversion api.ConversionJobRequest) { +func (h *Handler) convert(w http.ResponseWriter, r *http.Request, job, spaceID string, conversion api.ConversionJobRequest) { method := "conversion.upload" ctx := domain.GetRequestContext(r) @@ -145,7 +145,7 @@ func (h *Handler) convert(w http.ResponseWriter, r *http.Request, job, folderID } // Fetch space where document resides. - sp, err := h.Store.Space.Get(ctx, folderID) + sp, err := h.Store.Space.Get(ctx, spaceID) if err != nil { ctx.Transaction.Rollback() response.WriteServerError(w, method, err) diff --git a/domain/conversion/endpoint.go b/domain/conversion/endpoint.go index bb3a95ec..6a499743 100644 --- a/domain/conversion/endpoint.go +++ b/domain/conversion/endpoint.go @@ -29,12 +29,12 @@ type Handler struct { // UploadConvert is an endpoint to both upload and convert a document func (h *Handler) UploadConvert(w http.ResponseWriter, r *http.Request) { - job, folderID, orgID := h.upload(w, r) + job, spaceID, orgID := h.upload(w, r) if job == "" { return // error already handled } - h.convert(w, r, job, folderID, api.ConversionJobRequest{ + h.convert(w, r, job, spaceID, api.ConversionJobRequest{ Job: job, IndexDepth: 4, OrgID: orgID, diff --git a/domain/link/endpoint.go b/domain/link/endpoint.go index 04cbebfc..86ae5aa1 100644 --- a/domain/link/endpoint.go +++ b/domain/link/endpoint.go @@ -39,9 +39,9 @@ func (h *Handler) GetLinkCandidates(w http.ResponseWriter, r *http.Request) { method := "link.Candidates" ctx := domain.GetRequestContext(r) - folderID := request.Param(r, "folderID") - if len(folderID) == 0 { - response.WriteMissingDataError(w, method, "folderID") + spaceID := request.Param(r, "spaceID") + if len(spaceID) == 0 { + response.WriteMissingDataError(w, method, "spaceID") return } @@ -81,7 +81,7 @@ func (h *Handler) GetLinkCandidates(w http.ResponseWriter, r *http.Request) { if p.RefID != pageID { c := link.Candidate{ RefID: uniqueid.Generate(), - SpaceID: folderID, + SpaceID: spaceID, DocumentID: documentID, TargetID: p.RefID, LinkType: p.Type, @@ -109,7 +109,7 @@ func (h *Handler) GetLinkCandidates(w http.ResponseWriter, r *http.Request) { for _, f := range files { c := link.Candidate{ RefID: uniqueid.Generate(), - SpaceID: folderID, + SpaceID: spaceID, DocumentID: documentID, TargetID: f.RefID, LinkType: "file", diff --git a/domain/template/endpoint.go b/domain/template/endpoint.go index edabe803..f0509cf4 100644 --- a/domain/template/endpoint.go +++ b/domain/template/endpoint.go @@ -53,13 +53,13 @@ func (h *Handler) SavedList(w http.ResponseWriter, r *http.Request) { method := "template.saved" ctx := domain.GetRequestContext(r) - folderID := request.Param(r, "folderID") - if len(folderID) == 0 { - response.WriteMissingDataError(w, method, "folderID") + spaceID := request.Param(r, "spaceID") + if len(spaceID) == 0 { + response.WriteMissingDataError(w, method, "spaceID") return } - documents, err := h.Store.Document.TemplatesBySpace(ctx, folderID) + documents, err := h.Store.Document.TemplatesBySpace(ctx, spaceID) if err != nil { response.WriteServerError(w, method, err) h.Runtime.Log.Error(method, err) @@ -77,7 +77,7 @@ func (h *Handler) SavedList(w http.ResponseWriter, r *http.Request) { t.Dated = d.Created t.Type = template.TypePrivate - if d.SpaceID == folderID { + if d.SpaceID == spaceID { templates = append(templates, t) } } @@ -266,9 +266,9 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) { method := "template.use" ctx := domain.GetRequestContext(r) - folderID := request.Param(r, "folderID") - if len(folderID) == 0 { - response.WriteMissingDataError(w, method, "folderID") + spaceID := request.Param(r, "spaceID") + if len(spaceID) == 0 { + response.WriteMissingDataError(w, method, "spaceID") return } @@ -295,7 +295,7 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) { d.Excerpt = "Add detailed description for document..." d.Slug = stringutil.MakeSlug(d.Name) d.Tags = "" - d.SpaceID = folderID + d.SpaceID = spaceID documentID := uniqueid.Generate() d.RefID = documentID @@ -321,7 +321,7 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) { } // Fetch space where document resides. - sp, err := h.Store.Space.Get(ctx, folderID) + sp, err := h.Store.Space.Get(ctx, spaceID) if err != nil { response.WriteServerError(w, method, err) h.Runtime.Log.Error(method, err) @@ -339,7 +339,7 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) { documentID = uniqueid.Generate() d.RefID = documentID d.Template = false - d.SpaceID = folderID + d.SpaceID = spaceID d.UserID = ctx.UserID d.Name = docTitle diff --git a/gui/app/components/document/content-linker.js b/gui/app/components/document/content-linker.js index 58dbe839..2caa891b 100644 --- a/gui/app/components/document/content-linker.js +++ b/gui/app/components/document/content-linker.js @@ -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: '', diff --git a/gui/app/components/document/page-heading.js b/gui/app/components/document/page-heading.js index 2fb9647b..b7087ecf 100644 --- a/gui/app/components/document/page-heading.js +++ b/gui/app/components/document/page-heading.js @@ -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, diff --git a/gui/app/components/document/settings-meta.js b/gui/app/components/document/settings-meta.js index e7651954..c5b7764c 100644 --- a/gui/app/components/document/settings-meta.js +++ b/gui/app/components/document/settings-meta.js @@ -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') }; diff --git a/gui/app/components/folder/settings-category.js b/gui/app/components/folder/settings-category.js index 31a7e4eb..2109991a 100644 --- a/gui/app/components/folder/settings-category.js +++ b/gui/app/components/folder/settings-category.js @@ -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(); diff --git a/gui/app/components/folder/settings-general.js b/gui/app/components/folder/settings-general.js index aeaf1011..b8c57742 100644 --- a/gui/app/components/folder/settings-general.js +++ b/gui/app/components/folder/settings-general.js @@ -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') : ''); diff --git a/gui/app/components/folder/settings-permissions.js b/gui/app/components/folder/settings-permissions.js index 06a13fee..7b7fe176 100644 --- a/gui/app/components/folder/settings-permissions.js +++ b/gui/app/components/folder/settings-permissions.js @@ -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, diff --git a/gui/app/components/layout/top-bar.js b/gui/app/components/layout/top-bar.js index ce30b063..f0e1b99f 100644 --- a/gui/app/components/layout/top-bar.js +++ b/gui/app/components/layout/top-bar.js @@ -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)) { diff --git a/gui/app/components/spaces/space-list.js b/gui/app/components/spaces/space-list.js index f64f906a..a9f052a3 100644 --- a/gui/app/components/spaces/space-list.js +++ b/gui/app/components/spaces/space-list.js @@ -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); } }); diff --git a/gui/app/components/toolbar/for-document.js b/gui/app/components/toolbar/for-document.js index 4899586a..e45c690f 100644 --- a/gui/app/components/toolbar/for-document.js +++ b/gui/app/components/toolbar/for-document.js @@ -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) => { diff --git a/gui/app/components/toolbar/for-space.js b/gui/app/components/toolbar/for-space.js index 76c470fc..f88213e3 100644 --- a/gui/app/components/toolbar/for-space.js +++ b/gui/app/components/toolbar/for-space.js @@ -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) => { diff --git a/gui/app/constants/constants.js b/gui/app/constants/constants.js index 4c915c6e..8f713b11 100644 --- a/gui/app/constants/constants.js +++ b/gui/app/constants/constants.js @@ -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 diff --git a/gui/app/models/block.js b/gui/app/models/block.js index 5b882429..df42bcee 100644 --- a/gui/app/models/block.js +++ b/gui/app/models/block.js @@ -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'), diff --git a/gui/app/models/category.js b/gui/app/models/category.js index 35665f3e..2c97f637 100644 --- a/gui/app/models/category.js +++ b/gui/app/models/category.js @@ -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(), diff --git a/gui/app/models/document-activity.js b/gui/app/models/document-activity.js index 886356c5..166a7299 100644 --- a/gui/app/models/document-activity.js +++ b/gui/app/models/document-activity.js @@ -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'), diff --git a/gui/app/models/document.js b/gui/app/models/document.js index 85051b05..7659a44c 100644 --- a/gui/app/models/document.js +++ b/gui/app/models/document.js @@ -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'), diff --git a/gui/app/models/folder.js b/gui/app/models/folder.js index c5fff3d8..e1e86cad 100644 --- a/gui/app/models/folder.js +++ b/gui/app/models/folder.js @@ -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 diff --git a/gui/app/models/pin.js b/gui/app/models/pin.js index ae7bb6f1..38c2ce80 100644 --- a/gui/app/models/pin.js +++ b/gui/app/models/pin.js @@ -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'), diff --git a/gui/app/models/protected-folder-participant.js b/gui/app/models/protected-folder-participant.js index 32821a1c..0b7e2026 100644 --- a/gui/app/models/protected-folder-participant.js +++ b/gui/app/models/protected-folder-participant.js @@ -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')}`; diff --git a/gui/app/models/space-permission.js b/gui/app/models/space-permission.js index 3cc24507..2589cb3a 100644 --- a/gui/app/models/space-permission.js +++ b/gui/app/models/space-permission.js @@ -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'), diff --git a/gui/app/models/user-activity.js b/gui/app/models/user-activity.js index 465073a2..514f3a75 100644 --- a/gui/app/models/user-activity.js +++ b/gui/app/models/user-activity.js @@ -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'), diff --git a/gui/app/pods/customize/backup/controller.js b/gui/app/pods/customize/backup/controller.js index 24fb8608..9e1fe559 100644 --- a/gui/app/pods/customize/backup/controller.js +++ b/gui/app/pods/customize/backup/controller.js @@ -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); + } } } }); diff --git a/gui/app/pods/customize/backup/template.hbs b/gui/app/pods/customize/backup/template.hbs index bf880678..f921e19b 100644 --- a/gui/app/pods/customize/backup/template.hbs +++ b/gui/app/pods/customize/backup/template.hbs @@ -1 +1 @@ -{{customize/backup-restore onBackup=(action 'onBackup')}} +{{customize/backup-restore onBackup=(action 'onBackup') onRestore=(action 'onRestore')}} diff --git a/gui/app/pods/customize/folders/controller.js b/gui/app/pods/customize/folders/controller.js index 5bd094fa..240d4eff 100644 --- a/gui/app/pods/customize/folders/controller.js +++ b/gui/app/pods/customize/folders/controller.js @@ -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 = []; } diff --git a/gui/app/pods/customize/folders/route.js b/gui/app/pods/customize/folders/route.js index c7080975..22c1e4dc 100644 --- a/gui/app/pods/customize/folders/route.js +++ b/gui/app/pods/customize/folders/route.js @@ -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 = []; } diff --git a/gui/app/pods/folder/index/controller.js b/gui/app/pods/folder/index/controller.js index 3269ff96..3af6d63c 100644 --- a/gui/app/pods/folder/index/controller.js +++ b/gui/app/pods/folder/index/controller.js @@ -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); }); diff --git a/gui/app/services/document.js b/gui/app/services/document.js index 816bd152..480fa798 100644 --- a/gui/app/services/document.js +++ b/gui/app/services/document.js @@ -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; diff --git a/gui/app/services/link.js b/gui/app/services/link.js index e2073e52..07f1a0d2 100644 --- a/gui/app/services/link.js +++ b/gui/app/services/link.js @@ -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, diff --git a/gui/app/services/pinned.js b/gui/app/services/pinned.js index 74967154..8e38b4ac 100644 --- a/gui/app/services/pinned.js +++ b/gui/app/services/pinned.js @@ -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')); } }); diff --git a/gui/app/templates/components/customize/backup-restore.hbs b/gui/app/templates/components/customize/backup-restore.hbs index 8eac3434..ecb12277 100644 --- a/gui/app/templates/components/customize/backup-restore.hbs +++ b/gui/app/templates/components/customize/backup-restore.hbs @@ -8,17 +8,82 @@
-
-
-

It can take several minutes to complete the backup process — please be patient while the backup is running.

-
{{buttonLabel}}
- {{#if backupFailed}} -

Backup failed — please check server logs

- {{/if}} - {{#if backupSuccess}} -

Backup successful ({{backupFilename}})

- {{/if}} -
-
-
+
+
+ {{#if session.isGlobalAdmin}} +
+

+ 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 Global 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). +

+
+ {{/if}} +

It can take several minutes to complete the backup process — please be patient while the backup operation is in progress

+ +
+ {{#ui/ui-checkbox selected=backupSpec.retain}} + Retain backup file on server + {{/ui/ui-checkbox}} +
+ + + {{#if backupFailed}} +
Backup failed — please check server logs
+ {{/if}} + {{#if backupSuccess}} +
Backup successful ({{backupFilename}})
+ {{/if}} +
+
+ +
+
+ {{#if session.isGlobalAdmin}} +
+

WARNING:

+

+ You should only perform a restore on a new Documize instance and NOT on the original instance. + Duplicate data might exist if you restore onto the same instance without first removing previous data. +

+
+ {{/if}} +

It can take up to an hour to complete the restore process — please be patient while the restore operation is in progress

+ +
+
+ + +
+
+ {{#if restoreUploadReady}} +
Ready to start restore
+ {{/if}} + {{#if restoreUploading}} + +
Uploading file
+ {{/if}} +
+
+ {{#ui/ui-checkbox selected=restoreSpec.overwriteOrg}} + Overwrite settings — SMTP, authentication, integrations and other settings + {{/ui/ui-checkbox}} + {{#ui/ui-checkbox selected=restoreSpec.recreateUsers}} + Recreate user accounts — users, groups, permissions + {{/ui/ui-checkbox}} +
+ + {{#if restoreFailed}} +
Restore failed — please check server logs
+ {{else if restoreSuccess}} +
Restore completed — restart your browser and log in
+ {{else}} + {{#if restoreUploadReady}} + + {{/if}} + {{/if}} +
+
+ + \ No newline at end of file diff --git a/gui/mirage/config.js b/gui/mirage/config.js index b6e12a5a..24b4aa28 100644 --- a/gui/mirage/config.js +++ b/gui/mirage/config.js @@ -262,7 +262,7 @@ export default function () { "name": name, "orgId": "VzMuyEw_3WqiafcD", "userId": "VzMuyEw_3WqiafcE", - "folderType": 2 + "spaceType": 2 }; return schema.db.folders.insert(folder); @@ -346,7 +346,7 @@ export default function () { "name": "Test Folder", "orgId": "VzMuyEw_3WqiafcD", "userId": "VzMuyEw_3WqiafcE", - "folderType": 2 + "spaceType": 2 }; }); diff --git a/gui/mirage/factories/folder.js b/gui/mirage/factories/folder.js index 68fed0b3..0e814f96 100644 --- a/gui/mirage/factories/folder.js +++ b/gui/mirage/factories/folder.js @@ -1,11 +1,11 @@ // Copyright 2016 Documize Inc. . All rights reserved. // -// This software (Documize Community Edition) is licensed under +// This software (Documize Community Edition) is licensed under // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html // // You can operate outside the AGPL restrictions by purchasing // Documize Enterprise Edition and obtaining a commercial license -// by contacting . +// by contacting . // // https://documize.com @@ -18,5 +18,5 @@ export default Mirage.Factory.extend({ "name": faker.list.cycle('My Project', 'Test'), "orgId": "VzMuyEw_3WqiafcD", "userId": "VzMuyEw_3WqiafcE", - "folderType": faker.list.cycle(1, 2) -}); \ No newline at end of file + "spaceType": faker.list.cycle(1, 2) +}); diff --git a/model/activity/activity.go b/model/activity/activity.go index da3a9bf4..a24a6d7e 100644 --- a/model/activity/activity.go +++ b/model/activity/activity.go @@ -18,7 +18,7 @@ type UserActivity struct { ID uint64 `json:"id"` OrgID string `json:"orgId"` UserID string `json:"userId"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` DocumentID string `json:"documentId"` SectionID string `json:"pageId"` ActivityType Type `json:"activityType"` @@ -34,7 +34,7 @@ type UserActivity struct { type DocumentActivity struct { ID uint64 `json:"id"` OrgID string `json:"orgId"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` DocumentID string `json:"documentId"` SectionID string `json:"pageId"` SectionName string `json:"pageTitle"` diff --git a/model/block/block.go b/model/block/block.go index 16b59f1a..3dfec9ad 100644 --- a/model/block/block.go +++ b/model/block/block.go @@ -17,7 +17,7 @@ import "github.com/documize/community/model" type Block struct { model.BaseEntity OrgID string `json:"orgId"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` UserID string `json:"userId"` ContentType string `json:"contentType"` Type string `json:"pageType"` diff --git a/model/category/category.go b/model/category/category.go index 2c41d90a..be47ee61 100644 --- a/model/category/category.go +++ b/model/category/category.go @@ -17,7 +17,7 @@ import "github.com/documize/community/model" type Category struct { model.BaseEntity OrgID string `json:"orgId"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` Name string `json:"category"` } @@ -26,7 +26,7 @@ type Member struct { model.BaseEntity OrgID string `json:"orgId"` CategoryID string `json:"categoryId"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` DocumentID string `json:"documentId"` } diff --git a/model/doc/doc.go b/model/doc/doc.go index 5e2848f4..16d67c49 100644 --- a/model/doc/doc.go +++ b/model/doc/doc.go @@ -23,7 +23,7 @@ import ( type Document struct { model.BaseEntity OrgID string `json:"orgId"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` UserID string `json:"userId"` Job string `json:"job"` Location string `json:"location"` diff --git a/model/link/link.go b/model/link/link.go index f7f2243f..559865ba 100644 --- a/model/link/link.go +++ b/model/link/link.go @@ -17,7 +17,7 @@ import "github.com/documize/community/model" type Link struct { model.BaseEntity OrgID string `json:"orgId"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` UserID string `json:"userId"` LinkType string `json:"linkType"` SourceDocumentID string `json:"sourceDocumentId"` @@ -32,7 +32,7 @@ type Link struct { type Candidate struct { RefID string `json:"id"` LinkType string `json:"linkType"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` DocumentID string `json:"documentId"` TargetID string `json:"targetId"` Title string `json:"title"` // what we label the link diff --git a/model/org/meta.go b/model/org/meta.go index 0ca59160..ea26881e 100644 --- a/model/org/meta.go +++ b/model/org/meta.go @@ -21,7 +21,7 @@ import ( type SitemapDocument struct { DocumentID string Document string - FolderID string + SpaceID string Folder string Revised time.Time } diff --git a/model/permission/space.go b/model/permission/space.go index 67fd74fe..ab5f9706 100644 --- a/model/permission/space.go +++ b/model/permission/space.go @@ -17,7 +17,7 @@ package permission type Record struct { ID uint64 `json:"id"` OrgID string `json:"orgId"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` WhoID string `json:"whoId"` Who WhoType `json:"who"` SpaceView bool `json:"spaceView"` @@ -149,7 +149,7 @@ func EncodeRecord(r Record, a Action) (p Permission) { // CategoryViewRequestModel represents who should be allowed to see a category. type CategoryViewRequestModel struct { OrgID string `json:"orgId"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` CategoryID string `json:"categoryID"` WhoID string `json:"whoId"` Who WhoType `json:"who"` diff --git a/model/pin/pin.go b/model/pin/pin.go index 9d8d42fc..3338192e 100644 --- a/model/pin/pin.go +++ b/model/pin/pin.go @@ -18,7 +18,7 @@ type Pin struct { model.BaseEntity OrgID string `json:"orgId"` UserID string `json:"userId"` - SpaceID string `json:"folderId"` + SpaceID string `json:"spaceId"` DocumentID string `json:"documentId"` Name string `json:"pin"` Sequence int `json:"sequence"` diff --git a/model/space/space.go b/model/space/space.go index df16fb01..0788df40 100644 --- a/model/space/space.go +++ b/model/space/space.go @@ -22,7 +22,7 @@ type Space struct { Name string `json:"name"` OrgID string `json:"orgId"` UserID string `json:"userId"` - Type Scope `json:"folderType"` + Type Scope `json:"spaceType"` // Lifecycle stores the default value all new documents are given upon creation. Lifecycle workflow.Lifecycle `json:"lifecycle"` @@ -64,8 +64,8 @@ func (l *Space) IsRestricted() bool { // Viewer details who can see a particular space type Viewer struct { Name string `json:"name"` - SpaceID string `json:"folderId"` - Type int `json:"folderType"` + SpaceID string `json:"spaceId"` + Type int `json:"spaceType"` UserID string `json:"userId"` Firstname string `json:"firstname"` Lastname string `json:"lastname"`