add available tag for model downloaded configs

This commit is contained in:
josc146 2023-12-08 15:34:45 +08:00
parent 8a19181a38
commit eea53a6e9e
2 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import { FC } from 'react'; import { FC } from 'react';
import { observer } from 'mobx-react-lite'; import { observer } from 'mobx-react-lite';
import { Dropdown, Option } from '@fluentui/react-components'; import { Dropdown, Option, PresenceBadge } from '@fluentui/react-components';
import commonStore from '../stores/commonStore'; import commonStore from '../stores/commonStore';
export const ConfigSelector: FC<{ size?: 'small' | 'medium' | 'large' }> = observer(({ size }) => { export const ConfigSelector: FC<{ size?: 'small' | 'medium' | 'large' }> = observer(({ size }) => {
@ -12,7 +12,13 @@ export const ConfigSelector: FC<{ size?: 'small' | 'medium' | 'large' }> = obser
commonStore.setCurrentConfigIndex(Number(data.optionValue)); commonStore.setCurrentConfigIndex(Number(data.optionValue));
}}> }}>
{commonStore.modelConfigs.map((config, index) => {commonStore.modelConfigs.map((config, index) =>
<Option key={index} value={index.toString()}>{config.name}</Option> <Option key={index} value={index.toString()} text={config.name}>
<div className="flex justify-between grow">
{config.name}
{commonStore.modelSourceList.find(item => item.name === config.modelParameters.modelName)?.isComplete
&& <PresenceBadge status="available" />}
</div>
</Option>
)} )}
</Dropdown>; </Dropdown>;
}); });

View File

@ -8,6 +8,7 @@ import {
Input, Input,
Label, Label,
Option, Option,
PresenceBadge,
Select, Select,
Switch, Switch,
Text Text
@ -106,7 +107,13 @@ const Configs: FC = observer(() => {
} }
}}> }}>
{commonStore.modelConfigs.map((config, index) => {commonStore.modelConfigs.map((config, index) =>
<Option key={index} value={index.toString()}>{config.name}</Option> <Option key={index} value={index.toString()} text={config.name}>
<div className="flex justify-between grow">
{config.name}
{commonStore.modelSourceList.find(item => item.name === config.modelParameters.modelName)?.isComplete
&& <PresenceBadge status="available" />}
</div>
</Option>
)} )}
</Dropdown> </Dropdown>
<ToolTipButton desc={t('New Config')} icon={<AddCircle20Regular />} onClick={() => { <ToolTipButton desc={t('New Config')} icon={<AddCircle20Regular />} onClick={() => {