refactor(llmodels): rename MyModelsStatusValueMap keys to Stopped/NotReady/Ready
This commit is contained in:
@@ -249,7 +249,7 @@ const ModelItem: React.FC<{
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{[MyModelsStatusValueMap.Active].includes(model.status) && (
|
{[MyModelsStatusValueMap.Ready].includes(model.status) && (
|
||||||
<Button
|
<Button
|
||||||
size="middle"
|
size="middle"
|
||||||
type="default"
|
type="default"
|
||||||
|
|||||||
@@ -196,21 +196,21 @@ export const status: any = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const MyModelsStatusValueMap = {
|
export const MyModelsStatusValueMap = {
|
||||||
Inactive: 'stopped',
|
Stopped: 'stopped',
|
||||||
Degrade: 'not_ready',
|
NotReady: 'not_ready',
|
||||||
Active: 'ready'
|
Ready: 'ready'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MyModelsStatusMap = {
|
export const MyModelsStatusMap = {
|
||||||
[MyModelsStatusValueMap.Inactive]: StatusMaps.inactive,
|
[MyModelsStatusValueMap.Stopped]: StatusMaps.inactive,
|
||||||
[MyModelsStatusValueMap.Degrade]: StatusMaps.error,
|
[MyModelsStatusValueMap.NotReady]: StatusMaps.error,
|
||||||
[MyModelsStatusValueMap.Active]: StatusMaps.success
|
[MyModelsStatusValueMap.Ready]: StatusMaps.success
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MyModelsStatusLabelMap = {
|
export const MyModelsStatusLabelMap = {
|
||||||
[MyModelsStatusValueMap.Inactive]: 'models.mymodels.status.inactive',
|
[MyModelsStatusValueMap.Stopped]: 'models.mymodels.status.inactive',
|
||||||
[MyModelsStatusValueMap.Degrade]: 'models.mymodels.status.degrade',
|
[MyModelsStatusValueMap.NotReady]: 'models.mymodels.status.degrade',
|
||||||
[MyModelsStatusValueMap.Active]: 'models.mymodels.status.active'
|
[MyModelsStatusValueMap.Ready]: 'models.mymodels.status.active'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ScheduleValueMap = {
|
export const ScheduleValueMap = {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const useFilterStatus = (options?: {
|
|||||||
|
|
||||||
const statusOptions = [
|
const statusOptions = [
|
||||||
{
|
{
|
||||||
value: MyModelsStatusValueMap.Active,
|
value: MyModelsStatusValueMap.Ready,
|
||||||
color: 'var(--ant-color-success)',
|
color: 'var(--ant-color-success)',
|
||||||
icon: <Dot color="var(--ant-color-success)"></Dot>,
|
icon: <Dot color="var(--ant-color-success)"></Dot>,
|
||||||
label: intl.formatMessage({
|
label: intl.formatMessage({
|
||||||
@@ -32,7 +32,7 @@ const useFilterStatus = (options?: {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: MyModelsStatusValueMap.Inactive,
|
value: MyModelsStatusValueMap.Stopped,
|
||||||
color: 'var(--ant-color-fill-secondary)',
|
color: 'var(--ant-color-fill-secondary)',
|
||||||
icon: <Dot color="var(--ant-color-fill-secondary)"></Dot>,
|
icon: <Dot color="var(--ant-color-fill-secondary)"></Dot>,
|
||||||
label: intl.formatMessage({
|
label: intl.formatMessage({
|
||||||
@@ -40,7 +40,7 @@ const useFilterStatus = (options?: {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: MyModelsStatusValueMap.Degrade,
|
value: MyModelsStatusValueMap.NotReady,
|
||||||
color: 'var(--ant-color-warning)',
|
color: 'var(--ant-color-warning)',
|
||||||
icon: <Dot color="var(--ant-color-warning)"></Dot>,
|
icon: <Dot color="var(--ant-color-warning)"></Dot>,
|
||||||
label: intl.formatMessage({
|
label: intl.formatMessage({
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ const UserModels: React.FC = () => {
|
|||||||
watch: false,
|
watch: false,
|
||||||
isInfiniteScroll: true,
|
isInfiniteScroll: true,
|
||||||
defaultQueryParams: {
|
defaultQueryParams: {
|
||||||
perPage: 24
|
perPage: 24,
|
||||||
|
state: MyModelsStatusValueMap.Ready
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
@@ -64,21 +65,21 @@ const UserModels: React.FC = () => {
|
|||||||
const statusOptions = useMemo(() => {
|
const statusOptions = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
value: MyModelsStatusValueMap.Active,
|
value: MyModelsStatusValueMap.Ready,
|
||||||
color: 'var(--ant-color-success)',
|
color: 'var(--ant-color-success)',
|
||||||
label: intl.formatMessage({
|
label: intl.formatMessage({
|
||||||
id: 'models.mymodels.status.active'
|
id: 'models.mymodels.status.active'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: MyModelsStatusValueMap.Inactive,
|
value: MyModelsStatusValueMap.Stopped,
|
||||||
color: 'var(--ant-color-fill)',
|
color: 'var(--ant-color-fill)',
|
||||||
label: intl.formatMessage({
|
label: intl.formatMessage({
|
||||||
id: 'models.mymodels.status.inactive'
|
id: 'models.mymodels.status.inactive'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: MyModelsStatusValueMap.Degrade,
|
value: MyModelsStatusValueMap.NotReady,
|
||||||
color: 'var(--ant-color-warning)',
|
color: 'var(--ant-color-warning)',
|
||||||
label: intl.formatMessage({
|
label: intl.formatMessage({
|
||||||
id: 'models.mymodels.status.degrade'
|
id: 'models.mymodels.status.degrade'
|
||||||
@@ -125,17 +126,17 @@ const UserModels: React.FC = () => {
|
|||||||
|
|
||||||
const getStatus = useCallback((model: any) => {
|
const getStatus = useCallback((model: any) => {
|
||||||
if (!model.targets && !model.ready_targets) {
|
if (!model.targets && !model.ready_targets) {
|
||||||
return MyModelsStatusValueMap.Inactive;
|
return MyModelsStatusValueMap.Stopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.targets > 0 && !model.ready_targets) {
|
if (model.targets > 0 && !model.ready_targets) {
|
||||||
return MyModelsStatusValueMap.Degrade;
|
return MyModelsStatusValueMap.NotReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.ready_targets > 0 && model.targets > 0) {
|
if (model.ready_targets > 0 && model.targets > 0) {
|
||||||
return MyModelsStatusValueMap.Active;
|
return MyModelsStatusValueMap.Ready;
|
||||||
}
|
}
|
||||||
return MyModelsStatusValueMap.Degrade;
|
return MyModelsStatusValueMap.NotReady;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const dataList = useMemo(() => {
|
const dataList = useMemo(() => {
|
||||||
@@ -198,6 +199,7 @@ const UserModels: React.FC = () => {
|
|||||||
optionRender={optionRender}
|
optionRender={optionRender}
|
||||||
labelRender={labelRender}
|
labelRender={labelRender}
|
||||||
options={statusOptions}
|
options={statusOptions}
|
||||||
|
value={queryParams.state}
|
||||||
onChange={handleStatusChange}
|
onChange={handleStatusChange}
|
||||||
></BaseSelect>
|
></BaseSelect>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user