mirror of
https://github.com/documize/community.git
synced 2025-07-25 08:09:43 +02:00
Install helps docs as part of onboarding process
Our own docs are installed as sample data! Refactored search reindexing code.
This commit is contained in:
parent
411f64c359
commit
3621e2fb79
26 changed files with 1957 additions and 1280 deletions
|
@ -13,6 +13,7 @@ import { inject as service } from '@ember/service';
|
|||
import Route from '@ember/routing/route';
|
||||
|
||||
export default Route.extend({
|
||||
globalSvc: service('global'),
|
||||
session: service(),
|
||||
localStorage: service(),
|
||||
|
||||
|
@ -27,7 +28,15 @@ export default Route.extend({
|
|||
model({ token }) {
|
||||
this.get("session").authenticate('authenticator:documize', decodeURIComponent(token))
|
||||
.then(() => {
|
||||
this.transitionTo('folders');
|
||||
if (this.get('localStorage').isFirstRun()) {
|
||||
this.get('globalSvc').onboard().then(() => {
|
||||
this.transitionTo('folders');
|
||||
}).catch(() => {
|
||||
this.transitionTo('folders');
|
||||
});
|
||||
} else {
|
||||
this.transitionTo('folders');
|
||||
}
|
||||
}, () => {
|
||||
this.transitionTo('auth.login');
|
||||
});
|
||||
|
|
|
@ -166,15 +166,15 @@ export default Service.extend({
|
|||
let token = this.get('sessionService.session.content.authenticated.token');
|
||||
let uploadUrl = `${url}/global/backup?token=${token}`;
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', uploadUrl);
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
xhr.responseType = 'blob';
|
||||
|
||||
xhr.onload = function() {
|
||||
if (this.status == 200) {
|
||||
if (this.status === 200) {
|
||||
// get binary data as a response
|
||||
var blob = this.response;
|
||||
let blob = this.response;
|
||||
|
||||
let a = document.createElement("a");
|
||||
a.style = "display: none";
|
||||
|
@ -194,18 +194,18 @@ export default Service.extend({
|
|||
} else {
|
||||
reject();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror= function() {
|
||||
reject();
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(JSON.stringify(spec));
|
||||
});
|
||||
},
|
||||
|
||||
restore(spec, file) {
|
||||
var data = new FormData();
|
||||
let data = new FormData();
|
||||
data.set('restore-file', file);
|
||||
|
||||
return new EmberPromise((resolve, reject) => {
|
||||
|
@ -217,20 +217,20 @@ export default Service.extend({
|
|||
let token = this.get('sessionService.session.content.authenticated.token');
|
||||
let uploadUrl = `${url}/global/restore?token=${token}&org=${spec.overwriteOrg}&users=${spec.recreateUsers}`;
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', uploadUrl);
|
||||
|
||||
xhr.onload = function() {
|
||||
if (this.status == 200) {
|
||||
if (this.status === 200) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror= function() {
|
||||
reject();
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(data);
|
||||
});
|
||||
|
@ -242,9 +242,13 @@ export default Service.extend({
|
|||
method: 'POST',
|
||||
contentType: 'text',
|
||||
data: comment,
|
||||
}).then(() => {
|
||||
return;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onboard() {
|
||||
return this.get('ajax').request(`setup/onboard`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue