Improve admin panel usability

This commit is contained in:
syuilo 2018-11-05 10:32:45 +09:00
parent c1bbf5dab6
commit 42ac7b954d
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
4 changed files with 65 additions and 16 deletions

View file

@ -1081,6 +1081,7 @@ admin/views/instance.vue:
disableLocalTimeline: "ローカルタイムラインを無効にする"
invite: "招待"
save: "保存"
saved: "保存しました"
admin/views/charts.vue:
title: "チャート"
@ -1132,10 +1133,15 @@ admin/views/emoji.vue:
url: "絵文字画像URL"
add: "追加"
info: "50KB以下のPNG画像をおすすめします。"
added: "絵文字を登録しました"
emojis:
title: "絵文字一覧"
update: "更新"
remove: "削除"
updated: "更新しました"
remove-emoji:
are-you-sure: "「$1」を削除しますか"
removed: "削除しました"
admin/views/announcements.vue:
announcements: "お知らせ"
@ -1144,6 +1150,7 @@ admin/views/announcements.vue:
add: "追加"
title: "タイトル"
text: "内容"
saved: "保存しました"
admin/views/hashtags.vue:
hided-tags: "Hidden Tags"

View file

@ -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
});
});
}
}

View file

@ -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
});
});
});
}
}

View file

@ -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
});
});
}
}