1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-05 15:55:56 +02:00
This commit is contained in:
syuilo
2020-09-05 13:09:34 +09:00
parent 138c9868e8
commit deb3df1536
67 changed files with 229 additions and 229 deletions

View File

@@ -92,7 +92,7 @@ export default defineComponent({
params.channelId = this.channelId;
this.$root.api('channels/update', params)
.then(channel => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
@@ -100,7 +100,7 @@ export default defineComponent({
} else {
this.$root.api('channels/create', params)
.then(channel => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -11,7 +11,7 @@ export default defineComponent({
const acct = new URL(location.href).searchParams.get('acct');
if (acct == null) return;
const dialog = this.$root.showDialog({
const dialog = this.$store.dispatch('showDialog', {
type: 'waiting',
text: this.$t('fetchingAsApObject') + '...',
showOkButton: false,
@@ -26,7 +26,7 @@ export default defineComponent({
if (res.type == 'User') {
this.follow(res.object);
} else {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: 'Not a user'
}).then(() => {
@@ -34,7 +34,7 @@ export default defineComponent({
});
}
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
}).then(() => {
@@ -47,7 +47,7 @@ export default defineComponent({
this.$root.api('users/show', parseAcct(acct)).then(user => {
this.follow(user);
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
}).then(() => {
@@ -61,7 +61,7 @@ export default defineComponent({
methods: {
async follow(user) {
const { canceled } = await this.$root.showDialog({
const { canceled } = await this.$store.dispatch('showDialog', {
type: 'question',
text: this.$t('followConfirm', { name: user.name || user.username }),
showCancelButton: true
@@ -75,14 +75,14 @@ export default defineComponent({
this.$root.api('following/create', {
userId: user.id
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
}).then(() => {
window.close();
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
}).then(() => {

View File

@@ -57,7 +57,7 @@ export default defineComponent({
}).catch(() => {
this.submitting = false;
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: this.$t('error')
});

View File

@@ -68,7 +68,7 @@ export default defineComponent({
},
remove(announcement) {
this.$root.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
text: this.$t('saved')
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});
});
} else {
this.$root.api('admin/announcements/update', announcement).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
text: this.$t('saved')
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('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.showDialog({
const dialog = this.$store.dispatch('showDialog', {
type: 'waiting',
text: this.$t('doing') + '...',
showOkButton: false,
@@ -141,7 +141,7 @@ export default defineComponent({
})))
.then(() => {
this.$refs.emojis.reload();
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
@@ -159,7 +159,7 @@ export default defineComponent({
aliases: this.aliases.split(' '),
});
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
@@ -168,7 +168,7 @@ export default defineComponent({
},
async del() {
const { canceled } = await this.$root.showDialog({
const { canceled } = await this.$store.dispatch('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.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});

View File

@@ -34,7 +34,7 @@ export default defineComponent({
methods: {
clear() {
this.$root.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -57,7 +57,7 @@ export default defineComponent({
methods: {
clear() {
this.$root.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e.message || e
});
@@ -74,7 +74,7 @@ export default defineComponent({
}).then(() => {
this.refresh();
}).catch((e: any) => {
this.$root.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('showDialog', {
type: 'info',
text: x.code
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});
@@ -472,12 +472,12 @@ export default defineComponent({
subject: 'Test email',
text: 'Yo'
}).then(x => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
splash: true
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});
@@ -546,13 +546,13 @@ export default defineComponent({
}).then(() => {
this.$store.dispatch('instance/fetch');
if (withDialog) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
}
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('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.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
@@ -98,7 +98,7 @@ export default defineComponent({
},
async resetPassword() {
const dialog = this.$root.showDialog({
const dialog = this.$store.dispatch('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.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
text: this.$t('newPasswordIs', { password })
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});
@@ -121,7 +121,7 @@ export default defineComponent({
},
async toggleSilence() {
const confirm = await this.$root.showDialog({
const confirm = await this.$store.dispatch('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.showDialog({
const confirm = await this.$store.dispatch('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.showDialog({
const confirm = await this.$store.dispatch('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.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
};
await process().catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e.toString()
});

View File

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

View File

@@ -140,14 +140,14 @@ export default defineComponent({
const groups1 = await this.$root.api('users/groups/owned');
const groups2 = await this.$root.api('users/groups/joined');
if (groups1.length === 0 && groups2.length === 0) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'warning',
title: this.$t('youHaveNoGroups'),
text: this.$t('joinOrCreateGroup'),
});
return;
}
const { canceled, result: group } = await this.$root.showDialog({
const { canceled, result: group } = await this.$store.dispatch('showDialog', {
type: null,
title: this.$t('group'),
select: {

View File

@@ -97,7 +97,7 @@ export default defineComponent({
const ext = lio >= 0 ? file.name.slice(lio) : '';
const formatted = `${formatTimeString(new Date(file.lastModified), this.$store.state.settings.pastedFileName).replace(/{{number}}/g, '1')}${ext}`;
const name = this.$store.state.settings.pasteDialog
? await this.$root.showDialog({
? await this.$store.dispatch('showDialog', {
title: this.$t('enterFileName'),
input: {
default: formatted
@@ -109,7 +109,7 @@ export default defineComponent({
}
} else {
if (items[0].kind == 'file') {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: this.$t('onlyOneFileCanBeAttached')
});
@@ -134,7 +134,7 @@ export default defineComponent({
return;
} else if (e.dataTransfer.files.length > 1) {
e.preventDefault();
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: this.$t('onlyOneFileCanBeAttached')
});

View File

@@ -144,7 +144,7 @@ export default defineComponent({
this.form.upload(e.dataTransfer.files[0]);
return;
} else if (e.dataTransfer.files.length > 1) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: this.$t('onlyOneFileCanBeAttached')
});

View File

@@ -150,14 +150,14 @@ export default defineComponent({
});
}
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
},
async deleteAntenna() {
const { canceled } = await this.$root.showDialog({
const { canceled } = await this.$store.dispatch('showDialog', {
type: 'warning',
text: this.$t('removeAreYouSure', { x: this.antenna.name }),
showCancelButton: true
@@ -168,7 +168,7 @@ export default defineComponent({
antennaId: this.antenna.id,
});
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -93,12 +93,12 @@ export default defineComponent({
groupId: this.group.id,
userId: user.id
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});
@@ -116,7 +116,7 @@ export default defineComponent({
},
async renameGroup() {
const { canceled, result: name } = await this.$root.showDialog({
const { canceled, result: name } = await this.$store.dispatch('showDialog', {
title: this.$t('groupName'),
input: {
default: this.group.name
@@ -138,12 +138,12 @@ export default defineComponent({
groupId: this.group.id,
userId: user.id
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});
@@ -152,7 +152,7 @@ export default defineComponent({
},
async deleteGroup() {
const { canceled } = await this.$root.showDialog({
const { canceled } = await this.$store.dispatch('showDialog', {
type: 'warning',
text: this.$t('removeAreYouSure', { x: this.group.name }),
showCancelButton: true
@@ -162,7 +162,7 @@ export default defineComponent({
await this.$root.api('users/groups/delete', {
groupId: this.group.id
});
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -82,14 +82,14 @@ export default defineComponent({
methods: {
async create() {
const { canceled, result: name } = await this.$root.showDialog({
const { canceled, result: name } = await this.$store.dispatch('showDialog', {
title: this.$t('groupName'),
input: true
});
if (canceled) return;
await this.$root.api('users/groups/create', { name: name });
this.$refs.owned.reload();
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
@@ -98,7 +98,7 @@ export default defineComponent({
this.$root.api('users/groups/invitations/accept', {
invitationId: invitation.id
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -42,14 +42,14 @@ export default defineComponent({
methods: {
async create() {
const { canceled, result: name } = await this.$root.showDialog({
const { canceled, result: name } = await this.$store.dispatch('showDialog', {
title: this.$t('enterListName'),
input: true
});
if (canceled) return;
await this.$root.api('users/lists/create', { name: name });
this.$refs.list.reload();
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -93,12 +93,12 @@ export default defineComponent({
userId: user.id
}).then(() => {
this.users.push(user);
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});
@@ -116,7 +116,7 @@ export default defineComponent({
},
async renameList() {
const { canceled, result: name } = await this.$root.showDialog({
const { canceled, result: name } = await this.$store.dispatch('showDialog', {
title: this.$t('enterListName'),
input: {
default: this.list.name
@@ -133,7 +133,7 @@ export default defineComponent({
},
async deleteList() {
const { canceled } = await this.$root.showDialog({
const { canceled } = await this.$store.dispatch('showDialog', {
type: 'warning',
text: this.$t('removeAreYouSure', { x: this.list.name }),
showCancelButton: true
@@ -143,7 +143,7 @@ export default defineComponent({
await this.$root.api('users/lists/delete', {
listId: this.list.id
});
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -89,7 +89,7 @@ export default defineComponent({
},
methods: {
register() {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
title: this.$t('password'),
input: {
type: 'password'
@@ -105,7 +105,7 @@ export default defineComponent({
},
unregister() {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
title: this.$t('password'),
input: {
type: 'password'
@@ -118,7 +118,7 @@ export default defineComponent({
this.usePasswordLessLogin = false;
this.updatePasswordLessLogin();
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
@@ -131,13 +131,13 @@ export default defineComponent({
this.$root.api('i/2fa/done', {
token: this.token
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
this.$store.state.i.twoFactorEnabled = true;
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
iconOnly: true, autoClose: true
});
@@ -156,7 +156,7 @@ export default defineComponent({
}).then(key => {
this.registration = null;
key.lastUsed = new Date();
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
@@ -164,7 +164,7 @@ export default defineComponent({
},
unregisterKey(key) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
title: this.$t('password'),
input: {
type: 'password'
@@ -178,7 +178,7 @@ export default defineComponent({
this.usePasswordLessLogin = false;
this.updatePasswordLessLogin();
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
@@ -187,7 +187,7 @@ export default defineComponent({
},
addSecurityKey() {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
title: this.$t('password'),
input: {
type: 'password'

View File

@@ -33,7 +33,7 @@ export default defineComponent({
permission: permissions,
});
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
title: this.$t('token'),
text: token
@@ -41,7 +41,7 @@ export default defineComponent({
});
},
regenerateToken() {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
title: this.$t('password'),
input: {
type: 'password'

View File

@@ -39,7 +39,7 @@ export default defineComponent({
chooseUploadFolder() {
selectDriveFolder(this.$root, false).then(async folder => {
await this.$store.dispatch('settings/set', { key: 'uploadFolder', value: folder ? folder.id : null });
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -45,12 +45,12 @@ export default defineComponent({
this.exportTarget == 'user-lists' ? 'i/export-user-lists' :
null, {})
.then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'info',
text: this.$t('exportRequested')
});
}).catch((e: any) => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e.message
});
@@ -68,7 +68,7 @@ export default defineComponent({
data.append('file', file);
data.append('i', this.$store.state.i.token);
const dialog = this.$root.showDialog({
const dialog = this.$store.dispatch('showDialog', {
type: 'waiting',
text: this.$t('uploading') + '...',
showOkButton: false,
@@ -85,7 +85,7 @@ export default defineComponent({
this.reqImport(f);
})
.catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});
@@ -102,12 +102,12 @@ export default defineComponent({
null, {
fileId: file.id
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'info',
text: this.$t('importRequested')
});
}).catch((e: any) => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e.message
});

View File

@@ -122,7 +122,7 @@ export default defineComponent({
}).then(i => {
this.$store.state.i.includingNotificationTypes = i.includingNotificationTypes;
}).catch(err => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: err.message
});

View File

@@ -160,14 +160,14 @@ export default defineComponent({
this.$store.state.i.bannerUrl = i.bannerUrl;
if (notify) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
}
}).catch(err => {
this.saving = false;
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: err.id
});

View File

@@ -25,7 +25,7 @@ export default defineComponent({
methods: {
async change() {
const { canceled: canceled1, result: currentPassword } = await this.$root.showDialog({
const { canceled: canceled1, result: currentPassword } = await this.$store.dispatch('showDialog', {
title: this.$t('currentPassword'),
input: {
type: 'password'
@@ -33,7 +33,7 @@ export default defineComponent({
});
if (canceled1) return;
const { canceled: canceled2, result: newPassword } = await this.$root.showDialog({
const { canceled: canceled2, result: newPassword } = await this.$store.dispatch('showDialog', {
title: this.$t('newPassword'),
input: {
type: 'password'
@@ -41,7 +41,7 @@ export default defineComponent({
});
if (canceled2) return;
const { canceled: canceled3, result: newPassword2 } = await this.$root.showDialog({
const { canceled: canceled3, result: newPassword2 } = await this.$store.dispatch('showDialog', {
title: this.$t('newPasswordRetype'),
input: {
type: 'password'
@@ -50,14 +50,14 @@ export default defineComponent({
if (canceled3) return;
if (newPassword !== newPassword2) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: this.$t('retypedNotMatch')
});
return;
}
const dialog = this.$root.showDialog({
const dialog = this.$store.dispatch('showDialog', {
type: 'waiting',
iconOnly: true
});
@@ -66,12 +66,12 @@ export default defineComponent({
currentPassword,
newPassword
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
}).catch(e => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});

View File

@@ -64,7 +64,7 @@ export default defineComponent({
methods: {
async add() {
const { canceled, result: type } = await this.$root.showDialog({
const { canceled, result: type } = await this.$store.dispatch('showDialog', {
type: null,
title: this.$t('_pages.chooseBlock'),
select: {

View File

@@ -62,7 +62,7 @@ export default defineComponent({
methods: {
async rename() {
const { canceled, result: title } = await this.$root.showDialog({
const { canceled, result: title } = await this.$store.dispatch('showDialog', {
title: 'Enter title',
input: {
type: 'text',
@@ -75,7 +75,7 @@ export default defineComponent({
},
async add() {
const { canceled, result: type } = await this.$root.showDialog({
const { canceled, result: type } = await this.$store.dispatch('showDialog', {
type: null,
title: this.$t('_pages.chooseBlock'),
select: {

View File

@@ -210,7 +210,7 @@ export default defineComponent({
methods: {
async changeType() {
const { canceled, result: type } = await this.$root.showDialog({
const { canceled, result: type } = await this.$store.dispatch('showDialog', {
type: null,
title: this.$t('_pages.selectType'),
select: {

View File

@@ -239,14 +239,14 @@ export default defineComponent({
const onError = err => {
if (err.id == '3d81ceae-475f-4600-b2a8-2bc116157532') {
if (err.info.param == 'name') {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
title: this.$t('_pages.invalidNameTitle'),
text: this.$t('_pages.invalidNameText')
});
}
} else if (err.code == 'NAME_ALREADY_EXISTS') {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: this.$t('_pages.nameAlreadyExists')
});
@@ -258,7 +258,7 @@ export default defineComponent({
this.$root.api('pages/update', options)
.then(page => {
this.currentName = this.name.trim();
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
text: this.$t('_pages.updated')
});
@@ -268,7 +268,7 @@ export default defineComponent({
.then(page => {
this.pageId = page.id;
this.currentName = this.name.trim();
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
text: this.$t('_pages.created')
});
@@ -278,7 +278,7 @@ export default defineComponent({
},
del() {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'warning',
text: this.$t('removeAreYouSure', { x: this.title.trim() }),
showCancelButton: true
@@ -287,7 +287,7 @@ export default defineComponent({
this.$root.api('pages/delete', {
pageId: this.pageId,
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
text: this.$t('_pages.deleted')
});
@@ -297,7 +297,7 @@ export default defineComponent({
},
async add() {
const { canceled, result: type } = await this.$root.showDialog({
const { canceled, result: type } = await this.$store.dispatch('showDialog', {
type: null,
title: this.$t('_pages.chooseBlock'),
select: {
@@ -312,7 +312,7 @@ export default defineComponent({
},
async addVariable() {
let { canceled, result: name } = await this.$root.showDialog({
let { canceled, result: name } = await this.$store.dispatch('showDialog', {
title: this.$t('_pages.enterVariableName'),
input: {
type: 'text',
@@ -324,7 +324,7 @@ export default defineComponent({
name = name.trim();
if (this.hpml.isUsedName(name)) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: this.$t('_pages.variableNameIsAlreadyUsed')
});

View File

@@ -105,7 +105,7 @@ export default defineComponent({
this.$root.api('i/update', {
pinnedPageId: pin ? this.page.id : null,
}).then(() => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -295,7 +295,7 @@ export default defineComponent({
watch: {
lang() {
const dialog = this.$root.showDialog({
const dialog = this.$store.dispatch('showDialog', {
type: 'waiting',
iconOnly: true
});
@@ -306,7 +306,7 @@ export default defineComponent({
.then(() => location.reload())
.catch(() => {
dialog.close();
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
iconOnly: true,
autoClose: true

View File

@@ -85,7 +85,7 @@ export default defineComponent({
try {
ast = parse(this.script);
} catch (e) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: 'Syntax error :('
});
@@ -93,7 +93,7 @@ export default defineComponent({
}
const meta = AiScript.collectMetadata(ast);
if (meta == null) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: 'No metadata found :('
});
@@ -101,7 +101,7 @@ export default defineComponent({
}
const data = meta.get(null);
if (data == null) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: 'No metadata found :('
});
@@ -109,7 +109,7 @@ export default defineComponent({
}
const { name, version, author, description, permissions, config } = data;
if (name == null || version == null || author == null) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: 'Required property not found :('
});
@@ -142,7 +142,7 @@ export default defineComponent({
ast: serialize(ast)
});
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
@@ -154,7 +154,7 @@ export default defineComponent({
uninstall() {
this.$store.commit('deviceUser/uninstallPlugin', this.selectedPluginId);
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -61,7 +61,7 @@ export default defineComponent({
methods: {
async addItem() {
const menu = Object.keys(this.menuDef).filter(k => !this.$store.state.deviceUser.menu.includes(k));
const { canceled, result: item } = await this.$root.showDialog({
const { canceled, result: item } = await this.$store.dispatch('showDialog', {
type: null,
title: this.$t('addItem'),
select: {

View File

@@ -194,7 +194,7 @@ export default defineComponent({
copyThemeCode() {
copyToClipboard(this.selectedThemeCode);
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
@@ -206,21 +206,21 @@ export default defineComponent({
try {
theme = JSON5.parse(code);
} catch (e) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: this.$t('_theme.invalid')
});
return false;
}
if (!validateTheme(theme)) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: this.$t('_theme.invalid')
});
return false;
}
if (this.$store.state.device.themes.some(t => t.id === theme.id)) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'info',
text: this.$t('_theme.alreadyInstalled')
});
@@ -242,7 +242,7 @@ export default defineComponent({
this.$store.commit('device/set', {
key: 'themes', value: themes
});
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
text: this.$t('_theme.installed', { name: theme.name })
});
@@ -254,7 +254,7 @@ export default defineComponent({
this.$store.commit('device/set', {
key: 'themes', value: themes
});
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -141,7 +141,7 @@ export default defineComponent({
beforeRouteLeave(to, from, next) {
if (this.changed) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'warning',
text: this.$t('leaveConfirm'),
showCancelButton: true
@@ -171,7 +171,7 @@ export default defineComponent({
},
async add() {
const { canceled, result: id } = await this.$root.showDialog({
const { canceled, result: id } = await this.$store.dispatch('showDialog', {
type: null,
title: this.$t('_rooms.addFurniture'),
select: {
@@ -198,12 +198,12 @@ export default defineComponent({
room: room.getRoomInfo()
}).then(() => {
this.changed = false;
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});
}).catch((e: any) => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e.message
});
@@ -211,7 +211,7 @@ export default defineComponent({
},
clear() {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'warning',
text: this.$t('_rooms.clearConfirm'),
showCancelButton: true

View File

@@ -77,7 +77,7 @@ export default defineComponent({
}), {
in: (q) => {
return new Promise(ok => {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
title: q,
input: {}
}).then(({ canceled, result: a }) => {
@@ -108,7 +108,7 @@ export default defineComponent({
try {
ast = parse(this.code);
} catch (e) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: 'Syntax error :('
});
@@ -117,7 +117,7 @@ export default defineComponent({
try {
await aiscript.exec(ast);
} catch (e) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e
});

View File

@@ -64,7 +64,7 @@ export default defineComponent({
initialText: text.trim()
}).$once('posted', () => {
this.posted = true;
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
iconOnly: true, autoClose: true
});

View File

@@ -155,7 +155,7 @@ export default defineComponent({
},
async confirm(): Promise<boolean> {
const { canceled } = await this.$root.showDialog({
const { canceled } = await this.$store.dispatch('showDialog', {
type: 'warning',
text: this.$t('leaveConfirm'),
showCancelButton: true
@@ -172,7 +172,7 @@ export default defineComponent({
},
async del(i: number) {
const { canceled } = await this.$root.showDialog({
const { canceled } = await this.$store.dispatch('showDialog', {
type: 'warning',
showCancelButton: true,
text: this.$t('_theme.deleteConstantConfirm', { const: this.theme[i][0] }),
@@ -182,7 +182,7 @@ export default defineComponent({
},
async addConst() {
const { canceled, result } = await this.$root.showDialog({
const { canceled, result } = await this.$store.dispatch('showDialog', {
title: this.$t('_theme.inputConstantName'),
input: true
});
@@ -196,7 +196,7 @@ export default defineComponent({
this.$store.commit('device/set', {
key: 'themes', value: themes
});
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'success',
text: this.$t('_theme.installed', { name: theme.name })
});
@@ -208,7 +208,7 @@ export default defineComponent({
try {
applyTheme(theme, false);
} catch (e) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e.message
});
@@ -229,7 +229,7 @@ export default defineComponent({
this.theme = convertToViewModel(theme);
this.themeToImport = '';
} catch (e) {
this.$root.showDialog({
this.$store.dispatch('showDialog', {
type: 'error',
text: e.message
});