Починил ошибки в консоли

jwt
Rinsvent 2 years ago
parent 3e8f3943dc
commit c852ef14dd
  1. 1
      components/elements/commands/index.tsx
  2. 10
      components/elements/processes/index.tsx
  3. 5
      components/elements/tokens/index.tsx

@ -34,6 +34,7 @@ export default function Commands() {
}, [value]) }, [value])
let variants = commands.map((command: CommandInterface, index: number) => command.name); let variants = commands.map((command: CommandInterface, index: number) => command.name);
variants.push('')
let callback = (name: string, optionList: Record<string, any>, argumentList: Record<string, any>) => { let callback = (name: string, optionList: Record<string, any>, argumentList: Record<string, any>) => {
setOptionList(optionList) setOptionList(optionList)

@ -53,8 +53,8 @@ export default function Processes() {
const [commands, setCommands] = useState<CommandInterface[]>([]); const [commands, setCommands] = useState<CommandInterface[]>([]);
const [page, setPage] = useState<number>(0); const [page, setPage] = useState<number>(0);
const [count, setCount] = useState<number>(0); const [count, setCount] = useState<number>(0);
const [type, setType] = useState<string | null>(''); const [type, setType] = useState<string>('');
const [name, setName] = useState<string | null>(''); const [name, setName] = useState<string>('');
const [loading, setLoading] = useState<boolean>(true); const [loading, setLoading] = useState<boolean>(true);
const [modalLoading, setModalLoading] = useState<boolean>(true); const [modalLoading, setModalLoading] = useState<boolean>(true);
const [action, setAction] = useState<Action | null>(null); const [action, setAction] = useState<Action | null>(null);
@ -65,6 +65,7 @@ export default function Processes() {
const api = useApi() const api = useApi()
let variants = commands.map((command: CommandInterface, index: number) => command.name); let variants = commands.map((command: CommandInterface, index: number) => command.name);
variants.push('')
let refreshCommands = async () => { let refreshCommands = async () => {
const { data: commands } = await api.useMemory().getCommands() const { data: commands } = await api.useMemory().getCommands()
@ -199,10 +200,10 @@ export default function Processes() {
<Autocomplete <Autocomplete
value={type} value={type}
onChange={(event: any, newValue: string | null) => { onChange={(event: any, newValue: string | null) => {
setType(newValue); setType(newValue || '');
}} }}
disablePortal disablePortal
options={['None', "Running", "History"]} options={['None', "Running", "History", '']}
renderInput={(params) => <TextField {...params} label="Type"/>} renderInput={(params) => <TextField {...params} label="Type"/>}
/> />
</Grid> </Grid>
@ -302,6 +303,7 @@ export default function Processes() {
component="div" component="div"
count={count} count={count}
rowsPerPage={20} rowsPerPage={20}
rowsPerPageOptions={[10, 20, 50, 100]}
page={page} page={page}
onPageChange={handleChangePage} onPageChange={handleChangePage}
/> />

@ -30,7 +30,7 @@ export default function Tokens() {
let variants = tokens.map((token, index) => ({ let variants = tokens.map((token, index) => ({
...token, ...token,
label: token.host label: `${token.host} [${token.id}]`
})); }));
useEffect(() => { useEffect(() => {
@ -42,9 +42,10 @@ export default function Tokens() {
<Grid container> <Grid container>
<Grid item xs={2}> <Grid item xs={2}>
<Autocomplete <Autocomplete
freeSolo
value={{ value={{
...token, ...token,
label: token?.host ?? '' label: token?.host ? `${token.host} [${token.id}]` : ''
}} }}
onChange={(event: any, newValue: any) => { onChange={(event: any, newValue: any) => {
console.log('newValue', newValue); console.log('newValue', newValue);

Loading…
Cancel
Save