This commit is contained in:
syuilo 2020-09-05 11:14:42 +09:00
parent 190486d841
commit c399e3151e
73 changed files with 329 additions and 254 deletions

View file

@ -68,7 +68,7 @@ export default defineComponent({
},
remove(announcement) {
this.$root.dialog({
this.$root.showDialog({
type: 'warning',
text: this.$t('removeAreYouSure', { x: announcement.title }),
showCancelButton: true
@ -82,24 +82,24 @@ export default defineComponent({
save(announcement) {
if (announcement.id == null) {
this.$root.api('admin/announcements/create', announcement).then(() => {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
text: this.$t('saved')
});
}).catch(e => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e
});
});
} else {
this.$root.api('admin/announcements/update', announcement).then(() => {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
text: this.$t('saved')
});
}).catch(e => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e
});

View file

@ -128,7 +128,7 @@ export default defineComponent({
async add(e) {
const files = await selectFile(this, e.currentTarget || e.target, null, true);
const dialog = this.$root.dialog({
const dialog = this.$root.showDialog({
type: 'waiting',
text: this.$t('doing') + '...',
showOkButton: false,
@ -141,7 +141,7 @@ export default defineComponent({
})))
.then(() => {
this.$refs.emojis.reload();
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});
@ -159,7 +159,7 @@ export default defineComponent({
aliases: this.aliases.split(' '),
});
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});
@ -168,7 +168,7 @@ export default defineComponent({
},
async del() {
const { canceled } = await this.$root.dialog({
const { canceled } = await this.$root.showDialog({
type: 'warning',
text: this.$t('removeAreYouSure', { x: this.selected.name }),
showCancelButton: true
@ -187,12 +187,12 @@ export default defineComponent({
emojiId: this.selectedRemote.id,
}).then(() => {
this.$refs.emojis.reload();
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});
}).catch(e => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e
});

View file

@ -34,7 +34,7 @@ export default defineComponent({
methods: {
clear() {
this.$root.dialog({
this.$root.showDialog({
type: 'warning',
text: this.$t('clearCachedFilesConfirm'),
showCancelButton: true
@ -42,7 +42,7 @@ export default defineComponent({
if (canceled) return;
this.$root.api('admin/drive/clean-remote-files', {}).then(() => {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});

View file

@ -578,7 +578,7 @@ export default defineComponent({
deleteAllLogs() {
this.$root.api('admin/delete-logs').then(() => {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});

View file

@ -255,7 +255,7 @@ export default defineComponent({
this.$root.api('admin/federation/remove-all-following', {
host: this.instance.host
}).then(() => {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});
@ -266,7 +266,7 @@ export default defineComponent({
this.$root.api('admin/federation/delete-all-files', {
host: this.instance.host
}).then(() => {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});

View file

@ -57,7 +57,7 @@ export default defineComponent({
methods: {
clear() {
this.$root.dialog({
this.$root.showDialog({
type: 'warning',
title: this.$t('clearQueueConfirmTitle'),
text: this.$t('clearQueueConfirmText'),
@ -66,7 +66,7 @@ export default defineComponent({
if (canceled) return;
this.$root.api('admin/queue/clear', {}).then(() => {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});

View file

@ -61,7 +61,7 @@ export default defineComponent({
}).then((relay: any) => {
this.refresh();
}).catch((e: any) => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e.message || e
});
@ -74,7 +74,7 @@ export default defineComponent({
}).then(() => {
this.refresh();
}).catch((e: any) => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e.message || e
});

View file

@ -402,7 +402,7 @@ export default defineComponent({
mounted() {
this.$refs.enableHcaptcha.$on('change', () => {
if (this.enableHcaptcha && this.enableRecaptcha) {
this.$root.dialog({
this.$root.showDialog({
type: 'question', // warning cancel
showCancelButton: true,
title: this.$t('settingGuide'),
@ -419,7 +419,7 @@ export default defineComponent({
this.$refs.enableRecaptcha.$on('change', () => {
if (this.enableRecaptcha && this.enableHcaptcha) {
this.$root.dialog({
this.$root.showDialog({
type: 'question', // warning cancel
showCancelButton: true,
title: this.$t('settingGuide'),
@ -438,12 +438,12 @@ export default defineComponent({
methods: {
invite() {
this.$root.api('admin/invite').then(x => {
this.$root.dialog({
this.$root.showDialog({
type: 'info',
text: x.code
});
}).catch(e => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e
});
@ -472,12 +472,12 @@ export default defineComponent({
subject: 'Test email',
text: 'Yo'
}).then(x => {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
splash: true
});
}).catch(e => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e
});
@ -546,13 +546,13 @@ export default defineComponent({
}).then(() => {
this.$store.dispatch('instance/fetch');
if (withDialog) {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});
}
}).catch(e => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e
});

View file

@ -89,7 +89,7 @@ export default defineComponent({
async updateRemoteUser() {
await this.$root.api('admin/update-remote-user', { userId: this.user.id }).then(res => {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});
@ -98,7 +98,7 @@ export default defineComponent({
},
async resetPassword() {
const dialog = this.$root.dialog({
const dialog = this.$root.showDialog({
type: 'waiting',
iconOnly: true
});
@ -106,12 +106,12 @@ export default defineComponent({
this.$root.api('admin/reset-password', {
userId: this.user.id,
}).then(({ password }) => {
this.$root.dialog({
this.$root.showDialog({
type: 'success',
text: this.$t('newPasswordIs', { password })
});
}).catch(e => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e
});
@ -121,7 +121,7 @@ export default defineComponent({
},
async toggleSilence() {
const confirm = await this.$root.dialog({
const confirm = await this.$root.showDialog({
type: 'warning',
showCancelButton: true,
text: this.silenced ? this.$t('silenceConfirm') : this.$t('unsilenceConfirm'),
@ -135,7 +135,7 @@ export default defineComponent({
},
async toggleSuspend() {
const confirm = await this.$root.dialog({
const confirm = await this.$root.showDialog({
type: 'warning',
showCancelButton: true,
text: this.suspended ? this.$t('suspendConfirm') : this.$t('unsuspendConfirm'),
@ -154,7 +154,7 @@ export default defineComponent({
},
async deleteAllFiles() {
const confirm = await this.$root.dialog({
const confirm = await this.$root.showDialog({
type: 'warning',
showCancelButton: true,
text: this.$t('deleteAllFilesConfirm'),
@ -162,13 +162,13 @@ export default defineComponent({
if (confirm.canceled) return;
const process = async () => {
await this.$root.api('admin/delete-all-files-of-a-user', { userId: this.user.id });
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});
};
await process().catch(e => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e.toString()
});

View file

@ -152,7 +152,7 @@ export default defineComponent({
let _notFound = false;
const notFound = () => {
if (_notFound) {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: this.$t('noSuchUser')
});
@ -185,19 +185,19 @@ export default defineComponent({
},
async addUser() {
const { canceled: canceled1, result: username } = await this.$root.dialog({
const { canceled: canceled1, result: username } = await this.$root.showDialog({
title: this.$t('username'),
input: true
});
if (canceled1) return;
const { canceled: canceled2, result: password } = await this.$root.dialog({
const { canceled: canceled2, result: password } = await this.$root.showDialog({
title: this.$t('password'),
input: { type: 'password' }
});
if (canceled2) return;
const dialog = this.$root.dialog({
const dialog = this.$root.showDialog({
type: 'waiting',
iconOnly: true
});
@ -207,12 +207,12 @@ export default defineComponent({
password: password,
}).then(res => {
this.$refs.users.reload();
this.$root.dialog({
this.$root.showDialog({
type: 'success',
iconOnly: true, autoClose: true
});
}).catch(e => {
this.$root.dialog({
this.$root.showDialog({
type: 'error',
text: e.id
});