Skip to content

Commit

Permalink
feat: 74 chart flow data integration
Browse files Browse the repository at this point in the history
  • Loading branch information
codev99 committed Jun 19, 2024
1 parent abedd24 commit a09ecf8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/components/Widgets/ChartFlow/ChartFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const showNodeDetails = (data) => {
console.log(data);
}

const ChartFlow = () => {
const ChartFlow = ({ data }) => {
const { useToken } = theme;
const { token } = useToken();

Expand Down Expand Up @@ -107,6 +107,7 @@ const ChartFlow = () => {
const nodeWidth = 400;
const nodeHeight = 200;

/*
const mockData = [
{
"version":"v1",
Expand Down Expand Up @@ -407,9 +408,10 @@ const ChartFlow = () => {
"createdAt":"2024-05-02T07:15:03Z"
}
];
*/

// parsing data
const parsedNodes = mockData.map((el) => (
const parsedNodes = JSON.parse(data).map((el) => (
{
id: el.uid,
data: { name: el.name, kind: el.kind, icon: el.icon, health: el.health, status: el.status, version: el.version, date: el.createdAt },
Expand All @@ -418,7 +420,7 @@ const ChartFlow = () => {
));

const parsedEdges: Edge[] = [];
mockData.forEach((el) => {
JSON.parse(data).forEach((el) => {
if (el.parentRefs !== undefined && el.parentRefs?.length > 0) {
parsedEdges.push({ id: `${el.parentRefs[0].uid}-${el.uid}`, source: el.parentRefs[0].uid, target: el.uid, label: '' })
}
Expand Down
1 change: 1 addition & 0 deletions src/components/Widgets/ChartFlow/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
background: $light-color;
border-radius: 50px;
position: relative;
width: 400px;

.nodeIconProgressing {
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Widgets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const widgets = {
"ChartLine": ChartLine,
"ChartBars": ChartBars,
"ChartMultipleBars": ChartMultipleBars,
"ChartFlow": ChartFlow,
"chartflow": ChartFlow,
"CardTemplateList": CardTemplateList,
"card": CardTemplate,
"FormGenerator": FormGenerator,
Expand Down

0 comments on commit a09ecf8

Please sign in to comment.