Improve admin panel usability
This commit is contained in:
@ -54,9 +54,15 @@ export default Vue.extend({
|
||||
(this as any).api('admin/update-meta', {
|
||||
broadcasts: this.announcements
|
||||
}).then(() => {
|
||||
//(this as any).os.apis.dialog({ text: `Saved` });
|
||||
this.$swal({
|
||||
type: 'success',
|
||||
text: '%i18n:@saved%'
|
||||
});
|
||||
}).catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||
this.$swal({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -69,15 +69,22 @@ export default Vue.extend({
|
||||
url: this.url,
|
||||
aliases: this.aliases.split(' ')
|
||||
}).then(() => {
|
||||
//(this as any).os.apis.dialog({ text: `Added` });
|
||||
this.$swal({
|
||||
type: 'success',
|
||||
text: '%i18n:@add-emoji.added%'
|
||||
});
|
||||
this.fetchEmojis();
|
||||
}).catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||
this.$swal({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
fetchEmojis() {
|
||||
(this as any).api('admin/emoji/list').then(emojis => {
|
||||
emojis.reverse();
|
||||
emojis.forEach(e => e.aliases = (e.aliases || []).join(' '));
|
||||
this.emojis = emojis;
|
||||
});
|
||||
@ -90,20 +97,40 @@ export default Vue.extend({
|
||||
url: emoji.url,
|
||||
aliases: emoji.aliases.split(' ')
|
||||
}).then(() => {
|
||||
//(this as any).os.apis.dialog({ text: `Updated` });
|
||||
this.$swal({
|
||||
type: 'success',
|
||||
text: '%i18n:@updated%'
|
||||
});
|
||||
}).catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||
this.$swal({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
removeEmoji(emoji) {
|
||||
(this as any).api('admin/emoji/remove', {
|
||||
id: emoji.id
|
||||
}).then(() => {
|
||||
//(this as any).os.apis.dialog({ text: `Removed` });
|
||||
this.fetchEmojis();
|
||||
}).catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||
this.$swal({
|
||||
type: 'warning',
|
||||
text: '%i18n:@remove-emoji.are-you-sure%'.replace('$1', emoji.name),
|
||||
showCancelButton: true
|
||||
}).then(res => {
|
||||
if (!res.value) return;
|
||||
|
||||
(this as any).api('admin/emoji/remove', {
|
||||
id: emoji.id
|
||||
}).then(() => {
|
||||
this.$swal({
|
||||
type: 'success',
|
||||
text: '%i18n:@remove-emoji.removed%'
|
||||
});
|
||||
this.fetchEmojis();
|
||||
}).catch(e => {
|
||||
this.$swal({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,10 @@ export default Vue.extend({
|
||||
(this as any).api('admin/invite').then(x => {
|
||||
this.inviteCode = x.code;
|
||||
}).catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||
this.$swal({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@ -68,9 +71,15 @@ export default Vue.extend({
|
||||
name: this.name,
|
||||
description: this.description
|
||||
}).then(() => {
|
||||
//(this as any).os.apis.dialog({ text: `Saved` });
|
||||
this.$swal({
|
||||
type: 'success',
|
||||
text: '%i18n:@saved%'
|
||||
});
|
||||
}).catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||
this.$swal({
|
||||
type: 'error',
|
||||
text: e
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user