-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 118 input number instead slider in form * feat: 118 yaml viewer and form fixes * feat: 118 yaml png and readme entry
- Loading branch information
Showing
11 changed files
with
1,019 additions
and
1,082 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/components/Widgets/FormGenerator/SelectWithFilters.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { useEffect, useState } from "react"; | ||
import { useLazyGetContentQuery } from "../../../features/common/commonApiSlice"; | ||
import useCatchError from "../../../utils/useCatchError"; | ||
import { Select } from "antd"; | ||
|
||
const SelectWithFilters = ({node}) => { | ||
const [getContent] = useLazyGetContentQuery(); | ||
const { catchError } = useCatchError(); | ||
|
||
const [loading, setLoading] = useState(false); | ||
|
||
let options; | ||
|
||
useEffect(() => { | ||
const getOptions = async () => { | ||
try { | ||
setLoading(true) | ||
const result = await getContent({endpoint: node.endpoint}).unwrap() | ||
options = result.map(opt => ({value: opt, label: opt})) | ||
setLoading(false) | ||
} catch(error) { | ||
catchError({ message: "Unable to retrieve field data"}) | ||
} | ||
} | ||
|
||
if (node.source) { | ||
options = node.source.map(opt => ({value: opt, label: opt})) | ||
} | ||
if (node.endpoint) { | ||
getOptions() | ||
} | ||
}) | ||
|
||
return ( | ||
<Select | ||
placeholder={node.description ? node.description : undefined} | ||
loading={loading} | ||
options={options} | ||
allowClear | ||
showSearch | ||
optionFilterProp="label" | ||
/> | ||
) | ||
} | ||
|
||
export default SelectWithFilters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import SyntaxHighlighter from 'react-syntax-highlighter'; | ||
import { lightfair } from 'react-syntax-highlighter/dist/esm/styles/hljs'; | ||
|
||
const YamlViewer = ({yaml}: {yaml: string}) => { | ||
return ( | ||
<div style={{maxHeight: '600px', overflowY: 'auto'}}> | ||
<SyntaxHighlighter | ||
language="yaml" | ||
style={lightfair} | ||
showLineNumbers | ||
wrapLines | ||
wrapLongLines | ||
> | ||
{yaml} | ||
</SyntaxHighlighter> | ||
</div> | ||
) | ||
} | ||
|
||
export default YamlViewer |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.