1- <script setup lang="ts ">
1+ <script setup lang="tsx ">
22import {useGettext } from ' vue3-gettext'
3- import {ref } from ' vue'
3+ import {h , ref } from ' vue'
4+ import StdTable from ' @/components/StdDataDisplay/StdTable.vue'
5+ import cert from ' @/api/cert'
6+ import {customRender , datetime } from ' @/components/StdDataDisplay/StdTableTransformer'
7+ import {input } from ' @/components/StdDataEntry'
8+ import {Badge } from ' ant-design-vue'
49
510const {$gettext} = useGettext ()
611
712const props = defineProps ([' directivesMap' ])
813
914const visible = ref (false )
1015
16+ const columns = [{
17+ title : () => $gettext (' Name' ),
18+ dataIndex: ' name' ,
19+ sorter: true ,
20+ pithy: true ,
21+ customRender : (args : customRender ) => {
22+ const {text, record} = args
23+ if (! text ) {
24+ return h (' div' , record .domain )
25+ }
26+ return h (' div' , text )
27+ },
28+ edit: {
29+ type: input
30+ },
31+ search: true
32+ }, {
33+ title : () => $gettext (' Domain' ),
34+ dataIndex: ' domain' ,
35+ sorter: true ,
36+ pithy: true ,
37+ edit: {
38+ type: input
39+ },
40+ search: true
41+ }, {
42+ title : () => $gettext (' Auto Cert' ),
43+ dataIndex: ' auto_cert' ,
44+ customRender : (args : customRender ) => {
45+ const template: any = []
46+ const {text, column} = args
47+ if (text === true || text > 0 ) {
48+ template .push (<Badge status = " success" />)
49+ template .push ($gettext (' Enabled' ))
50+ } else {
51+ template .push (<Badge status = " warning" />)
52+ template .push ($gettext (' Disabled' ))
53+ }
54+ return h (' div' , template )
55+ },
56+ sorter: true ,
57+ pithy: true
58+ }, {
59+ title : () => $gettext (' SSL Certificate Path' ),
60+ dataIndex: ' ssl_certificate_path' ,
61+ edit: {
62+ type: input
63+ },
64+ display: false
65+ }, {
66+ title : () => $gettext (' SSL Certificate Key Path' ),
67+ dataIndex: ' ssl_certificate_key_path' ,
68+ edit: {
69+ type: input
70+ },
71+ display: false
72+ }, {
73+ title : () => $gettext (' Updated at' ),
74+ dataIndex: ' updated_at' ,
75+ customRender: datetime ,
76+ sorter: true ,
77+ pithy: true
78+ }, {
79+ title : () => $gettext (' Action' ),
80+ dataIndex: ' action'
81+ }]
82+
1183function open() {
1284 visible .value = true
1385}
86+
87+ function onSelect() {
88+
89+ }
90+
91+ function onSelectedRecord() {
92+
93+ }
1494 </script >
1595
1696<template >
@@ -21,7 +101,13 @@ function open() {
21101 v-model:visible =" visible"
22102 :mask =" false"
23103 >
24-
104+ <std-table
105+ :api =" cert"
106+ :pithy =" true"
107+ :columns =" columns"
108+ @onSelected =" onSelect"
109+ @onSelectedRecord =" onSelectedRecord"
110+ />
25111 </a-modal >
26112 </div >
27113</template >
0 commit comments