Skip to content

Commit d3fc931

Browse files
authored
Merge pull request #47 from hchen2020/main
Allow to change draw node width.
2 parents d7de954 + 44e3acc commit d3fc931

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

src/lib/drawflow/drawflow.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
:root {
2+
--drawflow-node-width: 250px;
3+
}
4+
15
.drawflow .drawflow-node {
26
background: var(--bs-primary);
37
color: white;
4-
width: 250px;
8+
width: var(--drawflow-node-width);
59
border: 2px solid var(--bs-primary);
610
}
711

@@ -15,10 +19,6 @@
1519
color: white;
1620
}
1721

18-
.drawflow .parent-node .task-node {
19-
width: 300px;
20-
}
21-
2222
.drawflow-delete {
2323
background-color: var(--bs-danger);
2424
line-height: 25px;

src/routes/page/task/+page.svelte

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,26 @@
2222
import Swal from 'sweetalert2/dist/sweetalert2.js';
2323
import "sweetalert2/src/sweetalert2.scss";
2424
import { replaceNewLine } from '$lib/helpers/http';
25+
import 'overlayscrollbars/overlayscrollbars.css';
26+
import { OverlayScrollbars } from 'overlayscrollbars';
2527
2628
let isError = false;
2729
const duration = 3000;
2830
const firstPage = 1;
2931
const pageSize = 10;
3032
33+
const options = {
34+
scrollbars: {
35+
visibility: 'auto',
36+
autoHide: 'move',
37+
autoHideDelay: 100,
38+
dragScroll: true,
39+
clickScroll: false,
40+
theme: 'os-theme-dark',
41+
pointers: ['mouse', 'touch', 'pen']
42+
}
43+
};
44+
3145
/** @type {import('$types').PagedItems<import('$types').AgentTaskModel>} */
3246
let tasks = { count: 0, items: [] };
3347
@@ -44,6 +58,11 @@
4458
4559
onMount(async () => {
4660
await getPagedAgentTasks();
61+
62+
const scrollElements = document.querySelectorAll('.scrollbar');
63+
scrollElements.forEach((item) => {
64+
const scrollbar = OverlayScrollbars(item, options);
65+
});
4766
});
4867
4968
async function getPagedAgentTasks() {
@@ -212,7 +231,7 @@
212231
</td>
213232
<td>{task.description}</td>
214233
<td>{task.agent_name}</td>
215-
<td>{@html replaceNewLine(task.content)}</td>
234+
<td><div style="max-height: 100px;" class="scrollbar">{@html replaceNewLine(task.content)}</div></td>
216235
<td>{utcToLocal(task.updated_datetime)}</td>
217236
<td><span class="badge bg-success">{task.enabled ? "Enabled" : "Disabled"}</span></td>
218237
<td>

src/routes/page/task/[taskId]/execution-flow.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@
3737
visibility: 'auto',
3838
autoHide: 'move',
3939
autoHideDelay: 100,
40-
dragScroll: true,
41-
clickScroll: false,
40+
dragScroll: false,
41+
clickScroll: true,
4242
theme: 'os-theme-dark',
4343
pointers: ['mouse', 'touch', 'pen']
4444
}
4545
};
4646
4747
onMount(async () => {
4848
const container = document.getElementById("drawflow");
49+
container.style.setProperty('--drawflow-node-width', '300px');
50+
4951
if (container) {
5052
editor = new Drawflow(container);
5153
editor.reroute = true;
@@ -174,7 +176,7 @@
174176
</script>
175177

176178
<div>
177-
<!--<button class="btn btn-primary me-2" on:click={handleRunTaskSequentiallyInServer}><i class="bx bx-run"></i> Execute Sequentially through Router</button>-->
179+
<!--<button class="btn btn-primary me-2" on:click={handleRunTaskSequentiallyInServer}><i class="bx bx-run"></i> Execute through {task?.agent_name}</button>-->
178180
{#if task?.direct_agent_id}
179181
<button class="btn btn-primary" on:click={handleRunTaskInteractively}><i class="bx bx-rocket"></i> Execute Interactively</button>
180182
{/if}

0 commit comments

Comments
 (0)