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

View file

@ -54,9 +54,15 @@ export default Vue.extend({
(this as any).api('admin/update-meta', { (this as any).api('admin/update-meta', {
broadcasts: this.announcements broadcasts: this.announcements
}).then(() => { }).then(() => {
//(this as any).os.apis.dialog({ text: `Saved` }); this.$swal({
type: 'success',
text: '%i18n:@saved%'
});
}).catch(e => { }).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, url: this.url,
aliases: this.aliases.split(' ') aliases: this.aliases.split(' ')
}).then(() => { }).then(() => {
//(this as any).os.apis.dialog({ text: `Added` }); this.$swal({
type: 'success',
text: '%i18n:@add-emoji.added%'
});
this.fetchEmojis(); this.fetchEmojis();
}).catch(e => { }).catch(e => {
//(this as any).os.apis.dialog({ text: `Failed ${e}` }); this.$swal({
type: 'error',
text: e
});
}); });
}, },
fetchEmojis() { fetchEmojis() {
(this as any).api('admin/emoji/list').then(emojis => { (this as any).api('admin/emoji/list').then(emojis => {
emojis.reverse();
emojis.forEach(e => e.aliases = (e.aliases || []).join(' ')); emojis.forEach(e => e.aliases = (e.aliases || []).join(' '));
this.emojis = emojis; this.emojis = emojis;
}); });
@ -90,20 +97,40 @@ export default Vue.extend({
url: emoji.url, url: emoji.url,
aliases: emoji.aliases.split(' ') aliases: emoji.aliases.split(' ')
}).then(() => { }).then(() => {
//(this as any).os.apis.dialog({ text: `Updated` }); this.$swal({
type: 'success',
text: '%i18n:@updated%'
});
}).catch(e => { }).catch(e => {
//(this as any).os.apis.dialog({ text: `Failed ${e}` }); this.$swal({
type: 'error',
text: e
});
}); });
}, },
removeEmoji(emoji) { removeEmoji(emoji) {
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', { (this as any).api('admin/emoji/remove', {
id: emoji.id id: emoji.id
}).then(() => { }).then(() => {
//(this as any).os.apis.dialog({ text: `Removed` }); this.$swal({
type: 'success',
text: '%i18n:@remove-emoji.removed%'
});
this.fetchEmojis(); this.fetchEmojis();
}).catch(e => { }).catch(e => {
//(this as any).os.apis.dialog({ text: `Failed ${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 as any).api('admin/invite').then(x => {
this.inviteCode = x.code; this.inviteCode = x.code;
}).catch(e => { }).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, name: this.name,
description: this.description description: this.description
}).then(() => { }).then(() => {
//(this as any).os.apis.dialog({ text: `Saved` }); this.$swal({
type: 'success',
text: '%i18n:@saved%'
});
}).catch(e => { }).catch(e => {
//(this as any).os.apis.dialog({ text: `Failed ${e}` }); this.$swal({
type: 'error',
text: e
});
}); });
} }
} }