|
@@ -1,20 +1,10 @@
|
|
|
-<script setup lang="tsx">
|
|
|
-import { Badge, Tag } from 'ant-design-vue'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import { CloudUploadOutlined, SafetyCertificateOutlined } from '@ant-design/icons-vue'
|
|
|
-import { input } from '@/components/StdDesign/StdDataEntry'
|
|
|
+import { Badge, Tag } from 'ant-design-vue'
|
|
|
+import type { Column, JSXElements } from '@/components/StdDesign/types'
|
|
|
import type { customRender } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer'
|
|
|
import { datetime, mask } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer'
|
|
|
-import cert from '@/api/cert'
|
|
|
-import type { Column, JSXElements } from '@/components/StdDesign/types'
|
|
|
-import type { Cert } from '@/api/cert'
|
|
|
-import { AutoCertState, PrivateKeyTypeMask } from '@/constants'
|
|
|
-import StdTable from '@/components/StdDesign/StdDataDisplay/StdTable.vue'
|
|
|
-import WildcardCertificate from '@/views/certificate/WildcardCertificate.vue'
|
|
|
-
|
|
|
-function notShowInAutoCert(record: Cert) {
|
|
|
- return record.auto_cert !== AutoCertState.Enable
|
|
|
-}
|
|
|
+import { input } from '@/components/StdDesign/StdDataEntry'
|
|
|
+import { PrivateKeyTypeMask } from '@/constants'
|
|
|
|
|
|
const columns: Column[] = [{
|
|
|
title: () => $gettext('Name'),
|
|
@@ -28,11 +18,9 @@ const columns: Column[] = [{
|
|
|
|
|
|
return h('div', text)
|
|
|
},
|
|
|
- edit: {
|
|
|
+ search: {
|
|
|
type: input,
|
|
|
- show: notShowInAutoCert,
|
|
|
},
|
|
|
- search: true,
|
|
|
}, {
|
|
|
title: () => $gettext('Type'),
|
|
|
dataIndex: 'auto_cert',
|
|
@@ -45,17 +33,17 @@ const columns: Column[] = [{
|
|
|
if (text === true || text === 1) {
|
|
|
template.push(<Tag bordered={false} color="processing">
|
|
|
{ managed }
|
|
|
- </Tag>)
|
|
|
+ </Tag>)
|
|
|
}
|
|
|
else if (text === 2) {
|
|
|
template.push(<Tag bordered={false} color="success">
|
|
|
{ sync }
|
|
|
- </Tag>)
|
|
|
+ </Tag>)
|
|
|
}
|
|
|
else {
|
|
|
template.push(<Tag bordered={false} color="purple">{
|
|
|
- general }
|
|
|
- </Tag>)
|
|
|
+ general }
|
|
|
+ </Tag>)
|
|
|
}
|
|
|
|
|
|
return h('div', template)
|
|
@@ -68,29 +56,17 @@ const columns: Column[] = [{
|
|
|
customRender: mask(PrivateKeyTypeMask),
|
|
|
sortable: true,
|
|
|
pithy: true,
|
|
|
-}, {
|
|
|
- title: () => $gettext('SSL Certificate Path'),
|
|
|
- dataIndex: 'ssl_certificate_path',
|
|
|
- edit: {
|
|
|
- type: input,
|
|
|
- show: notShowInAutoCert,
|
|
|
- },
|
|
|
- hiddenInTable: true,
|
|
|
-}, {
|
|
|
- title: () => $gettext('SSL Certificate Key Path'),
|
|
|
- dataIndex: 'ssl_certificate_key_path',
|
|
|
- edit: {
|
|
|
- type: input,
|
|
|
- show: notShowInAutoCert,
|
|
|
- },
|
|
|
- hiddenInTable: true,
|
|
|
}, {
|
|
|
title: () => $gettext('Status'),
|
|
|
dataIndex: 'certificate_info',
|
|
|
+ pithy: true,
|
|
|
customRender: (args: customRender) => {
|
|
|
const template: JSXElements = []
|
|
|
|
|
|
- const text = args.text?.not_before && args.text?.not_after && !dayjs().isBefore(args.text?.not_before) && !dayjs().isAfter(args.text?.not_after)
|
|
|
+ const text = args.text?.not_before
|
|
|
+ && args.text?.not_after
|
|
|
+ && !dayjs().isBefore(args.text?.not_before)
|
|
|
+ && !dayjs().isAfter(args.text?.not_after)
|
|
|
|
|
|
if (text) {
|
|
|
template.push(<Badge status="success"/>)
|
|
@@ -114,50 +90,4 @@ const columns: Column[] = [{
|
|
|
dataIndex: 'action',
|
|
|
}]
|
|
|
|
|
|
-// DO NOT REMOVE THESE LINES
|
|
|
-const no_server_name = computed(() => {
|
|
|
- return false
|
|
|
-})
|
|
|
-
|
|
|
-provide('no_server_name', no_server_name)
|
|
|
-
|
|
|
-const refWildcard = ref()
|
|
|
-const refTable = ref()
|
|
|
-</script>
|
|
|
-
|
|
|
-<template>
|
|
|
- <ACard :title="$gettext('Certificates')">
|
|
|
- <template #extra>
|
|
|
- <AButton
|
|
|
- type="link"
|
|
|
- @click="$router.push('/certificates/import')"
|
|
|
- >
|
|
|
- <CloudUploadOutlined />
|
|
|
- {{ $gettext('Import') }}
|
|
|
- </AButton>
|
|
|
-
|
|
|
- <AButton
|
|
|
- type="link"
|
|
|
- @click="() => refWildcard.open()"
|
|
|
- >
|
|
|
- <SafetyCertificateOutlined />
|
|
|
- {{ $gettext('Issue wildcard certificate') }}
|
|
|
- </AButton>
|
|
|
- </template>
|
|
|
- <StdTable
|
|
|
- ref="refTable"
|
|
|
- :api="cert"
|
|
|
- :columns="columns"
|
|
|
- disabled-view
|
|
|
- @click-edit="id => $router.push(`/certificates/${id}`)"
|
|
|
- />
|
|
|
- <WildcardCertificate
|
|
|
- ref="refWildcard"
|
|
|
- @issued="() => refTable.get_list()"
|
|
|
- />
|
|
|
- </ACard>
|
|
|
-</template>
|
|
|
-
|
|
|
-<style lang="less" scoped>
|
|
|
-
|
|
|
-</style>
|
|
|
+export default columns
|