Skip to content

Commit 07ce0c7

Browse files
LeoWoerteler3nol
authored andcommitted
DEVOPS-3809: Restore accidentally reverted changes
DEVOPS-3809 (Incremental version bumps for AP 5.12.0)
1 parent af22740 commit 07ce0c7

File tree

6 files changed

+190
-45
lines changed

6 files changed

+190
-45
lines changed

org.knime.ui.js/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@
127127
"@knime/knime-ui-table@0.5.22>@knime/components": "1.33.0",
128128
"lodash-es@>=4.0.0 <=4.17.22": ">=4.17.23",
129129
"lodash@>=4.0.0 <=4.17.22": ">=4.17.23",
130-
"markdown-it@>=13.0.0 <14.1.1": ">=14.1.1"
130+
"markdown-it@>=13.0.0 <14.1.1": ">=14.1.1",
131+
"minimatch@<3.1.3": ">=3.1.3",
132+
"minimatch@<3.1.4": ">=3.1.4"
131133
},
132134
"onlyBuiltDependencies": [
133135
"esbuild",

org.knime.ui.js/pnpm-lock.yaml

Lines changed: 36 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

org.knime.ui.js/src/components/uiExtensions/portViews/PortViewTabToggles.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ const tabToggles = computed(() => {
4848
);
4949
});
5050
51+
const isTabItemDisabled = (
52+
item: ReturnType<typeof ports.toRenderablePortViewState>[number],
53+
) => {
54+
return !item.detachable || item.disabled;
55+
};
56+
5157
const setFirstTab = () => {
5258
activeView.value = tabToggles.value.at(0)
5359
? Number(tabToggles.value.at(0)!.id)
@@ -80,8 +86,9 @@ const openInNewWindow = (item: { id: string } | null = null) => {
8086
>
8187
<template v-if="canOpenDetatchedWindow" #default="{ item }">
8288
<Button
89+
data-test-id="toggle-with-detach"
8390
class="open-window"
84-
:disabled="!item.canDetach || item.disabled"
91+
:disabled="isTabItemDisabled(item)"
8592
:title="`Open ${item.text} view in new window`"
8693
@click="openInNewWindow(item)"
8794
>
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
import { describe, expect, it } from "vitest";
2+
import { mount } from "@vue/test-utils";
3+
4+
import { ValueSwitch } from "@knime/components";
5+
6+
import { NodeState } from "@/api/gateway-api/generated-api";
7+
import {
8+
PORT_TYPE_IDS,
9+
createAvailablePortTypes,
10+
createNativeNode,
11+
createPort,
12+
} from "@/test/factories";
13+
import { mockStores } from "@/test/utils/mockStores";
14+
import PortViewTabToggles from "../PortViewTabToggles.vue";
15+
16+
describe("PortViewTabToggles.vue", () => {
17+
type ComponentProps = InstanceType<typeof PortViewTabToggles>["$props"];
18+
19+
type MountOpts = {
20+
props?: Partial<ComponentProps>;
21+
};
22+
23+
const doMount = ({ props }: MountOpts = {}) => {
24+
const port = createPort({ typeId: PORT_TYPE_IDS.BufferedDataTable });
25+
const node = createNativeNode({
26+
state: {
27+
executionState: NodeState.ExecutionStateEnum.EXECUTED,
28+
},
29+
outPorts: [port],
30+
});
31+
const availablePortTypes = createAvailablePortTypes();
32+
33+
const mockedStores = mockStores();
34+
mockedStores.applicationStore.setAvailablePortTypes(availablePortTypes);
35+
36+
const wrapper = mount(PortViewTabToggles, {
37+
props: {
38+
uniquePortKey: "foo",
39+
selectedNode: node,
40+
selectedPort: port,
41+
...props,
42+
},
43+
global: {
44+
plugins: [mockedStores.testingPinia],
45+
},
46+
});
47+
48+
return { wrapper, mockedStores };
49+
};
50+
51+
it("renders correctly for CONFIGURED node", () => {
52+
const port = createPort({ typeId: PORT_TYPE_IDS.BufferedDataTable });
53+
const node = createNativeNode({
54+
state: {
55+
executionState: NodeState.ExecutionStateEnum.CONFIGURED,
56+
},
57+
outPorts: [port],
58+
});
59+
60+
const { wrapper } = doMount({
61+
props: { selectedNode: node, selectedPort: port },
62+
});
63+
64+
expect(wrapper.findComponent(ValueSwitch).props("possibleValues")).toEqual([
65+
{
66+
detachable: false,
67+
disabled: false,
68+
id: "0",
69+
text: "Table",
70+
},
71+
{
72+
detachable: true,
73+
disabled: true,
74+
id: "2",
75+
text: "Statistics",
76+
},
77+
]);
78+
79+
expect(wrapper.findAll('[data-test-id="toggle-with-detach"]')).toHaveLength(
80+
2,
81+
);
82+
expect(
83+
wrapper
84+
.findAll('[data-test-id="toggle-with-detach"]')
85+
.at(0)
86+
?.attributes("disabled"),
87+
).toBeFalsy();
88+
expect(
89+
wrapper
90+
.findAll('[data-test-id="toggle-with-detach"]')
91+
.at(1)
92+
?.attributes("disabled"),
93+
).toBeDefined();
94+
});
95+
96+
it("renders correctly for EXECUTED node", () => {
97+
const port = createPort({ typeId: PORT_TYPE_IDS.BufferedDataTable });
98+
const node = createNativeNode({
99+
state: {
100+
executionState: NodeState.ExecutionStateEnum.EXECUTED,
101+
},
102+
outPorts: [port],
103+
});
104+
105+
const { wrapper } = doMount({
106+
props: { selectedNode: node, selectedPort: port },
107+
});
108+
109+
expect(wrapper.findComponent(ValueSwitch).props("possibleValues")).toEqual([
110+
{
111+
detachable: true,
112+
disabled: false,
113+
id: "1",
114+
text: "Table",
115+
},
116+
{
117+
detachable: true,
118+
disabled: false,
119+
id: "2",
120+
text: "Statistics",
121+
},
122+
]);
123+
124+
expect(wrapper.findAll('[data-test-id="toggle-with-detach"]')).toHaveLength(
125+
2,
126+
);
127+
expect(
128+
wrapper
129+
.findAll('[data-test-id="toggle-with-detach"]')
130+
.at(0)
131+
?.attributes("disabled"),
132+
).toBeFalsy();
133+
expect(
134+
wrapper
135+
.findAll('[data-test-id="toggle-with-detach"]')
136+
.at(1)
137+
?.attributes("disabled"),
138+
).toBeFalsy();
139+
});
140+
});

org.knime.ui.js/src/lib/workflow-canvas/clipboard/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@ const determinePastePosition = (params: {
7272
visibleFrame: GeometryBounds;
7373
clipboardContent: { objectBounds: GeometryBounds };
7474
isWorkflowEmpty: boolean;
75-
}): { position: XY; fillScreenAfterPaste?: boolean } => {
75+
}): { position: XY } => {
7676
const { clipboardContent, isWorkflowEmpty, visibleFrame } = params;
7777

7878
if (isWorkflowEmpty) {
7979
consola.info("workflow is empty: paste to center");
8080
return {
8181
position: centerStrategy({ visibleFrame, clipboardContent }),
82-
fillScreenAfterPaste: true,
8382
};
8483
}
8584

org.knime.ui.js/src/store/workflow/clipboardInteractions.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ export const useClipboardInteractionsStore = defineStore(
291291
consola.info("Pasted workflow parts");
292292

293293
// 1. Decide where to paste
294-
const { position, fillScreenAfterPaste } = customPosition
295-
? { position: customPosition, fillScreenAfterPaste: false }
294+
const { position } = customPosition
295+
? { position: customPosition }
296296
: clipboard.determinePastePosition({
297297
visibleFrame: canvasStore.value.getVisibleFrame,
298298
clipboardContent,
@@ -318,11 +318,6 @@ export const useClipboardInteractionsStore = defineStore(
318318
position,
319319
});
320320

321-
// 4. Execute hook and select pasted content
322-
if (fillScreenAfterPaste) {
323-
canvasStore.value.fillScreen();
324-
}
325-
326321
selectionStore.deselectAllObjects(nodeIds);
327322
selectionStore.selectAnnotations(annotationIds!);
328323
},

0 commit comments

Comments
 (0)