fix: dashboard gauge chart data

This commit is contained in:
jialin
2024-07-19 13:06:02 +08:00
parent 1439f59131
commit b8b0d39635
13 changed files with 46 additions and 70 deletions
+12 -6
View File
@@ -7,7 +7,7 @@ import { PageActionType } from '@/config/types';
import { useIntl } from '@umijs/max';
import { Button, Form, Modal, Select, Tag } from 'antd';
import dayjs from 'dayjs';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { createApisKey } from '../apis';
import { expirationOptions } from '../config';
import { FormData } from '../config/types';
@@ -33,11 +33,17 @@ const AddModal: React.FC<AddModalProps> = ({
const [apikeyValue, setAPIKeyValue] = useState('');
const [loading, setLoading] = useState(false);
if (action === PageAction.CREATE && open) {
form.setFieldsValue({
expires_in: 1
});
}
const initValues = () => {
if (action === PageAction.CREATE && open) {
form.setFieldsValue({
expires_in: 1
});
}
};
useEffect(() => {
initValues();
}, [open]);
const getExpireValue = (val: number | null) => {
const expires_in = val;
+4 -6
View File
@@ -18,7 +18,7 @@ import { ListItem } from './config/types';
const { Column } = Table;
const Models: React.FC = () => {
const APIKeys: React.FC = () => {
const rowSelection = useTableRowSelection();
const { sortOrder, setSortOrder } = useTableSort({
defaultSortOrder: 'descend'
@@ -85,10 +85,10 @@ const Models: React.FC = () => {
const handleModalOk = async () => {
try {
await fetchData();
setOpenAddModal(false);
fetchData();
} catch (error) {
setOpenAddModal(false);
// do nothing
}
};
@@ -99,7 +99,6 @@ const Models: React.FC = () => {
const handleDelete = (row: ListItem) => {
modalRef.current.show({
title: '',
content: 'apikeys.table.apikeys',
async onOk() {
console.log('OK');
@@ -111,7 +110,6 @@ const Models: React.FC = () => {
const handleDeleteBatch = () => {
modalRef.current.show({
title: '',
content: 'apikeys.table.apikeys',
async onOk() {
await handleBatchRequest(rowSelection.selectedRowKeys, deleteApisKey);
@@ -261,4 +259,4 @@ const Models: React.FC = () => {
);
};
export default Models;
export default APIKeys;