Skip to content

Commit 5310a13

Browse files
committed
Apply review suggestions
1 parent efe6c88 commit 5310a13

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

  • workspaces
    • ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/SMBForm
    • bi/bi-extension/src/test/e2e-playwright-tests/file-integration

workspaces/ballerina/ballerina-visualizer/src/views/BI/ServiceDesigner/Forms/SMBForm/index.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function SMBForm(props: SMBFormProps) {
6868

6969
const payloadContext = {
7070
protocol: Protocol.SMB,
71-
filterType: functionModel?.name.metadata.label || "JSON",
71+
filterType: functionModel?.name?.metadata?.label || "JSON",
7272
} as GeneralPayloadContext;
7373

7474
const [isTypeEditorOpen, setIsTypeEditorOpen] = useState<boolean>(false);
@@ -182,15 +182,16 @@ export function SMBForm(props: SMBFormProps) {
182182

183183
let baseType = typeValue;
184184

185-
if (baseType.endsWith("[]") && baseType !== "string[]") {
186-
baseType = baseType.slice(0, -2);
187-
} else if (baseType.startsWith("stream<")) {
185+
if (baseType.startsWith("stream<")) {
188186
if (baseType.endsWith(", error>")) {
189187
baseType = baseType.slice(7, -8);
190188
} else if (baseType.endsWith(">")) {
191189
baseType = baseType.slice(7, -1);
192190
}
193191
}
192+
if (baseType.endsWith("[]") && baseType !== "string[]") {
193+
baseType = baseType.slice(0, -2);
194+
}
194195

195196
return baseType;
196197
};
@@ -251,6 +252,16 @@ export function SMBForm(props: SMBFormProps) {
251252
enabled: true
252253
};
253254
}
255+
if (p.kind === "REQUIRED" && p.name.value === "content") {
256+
const resetValue = hasStreamProperty && functionModel.properties?.stream?.enabled
257+
? selectType(p.type.placeholder, functionModel.properties.stream.enabled)
258+
: p.type.placeholder;
259+
return {
260+
...p,
261+
type: { ...p.type, value: resetValue },
262+
enabled: true
263+
};
264+
}
254265
return p;
255266
});
256267

@@ -346,7 +357,10 @@ export function SMBForm(props: SMBFormProps) {
346357
if (params.length === 0) {
347358
handleDeleteContentSchema();
348359
} else {
349-
handleParamChange(params);
360+
const updatedParameters = functionModel.parameters.map(p =>
361+
p.kind === "DATA_BINDING" ? params[0] : p
362+
);
363+
handleParamChange(updatedParameters);
350364
}
351365
}}
352366
onEditClick={handleEditContentSchema}

workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integration/smb.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ import { ProjectExplorer } from '../utils/pages';
2222
import { DEFAULT_PROJECT_NAME } from '../utils/helpers/setup';
2323

2424
export default function createTests() {
25+
const listenerName = 'smbListener';
2526
test.describe('SMB Integration Tests', {
2627
tag: '@group1',
2728
}, async () => {
28-
let listenerName: string;
29+
test.describe.configure({ mode: 'serial' });
2930
initTest();
3031
test('Create SMB Integration', async ({ }, testInfo) => {
3132
const testAttempt = testInfo.retry + 1;
@@ -35,7 +36,6 @@ export default function createTests() {
3536
if (!artifactWebView) {
3637
throw new Error('WSO2 Integrator: BI webview not found');
3738
}
38-
listenerName = `smbListener`;
3939
const form = new Form(page.page, 'WSO2 Integrator: BI', artifactWebView);
4040
await form.switchToFormView(false, artifactWebView);
4141
await form.submit('Create');

0 commit comments

Comments
 (0)