From 36b03843191004fc29b8e7276b9bd8e7ca478d09 Mon Sep 17 00:00:00 2001 From: Sense T Date: Mon, 8 Apr 2024 15:02:55 +0800 Subject: [PATCH] delete domain modal done --- TODO | 5 +- web/src/components/domains/DomainOps.vue | 22 ++- .../components/domains/DomainRemoveModal.vue | 83 ++++++++- web/src/components/icons/IconCommunity.vue | 7 - .../components/icons/IconDocumentation.vue | 7 - web/src/components/icons/IconEcosystem.vue | 7 - web/src/components/icons/IconSupport.vue | 7 - web/src/components/icons/IconTooling.vue | 19 -- web/src/locale/en-US.ts | 8 +- web/src/locale/zh-CN.ts | 8 +- web/src/views/DomainsView.vue | 48 +++-- web/src/views/HomeView.vue | 2 + web/src/views/RecordsView.vue | 164 +++++++++--------- 13 files changed, 229 insertions(+), 158 deletions(-) delete mode 100644 web/src/components/icons/IconCommunity.vue delete mode 100644 web/src/components/icons/IconDocumentation.vue delete mode 100644 web/src/components/icons/IconEcosystem.vue delete mode 100644 web/src/components/icons/IconSupport.vue delete mode 100644 web/src/components/icons/IconTooling.vue diff --git a/TODO b/TODO index ce82031..57fe64a 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,8 @@ - [x] metrics - [] Web UI - - [] i18n + - [x] i18n + - [] modals - [] swagger - [] Nix Module - [] RBAC - [] Audit - - diff --git a/web/src/components/domains/DomainOps.vue b/web/src/components/domains/DomainOps.vue index 9c33d40..bac8022 100644 --- a/web/src/components/domains/DomainOps.vue +++ b/web/src/components/domains/DomainOps.vue @@ -9,27 +9,27 @@ - 查看/修改记录 + {{ t('domains.dnsRecord') }} - 修改 + {{ t('common.edit') }} - 删除 + {{ t('common.delete') }} @@ -40,12 +40,24 @@ import { NSpace, NButton, NIcon, NTooltip, NFlex } from 'naive-ui' import { TrashAlt, EditRegular, Book } from '@vicons/fa' import { type Domain } from "../../stores/domains" import router from '@/router'; +import { useI18n } from 'vue-i18n'; +const { t } = useI18n() const props = defineProps<{ domain: Domain }>() +const emit = defineEmits(['remove-domain', 'edit-domain']) + function loadRecord() { router.push(`/records/${props.domain.domain_name}`) } + +function removeDomain() { + emit('remove-domain', props.domain) +} + +function editDomain() { + emit('edit-domain', props.domain) +} \ No newline at end of file diff --git a/web/src/components/domains/DomainRemoveModal.vue b/web/src/components/domains/DomainRemoveModal.vue index b435d7e..54ec209 100644 --- a/web/src/components/domains/DomainRemoveModal.vue +++ b/web/src/components/domains/DomainRemoveModal.vue @@ -1,13 +1,88 @@ \ No newline at end of file + +async function confirm() { + domain_name.value = ''; + loading.value = true; + + if (props.domain) { + try { + await domainStore.removeDomain(props.domain) + show.value = false; + } catch (e) { + const msg = getErrorInfo(e) + notification.error(msg) + } + } + loading.value = false; +} + + + \ No newline at end of file diff --git a/web/src/components/icons/IconCommunity.vue b/web/src/components/icons/IconCommunity.vue deleted file mode 100644 index 2dc8b05..0000000 --- a/web/src/components/icons/IconCommunity.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/web/src/components/icons/IconDocumentation.vue b/web/src/components/icons/IconDocumentation.vue deleted file mode 100644 index 6d4791c..0000000 --- a/web/src/components/icons/IconDocumentation.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/web/src/components/icons/IconEcosystem.vue b/web/src/components/icons/IconEcosystem.vue deleted file mode 100644 index c3a4f07..0000000 --- a/web/src/components/icons/IconEcosystem.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/web/src/components/icons/IconSupport.vue b/web/src/components/icons/IconSupport.vue deleted file mode 100644 index 7452834..0000000 --- a/web/src/components/icons/IconSupport.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/web/src/components/icons/IconTooling.vue b/web/src/components/icons/IconTooling.vue deleted file mode 100644 index 660598d..0000000 --- a/web/src/components/icons/IconTooling.vue +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/web/src/locale/en-US.ts b/web/src/locale/en-US.ts index 1eb19b4..4db4748 100644 --- a/web/src/locale/en-US.ts +++ b/web/src/locale/en-US.ts @@ -7,6 +7,8 @@ export default { edit: 'Edit', add: 'New', new: 'New', + cancel: 'Cancel', + confirm: 'OK', }, api: { error400: { @@ -35,7 +37,11 @@ export default { } }, domains: { - dnsRecord: 'DNS Record' + dnsRecord: 'DNS Record', + delete: 'Remove Domain', + deleteHint: 'All records of this domain will be WIPED!', + confirm1: 'Please input', + confirm2: 'for comfirmation' }, records: { name: 'Record Name', diff --git a/web/src/locale/zh-CN.ts b/web/src/locale/zh-CN.ts index 0d27725..ee4b651 100644 --- a/web/src/locale/zh-CN.ts +++ b/web/src/locale/zh-CN.ts @@ -7,6 +7,8 @@ export default { edit: '修改', add: '新增', new: '新增', + cancel: '取消', + confirm: '确定', }, api: { error400: { @@ -35,7 +37,11 @@ export default { } }, domains: { - dnsRecord: 'DNS 记录' + dnsRecord: 'DNS 记录', + delete: '删除域名', + deleteHint: '该域名所有记录将被删除!', + confirm1: '请输入', + confirm2: '以确认要删除的域名' }, records: { name: '记录名', diff --git a/web/src/views/DomainsView.vue b/web/src/views/DomainsView.vue index 527806e..778813a 100644 --- a/web/src/views/DomainsView.vue +++ b/web/src/views/DomainsView.vue @@ -1,16 +1,20 @@