|
@@ -2,31 +2,34 @@
|
|
|
import CertInfo from '@/views/domain/cert/CertInfo.vue'
|
|
|
import IssueCert from '@/views/domain/cert/IssueCert.vue'
|
|
|
import ChangeCert from '@/views/domain/cert/components/ChangeCert/ChangeCert.vue'
|
|
|
-import type { CertificateInfo } from '@/api/cert'
|
|
|
+import type { Cert, CertificateInfo } from '@/api/cert'
|
|
|
|
|
|
const props = defineProps<{
|
|
|
configName: string
|
|
|
- enabled: boolean
|
|
|
currentServerIndex: number
|
|
|
certInfo?: CertificateInfo[]
|
|
|
}>()
|
|
|
|
|
|
-const emit = defineEmits(['update:enabled'])
|
|
|
+const enabled = defineModel<boolean>('enabled', {
|
|
|
+ default: () => false,
|
|
|
+})
|
|
|
+
|
|
|
+const changedCerts: Ref<Cert[]> = ref([])
|
|
|
|
|
|
-const enabled = computed({
|
|
|
- get() {
|
|
|
- return props.enabled
|
|
|
- },
|
|
|
- set(value) {
|
|
|
- emit('update:enabled', value)
|
|
|
- },
|
|
|
+// if certInfo update, clear changedCerts
|
|
|
+watch(() => props.certInfo, () => {
|
|
|
+ changedCerts.value = []
|
|
|
})
|
|
|
+
|
|
|
+function handleCertChange(certs: Cert[]) {
|
|
|
+ changedCerts.value = certs
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div>
|
|
|
<h3>
|
|
|
- {{ $gettext('Certificate Status') }}
|
|
|
+ {{ $ngettext('Certificate Status', 'Certificates Status', certInfo?.length || 1) }}
|
|
|
</h3>
|
|
|
|
|
|
<ARow
|
|
@@ -43,7 +46,26 @@ const enabled = computed({
|
|
|
</ACol>
|
|
|
</ARow>
|
|
|
|
|
|
- <ChangeCert />
|
|
|
+ <template v-if="changedCerts.length > 0">
|
|
|
+ <h3>
|
|
|
+ {{ $ngettext('Changed Certificate', 'Changed Certificates', changedCerts?.length || 1) }}
|
|
|
+ </h3>
|
|
|
+ <ARow
|
|
|
+ :gutter="[16, 16]"
|
|
|
+ class="mb-4"
|
|
|
+ >
|
|
|
+ <ACol
|
|
|
+ v-for="(c, index) in changedCerts"
|
|
|
+ :key="index"
|
|
|
+ :xs="24"
|
|
|
+ :sm="12"
|
|
|
+ >
|
|
|
+ <CertInfo :cert="c.certificate_info" />
|
|
|
+ </ACol>
|
|
|
+ </ARow>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <ChangeCert @change="handleCertChange" />
|
|
|
|
|
|
<IssueCert
|
|
|
v-model:enabled="enabled"
|