feat: paste multiple lines in parameters input
This commit is contained in:
@@ -8,15 +8,12 @@ import { useQueryClusterList } from '@/pages/cluster-management/services/use-que
|
||||
import { useIntl, useSearchParams } from '@umijs/max';
|
||||
import { ConfigProvider, Table } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { GPU_DEVICES_API, queryGpuDevicesList } from '../apis';
|
||||
import { GPUDeviceItem } from '../config/types';
|
||||
import useGPUColumns from '../hooks/use-gpu-columns';
|
||||
|
||||
const GPUList: React.FC<{ clusterId?: number; widths?: { input: number } }> = ({
|
||||
clusterId,
|
||||
widths
|
||||
}) => {
|
||||
const GPUList = () => {
|
||||
const {
|
||||
dataSource,
|
||||
queryParams,
|
||||
@@ -31,10 +28,7 @@ const GPUList: React.FC<{ clusterId?: number; widths?: { input: number } }> = ({
|
||||
key: PaginationKey.GPUs,
|
||||
fetchAPI: queryGpuDevicesList,
|
||||
polling: true,
|
||||
API: GPU_DEVICES_API,
|
||||
defaultQueryParams: {
|
||||
cluster_id: clusterId
|
||||
}
|
||||
API: GPU_DEVICES_API
|
||||
});
|
||||
const [searchParams] = useSearchParams();
|
||||
const page = searchParams.get('page');
|
||||
@@ -108,8 +102,7 @@ const GPUList: React.FC<{ clusterId?: number; widths?: { input: number } }> = ({
|
||||
handleInputChange={handleNameChange}
|
||||
handleSelectChange={handleClusterChange}
|
||||
selectOptions={clusterList}
|
||||
showSelect={page !== 'clusters'}
|
||||
widths={{ input: widths?.input || 200 }}
|
||||
showSelect={true}
|
||||
></FilterBar>
|
||||
<ConfigProvider renderEmpty={renderEmpty}>
|
||||
<Table
|
||||
|
||||
@@ -12,7 +12,7 @@ import useGranfanaLink from '@/pages/resources/hooks/use-grafana-link';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { ConfigProvider, Table, message } from 'antd';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import {
|
||||
WORKERS_API,
|
||||
deleteWorker,
|
||||
@@ -27,19 +27,7 @@ import UpdateLabels from './update-labels';
|
||||
import WorkerDetailModal from './worker-detail-modal';
|
||||
import WorkerRightActions from './worker-right-actions';
|
||||
|
||||
const Workers: React.FC<{
|
||||
clusterId?: string | number | null;
|
||||
showSelect?: boolean;
|
||||
showAddButton?: boolean;
|
||||
widths?: { input: number };
|
||||
sourceType?: string;
|
||||
}> = ({
|
||||
clusterId,
|
||||
showSelect = true,
|
||||
showAddButton = true,
|
||||
widths = { input: 200 },
|
||||
sourceType = 'resources'
|
||||
}) => {
|
||||
const Workers = () => {
|
||||
const {
|
||||
dataSource,
|
||||
rowSelection,
|
||||
@@ -63,10 +51,7 @@ const Workers: React.FC<{
|
||||
contentForDelete: 'resources.worker',
|
||||
watch: true,
|
||||
API: WORKERS_API,
|
||||
updateManually: true,
|
||||
defaultQueryParams: {
|
||||
cluster_id: clusterId
|
||||
}
|
||||
updateManually: true
|
||||
});
|
||||
const { goToGrafana, ActionButton } = useGranfanaLink({
|
||||
type: 'worker'
|
||||
@@ -255,8 +240,7 @@ const Workers: React.FC<{
|
||||
loadend: dataSource.loadend,
|
||||
firstLoad: extraStatus.firstLoad,
|
||||
sortOrder,
|
||||
handleSelect,
|
||||
sourceType
|
||||
handleSelect
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -268,7 +252,7 @@ const Workers: React.FC<{
|
||||
<>
|
||||
<PageBox>
|
||||
<FilterBar
|
||||
showSelect={showSelect}
|
||||
showSelect={true}
|
||||
selectHolder={intl.formatMessage({ id: 'clusters.filterBy.cluster' })}
|
||||
marginBottom={22}
|
||||
marginTop={30}
|
||||
@@ -280,7 +264,6 @@ const Workers: React.FC<{
|
||||
handleInputChange={handleNameChange}
|
||||
rowSelection={rowSelection}
|
||||
selectOptions={clusterData.list}
|
||||
widths={widths}
|
||||
right={
|
||||
<WorkerRightActions
|
||||
handleDeleteByBatch={handleDeleteBatch}
|
||||
|
||||
@@ -235,7 +235,6 @@ const useWorkerColumns = ({
|
||||
loadend,
|
||||
firstLoad,
|
||||
sortOrder,
|
||||
sourceType,
|
||||
handleSelect
|
||||
}: {
|
||||
clusterData: {
|
||||
@@ -245,7 +244,6 @@ const useWorkerColumns = ({
|
||||
loadend: boolean;
|
||||
firstLoad: boolean;
|
||||
sortOrder: string[];
|
||||
sourceType: string;
|
||||
handleSelect: (action: string, record: ListItem) => void;
|
||||
}): ColumnsType<ListItem> => {
|
||||
const intl = useIntl();
|
||||
@@ -316,7 +314,6 @@ const useWorkerColumns = ({
|
||||
{
|
||||
title: intl.formatMessage({ id: 'clusters.title' }),
|
||||
dataIndex: 'cluster_id',
|
||||
hidden: sourceType === 'cluster',
|
||||
render: (id: number) => (
|
||||
<AutoTooltip ghost maxWidth={240}>
|
||||
{_.get(clusterData.data, id, '')}
|
||||
@@ -440,7 +437,7 @@ const useWorkerColumns = ({
|
||||
)
|
||||
}
|
||||
],
|
||||
[intl, sourceType, sortOrder, clusterData, loadend, firstLoad, handleSelect]
|
||||
[intl, sortOrder, clusterData, loadend, firstLoad, handleSelect]
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user