From 635eb7e7da6ade16c21db76f053294523b6bb5d8 Mon Sep 17 00:00:00 2001 From: Marco Salazar Date: Thu, 28 Sep 2023 06:46:50 -0400 Subject: [PATCH 1/6] basic refactoring --- .../packages/ui-core/src/asset-graph/sidebar/util.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts diff --git a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts new file mode 100644 index 0000000000000..b7f66f259f709 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts @@ -0,0 +1,7 @@ +export function nodeId(node: {path: string; id: string} | {id: string}) { + return 'path' in node ? node.path : node.id; +} + +export function getDisplayName(node: GraphNode) { + return node.assetKey.path[node.assetKey.path.length - 1]!; +} From 304c0b5a578224fe6b6d62282460857e6906cf5e Mon Sep 17 00:00:00 2001 From: Marco Salazar Date: Thu, 28 Sep 2023 07:07:56 -0400 Subject: [PATCH 2/6] import --- .../packages/ui-core/src/asset-graph/sidebar/Node.tsx | 2 ++ .../dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/Node.tsx b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/Node.tsx index 7ac4fa3c26ed6..a95b46ad2a268 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/Node.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/Node.tsx @@ -27,6 +27,8 @@ import {GraphData, GraphNode, tokenForAssetKey} from '../Utils'; import {FolderNodeNonAssetType, StatusCaseDot, getDisplayName} from './util'; +import {getDisplayName} from './util'; + export const Node = ({ graphData, node, diff --git a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts index b7f66f259f709..ebb913b79aee6 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts +++ b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts @@ -1,3 +1,5 @@ +import {GraphNode} from '../Utils'; + export function nodeId(node: {path: string; id: string} | {id: string}) { return 'path' in node ? node.path : node.id; } From a931c43e65efc7f089992e432e67731fbd738f01 Mon Sep 17 00:00:00 2001 From: Marco Salazar Date: Thu, 28 Sep 2023 07:13:43 -0400 Subject: [PATCH 3/6] move types to util --- .../packages/ui-core/src/asset-graph/sidebar/Node.tsx | 2 -- .../packages/ui-core/src/asset-graph/sidebar/util.ts | 9 --------- 2 files changed, 11 deletions(-) delete mode 100644 js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts diff --git a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/Node.tsx b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/Node.tsx index a95b46ad2a268..7ac4fa3c26ed6 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/Node.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/Node.tsx @@ -27,8 +27,6 @@ import {GraphData, GraphNode, tokenForAssetKey} from '../Utils'; import {FolderNodeNonAssetType, StatusCaseDot, getDisplayName} from './util'; -import {getDisplayName} from './util'; - export const Node = ({ graphData, node, diff --git a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts b/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts deleted file mode 100644 index ebb913b79aee6..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/asset-graph/sidebar/util.ts +++ /dev/null @@ -1,9 +0,0 @@ -import {GraphNode} from '../Utils'; - -export function nodeId(node: {path: string; id: string} | {id: string}) { - return 'path' in node ? node.path : node.id; -} - -export function getDisplayName(node: GraphNode) { - return node.assetKey.path[node.assetKey.path.length - 1]!; -} From 06457c805c6d9b554fa2c4725e9a7b52ce27a87b Mon Sep 17 00:00:00 2001 From: Marco Salazar Date: Fri, 29 Sep 2023 01:25:38 -0400 Subject: [PATCH 4/6] button --- .../src/components/RefreshableCountdown.tsx | 2 +- .../src/asset-data/AssetDataRefreshButton.tsx | 73 ++++++++++++ .../src/asset-data/AssetLiveDataProvider.tsx | 105 +++++++++++++++--- .../src/asset-graph/AssetGraphExplorer.tsx | 2 + .../ui-core/src/asset-graph/sidebar/Node.tsx | 1 - 5 files changed, 163 insertions(+), 20 deletions(-) create mode 100644 js_modules/dagster-ui/packages/ui-core/src/asset-data/AssetDataRefreshButton.tsx diff --git a/js_modules/dagster-ui/packages/ui-components/src/components/RefreshableCountdown.tsx b/js_modules/dagster-ui/packages/ui-components/src/components/RefreshableCountdown.tsx index 841c1866961ce..4dc25b7ddb829 100644 --- a/js_modules/dagster-ui/packages/ui-components/src/components/RefreshableCountdown.tsx +++ b/js_modules/dagster-ui/packages/ui-components/src/components/RefreshableCountdown.tsx @@ -36,7 +36,7 @@ export const RefreshableCountdown = (props: Props) => { ); }; -const RefreshButton = styled.button` +export const RefreshButton = styled.button` border: none; cursor: pointer; padding: 8px; diff --git a/js_modules/dagster-ui/packages/ui-core/src/asset-data/AssetDataRefreshButton.tsx b/js_modules/dagster-ui/packages/ui-core/src/asset-data/AssetDataRefreshButton.tsx new file mode 100644 index 0000000000000..13b7628cd54c9 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/asset-data/AssetDataRefreshButton.tsx @@ -0,0 +1,73 @@ +import {Box, Button, Colors, Icon, RefreshButton, Tooltip} from '@dagster-io/ui-components'; +import dayjs from 'dayjs'; +import relativeTime from 'dayjs/plugin/relativeTime'; +import updateLocale from 'dayjs/plugin/updateLocale'; +import React from 'react'; + +dayjs.extend(relativeTime); +dayjs.extend(updateLocale); + +dayjs.updateLocale('en', { + relativeTime: { + future: 'in %s', + past: '%s ago', + s: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, +}); + +export const AssetDataRefreshButton = ({ + isRefreshing, + onRefresh, + oldestDataTimestamp, +}: { + isRefreshing: boolean; + onRefresh: () => void; + oldestDataTimestamp: number; +}) => { + return ( + + +
Click to refresh now
+ + ) + } + > + + + a.isObservable)} + : {all: allDefinitionsForMaterialize.filter((a) => a.isObservable)} + } + /> + + {showSidebar || !flagDAGSidebar ? null : ( @@ -459,16 +473,6 @@ const AssetGraphExplorerWithData: React.FC = ({ /> )} - {fetchOptionFilters} - - onChangeExplorerPath({...explorerPath, opsQuery}, 'replace')} - popoverPosition="bottom-left" - /> } @@ -588,3 +592,26 @@ const assetKeyTokensInRange = ( return uniq(ledToTarget); }; + +const TopbarWrapper = styled.div` + position: absolute; + top: 0; + left: 0; + right: 0; + display: grid; + background: white; + grid-template-columns: auto 1fr auto auto auto auto; + gap: 12px; + align-items: center; + padding: 12px 15px; + border-bottom: 1px solid ${Colors.KeylineGray}; + ${TextInputContainer} { + width: 100%; + } + > :nth-child(2) { + > * { + display: block; + width: 100%; + } + } +`; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/LaunchAssetObservationButton.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/LaunchAssetObservationButton.tsx index b73a39a8737f1..6f776ee048011 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/LaunchAssetObservationButton.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/LaunchAssetObservationButton.tsx @@ -43,7 +43,7 @@ export const LaunchAssetObservationButton: React.FC<{ const scopeAssets = 'selected' in scope ? scope.selected : scope.all; if (!scopeAssets.length) { - return ; + return <>; } const count = scopeAssets.length > 1 ? ` (${scopeAssets.length})` : ''; diff --git a/js_modules/dagster-ui/packages/ui-core/src/ui/GraphQueryInput.tsx b/js_modules/dagster-ui/packages/ui-core/src/ui/GraphQueryInput.tsx index c12411b9a59d6..1a685963a3042 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/ui/GraphQueryInput.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/ui/GraphQueryInput.tsx @@ -11,6 +11,11 @@ import { Popover, TextInput, Tooltip, + Dialog, + DialogFooter, + DialogBody, + Table, + Tag, } from '@dagster-io/ui-components'; import isEqual from 'lodash/isEqual'; import uniq from 'lodash/uniq'; @@ -34,6 +39,7 @@ interface GraphQueryInputProps { popoverPosition?: PopoverPosition; className?: string; disabled?: boolean; + type?: 'asset_graph'; linkToPreview?: { repoName: string; @@ -320,6 +326,7 @@ export const GraphQueryInput = React.memo( disabled={props.disabled} value={pendingValue} icon="op_selector" + rightElement={props.type === 'asset_graph' ? : undefined} strokeColor={intentToStrokeColor(props.intent)} autoFocus={props.autoFocus} placeholder={placeholderTextForItems(props.placeholder, props.items)} @@ -423,6 +430,116 @@ export const GraphQueryInput = React.memo( isEqual(prevProps.presets, nextProps.presets), ); +const InfoIconDialog = () => { + const [isOpen, setIsOpen] = React.useState(false); + return ( + <> + setIsOpen(false)} + style={{width: '743px', maxWidth: '80%'}} + > + + +
Create custom filter queries to fine tune which assets appear in the graph.
+ + + + Query + Description + + + + + + * + + Render the entire lineage graph + + + + *"my_asset" + + Render the entire upstream lineage of my_asset + + + + ++"my_asset" + + Render two layers upstream of my_asset + + + + "my_asset"* + + Render one layer upstream of my_asset + + + + "my_asset"+ + + Render the entire downstream lineage of my_asset + + + + "my_asset"++ + + Render two layers downstream of my_asset + + + + +"my_asset"+ + + Render one layer upstream and downstream of my_asset + + + + "my_asset" AND "another" + + Render two disjointed lineage segments + + + +
+
+ + + +
+
{ + setIsOpen(true); + }} + > + +
+ + ); +}; + +const CustomTable = styled(Table)` + border-left: none; + + &&& tr { + &:last-child td { + box-shadow: inset 1px 1px 0 rgba(233, 232, 232, 1) !important; + } + &:last-child td:first-child, + td:first-child, + th:first-child { + vertical-align: middle; + box-shadow: inset 0 1px 0 ${Colors.KeylineGray} !important; + } + } + border: 1px solid ${Colors.KeylineGray}; + border-top: none; + margin-bottom: 12px; +`; + const OpInfoWrap = styled.div` width: 350px; padding: 10px 16px 10px 16px;