Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion org.knime.python3.scripting.nodes/js-src/.stylelintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ module.exports = {
"csstools/value-no-unknown-custom-properties": [
true,
{
importFrom: ["node_modules/@knime/styles/css/variables/index.css"],
importFrom: [
"node_modules/@knime/styles/css/variables/index.css",
"node_modules/@knime/kds-styles/dist/tokens/css/_variables.css",
],
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { type Ref, onMounted, onUnmounted, ref } from "vue";
import { useDebounceFn, useResizeObserver } from "@vueuse/core";

import { Button } from "@knime/components";
import { KdsButton } from "@knime/kds-components";

import {
getPythonInitialData,
Expand All @@ -18,11 +18,13 @@ import PythonWorkspaceHeader, {
const resizeContainer = ref<HTMLElement | null>(null);
const totalWidth: Ref<number> = ref(0);
const headerWidths = ref<ColumnSizes>([100, 100, 100]);
// TODO KDS-690: Replace it once the JS tokens are available
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded magic number 8 should be documented to explain how it corresponds to the CSS padding value. The comment mentions JS tokens will replace this, but it's unclear how this value relates to var(--kds-spacing-container-0-5x) used in the CSS.

Suggested change
// TODO KDS-690: Replace it once the JS tokens are available
// TODO KDS-690: Replace this hardcoded value once JS spacing tokens are available.
// 8px corresponds to `var(--kds-spacing-container-0-5x)` used as the horizontal padding
// in the `.workspace` CSS rule below. Keep this value in sync with that CSS token.

Copilot uses AI. Check for mistakes.
const tableSidePadding = 8;

const useTotalWidth = () => {
const rootResizeCallback = useDebounceFn((entries) => {
const rect = entries[0].contentRect;
totalWidth.value = rect.width;
totalWidth.value = rect.width - tableSidePadding * 2;
});
const resizeObserver = useResizeObserver(resizeContainer, rootResizeCallback);

Expand Down Expand Up @@ -75,15 +77,16 @@ onMounted(() => {
</table>
</div>
<div class="controls">
<Button
<KdsButton
class="reset-button"
:with-border="false"
compact
label="Reset Values"
leading-icon="reset-all"
variant="transparent"
:disabled="!resetButtonEnabled"
@click="resetWorkspace"
>
Reset values
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button text 'Reset values' is duplicated between the 'label' prop (line 80) and the slot content. Remove the slot content since the label prop already provides the button text.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No slots in KdsButtons anymore!

</Button>
</KdsButton>
</div>
</div>
</template>
Expand All @@ -94,25 +97,24 @@ onMounted(() => {
flex-direction: column;
justify-content: space-between;
height: 100%;
background-color: var(--knime-gray-ultra-light);
}

.workspace {
--controls-height: 40px;

position: relative;
min-width: 120px;

/* padding to match tableSidePadding in script */
padding: var(--kds-spacing-container-0-5x) var(--kds-spacing-container-0-5x) 0
var(--kds-spacing-container-0-5x);
margin-top: 0;
overflow: hidden auto;

& table {
flex: 1;
max-width: 100%;
height: calc(100% - var(--controls-height));
font-family: "Roboto Mono", sans-serif;
font-size: 13px;
line-height: 24px;
color: var(--knime-masala);
text-align: left;
border-collapse: collapse;
}
}
Expand All @@ -121,17 +123,11 @@ onMounted(() => {
display: flex;
flex-direction: row-reverse;
place-content: center space-between;
min-height: var(--controls-height);
max-height: var(--controls-height);
align-items: center;
height: var(--kds-dimension-component-height-2-25x);
padding-right: var(--kds-spacing-container-0-25x);
padding-left: var(--kds-spacing-container-0-25x);
overflow: hidden;
border-top: 1px solid var(--knime-silver-sand);
}

.reset-button {
height: 30px;
margin-top: 5px;
margin-right: 10px;
margin-bottom: 5px;
border-top: var(--kds-border-base-subtle);
}
</style>
@/python-initial-data-service
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,32 @@ const totalWidth = computed(() =>
<style scoped lang="postcss">
tbody {
display: table;
font-size: 13px;
font-weight: 400;
line-height: 18px;
color: var(--knime-dove-gray);
letter-spacing: 0;

& tr {
display: flex;
color: var(--knime-dove-gray);
border-bottom: 1px solid var(--knime-porcelain);

&:hover {
color: var(--knime-masala);
cursor: pointer;
background-color: var(--kds-color-background-neutral-hover);
border-radius: var(--kds-border-radius-container-0-25x);
}

& td {
gap: var(--kds-spacing-container-0-12x);
height: var(--kds-dimension-component-height-1-5x);
padding-right: var(--kds-spacing-container-0-25x);
padding-left: var(--kds-spacing-container-0-25x);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

& span {
width: inherit;
margin: 6px;
overflow: hidden;
text-overflow: ellipsis;
font: var(--kds-font-base-interactive-small);
color: var(--kds-color-text-and-icon-neutral);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,31 +204,28 @@ const onPointerMove = (event: { clientX: number }) => {

<style lang="postcss" scoped>
thead {
position: sticky;
top: 0;
width: calc(100% - 15px);
font-weight: 500;
line-height: 15px;
text-align: left;
letter-spacing: 0;
table-layout: fixed;
background-color: var(--knime-porcelain);
display: contents;
border-bottom: var(--kds-border-base-subtle);

& tr {
position: sticky;
display: flex;
height: var(--kds-spacing-container-1-5x);
padding-right: var(--kds-spacing-container-0-25x);
padding-left: var(--kds-spacing-container-0-25x);

& th {
display: flex;
justify-content: space-between;
overflow: hidden;
text-overflow: ellipsis;
text-align: left;
white-space: nowrap;

& span {
margin: 0 5px;
overflow: hidden;
text-overflow: ellipsis;
font: var(--kds-font-base-interactive-small-strong);
color: var(--kds-color-text-and-icon-neutral);
}

& .drag-handle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { type Ref } from "vue";
import { flushPromises, mount } from "@vue/test-utils";

import { Button } from "@knime/components";
import { KdsButton } from "@knime/kds-components";
import { getScriptingService, initMocked } from "@knime/scripting-editor";

import { DEFAULT_INITIAL_DATA } from "@/__mocks__/mock-data";
Expand Down Expand Up @@ -113,7 +113,7 @@ describe("PythonWorkspace", () => {

it("reset button enabled if inputs are available", async () => {
const { wrapper } = await doMount();
const button = wrapper.findComponent(Button);
const button = wrapper.findComponent(KdsButton);
expect(button.props().disabled).toBeFalsy();
});

Expand All @@ -129,7 +129,7 @@ describe("PythonWorkspace", () => {
});

const { wrapper } = await doMount();
const button = wrapper.findComponent(Button);
const button = wrapper.findComponent(KdsButton);
expect(button.props().disabled).toBeTruthy();
});
});
4 changes: 3 additions & 1 deletion org.knime.python3.scripting.nodes/js-src/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default defineConfig({
environment: "jsdom",
reporters: ["default"],
root: fileURLToPath(new URL("./", import.meta.url)),
server: { deps: { inline: ["@knime/scripting-editor"] } },
server: {
deps: { inline: ["@knime/scripting-editor", "@knime/kds-components"] },
},
pool: "threads",
alias: {
"monaco-editor": fileURLToPath(
Expand Down