1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-18 20:59:43 +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

@ -121,16 +121,16 @@ func (h *Handler) GetBySpace(w http.ResponseWriter, r *http.Request) {
method := "block.space" method := "block.space"
ctx := domain.GetRequestContext(r) ctx := domain.GetRequestContext(r)
folderID := request.Param(r, "folderID") spaceID := request.Param(r, "spaceID")
if len(folderID) == 0 { if len(spaceID) == 0 {
response.WriteMissingDataError(w, method, "folderID") response.WriteMissingDataError(w, method, "spaceID")
return return
} }
var b []block.Block var b []block.Block
var err error var err error
b, err = h.Store.Block.GetBySpace(ctx, folderID) b, err = h.Store.Block.GetBySpace(ctx, spaceID)
if len(b) == 0 { if len(b) == 0 {
b = []block.Block{} b = []block.Block{}

View file

@ -51,9 +51,9 @@ func (h *Handler) upload(w http.ResponseWriter, r *http.Request) (string, string
method := "conversion.upload" method := "conversion.upload"
ctx := domain.GetRequestContext(r) 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) response.WriteForbiddenError(w)
return "", "", "" 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)) 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" method := "conversion.upload"
ctx := domain.GetRequestContext(r) 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. // Fetch space where document resides.
sp, err := h.Store.Space.Get(ctx, folderID) sp, err := h.Store.Space.Get(ctx, spaceID)
if err != nil { if err != nil {
ctx.Transaction.Rollback() ctx.Transaction.Rollback()
response.WriteServerError(w, method, err) response.WriteServerError(w, method, err)

View file

@ -29,12 +29,12 @@ type Handler struct {
// UploadConvert is an endpoint to both upload and convert a document // UploadConvert is an endpoint to both upload and convert a document
func (h *Handler) UploadConvert(w http.ResponseWriter, r *http.Request) { 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 == "" { if job == "" {
return // error already handled return // error already handled
} }
h.convert(w, r, job, folderID, api.ConversionJobRequest{ h.convert(w, r, job, spaceID, api.ConversionJobRequest{
Job: job, Job: job,
IndexDepth: 4, IndexDepth: 4,
OrgID: orgID, OrgID: orgID,

View file

@ -39,9 +39,9 @@ func (h *Handler) GetLinkCandidates(w http.ResponseWriter, r *http.Request) {
method := "link.Candidates" method := "link.Candidates"
ctx := domain.GetRequestContext(r) ctx := domain.GetRequestContext(r)
folderID := request.Param(r, "folderID") spaceID := request.Param(r, "spaceID")
if len(folderID) == 0 { if len(spaceID) == 0 {
response.WriteMissingDataError(w, method, "folderID") response.WriteMissingDataError(w, method, "spaceID")
return return
} }
@ -81,7 +81,7 @@ func (h *Handler) GetLinkCandidates(w http.ResponseWriter, r *http.Request) {
if p.RefID != pageID { if p.RefID != pageID {
c := link.Candidate{ c := link.Candidate{
RefID: uniqueid.Generate(), RefID: uniqueid.Generate(),
SpaceID: folderID, SpaceID: spaceID,
DocumentID: documentID, DocumentID: documentID,
TargetID: p.RefID, TargetID: p.RefID,
LinkType: p.Type, LinkType: p.Type,
@ -109,7 +109,7 @@ func (h *Handler) GetLinkCandidates(w http.ResponseWriter, r *http.Request) {
for _, f := range files { for _, f := range files {
c := link.Candidate{ c := link.Candidate{
RefID: uniqueid.Generate(), RefID: uniqueid.Generate(),
SpaceID: folderID, SpaceID: spaceID,
DocumentID: documentID, DocumentID: documentID,
TargetID: f.RefID, TargetID: f.RefID,
LinkType: "file", LinkType: "file",

View file

@ -53,13 +53,13 @@ func (h *Handler) SavedList(w http.ResponseWriter, r *http.Request) {
method := "template.saved" method := "template.saved"
ctx := domain.GetRequestContext(r) ctx := domain.GetRequestContext(r)
folderID := request.Param(r, "folderID") spaceID := request.Param(r, "spaceID")
if len(folderID) == 0 { if len(spaceID) == 0 {
response.WriteMissingDataError(w, method, "folderID") response.WriteMissingDataError(w, method, "spaceID")
return return
} }
documents, err := h.Store.Document.TemplatesBySpace(ctx, folderID) documents, err := h.Store.Document.TemplatesBySpace(ctx, spaceID)
if err != nil { if err != nil {
response.WriteServerError(w, method, err) response.WriteServerError(w, method, err)
h.Runtime.Log.Error(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.Dated = d.Created
t.Type = template.TypePrivate t.Type = template.TypePrivate
if d.SpaceID == folderID { if d.SpaceID == spaceID {
templates = append(templates, t) templates = append(templates, t)
} }
} }
@ -266,9 +266,9 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) {
method := "template.use" method := "template.use"
ctx := domain.GetRequestContext(r) ctx := domain.GetRequestContext(r)
folderID := request.Param(r, "folderID") spaceID := request.Param(r, "spaceID")
if len(folderID) == 0 { if len(spaceID) == 0 {
response.WriteMissingDataError(w, method, "folderID") response.WriteMissingDataError(w, method, "spaceID")
return return
} }
@ -295,7 +295,7 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) {
d.Excerpt = "Add detailed description for document..." d.Excerpt = "Add detailed description for document..."
d.Slug = stringutil.MakeSlug(d.Name) d.Slug = stringutil.MakeSlug(d.Name)
d.Tags = "" d.Tags = ""
d.SpaceID = folderID d.SpaceID = spaceID
documentID := uniqueid.Generate() documentID := uniqueid.Generate()
d.RefID = documentID d.RefID = documentID
@ -321,7 +321,7 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) {
} }
// Fetch space where document resides. // Fetch space where document resides.
sp, err := h.Store.Space.Get(ctx, folderID) sp, err := h.Store.Space.Get(ctx, spaceID)
if err != nil { if err != nil {
response.WriteServerError(w, method, err) response.WriteServerError(w, method, err)
h.Runtime.Log.Error(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() documentID = uniqueid.Generate()
d.RefID = documentID d.RefID = documentID
d.Template = false d.Template = false
d.SpaceID = folderID d.SpaceID = spaceID
d.UserID = ctx.UserID d.UserID = ctx.UserID
d.Name = docTitle d.Name = docTitle

View file

@ -127,7 +127,7 @@ export default Component.extend(ModalMixin, TooltipMixin, {
selection = { selection = {
context: '', context: '',
documentId: documentId, documentId: documentId,
folderId: folderId, spaceId: folderId,
id: stringUtil.makeId(16), id: stringUtil.makeId(16),
linkType: 'network', linkType: 'network',
targetId: '', 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) => { this.get('documentService').getPageMeta(this.get('document.id'), page.get('id')).then((pm) => {
let block = { let block = {
folderId: this.get('folder.id'), spaceId: this.get('folder.id'),
contentType: page.get('contentType'), contentType: page.get('contentType'),
pageType: page.get('pageType'), pageType: page.get('pageType'),
title: blockTitle, title: blockTitle,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -164,7 +164,7 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, Notifier, {
let pin = { let pin = {
pin: this.get('pinState.newName'), pin: this.get('pinState.newName'),
documentId: '', documentId: '',
folderId: this.get('space.id') spaceId: this.get('space.id')
}; };
this.get('pinned').pinItem(pin).then((pin) => { 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 = this.get('constants');
let constants = EmberObject.extend({ 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, Public: 1,
Private: 2, Private: 2,
Protected: 3 Protected: 3

View file

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

View file

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

View file

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

View file

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

View file

@ -18,7 +18,7 @@ export default Model.extend({
name: attr('string'), name: attr('string'),
orgId: attr('string'), orgId: attr('string'),
userId: attr('string'), userId: attr('string'),
folderType: attr('number', { defaultValue: 2 }), spaceType: attr('number', { defaultValue: 2 }),
lifecycle: attr('number', { defaultValue: 1 }), lifecycle: attr('number', { defaultValue: 1 }),
likes: attr('string'), likes: attr('string'),
@ -32,17 +32,17 @@ export default Model.extend({
markAsRestricted() { markAsRestricted() {
let constants = this.get('constants'); let constants = this.get('constants');
this.set('folderType', constants.FolderType.Protected); this.set('spaceType', constants.SpaceType.Protected);
}, },
markAsPrivate() { markAsPrivate() {
let constants = this.get('constants'); let constants = this.get('constants');
this.set('folderType', constants.FolderType.Private); this.set('spaceType', constants.SpaceType.Private);
}, },
markAsPublic() { markAsPublic() {
let constants = this.get('constants'); 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 // 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({ export default Model.extend({
orgId: attr('string'), orgId: attr('string'),
userId: attr('string'), userId: attr('string'),
folderId: attr('string'), spaceId: attr('string'),
documentId: attr('string'), documentId: attr('string'),
sequence: attr('number', { defaultValue: 99 }), sequence: attr('number', { defaultValue: 99 }),
pin: attr('string'), pin: attr('string'),

View file

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

View file

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

View file

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

View file

@ -20,6 +20,12 @@ export default Controller.extend({
if(this.get('session.isAdmin')) { if(this.get('session.isAdmin')) {
return this.get('global').backup(spec); 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.set('deleteSpace.name', '');
this.get('folderService').adminList().then((folders) => { 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)) { if (is.empty(nonPrivateFolders) || is.null(folders) || is.undefined(folders)) {
nonPrivateFolders = []; nonPrivateFolders = [];
} }

View file

@ -27,7 +27,7 @@ export default Route.extend(AuthenticatedRouteMixin, {
}, },
setupController(controller, model) { 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)) { if (is.empty(nonPrivateFolders) || is.null(model) || is.undefined(model)) {
nonPrivateFolders = []; nonPrivateFolders = [];
} }

View file

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

View file

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

View file

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

View file

@ -133,7 +133,7 @@ export default Service.extend({
return this.getUserPins().then((pins) => { return this.getUserPins().then((pins) => {
pins.forEach((pin) => { 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')); resolve(pin.get('id'));
} }
}); });

View file

@ -8,17 +8,82 @@
</div> </div>
<div class="view-customize"> <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>

View file

@ -262,7 +262,7 @@ export default function () {
"name": name, "name": name,
"orgId": "VzMuyEw_3WqiafcD", "orgId": "VzMuyEw_3WqiafcD",
"userId": "VzMuyEw_3WqiafcE", "userId": "VzMuyEw_3WqiafcE",
"folderType": 2 "spaceType": 2
}; };
return schema.db.folders.insert(folder); return schema.db.folders.insert(folder);
@ -346,7 +346,7 @@ export default function () {
"name": "Test Folder", "name": "Test Folder",
"orgId": "VzMuyEw_3WqiafcD", "orgId": "VzMuyEw_3WqiafcD",
"userId": "VzMuyEw_3WqiafcE", "userId": "VzMuyEw_3WqiafcE",
"folderType": 2 "spaceType": 2
}; };
}); });

View file

@ -1,11 +1,11 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved. // Copyright 2016 Documize Inc. <legal@documize.com>. 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 // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
// //
// You can operate outside the AGPL restrictions by purchasing // You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license // Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>. // by contacting <sales@documize.com>.
// //
// https://documize.com // https://documize.com
@ -18,5 +18,5 @@ export default Mirage.Factory.extend({
"name": faker.list.cycle('My Project', 'Test'), "name": faker.list.cycle('My Project', 'Test'),
"orgId": "VzMuyEw_3WqiafcD", "orgId": "VzMuyEw_3WqiafcD",
"userId": "VzMuyEw_3WqiafcE", "userId": "VzMuyEw_3WqiafcE",
"folderType": faker.list.cycle(1, 2) "spaceType": faker.list.cycle(1, 2)
}); });

View file

@ -18,7 +18,7 @@ type UserActivity struct {
ID uint64 `json:"id"` ID uint64 `json:"id"`
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
UserID string `json:"userId"` UserID string `json:"userId"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
DocumentID string `json:"documentId"` DocumentID string `json:"documentId"`
SectionID string `json:"pageId"` SectionID string `json:"pageId"`
ActivityType Type `json:"activityType"` ActivityType Type `json:"activityType"`
@ -34,7 +34,7 @@ type UserActivity struct {
type DocumentActivity struct { type DocumentActivity struct {
ID uint64 `json:"id"` ID uint64 `json:"id"`
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
DocumentID string `json:"documentId"` DocumentID string `json:"documentId"`
SectionID string `json:"pageId"` SectionID string `json:"pageId"`
SectionName string `json:"pageTitle"` SectionName string `json:"pageTitle"`

View file

@ -17,7 +17,7 @@ import "github.com/documize/community/model"
type Block struct { type Block struct {
model.BaseEntity model.BaseEntity
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
UserID string `json:"userId"` UserID string `json:"userId"`
ContentType string `json:"contentType"` ContentType string `json:"contentType"`
Type string `json:"pageType"` Type string `json:"pageType"`

View file

@ -17,7 +17,7 @@ import "github.com/documize/community/model"
type Category struct { type Category struct {
model.BaseEntity model.BaseEntity
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
Name string `json:"category"` Name string `json:"category"`
} }
@ -26,7 +26,7 @@ type Member struct {
model.BaseEntity model.BaseEntity
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
CategoryID string `json:"categoryId"` CategoryID string `json:"categoryId"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
DocumentID string `json:"documentId"` DocumentID string `json:"documentId"`
} }

View file

@ -23,7 +23,7 @@ import (
type Document struct { type Document struct {
model.BaseEntity model.BaseEntity
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
UserID string `json:"userId"` UserID string `json:"userId"`
Job string `json:"job"` Job string `json:"job"`
Location string `json:"location"` Location string `json:"location"`

View file

@ -17,7 +17,7 @@ import "github.com/documize/community/model"
type Link struct { type Link struct {
model.BaseEntity model.BaseEntity
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
UserID string `json:"userId"` UserID string `json:"userId"`
LinkType string `json:"linkType"` LinkType string `json:"linkType"`
SourceDocumentID string `json:"sourceDocumentId"` SourceDocumentID string `json:"sourceDocumentId"`
@ -32,7 +32,7 @@ type Link struct {
type Candidate struct { type Candidate struct {
RefID string `json:"id"` RefID string `json:"id"`
LinkType string `json:"linkType"` LinkType string `json:"linkType"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
DocumentID string `json:"documentId"` DocumentID string `json:"documentId"`
TargetID string `json:"targetId"` TargetID string `json:"targetId"`
Title string `json:"title"` // what we label the link Title string `json:"title"` // what we label the link

View file

@ -21,7 +21,7 @@ import (
type SitemapDocument struct { type SitemapDocument struct {
DocumentID string DocumentID string
Document string Document string
FolderID string SpaceID string
Folder string Folder string
Revised time.Time Revised time.Time
} }

View file

@ -17,7 +17,7 @@ package permission
type Record struct { type Record struct {
ID uint64 `json:"id"` ID uint64 `json:"id"`
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
WhoID string `json:"whoId"` WhoID string `json:"whoId"`
Who WhoType `json:"who"` Who WhoType `json:"who"`
SpaceView bool `json:"spaceView"` 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. // CategoryViewRequestModel represents who should be allowed to see a category.
type CategoryViewRequestModel struct { type CategoryViewRequestModel struct {
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
CategoryID string `json:"categoryID"` CategoryID string `json:"categoryID"`
WhoID string `json:"whoId"` WhoID string `json:"whoId"`
Who WhoType `json:"who"` Who WhoType `json:"who"`

View file

@ -18,7 +18,7 @@ type Pin struct {
model.BaseEntity model.BaseEntity
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
UserID string `json:"userId"` UserID string `json:"userId"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
DocumentID string `json:"documentId"` DocumentID string `json:"documentId"`
Name string `json:"pin"` Name string `json:"pin"`
Sequence int `json:"sequence"` Sequence int `json:"sequence"`

View file

@ -22,7 +22,7 @@ type Space struct {
Name string `json:"name"` Name string `json:"name"`
OrgID string `json:"orgId"` OrgID string `json:"orgId"`
UserID string `json:"userId"` 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 stores the default value all new documents are given upon creation.
Lifecycle workflow.Lifecycle `json:"lifecycle"` Lifecycle workflow.Lifecycle `json:"lifecycle"`
@ -64,8 +64,8 @@ func (l *Space) IsRestricted() bool {
// Viewer details who can see a particular space // Viewer details who can see a particular space
type Viewer struct { type Viewer struct {
Name string `json:"name"` Name string `json:"name"`
SpaceID string `json:"folderId"` SpaceID string `json:"spaceId"`
Type int `json:"folderType"` Type int `json:"spaceType"`
UserID string `json:"userId"` UserID string `json:"userId"`
Firstname string `json:"firstname"` Firstname string `json:"firstname"`
Lastname string `json:"lastname"` Lastname string `json:"lastname"`