Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alonkeyval committed May 30, 2024
1 parent 5b6d6ba commit 41c189f
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 10 deletions.
12 changes: 12 additions & 0 deletions dist/index.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ interface Source {
name: string;
kind: string;
namespace: string;
conditions?: {
type: string;
status: string;
message: string;
lastTransitionTime: string;
}[];
languages: Array<{
container_name: string;
language: string;
Expand All @@ -411,6 +417,12 @@ interface Destination {
logs: boolean;
};
fields: Record<string, any>;
conditions?: {
type: string;
status: string;
message: string;
lastTransitionTime: string;
}[];
destination_type: {
type: string;
display_name: string;
Expand Down
12 changes: 12 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ interface Source {
name: string;
kind: string;
namespace: string;
conditions?: {
type: string;
status: string;
message: string;
lastTransitionTime: string;
}[];
languages: Array<{
container_name: string;
language: string;
Expand All @@ -411,6 +417,12 @@ interface Destination {
logs: boolean;
};
fields: Record<string, any>;
conditions?: {
type: string;
status: string;
message: string;
lastTransitionTime: string;
}[];
destination_type: {
type: string;
display_name: string;
Expand Down
19 changes: 16 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3138,6 +3138,12 @@ var buildFlowNodesAndEdges = (sources2, destinations2, actions) => {
data: { label: "Center Node" }
});
sources2.forEach((source, index) => {
let hasError = false;
if (source?.conditions) {
hasError = source.conditions.some(
(condition) => condition.status === "False"
);
}
const namespaceNodeId = `namespace-${index}`;
nodes2.push({
id: namespaceNodeId,
Expand All @@ -3150,11 +3156,17 @@ var buildFlowNodesAndEdges = (sources2, destinations2, actions) => {
source: namespaceNodeId,
target: actions?.length > 0 ? `action-0` : centerNodeId,
animated: true,
style: { stroke: "#96f3ff8e" },
style: { stroke: hasError ? "#ff0000" : "#96f3ff8e" },
data: null
});
});
destinations2.forEach((destination, index) => {
let isErrored = false;
if (destination?.conditions) {
isErrored = destination.conditions.some(
(condition) => condition.status === "False"
);
}
const destinationNodeId = `destination-${index}`;
nodes2.push({
id: destinationNodeId,
Expand All @@ -3170,7 +3182,7 @@ var buildFlowNodesAndEdges = (sources2, destinations2, actions) => {
source: centerNodeId,
target: destinationNodeId,
animated: true,
style: { stroke: "#96f3ff8e" },
style: { stroke: isErrored ? "#ff0000" : "#96f3ff8e" },
data: null
});
});
Expand Down
2 changes: 1 addition & 1 deletion dist/index.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@keyval-dev/design-system",
"version": "1.8.4",
"version": "1.8.7",
"private": false,
"scripts": {
"dev": "next dev",
Expand Down
28 changes: 26 additions & 2 deletions src/design.system/data.flow/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ interface Source {
name: string;
kind: string;
namespace: string;
conditions?: {
type: string;
status: string;
message: string;
lastTransitionTime: string;
}[];
languages: Array<{
container_name: string;
language: string;
Expand All @@ -230,6 +236,12 @@ interface Destination {
logs: boolean;
};
fields: Record<string, any>;
conditions?: {
type: string;
status: string;
message: string;
lastTransitionTime: string;
}[];
destination_type: {
type: string;
display_name: string;
Expand Down Expand Up @@ -323,6 +335,12 @@ export const buildFlowNodesAndEdges = (

// Create namespace nodes from sources and edges to the center
sources.forEach((source, index) => {
let hasError = false;
if (source?.conditions) {
hasError = source.conditions.some(
(condition) => condition.status === 'False'
);
}
const namespaceNodeId = `namespace-${index}`;
nodes.push({
id: namespaceNodeId,
Expand All @@ -335,13 +353,19 @@ export const buildFlowNodesAndEdges = (
source: namespaceNodeId,
target: actions?.length > 0 ? `action-0` : centerNodeId,
animated: true,
style: { stroke: '#96f3ff8e' },
style: { stroke: hasError ? '#ff0000' : '#96f3ff8e' },
data: null,
});
});

// Create destination nodes and edges from the center
destinations.forEach((destination, index) => {
let isErrored = false;
if (destination?.conditions) {
isErrored = destination.conditions.some(
(condition) => condition.status === 'False'
);
}
const destinationNodeId = `destination-${index}`;
nodes.push({
id: destinationNodeId,
Expand All @@ -357,7 +381,7 @@ export const buildFlowNodesAndEdges = (
source: centerNodeId,
target: destinationNodeId,
animated: true,
style: { stroke: '#96f3ff8e' },
style: { stroke: isErrored ? '#ff0000' : '#96f3ff8e' },
data: null,
});
});
Expand Down

0 comments on commit 41c189f

Please sign in to comment.