Skip to content

Commit cdcdf6e

Browse files
committed
refactor(platform): rename type Device to DeviceData
1 parent b2263fb commit cdcdf6e

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

packages/platform/src/app/routes/list/standard-table/DeviceModal.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { OpenModalFn } from '../../../utils/types';
2-
import type { Device } from './StandardTable';
2+
import type { DeviceData } from './StandardTable';
33
import type { DSelectItem } from '@react-devui/ui/components/select';
44

55
import { isUndefined } from 'lodash';
@@ -13,7 +13,7 @@ export interface AppDeviceModalProps {
1313
aModelList: DSelectItem<string>[] | undefined;
1414
}
1515

16-
function DeviceModal(props: AppDeviceModalProps, ref: React.ForwardedRef<OpenModalFn<Device>>): JSX.Element | null {
16+
function DeviceModal(props: AppDeviceModalProps, ref: React.ForwardedRef<OpenModalFn<DeviceData>>): JSX.Element | null {
1717
const { aModelList } = props;
1818

1919
const async = useAsync();
@@ -22,7 +22,7 @@ function DeviceModal(props: AppDeviceModalProps, ref: React.ForwardedRef<OpenMod
2222
const id = `app-form-${uniqueId}`;
2323

2424
const [visible, setVisible] = useState(false);
25-
const [device, setDevice] = useState<Device>();
25+
const [device, setDevice] = useState<DeviceData>();
2626
const [form, updateForm] = useForm(
2727
() =>
2828
new FormGroup({
@@ -31,7 +31,7 @@ function DeviceModal(props: AppDeviceModalProps, ref: React.ForwardedRef<OpenMod
3131
})
3232
);
3333

34-
const open = useEventCallback<OpenModalFn<Device>>((device) => {
34+
const open = useEventCallback<OpenModalFn<DeviceData>>((device) => {
3535
setVisible(true);
3636
setDevice(device);
3737
form.reset(device ? { name: device.name, model: device.model } : undefined);

packages/platform/src/app/routes/list/standard-table/StandardTable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { useAPI, useQueryParams } from '../../../hooks';
1515
import { AppDeviceModal } from './DeviceModal';
1616
import styles from './StandardTable.module.scss';
1717

18-
export type Device = DeviceDoc;
18+
export type DeviceData = DeviceDoc;
1919

2020
interface DeviceQueryParams {
2121
keyword: string;
@@ -27,7 +27,7 @@ interface DeviceQueryParams {
2727
}
2828

2929
export default function StandardTable(): JSX.Element | null {
30-
const deviceModalRef = useRef<OpenModalFn<Device>>(null);
30+
const deviceModalRef = useRef<OpenModalFn<DeviceData>>(null);
3131

3232
const { t } = useTranslation();
3333
const async = useAsync();
@@ -57,7 +57,7 @@ export default function StandardTable(): JSX.Element | null {
5757

5858
const [deviceTable, setDeviceTable] = useImmer({
5959
loading: true,
60-
list: [] as Device[],
60+
list: [] as DeviceData[],
6161
totalSize: 0,
6262
selected: new Set<number>(),
6363
});
@@ -68,7 +68,7 @@ export default function StandardTable(): JSX.Element | null {
6868

6969
const [paramsOfDeleteModal, setParamsOfDeleteModal] = useImmer<{
7070
visible: boolean;
71-
device: Device;
71+
device: DeviceData;
7272
}>();
7373

7474
useMount(() => {
@@ -100,7 +100,7 @@ export default function StandardTable(): JSX.Element | null {
100100
setDeviceTable((draft) => {
101101
draft.loading = true;
102102
});
103-
deviceApi.list<Device>(apiQuery).subscribe({
103+
deviceApi.list<DeviceData>(apiQuery).subscribe({
104104
next: (res) => {
105105
setDeviceQuery((draft) => {
106106
draft.page = res.metadata.page;

packages/platform/src/app/routes/list/standard-table/detail/Detail.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { OpenModalFn } from '../../../../utils/types';
2-
import type { Device } from '../StandardTable';
2+
import type { DeviceData } from '../StandardTable';
33
import type { DSelectItem } from '@react-devui/ui/components/select';
44

55
import { isUndefined } from 'lodash';
@@ -17,7 +17,7 @@ import { AppDeviceModal } from '../DeviceModal';
1717
import styles from './Detail.module.scss';
1818

1919
export default function Detail(): JSX.Element | null {
20-
const deviceModalRef = useRef<OpenModalFn<Device>>(null);
20+
const deviceModalRef = useRef<OpenModalFn<DeviceData>>(null);
2121

2222
const { t } = useTranslation();
2323

@@ -27,7 +27,7 @@ export default function Detail(): JSX.Element | null {
2727
const { id: _id } = useParams();
2828
const id = Number(_id!);
2929

30-
const [device, setDevice] = useState<Device>();
30+
const [device, setDevice] = useState<DeviceData>();
3131

3232
const [modelList, setModelList] = useState<DSelectItem<string>[]>();
3333

0 commit comments

Comments
 (0)