mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-05 22:38:48 +00:00
feat: add workflow default sources and clean source names in DataSourceSelect (#13201)
This commit is contained in:
parent
f6ed13e550
commit
4c67f5db8b
3 changed files with 14 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ import { DataBaseSources, ApiSources, CloudStorageSources } from '@/modules/comm
|
|||
import { canCreateDataSource } from '@/_helpers';
|
||||
import './../queryManager.theme.scss';
|
||||
import { DATA_SOURCE_TYPE } from '@/_helpers/constants';
|
||||
import { workflowDefaultSources } from '../constants';
|
||||
|
||||
function DataSourceSelect({ isDisabled, selectRef, closePopup, workflowDataSources, onNewNode, staticDataSources }) {
|
||||
const dataSources = useDataSources();
|
||||
|
|
@ -32,6 +33,10 @@ function DataSourceSelect({ isDisabled, selectRef, closePopup, workflowDataSourc
|
|||
closePopup();
|
||||
};
|
||||
|
||||
function cleanWord(word) {
|
||||
return word.replace(/default/g, '');
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const shouldAddSampleDataSource = !!sampleDataSource;
|
||||
const allDataSources = [...dataSources, ...globalDataSources, shouldAddSampleDataSource && sampleDataSource].filter(
|
||||
|
|
@ -146,7 +151,7 @@ function DataSourceSelect({ isDisabled, selectRef, closePopup, workflowDataSourc
|
|||
label: (
|
||||
<div>
|
||||
<DataSourceIcon source={source} height={16} />{' '}
|
||||
<span className="ms-1 small">{source?.name ?? source.kind}</span>
|
||||
<span className="ms-1 small"> {workflowDefaultSources[cleanWord(source.name)]?.name}</span>
|
||||
</div>
|
||||
),
|
||||
value: source.name,
|
||||
|
|
|
|||
|
|
@ -106,3 +106,10 @@ export const defaultSources = {
|
|||
runpy: { kind: 'runpy', id: 'runpy', name: 'Run Python code' },
|
||||
workflows: { kind: 'workflows', id: 'null', name: 'Run Workflow' },
|
||||
};
|
||||
|
||||
export const workflowDefaultSources = {
|
||||
...defaultSources,
|
||||
'If condition': { kind: 'if', id: 'if', name: 'If condition' },
|
||||
Response: { kind: 'response', id: 'response', name: 'Response' },
|
||||
Loop: { kind: 'loop', id: 'loop', name: 'Loop' },
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 076a96e7614285c57bfdf2f2729247aefbc8c80e
|
||||
Subproject commit 1adb563573bde7d204976a45c06ef4ce96d7dad3
|
||||
Loading…
Reference in a new issue