mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
reworked smart section UX
This commit is contained in:
parent
57b3801f87
commit
0eef10e586
6 changed files with 67 additions and 92 deletions
|
@ -10,15 +10,12 @@
|
|||
// https://documize.com
|
||||
|
||||
import { set } from '@ember/object';
|
||||
|
||||
import { schedule } from '@ember/runloop';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Component from '@ember/component';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
import TooltipMixin from '../../../mixins/tooltip';
|
||||
import SectionMixin from '../../../mixins/section';
|
||||
|
||||
export default Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
||||
export default Component.extend(SectionMixin, {
|
||||
sectionService: service('section'),
|
||||
isDirty: false,
|
||||
waiting: false,
|
||||
|
@ -69,10 +66,6 @@ export default Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
|||
});
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.destroyTooltips();
|
||||
},
|
||||
|
||||
getWorkspaces() {
|
||||
let page = this.get('page');
|
||||
let self = this;
|
||||
|
@ -155,15 +148,15 @@ export default Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
|||
auth() {
|
||||
// missing data?
|
||||
if (is.empty(this.get('config.url'))) {
|
||||
$("#gemini-url").addClass("error").focus();
|
||||
$("#gemini-url").addClass("is-invalid").focus();
|
||||
return;
|
||||
}
|
||||
if (is.empty(this.get('config.username'))) {
|
||||
$("#gemini-username").addClass("error").focus();
|
||||
$("#gemini-username").addClass("is-invalid").focus();
|
||||
return;
|
||||
}
|
||||
if (is.empty(this.get('config.APIKey'))) {
|
||||
$("#gemini-apikey").addClass("error").focus();
|
||||
$("#gemini-apikey").addClass("is-invalid").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -195,17 +188,6 @@ export default Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
|||
self.set('user', null);
|
||||
self.set('config.userId', 0);
|
||||
self.set('waiting', false);
|
||||
|
||||
switch (reason.status) {
|
||||
case 400:
|
||||
self.showNotification(`Unable to connect to Gemini URL`);
|
||||
break;
|
||||
case 403:
|
||||
self.showNotification(`Unable to authenticate`);
|
||||
break;
|
||||
default:
|
||||
self.showNotification(`Something went wrong, try again!`);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -10,15 +10,13 @@
|
|||
// https://documize.com
|
||||
|
||||
import { set } from '@ember/object';
|
||||
|
||||
import { inject as service } from '@ember/service';
|
||||
import Component from '@ember/component';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
import TooltipMixin from '../../../mixins/tooltip';
|
||||
import SectionMixin from '../../../mixins/section';
|
||||
import netUtil from '../../../utils/net';
|
||||
|
||||
export default Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
||||
export default Component.extend(SectionMixin, NotifierMixin, {
|
||||
sectionService: service('section'),
|
||||
isDirty: false,
|
||||
waiting: false,
|
||||
|
@ -48,10 +46,6 @@ export default Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
|||
this.send('auth');
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this.destroyTooltips();
|
||||
},
|
||||
|
||||
displayError(reason) {
|
||||
if (netUtil.isAjaxAccessError(reason)) {
|
||||
this.showNotification(`Unable to authenticate`);
|
||||
|
@ -93,17 +87,17 @@ export default Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
|||
if (is.not.undefined(group)) {
|
||||
set(config, 'group', group);
|
||||
}
|
||||
}, function (reason) {
|
||||
}, function (reason) {
|
||||
self.set('authenticated', false);
|
||||
self.set('waiting', false);
|
||||
self.set('config.APIToken', ''); // clear the api token
|
||||
self.set('config.APIToken', ''); // clear the api token
|
||||
self.displayError(reason);
|
||||
console.log("get options call failed"); // eslint-disable-line no-console
|
||||
});
|
||||
}, function (reason) {
|
||||
}, function (reason) {
|
||||
self.set('authenticated', false);
|
||||
self.set('waiting', false);
|
||||
self.set('config.APIToken', ''); // clear the api token
|
||||
self.set('config.APIToken', ''); // clear the api token
|
||||
self.displayError(reason);
|
||||
console.log("auth token invalid"); // eslint-disable-line no-console
|
||||
});
|
||||
|
@ -186,4 +180,4 @@ export default Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
|||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue