-
Notifications
You must be signed in to change notification settings - Fork 60
Update package configurable view and enhance state machine actions #924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0359e39
e97ea2b
d320cf5
99f49c6
80e41bb
e49bed4
279226a
6701023
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -499,11 +499,17 @@ export function ConfigObjectEditor(props: ObjectEditorProps) { | |||||
| // If there's an existing config value, parse it and merge with recordConfig | ||||||
| if (configValue) { | ||||||
| try { | ||||||
| let parsedValue; | ||||||
| let parsedValue: any; | ||||||
| if (typeof configValue === 'string') { | ||||||
| // Attempt to fix JSON if it is JavaScript-style (unquoted keys) | ||||||
| const fixedJson = configValue.replace(/([{,]\s*)([a-zA-Z0-9_]+)\s*:/g, '$1"$2":'); | ||||||
| parsedValue = JSON.parse(fixedJson); | ||||||
| // Check if there are string values that are not wrapped in quotes | ||||||
| Object.keys(parsedValue).forEach(key => { | ||||||
| if (typeof parsedValue[key] === 'string' && !/^".*"$/.test(parsedValue[key])) { | ||||||
| parsedValue[key] = `"${parsedValue[key]}"`; | ||||||
|
||||||
| parsedValue[key] = `"${parsedValue[key]}"`; | |
| parsedValue[key] = JSON.stringify(parsedValue[key]); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -124,6 +124,20 @@ export function ConfigurableItem(props: ConfigurableItemProps) { | |||||||||||||||||||||||||||||||||
| setEditConfigVariableFormOpen(true); | ||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const handleTextAreaChange = (value: any) => { | ||||||||||||||||||||||||||||||||||
| if (configVariable.properties?.type?.value === 'string' && !/^".*"$/.test(value)) { | ||||||||||||||||||||||||||||||||||
| value = `"${value}"`; | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| value = `"${value}"`; | |
| value = JSON.stringify(value); |
Copilot
AI
Nov 16, 2025
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.
Missing semicolons after function declarations. While JavaScript/TypeScript allows this, it's inconsistent with the coding style used elsewhere in the file where semicolons are present after other statements. Add semicolons at the end of both function declarations for consistency.
| } | |
| const getPlainValue = (value: string) => { | |
| if (configVariable.properties?.type?.value === 'string' && /^".*"$/.test(value)) { | |
| return value.replace(/^"|"$/g, ''); | |
| } | |
| return value; | |
| } | |
| }; | |
| const getPlainValue = (value: string) => { | |
| if (configVariable.properties?.type?.value === 'string' && /^".*"$/.test(value)) { | |
| return value.replace(/^"|"$/g, ''); | |
| } | |
| return value; | |
| }; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,7 @@ import { AddForm } from "../AddConfigurableVariables"; | |||||
| import { TopNavigationBar } from "../../../../components/TopNavigationBar"; | ||||||
| import { TitleBar } from "../../../../components/TitleBar"; | ||||||
| import ConfigurableItem from "../ConfigurableItem"; | ||||||
| import { RelativeLoader } from "../../../../components/RelativeLoader"; | ||||||
|
|
||||||
| const Container = styled.div` | ||||||
| width: 100%; | ||||||
|
|
@@ -117,10 +118,12 @@ export function ViewConfigurableVariables(props?: ConfigProps) { | |||||
| const [categoriesWithModules, setCategoriesWithModules] = useState<CategoryWithModules[]>([]); | ||||||
| const [selectedModule, setSelectedModule] = useState<PackageModuleState>(null); | ||||||
| const integrationCategory = `${props.org}/${props.package}`; | ||||||
| const [isLoading, setIsLoading] = useState<boolean>(false); | ||||||
|
|
||||||
| useEffect(() => { | ||||||
| getConfigVariables(); | ||||||
| }, [props]); | ||||||
| setIsLoading(true); | ||||||
| getConfigVariables(true); | ||||||
| }, [props.org, props.package]); | ||||||
|
Comment on lines
123
to
+126
|
||||||
|
|
||||||
| useEffect(() => { | ||||||
| if (categoriesWithModules.length > 0 && !selectedModule) { | ||||||
|
|
@@ -265,7 +268,7 @@ export function ViewConfigurableVariables(props?: ConfigProps) { | |||||
| }); | ||||||
| }; | ||||||
|
|
||||||
| const getConfigVariables = async () => { | ||||||
| const getConfigVariables = async (initialLoad: boolean = false) => { | ||||||
|
|
||||||
| let data: ConfigVariablesState = {}; | ||||||
| let errorMsg: string = ''; | ||||||
|
|
@@ -278,13 +281,13 @@ export function ViewConfigurableVariables(props?: ConfigProps) { | |||||
| .then((variables) => { | ||||||
| data = (variables as any).configVariables; | ||||||
| errorMsg = (variables as any).errorMsg; | ||||||
| }); | ||||||
| }) | ||||||
|
||||||
| }) | |
| }); |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -170,7 +170,13 @@ export class MiDataMapperRpcManager implements MIDataMapperAPI { | |||||||||||||
|
|
||||||||||||||
| async formatDMC(documentUri: string): Promise<void> { | ||||||||||||||
| const uri = Uri.file(documentUri); | ||||||||||||||
| const edits: TextEdit[] = await commands.executeCommand("vscode.executeFormatDocumentProvider", uri); | ||||||||||||||
| let edits: TextEdit[]; | ||||||||||||||
| try { | ||||||||||||||
| edits = await commands.executeCommand("vscode.executeFormatDocumentProvider", uri); | ||||||||||||||
| } catch (error) { | ||||||||||||||
| console.error("Error occurred while formatting DMC file: ", error); | ||||||||||||||
| return; | ||||||||||||||
| } | ||||||||||||||
|
||||||||||||||
| } | |
| } | |
| if (!edits) { | |
| console.warn("No formatting edits returned for DMC file"); | |
| return; | |
| } |
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.
Potential issue: The
getOrgAndPackageNamefunction is called withviewLocation.projectPathwhich might be undefined. While the function handles this by returning empty strings, this could lead to incorrect org/package information being set in the view location. Consider validating thatviewLocation.projectPathexists before calling this function, or provide a fallback toStateMachine.context().projectPath.