diff --git a/web/src/components/domains/DomainEditModal.vue b/web/src/components/domains/DomainEditModal.vue
index fbd52cf..7318fa5 100644
--- a/web/src/components/domains/DomainEditModal.vue
+++ b/web/src/components/domains/DomainEditModal.vue
@@ -25,28 +25,28 @@
- {{ t('domains.form.unitForSecond') }}
+ {{ t('common.unitForSecond') }}
- {{ t('domains.form.unitForSecond') }}
+ {{ t('common.unitForSecond') }}
- {{ t('domains.form.unitForSecond') }}
+ {{ t('common.unitForSecond') }}
- {{ t('domains.form.unitForSecond') }}
+ {{ t('common.unitForSecond') }}
@@ -62,16 +62,16 @@
{{ t('common.cancel') }}
-
-
-
-
-
-
-
- {{ t('common.confirm') }}
-
-
+
+
+
+
+
+
+
+ {{ t('common.confirm') }}
+
@@ -92,12 +92,11 @@ import {
NButton,
NInput,
NInputNumber,
- NSpin,
useNotification,
type FormRules,
type FormItemRule
} from 'naive-ui'
-import { ref, watch } from 'vue';
+import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
const enum validFlags {
@@ -105,7 +104,7 @@ const enum validFlags {
mainNsValid = domainNameValid << 1,
adminEmailValid = mainNsValid << 1
}
-const allFlags = validFlags.adminEmailValid|validFlags.mainNsValid|validFlags.domainNameValid
+const allFlags = validFlags.adminEmailValid | validFlags.mainNsValid | validFlags.domainNameValid
const { t } = useI18n()
@@ -133,7 +132,6 @@ const rules = {
main_dns: [{
required: true,
trigger: 'blur',
-
validator: (_rule: FormItemRule, value: string) => {
return validate(
value,
@@ -173,6 +171,7 @@ const rules = {
negative_ttl: [{
required: true,
trigger: 'blur',
+ type: 'number'
}]
} as FormRules
@@ -197,7 +196,7 @@ async function confirm() {
}
function validate(value: string, reg: RegExp, msg: string, flag: validFlags): Promise {
- return new Promise((resolve, reject) => {
+ return new Promise((resolve, reject) => {
if (!value) {
invalidData.value &= ~flag
reject(Error(t('common.mandatory')))
diff --git a/web/src/components/domains/DomainRemoveModal.vue b/web/src/components/domains/DomainRemoveModal.vue
index e22b3c5..55e35af 100644
--- a/web/src/components/domains/DomainRemoveModal.vue
+++ b/web/src/components/domains/DomainRemoveModal.vue
@@ -24,17 +24,16 @@
{{ t('common.cancel') }}
-
-
-
-
-
-
-
- {{ t('common.confirm') }}
-
-
+
+
+
+
+
+
+
+ {{ t('common.confirm') }}
+
@@ -43,7 +42,7 @@
\ No newline at end of file
diff --git a/web/src/components/records/RecordOps.vue b/web/src/components/records/RecordOps.vue
index fc08a7e..c18ead0 100644
--- a/web/src/components/records/RecordOps.vue
+++ b/web/src/components/records/RecordOps.vue
@@ -11,7 +11,7 @@
{{ $t("common.edit") }}
-
+
@@ -26,12 +26,22 @@
\ No newline at end of file
diff --git a/web/src/locale/en-US.ts b/web/src/locale/en-US.ts
index 2a5cf25..7dd9bc8 100644
--- a/web/src/locale/en-US.ts
+++ b/web/src/locale/en-US.ts
@@ -9,7 +9,8 @@ export default {
new: 'New',
cancel: 'Cancel',
confirm: 'OK',
- mandatory: 'This field is mandatory'
+ mandatory: 'This field is mandatory',
+ unitForSecond: 'Second(s)'
},
api: {
error400: {
@@ -48,7 +49,6 @@ export default {
form: {
adminMail: 'Admin Email',
mainDNS: 'Main DNS',
- unitForSecond: 'Second(s)'
},
errors: {
@@ -67,5 +67,18 @@ export default {
retry: 'Retry Interval',
expire: 'Expiry Period',
ttl: 'Negative TTL',
+
+ form: {
+ text: 'Text',
+ host: 'Host',
+ preference: 'Preference',
+ priority: 'Priority',
+ weight: 'Weight',
+ port: 'Port',
+ target: 'Target',
+ flag: 'Flag',
+ tag: 'Tag',
+ value: 'Value'
+ }
}
}
\ No newline at end of file
diff --git a/web/src/locale/zh-CN.ts b/web/src/locale/zh-CN.ts
index a39970f..50782f0 100644
--- a/web/src/locale/zh-CN.ts
+++ b/web/src/locale/zh-CN.ts
@@ -9,7 +9,8 @@ export default {
new: '新增',
cancel: '取消',
confirm: '确定',
- mandatory: '此项必填'
+ mandatory: '此项必填',
+ unitForSecond: '秒'
},
api: {
error400: {
@@ -48,7 +49,6 @@ export default {
form: {
adminMail: '管理员邮箱',
mainDNS: '主 DNS 服务器',
- unitForSecond: '秒'
},
errors: {
@@ -67,5 +67,18 @@ export default {
retry: '重试间隔',
expire: '超期时间',
ttl: '缓存时间',
+
+ form: {
+ text: '文本',
+ host: '主机',
+ preference: '优先级',
+ priority: '优先级',
+ weight: '权重',
+ port: '端口',
+ target: '目标',
+ flag: '标志',
+ tag: '标签',
+ value: '值'
+ }
}
}
\ No newline at end of file
diff --git a/web/src/stores/records.ts b/web/src/stores/records.ts
index e0d8ecc..8af35db 100644
--- a/web/src/stores/records.ts
+++ b/web/src/stores/records.ts
@@ -232,5 +232,5 @@ export const useRecordStore = defineStore('records', () => {
records.value = records.value?.filter(e => e.id !== record.id)
}
- return { records, recordsGetter, loadRecords }
+ return { records, recordsGetter, loadRecords, addRecord, updateRecord, removeRecord }
})
diff --git a/web/src/views/RecordsView.vue b/web/src/views/RecordsView.vue
index 785a638..2ee6814 100644
--- a/web/src/views/RecordsView.vue
+++ b/web/src/views/RecordsView.vue
@@ -49,7 +49,7 @@ const columns = [
{
key: '',
render(row: Record) {
- return
+ return
}
}
] as DataTableColumns
@@ -70,11 +70,18 @@ onMounted(() => {
}
})
-function refreshRecords() {
- recordStore.loadRecords(props.domain)
- records.value = recordStore.records?.filter(e => e.record_type !== RecordTypes.RecordTypeSOA)
- soa.value = recordStore.records?.find(e => e.record_type === RecordTypes.RecordTypeSOA)?.content as SOARecord
- loading.value = false;
+async function refreshRecords() {
+ try {
+ await recordStore.loadRecords(props.domain)
+ records.value = recordStore.records?.filter(e => e.record_type !== RecordTypes.RecordTypeSOA)
+ soa.value = recordStore.records?.find(e => e.record_type === RecordTypes.RecordTypeSOA)?.content as SOARecord
+ } catch (err) {
+ const msg = getErrorInfo(err)
+ notification.error(msg)
+ console.error(err)
+ } finally {
+ loading.value = false;
+ }
}
function goBack() {
@@ -91,6 +98,17 @@ function searchRecord(value: string) {
filter(e => e.record_type !== RecordTypes.RecordTypeSOA)
}
}
+
+async function deleteRecord(domain: string, record: Record) {
+ try {
+ await recordStore.removeRecord(domain, record)
+ records.value = recordStore.records?.filter(e => e.record_type !== RecordTypes.RecordTypeSOA)
+ } catch (err) {
+ const msg = getErrorInfo(err)
+ notification.error(msg)
+ console.error(err)
+ }
+}