-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: Generic Callback Dialog Input for Custom Component #6236
Merged
Changes from all commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
5383620
force dialog
deon-sanchez be070a7
Reimplement backend dialog
erichare 633e632
Update astradb.py
erichare a681341
Clean up dropdown options
erichare c87c3e7
Remove unused import
erichare 581deee
Merge branch 'main' into LFOSS-492
erichare df0fb10
[autofix.ci] apply automated fixes
autofix-ci[bot] d7689c4
Update astradb.py
erichare 5fca727
Ruff fixes
erichare 6154c42
Update Vector Store RAG.json
erichare 6cd2dcd
[autofix.ci] apply automated fixes
autofix-ci[bot] fcd55c6
fix: Conditionally render custom option dialog in dropdown
deon-sanchez 43392db
✨ (NodeDialogComponent/index.tsx): Add support for passing 'name' pro…
Cristhianzl 6798f17
Merge branch 'LFOSS-492' of https://github.com/langflow-ai/langflow i…
Cristhianzl 39de25c
Merge branch 'main' into LFOSS-492
erichare 81af805
✨ Refactor NodeDialog component to improve state management and paylo…
deon-sanchez b4e0778
Merge branch 'LFOSS-492' of https://github.com/langflow-ai/langflow i…
deon-sanchez 928f240
Update astradb.py
erichare 4be2bca
[autofix.ci] apply automated fixes
autofix-ci[bot] 7f2ee10
Merge branch 'main' into LFOSS-492
erichare d7a3a1d
✨ Enhance NodeDialog and Dropdown components with improved payload ha…
deon-sanchez e855c3d
Merge branch 'LFOSS-492' of https://github.com/langflow-ai/langflow i…
deon-sanchez 5068bce
Add DB creation functionality
erichare 1f95c9d
First version of create
erichare 6942880
Update astradb.py
erichare ba30352
Fix ruff errors
erichare 142c074
Update Vector Store RAG.json
erichare 205127a
[autofix.ci] apply automated fixes
autofix-ci[bot] 81131fd
Update astradb.py
erichare 6d9a9a7
[autofix.ci] apply automated fixes
autofix-ci[bot] 78c8335
Update astradb.py
erichare 60dbca1
[autofix.ci] apply automated fixes
autofix-ci[bot] 39b2eca
Update astradb.py
erichare 0908a42
Update astradb.py
erichare 129b20a
Update astradb.py
erichare dc58ac9
Update Vector Store RAG.json
erichare 3fa71eb
[autofix.ci] apply automated fixes
autofix-ci[bot] 17e97e9
Update astradb.py
erichare 6609477
[autofix.ci] apply automated fixes
autofix-ci[bot] 32070b1
Merge branch 'main' into LFOSS-492
erichare c38967d
feat: Enhance dropdown and node dialog with loading states and improv…
deon-sanchez b3604dc
refactor: Improve error handling in NodeDialog component
deon-sanchez 506ce50
refactor: Update default excluded keys in dropdown metadata filter
deon-sanchez 8b0b1c8
Merge branch 'main' of https://github.com/langflow-ai/langflow into L…
deon-sanchez 8eed3c6
[autofix.ci] apply automated fixes
autofix-ci[bot] dd9d57f
refactor: Update Vector Store RAG starter project JSON with formattin…
deon-sanchez 692cf56
Merge branch 'LFOSS-492' of https://github.com/langflow-ai/langflow i…
deon-sanchez 2590de6
Hide fields that aren't relevant yet
erichare 1f689a0
[autofix.ci] apply automated fixes
autofix-ci[bot] 541fe71
Update Vector Store RAG.json
erichare 2261195
[autofix.ci] apply automated fixes
autofix-ci[bot] 7a97291
Update astradb.py
erichare 6951b4d
feat: Improve dropdown component with loading states and enhanced UX
deon-sanchez 2ffba66
Merge branch 'LFOSS-492' of https://github.com/langflow-ai/langflow i…
deon-sanchez 22b71e2
Update astradb.py
erichare 292bd12
[autofix.ci] apply automated fixes
autofix-ci[bot] 9849785
Update astradb.py
erichare 364944e
Simon feedback
erichare 9ed87e4
[autofix.ci] apply automated fixes
autofix-ci[bot] b76f299
feat: Enhance dropdown and UI components with status indicators and l…
deon-sanchez 8a3a65f
refactor: Update dropdown metadata filtering to exclude 'icon' key
deon-sanchez 6f2b5f3
fix: Conditionally render dropdown icon when available
deon-sanchez 784ccdb
fix: Improve dropdown icon rendering with null checks
deon-sanchez ddf05f1
chore: Remove debug console log in dropdown component
deon-sanchez 97ae178
Add support for icons in the dropdowns
erichare 36d8b2d
Update astradb.py
erichare a2d52b7
Merge branch 'main' into LFOSS-492
erichare 4113265
Update Vector Store RAG.json
erichare 06f7f4f
[autofix.ci] apply automated fixes
autofix-ci[bot] d309948
feat: Enhance dropdown status display and color handling
deon-sanchez 498c779
feat: Add auto-close functionality to node dialog and expand status c…
deon-sanchez ba41038
feat: Add real-time template refresh for node dialog fields
deon-sanchez 14417cb
refactor: Improve node dialog component state management and naming
deon-sanchez 039113d
Async for create collection
erichare 15c052c
[autofix.ci] apply automated fixes
autofix-ci[bot] a66c3bc
Dynamic provider list generation
erichare 0b02246
Merge branch 'main' into LFOSS-492
erichare 68bc2ab
Update astradb.py
erichare f8e8b7e
[autofix.ci] apply automated fixes
autofix-ci[bot] 3460fd9
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] 36842e0
Merge branch 'main' into LFOSS-492
erichare 97b9380
Merge branch 'main' into LFOSS-492
erichare 6c73f12
Update astradb.py
erichare 62512d2
Merge branch 'main' into LFOSS-492
erichare 98fc3ae
[autofix.ci] apply automated fixes
autofix-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
456 changes: 315 additions & 141 deletions
456
src/backend/base/langflow/components/vectorstores/astradb.py
Large diffs are not rendered by default.
Oops, something went wrong.
739 changes: 558 additions & 181 deletions
739
src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json
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
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -8,105 +8,184 @@ import { | |||||||||||||||||||||||||||||||||||
DialogHeader, | ||||||||||||||||||||||||||||||||||||
DialogTitle, | ||||||||||||||||||||||||||||||||||||
} from "@/components/ui/dialog"; | ||||||||||||||||||||||||||||||||||||
import { usePostTemplateValue } from "@/controllers/API/queries/nodes/use-post-template-value"; | ||||||||||||||||||||||||||||||||||||
import { getCustomParameterTitle } from "@/customization/components/custom-parameter"; | ||||||||||||||||||||||||||||||||||||
import useHandleOnNewValue from "@/CustomNodes/hooks/use-handle-new-value"; | ||||||||||||||||||||||||||||||||||||
import { mutateTemplate } from "@/CustomNodes/helpers/mutate-template"; | ||||||||||||||||||||||||||||||||||||
import useAlertStore from "@/stores/alertStore"; | ||||||||||||||||||||||||||||||||||||
import useFlowStore from "@/stores/flowStore"; | ||||||||||||||||||||||||||||||||||||
import { InputFieldType } from "@/types/api"; | ||||||||||||||||||||||||||||||||||||
import { cloneDeep } from "lodash"; | ||||||||||||||||||||||||||||||||||||
import { APIClassType, InputFieldType } from "@/types/api"; | ||||||||||||||||||||||||||||||||||||
import { useState } from "react"; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
export const NodeDialog = ({ | ||||||||||||||||||||||||||||||||||||
open, | ||||||||||||||||||||||||||||||||||||
onClose, | ||||||||||||||||||||||||||||||||||||
dialogInputs, | ||||||||||||||||||||||||||||||||||||
nodeId, | ||||||||||||||||||||||||||||||||||||
}: { | ||||||||||||||||||||||||||||||||||||
interface NodeDialogProps { | ||||||||||||||||||||||||||||||||||||
open: boolean; | ||||||||||||||||||||||||||||||||||||
onClose: () => void; | ||||||||||||||||||||||||||||||||||||
dialogInputs: any; | ||||||||||||||||||||||||||||||||||||
nodeId: string; | ||||||||||||||||||||||||||||||||||||
name: string; | ||||||||||||||||||||||||||||||||||||
nodeClass: APIClassType; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
interface ValueObject { | ||||||||||||||||||||||||||||||||||||
value: string; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
export const NodeDialog: React.FC<NodeDialogProps> = ({ | ||||||||||||||||||||||||||||||||||||
open, | ||||||||||||||||||||||||||||||||||||
onClose, | ||||||||||||||||||||||||||||||||||||
dialogInputs, | ||||||||||||||||||||||||||||||||||||
nodeId, | ||||||||||||||||||||||||||||||||||||
name, | ||||||||||||||||||||||||||||||||||||
nodeClass, | ||||||||||||||||||||||||||||||||||||
}) => { | ||||||||||||||||||||||||||||||||||||
const [isLoading, setIsLoading] = useState(false); | ||||||||||||||||||||||||||||||||||||
const [fieldValues, setFieldValues] = useState<Record<string, string>>({}); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
const nodes = useFlowStore((state) => state.nodes); | ||||||||||||||||||||||||||||||||||||
const setNode = useFlowStore((state) => state.setNode); | ||||||||||||||||||||||||||||||||||||
const setErrorData = useAlertStore((state) => state.setErrorData); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
const handleNewValue = (value: string, key: string) => { | ||||||||||||||||||||||||||||||||||||
let rawValue = value; | ||||||||||||||||||||||||||||||||||||
const postTemplateValue = usePostTemplateValue({ | ||||||||||||||||||||||||||||||||||||
parameterId: name, | ||||||||||||||||||||||||||||||||||||
nodeId: nodeId, | ||||||||||||||||||||||||||||||||||||
node: nodeClass, | ||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
if (typeof value === "object" && value) { | ||||||||||||||||||||||||||||||||||||
rawValue = (value as { value: string }).value; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
const { fields, functionality: submitButtonText } = dialogInputs || {}; | ||||||||||||||||||||||||||||||||||||
const dialogNodeData = fields?.data?.node; | ||||||||||||||||||||||||||||||||||||
const dialogTemplate = dialogNodeData?.template || {}; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
const setNodeClass = (newNode: APIClassType) => { | ||||||||||||||||||||||||||||||||||||
const targetNode = nodes.find((node) => node.id === nodeId); | ||||||||||||||||||||||||||||||||||||
if (!targetNode) return; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
const template = cloneDeep(dialogInputs?.fields?.data?.node?.template); | ||||||||||||||||||||||||||||||||||||
template[key].value = value; | ||||||||||||||||||||||||||||||||||||
targetNode.data.node = newNode; | ||||||||||||||||||||||||||||||||||||
setNode(nodeId, targetNode); | ||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
const handleErrorData = (newState: { | ||||||||||||||||||||||||||||||||||||
title: string; | ||||||||||||||||||||||||||||||||||||
list?: Array<string>; | ||||||||||||||||||||||||||||||||||||
}) => { | ||||||||||||||||||||||||||||||||||||
setErrorData(newState); | ||||||||||||||||||||||||||||||||||||
setIsLoading(false); | ||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
const updateFieldValue = (value: string | ValueObject, fieldKey: string) => { | ||||||||||||||||||||||||||||||||||||
const newValue = typeof value === "object" ? value.value : value; | ||||||||||||||||||||||||||||||||||||
const targetNode = nodes.find((node) => node.id === nodeId); | ||||||||||||||||||||||||||||||||||||
if (!targetNode || !name) return; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
const newNode = cloneDeep(nodes.find((node) => node.id === nodeId)); | ||||||||||||||||||||||||||||||||||||
if (newNode) { | ||||||||||||||||||||||||||||||||||||
const template = newNode.data.node.template; | ||||||||||||||||||||||||||||||||||||
const databaseFields = template.database_name.dialog_inputs.fields; | ||||||||||||||||||||||||||||||||||||
const nodeTemplate = databaseFields.data.node.template; | ||||||||||||||||||||||||||||||||||||
targetNode.data.node.template[name].dialog_inputs.fields.data.node.template[ | ||||||||||||||||||||||||||||||||||||
fieldKey | ||||||||||||||||||||||||||||||||||||
].value = newValue; | ||||||||||||||||||||||||||||||||||||
setNode(nodeId, targetNode); | ||||||||||||||||||||||||||||||||||||
setFieldValues((prev) => ({ ...prev, [fieldKey]: newValue })); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
if (dialogTemplate[fieldKey].real_time_refresh) { | ||||||||||||||||||||||||||||||||||||
mutateTemplate( | ||||||||||||||||||||||||||||||||||||
{ [fieldKey]: newValue }, | ||||||||||||||||||||||||||||||||||||
nodeClass, | ||||||||||||||||||||||||||||||||||||
setNodeClass, | ||||||||||||||||||||||||||||||||||||
postTemplateValue, | ||||||||||||||||||||||||||||||||||||
handleErrorData, | ||||||||||||||||||||||||||||||||||||
name, | ||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
nodeTemplate[key].value = rawValue; | ||||||||||||||||||||||||||||||||||||
const handleCloseDialog = () => { | ||||||||||||||||||||||||||||||||||||
setFieldValues({}); | ||||||||||||||||||||||||||||||||||||
const targetNode = nodes.find((node) => node.id === nodeId); | ||||||||||||||||||||||||||||||||||||
if (targetNode && name) { | ||||||||||||||||||||||||||||||||||||
const nodeTemplate = targetNode.data.node.template; | ||||||||||||||||||||||||||||||||||||
Object.keys(dialogTemplate).forEach((key) => { | ||||||||||||||||||||||||||||||||||||
nodeTemplate[name].dialog_inputs.fields.data.node.template[key].value = | ||||||||||||||||||||||||||||||||||||
""; | ||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||
Comment on lines
+100
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||
setNode(nodeId, targetNode); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
setNode(nodeId, newNode!); | ||||||||||||||||||||||||||||||||||||
setIsLoading(false); | ||||||||||||||||||||||||||||||||||||
onClose(); | ||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
const handleSubmitDialog = async () => { | ||||||||||||||||||||||||||||||||||||
setIsLoading(true); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
await mutateTemplate( | ||||||||||||||||||||||||||||||||||||
fieldValues, | ||||||||||||||||||||||||||||||||||||
nodeClass, | ||||||||||||||||||||||||||||||||||||
setNodeClass, | ||||||||||||||||||||||||||||||||||||
postTemplateValue, | ||||||||||||||||||||||||||||||||||||
handleErrorData, | ||||||||||||||||||||||||||||||||||||
name, | ||||||||||||||||||||||||||||||||||||
handleCloseDialog, | ||||||||||||||||||||||||||||||||||||
nodeClass.tool_mode, | ||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
setTimeout(() => { | ||||||||||||||||||||||||||||||||||||
handleCloseDialog(); | ||||||||||||||||||||||||||||||||||||
}, 5000); | ||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
// Render | ||||||||||||||||||||||||||||||||||||
return ( | ||||||||||||||||||||||||||||||||||||
<Dialog open={open} onOpenChange={onClose}> | ||||||||||||||||||||||||||||||||||||
<Dialog open={open} onOpenChange={handleCloseDialog}> | ||||||||||||||||||||||||||||||||||||
<DialogContent className="max-w-[700px] gap-2 px-1 py-6"> | ||||||||||||||||||||||||||||||||||||
<DialogHeader className="px-5 pb-3"> | ||||||||||||||||||||||||||||||||||||
<DialogTitle> | ||||||||||||||||||||||||||||||||||||
<div className="flex items-center"> | ||||||||||||||||||||||||||||||||||||
<span className="pb-2"> | ||||||||||||||||||||||||||||||||||||
{dialogInputs.fields?.data?.node?.display_name} | ||||||||||||||||||||||||||||||||||||
</span> | ||||||||||||||||||||||||||||||||||||
<span className="pb-2">{dialogNodeData?.display_name}</span> | ||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||
</DialogTitle> | ||||||||||||||||||||||||||||||||||||
<DialogDescription> | ||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||
{dialogInputs.fields?.data?.node?.description} | ||||||||||||||||||||||||||||||||||||
{dialogNodeData?.description} | ||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||
</DialogDescription> | ||||||||||||||||||||||||||||||||||||
</DialogHeader> | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
<div className="flex flex-col gap-5 overflow-y-auto px-5"> | ||||||||||||||||||||||||||||||||||||
{Object.entries(dialogInputs?.fields?.data?.node?.template ?? {}).map( | ||||||||||||||||||||||||||||||||||||
([key, value]) => ( | ||||||||||||||||||||||||||||||||||||
<div key={key}> | ||||||||||||||||||||||||||||||||||||
<div> | ||||||||||||||||||||||||||||||||||||
{getCustomParameterTitle({ | ||||||||||||||||||||||||||||||||||||
title: | ||||||||||||||||||||||||||||||||||||
dialogInputs?.fields?.data?.node?.template[key] | ||||||||||||||||||||||||||||||||||||
.display_name ?? "", | ||||||||||||||||||||||||||||||||||||
nodeId, | ||||||||||||||||||||||||||||||||||||
isFlexView: false, | ||||||||||||||||||||||||||||||||||||
})} | ||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||
<ParameterRenderComponent | ||||||||||||||||||||||||||||||||||||
handleOnNewValue={(value: string) => | ||||||||||||||||||||||||||||||||||||
handleNewValue(value, key) | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
name={key} | ||||||||||||||||||||||||||||||||||||
nodeId={nodeId} | ||||||||||||||||||||||||||||||||||||
templateData={value as Partial<InputFieldType>} | ||||||||||||||||||||||||||||||||||||
templateValue={ | ||||||||||||||||||||||||||||||||||||
dialogInputs?.fields?.data?.node?.template[key].value | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
editNode={false} | ||||||||||||||||||||||||||||||||||||
handleNodeClass={() => {}} | ||||||||||||||||||||||||||||||||||||
nodeClass={dialogInputs.fields?.data?.node} | ||||||||||||||||||||||||||||||||||||
disabled={false} | ||||||||||||||||||||||||||||||||||||
placeholder="" | ||||||||||||||||||||||||||||||||||||
isToolMode={false} | ||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||
{Object.entries(dialogTemplate).map(([fieldKey, fieldValue]) => ( | ||||||||||||||||||||||||||||||||||||
<div key={fieldKey}> | ||||||||||||||||||||||||||||||||||||
<div> | ||||||||||||||||||||||||||||||||||||
{getCustomParameterTitle({ | ||||||||||||||||||||||||||||||||||||
title: | ||||||||||||||||||||||||||||||||||||
(fieldValue as { display_name: string })?.display_name ?? | ||||||||||||||||||||||||||||||||||||
"", | ||||||||||||||||||||||||||||||||||||
nodeId, | ||||||||||||||||||||||||||||||||||||
isFlexView: false, | ||||||||||||||||||||||||||||||||||||
})} | ||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||||||||
<ParameterRenderComponent | ||||||||||||||||||||||||||||||||||||
handleOnNewValue={(value: string) => | ||||||||||||||||||||||||||||||||||||
updateFieldValue(value, fieldKey) | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
name={fieldKey} | ||||||||||||||||||||||||||||||||||||
nodeId={nodeId} | ||||||||||||||||||||||||||||||||||||
templateData={fieldValue as Partial<InputFieldType>} | ||||||||||||||||||||||||||||||||||||
templateValue={fieldValues[fieldKey] || ""} | ||||||||||||||||||||||||||||||||||||
editNode={false} | ||||||||||||||||||||||||||||||||||||
handleNodeClass={() => {}} | ||||||||||||||||||||||||||||||||||||
nodeClass={dialogNodeData} | ||||||||||||||||||||||||||||||||||||
disabled={false} | ||||||||||||||||||||||||||||||||||||
placeholder="" | ||||||||||||||||||||||||||||||||||||
isToolMode={false} | ||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||
))} | ||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
<DialogFooter className="px-5 pt-3"> | ||||||||||||||||||||||||||||||||||||
<Button variant="outline" onClick={onClose}> | ||||||||||||||||||||||||||||||||||||
<Button variant="secondary" onClick={handleCloseDialog}> | ||||||||||||||||||||||||||||||||||||
Cancel | ||||||||||||||||||||||||||||||||||||
</Button> | ||||||||||||||||||||||||||||||||||||
<Button>{dialogInputs.functionality}</Button> | ||||||||||||||||||||||||||||||||||||
<Button | ||||||||||||||||||||||||||||||||||||
variant="default" | ||||||||||||||||||||||||||||||||||||
onClick={handleSubmitDialog} | ||||||||||||||||||||||||||||||||||||
loading={isLoading} | ||||||||||||||||||||||||||||||||||||
> | ||||||||||||||||||||||||||||||||||||
{submitButtonText} | ||||||||||||||||||||||||||||||||||||
</Button> | ||||||||||||||||||||||||||||||||||||
</DialogFooter> | ||||||||||||||||||||||||||||||||||||
</DialogContent> | ||||||||||||||||||||||||||||||||||||
</Dialog> | ||||||||||||||||||||||||||||||||||||
|
21 changes: 21 additions & 0 deletions
21
src/frontend/src/components/common/fetchIconComponent/index.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,21 @@ | ||
import ForwardedIconComponent from "../genericIconComponent"; | ||
|
||
const FetchIconComponent = ({ | ||
source, | ||
name, | ||
}: { | ||
source: string; | ||
name: string; | ||
}) => { | ||
return ( | ||
<div> | ||
{source ? ( | ||
<img src={source} alt={name} /> | ||
) : ( | ||
<ForwardedIconComponent name="Unknown" /> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default FetchIconComponent; |
23 changes: 23 additions & 0 deletions
23
src/frontend/src/components/common/loadingTextComponent/index.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,23 @@ | ||
import { useEffect, useState } from "react"; | ||
|
||
const LoadingTextComponent = ({ text }: { text: string }) => { | ||
const [dots, setDots] = useState("."); | ||
|
||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
setDots((prevDots) => (prevDots === "..." ? "" : `${prevDots}.`)); | ||
}, 300); | ||
|
||
return () => { | ||
clearInterval(interval); | ||
}; | ||
}, []); | ||
|
||
if (!text) { | ||
return null; | ||
} | ||
|
||
return <span>{`${text}${dots}`}</span>; | ||
}; | ||
|
||
export default LoadingTextComponent; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.