Skip to content

Commit ffb486a

Browse files
committed
include seeds and omit nil
1 parent 07a95cb commit ffb486a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

frontend/src/pages/org/workflow-detail.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { guard } from "lit/directives/guard.js";
99
import { ifDefined } from "lit/directives/if-defined.js";
1010
import { until } from "lit/directives/until.js";
1111
import { when } from "lit/directives/when.js";
12+
import omitBy from "lodash/fp/omitBy";
13+
import isNil from "lodash/isNil";
1214
import queryString from "query-string";
1315

1416
import type { Crawl, CrawlLog, Seed, Workflow } from "./types";
@@ -51,6 +53,9 @@ const CRAWLS_PAGINATION_NAME = "crawlsPage";
5153

5254
const isLoading = (task: Task) => task.status === TaskStatus.PENDING;
5355

56+
// Omit null or undefined values from object
57+
const omitNil = omitBy(isNil);
58+
5459
/**
5560
* Usage:
5661
* ```ts
@@ -794,7 +799,16 @@ export class WorkflowDetail extends BtrixElement {
794799
<btrix-copy-button
795800
name="filetype-json"
796801
value=${ifDefined(
797-
this.workflow && JSON.stringify(this.workflow.config),
802+
this.workflow &&
803+
this.seeds &&
804+
JSON.stringify(
805+
{
806+
...omitNil(this.workflow.config),
807+
seeds: this.seeds.items.map(omitNil),
808+
},
809+
null,
810+
2,
811+
),
798812
)}
799813
content=${msg("Copy as JSON")}
800814
size="medium"

0 commit comments

Comments
 (0)