SkyeYoung commented on code in PR #3014:
URL: https://github.com/apache/apisix-dashboard/pull/3014#discussion_r2075810793
##########
src/routes/ssls/index.tsx:
##########
@@ -1,9 +1,121 @@
-import { createFileRoute } from '@tanstack/react-router'
-
-export const Route = createFileRoute('/ssls/')({
- component: RouteComponent,
-})
+import { queryClient } from '@/config/global';
+import { useSuspenseQuery } from '@tanstack/react-query';
+import { createFileRoute } from '@tanstack/react-router';
+import { useTranslation } from 'react-i18next';
+import type { APISIXType } from '@/types/schema/apisix';
+import { ProTable } from '@ant-design/pro-components';
+import type { ProColumns } from '@ant-design/pro-components';
+import { useEffect, useMemo } from 'react';
+import PageHeader from '@/components/page/PageHeader';
+import { ToAddPageBtn } from '@/components/page/ToAddPageBtn';
+import { AntdConfigProvider } from '@/config/antdConfigProvider';
+import { usePagination } from '@/utils/usePagination';
+import { pageSearchSchema } from '@/types/schema/pageSearch';
+import { getSSLListQueryOptions } from '@/apis/ssls';
function RouteComponent() {
- return <div>Hello "/ssl/"!</div>
+ const { t } = useTranslation();
+
+ const { pagination, handlePageChange, updateTotal } = usePagination({
+ queryKey: 'ssls',
+ });
+
+ const sslsQuery = useSuspenseQuery(getSSLListQueryOptions(pagination));
+ const { data, isLoading } = sslsQuery;
+
+ useEffect(() => {
+ if (data?.total) {
+ updateTotal(data.total);
+ }
+ }, [data?.total, updateTotal]);
+
+ const columns = useMemo<ProColumns<APISIXType['RespSSLItem']>[]>(() => {
+ return [
+ {
+ dataIndex: ['value', 'id'],
+ title: 'ID',
+ key: 'id',
+ valueType: 'text',
+ },
+ {
+ dataIndex: ['value', 'sni'],
+ title: 'SNI',
+ key: 'sni',
+ valueType: 'text',
+ render: (_, record) => {
+ // Show sni if available, otherwise show the first snis entry
+ const sni = record.value.sni;
+ const snis = record.value.snis;
+ if (sni) return sni;
+ if (snis && snis.length > 0) return snis.join(', ');
+ return '-';
+ },
+ },
+ {
+ dataIndex: ['value', 'status'],
+ title: t('form.basic.status'),
+ key: 'status',
+ valueEnum: {
+ 1: { text: t('enabled'), status: 'Success' },
+ 0: { text: t('disabled'), status: 'Error' },
+ },
+ },
+ {
+ title: t('actions'),
+ valueType: 'option',
+ key: 'option',
+ width: 120,
+ // render: (_, record) => [],
Review Comment:
This is filled in a subsequent PR #3015 .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]