Skip to content

Commit

Permalink
chore: add workflow tab in export (#393)
Browse files Browse the repository at this point in the history
* chore: add workflow tab in export

* chore: show workflow tab only at debug
  • Loading branch information
islxyqwe authored Jun 19, 2024
1 parent 9c73454 commit a02af90
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/graphic-walker/src/components/codeExport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,28 @@ const CodeExport: React.FC = observer((props) => {
key: 'vega-lite',
label: 'Vega-Lite',
},
...(vizStore.layout.showActions
? [
{
key: 'workflow',
label: 'Workflow',
},
]
: []),
];

useEffect(() => {
if (showCodeExportPanel) {
if (tabKey === 'graphic-walker') {
const res = vizStore.exportCode();
setCode(res);
} else {
} else if (tabKey === 'vega-lite') {
setCode(vizStore.lastSpec);
} else if (tabKey === 'workflow') {
const workflow = vizStore.workflow;
setCode(workflow);
} else {
console.error('unknown tabKey');
}
}
}, [tabKey, showCodeExportPanel, vizStore]);
Expand All @@ -74,7 +87,9 @@ const CodeExport: React.FC = observer((props) => {
<Tabs value={tabKey} onValueChange={setTabKey}>
<TabsList className="my-1">
{specTabs.map((tab) => (
<TabsTrigger key={tab.key} value={tab.key}>{tab.label}</TabsTrigger>
<TabsTrigger key={tab.key} value={tab.key}>
{tab.label}
</TabsTrigger>
))}
</TabsList>
<div className="border rounded-md overflow-hidden">
Expand Down

0 comments on commit a02af90

Please sign in to comment.