Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions workspaces/common-libs/service-designer/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ export interface Resource {
additionalActions?: Item[]; // Additional actions for the resource
}

export interface Query {
name: string;
methods: any[];
isOpen?: boolean;
expandable?: boolean;
additionalInfo?: JSX.Element; // Additional information to be displayed in the resource expanded view
additionalActions?: Item[]; // Additional actions for the resource
params?: ParameterConfig[];
advancedParams?: Map<string, ParameterConfig>;
}

export interface PathConfig {
path: string;
resources: ParameterConfig[];
Expand Down
3 changes: 2 additions & 1 deletion workspaces/mi/mi-core/src/state-machine-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export enum MACHINE_VIEW {
DefaultEndpointForm = "Default Endpoint Form",
DataServiceForm = "Data Service Form",
DssDataSourceForm = "DSS Data Source Form",
DSSServiceDesigner = "Data Service Designer",
DSSResourceServiceDesigner = "DSS Resource Designer",
DSSQueryServiceDesigner = "DSS Query Designer",
ProjectCreationForm = "Project Creation Form",
ImportProjectForm = "Import Project Form",
LocalEntryForm = "Local Entry Form",
Expand Down
8 changes: 5 additions & 3 deletions workspaces/mi/mi-diagram/src/components/Form/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ export const getParamManagerFromValues = (values: any[], keyIndex?: number, valu

if (typeof value === 'object' && value !== null) {
const paramValues = getParamValues(value);
const key = keyIndex != undefined && keyIndex >= 0 ? typeof value[keyIndex] === 'object' ? value[keyIndex].value : value[keyIndex] : index + 1;
return {
id: index,
key: keyIndex != undefined && keyIndex >= 0 ? typeof value[keyIndex] === 'object' ? value[keyIndex].value : value[keyIndex] : index + 1,
value: typeof value[valueIndex] === 'object' ? value[valueIndex].value : value[valueIndex],
icon: 'query', paramValues
key: key,
value: (key === "Query" && valueIndex == 4) ? (typeof value[1] === 'object' ? value[1].value : value[1]) :
(typeof value[valueIndex] === 'object' ? value[valueIndex].value : value[valueIndex]),
paramValues
};
} else {
return { value };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class ReferenceNodeModel extends BaseNodeModel {
rpcClient.getMiVisualizerRpcClient().openView({
type: EVENT_TYPE.OPEN_VIEW,
location: {
view: MACHINE_VIEW.DSSServiceDesigner,
view: MACHINE_VIEW.DSSResourceServiceDesigner,
documentUri: uri
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const QueryForm = (props: AddMediatorProps) => {
returnGeneratedKeys: sidePanelContext?.formValues?.returnGeneratedKeys || false,
keyColumns: sidePanelContext?.formValues?.keyColumns || "",
returnUpdatedRowCount: sidePanelContext?.formValues?.returnUpdatedRowCount || false,
forceStoredProc: sidePanelContext?.formValues?.forceStoredProc || false,
forceJdbcBatchRequests: sidePanelContext?.formValues?.forceJdbcBatchRequests || false,
forceStoredProc: sidePanelContext?.formValues?.forceStoredProc === "true" || false,
forceJDBCBatchRequests: sidePanelContext?.formValues?.forceJDBCBatchRequests === "true" || false,
});
setIsLoading(false);
}, []);
Expand All @@ -89,7 +89,7 @@ const QueryForm = (props: AddMediatorProps) => {
queryProperties.maxFieldSize = values.maxFieldSize;
queryProperties.maxRows = values.maxRows;
queryProperties.forceStoredProc = values.forceStoredProc;
queryProperties.forceJDBCBatchRequests = values.forceJdbcBatchRequests;
queryProperties.forceJDBCBatchRequests = values.forceJDBCBatchRequests;
queryProperties = Object.entries(queryProperties)
.filter(([_, value]) => value !== "").map(([key, value]) => ({ key, value }));
const updatedQuery = sidePanelContext?.formValues?.queryObject;
Expand Down Expand Up @@ -184,18 +184,6 @@ const QueryForm = (props: AddMediatorProps) => {
<>
<Typography sx={{ padding: "10px 20px", borderBottom: "1px solid var(--vscode-editorWidget-border)" }} variant="body3"></Typography>
<div style={{ padding: "20px" }}>

<Field>
<Controller
name="queryId"
control={control}
render={({ field }) => (
<TextField {...field} label="Query ID" size={50} placeholder="" />
)}
/>
{errors.queryId && <Error>{errors.queryId.message.toString()}</Error>}
</Field>

<Field>
<Controller
name="datasource"
Expand Down Expand Up @@ -335,13 +323,13 @@ const QueryForm = (props: AddMediatorProps) => {

<Field>
<Controller
name="forceJdbcBatchRequests"
name="forceJDBCBatchRequests"
control={control}
render={({ field }) => (
<VSCodeCheckbox {...field} type="checkbox" checked={field.value} onChange={(e: any) => { field.onChange(e.target.checked) }}>Force JDBC Batch Requests</VSCodeCheckbox>
)}
/>
{errors.forceJdbcBatchRequests && <Error>{errors.forceJdbcBatchRequests.message.toString()}</Error>}
{errors.forceJDBCBatchRequests && <Error>{errors.forceJDBCBatchRequests.message.toString()}</Error>}
</Field>

</ComponentCard>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export async function activateProjectExplorer(treeviewId: string, context: Exten
commands.registerCommand(COMMANDS.OPEN_DSS_SERVICE_DESIGNER, async (entry: ProjectExplorerEntry | Uri) => {
revealWebviewPanel(false);
const documentUri = entry instanceof ProjectExplorerEntry ? entry.info?.path : entry.fsPath;
openView(EVENT_TYPE.OPEN_VIEW, { view: MACHINE_VIEW.DSSServiceDesigner, documentUri });
openView(EVENT_TYPE.OPEN_VIEW, { view: MACHINE_VIEW.DSSResourceServiceDesigner, documentUri });
});

commands.registerCommand(COMMANDS.EDIT_K8_CONFIGURATION_COMMAND, async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export class DataService {
await projectExplorer.goToOverview("testProject");
await projectExplorer.findItem(['Project testProject', 'Data Services', prevName], true);

const webView = await switchToIFrame('Data Service Designer', this._page);
const webView = await switchToIFrame('DSS Resource Designer', this._page);
if (!webView) {
throw new Error("Failed to switch to Data Service Designer iframe");
throw new Error("Failed to switch to DSS Resource Designer iframe");
}
const frame = webView.locator('div#root');
await frame.getByTestId('edit-button').getByLabel('Icon Button').click();
Expand Down Expand Up @@ -156,9 +156,9 @@ export class DataService {
await projectExplorer.goToOverview("testProject");
await projectExplorer.findItem(['Project testProject', 'Data Services', prevName], true);

const webView = await switchToIFrame('Data Service Designer', this._page);
const webView = await switchToIFrame('DSS Resource Designer', this._page);
if (!webView) {
throw new Error("Failed to switch to Data Service Designer iframe");
throw new Error("Failed to switch to DSS Resource Designer iframe");
}
const frame = webView.locator('div#root');
await frame.waitFor();
Expand Down Expand Up @@ -292,9 +292,9 @@ export class DataService {
await projectExplorer.goToOverview("testProject");
await projectExplorer.findItem(['Project testProject', 'Data Services', prevName], true);

const webView = await switchToIFrame('Data Service Designer', this._page);
const webView = await switchToIFrame('DSS Resource Designer', this._page);
if (!webView) {
throw new Error("Failed to switch to Data Service Designer iframe");
throw new Error("Failed to switch to DSS Resource Designer iframe");
}
const frame = webView.locator('div#root');
await frame.waitFor();
Expand Down Expand Up @@ -413,9 +413,9 @@ export class DataService {
await projectExplorer.goToOverview("testProject");
await projectExplorer.findItem(['Project testProject', 'Data Services', prevName], true);

const webView = await switchToIFrame('Data Service Designer', this._page);
const webView = await switchToIFrame('DSS Resource Designer', this._page);
if (!webView) {
throw new Error("Failed to switch to Data Service Designer iframe");
throw new Error("Failed to switch to DSS Resource Designer iframe");
}
const frame = webView.locator('div#root');
await frame.waitFor();
Expand Down Expand Up @@ -514,9 +514,9 @@ export class DataService {
await projectExplorer.goToOverview("testProject");
await projectExplorer.findItem(['Project testProject', 'Data Services', prevName], true);

const webView = await switchToIFrame('Data Service Designer', this._page);
const webView = await switchToIFrame('DSS Resource Designer', this._page);
if (!webView) {
throw new Error("Failed to switch to Data Service Designer iframe");
throw new Error("Failed to switch to DSS Resource Designer iframe");
}
const frame = webView.locator('div#root');
await frame.waitFor();
Expand Down
10 changes: 7 additions & 3 deletions workspaces/mi/mi-visualizer/src/MainPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React, { useEffect, useState, Suspense } from 'react';
import { POPUP_EVENT_TYPE, PopupMachineStateValue, MACHINE_VIEW, Platform, VisualizerLocation } from '@wso2/mi-core';
import { useVisualizerContext } from '@wso2/mi-rpc-client';
import { ServiceDesignerView } from './views/ServiceDesigner';
import { DSSServiceDesignerView } from './views/Forms/DataServiceForm/ServiceDesigner';
import { DSSResourceServiceDesignerView } from './views/Forms/DataServiceForm/ResourceServiceDesigner';
import { DSSQueryServiceDesignerView } from './views/Forms/DataServiceForm/QueryServiceDesigner';
import { APIWizard, APIWizardProps } from './views/Forms/APIform';
import { EndpointWizard } from './views/Forms/EndpointForm';
import { SequenceWizard } from './views/Forms/SequenceForm';
Expand Down Expand Up @@ -376,8 +377,11 @@ const MainPanel = (props: MainPanelProps) => {
case MACHINE_VIEW.MockService:
setViewComponent(<MockServiceForm filePath={visualizerState.documentUri} stNode={visualizerState.stNode as MockService} isWindows={isWindows} />);
break;
case MACHINE_VIEW.DSSServiceDesigner:
setViewComponent(<DSSServiceDesignerView syntaxTree={visualizerState.stNode} documentUri={visualizerState.documentUri} />);
case MACHINE_VIEW.DSSResourceServiceDesigner:
setViewComponent(<DSSResourceServiceDesignerView syntaxTree={visualizerState.stNode} documentUri={visualizerState.documentUri} />);
break;
case MACHINE_VIEW.DSSQueryServiceDesigner:
setViewComponent(<DSSQueryServiceDesignerView syntaxTree={visualizerState.stNode} documentUri={visualizerState.documentUri} />);
break;
case MACHINE_VIEW.Welcome:
setViewComponent(<WelcomeView />);
Expand Down
4 changes: 4 additions & 0 deletions workspaces/mi/mi-visualizer/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export const DSS_TEMPLATES = {
EDIT_OPERATION: "edit-dss-operation",
EDIT_DESCRIPTION: "edit-dss-description",
ADD_QUERY: "add-dss-query",
ADD_FULL_QUERY: "add-full-dss-query",
UPDATE_QUERY_CONFIG: "update-query-config",
UPDATE_QUERY: "update-query",
EDIT_QUERY_REFERENCE: "edit-query-reference"
} as const;

export enum EndpointTypes {
Expand Down
Loading
Loading