-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
611d0b1
commit 5da2cde
Showing
6 changed files
with
102 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
js_modules/dagster-ui/packages/ui-core/src/runs/NewCreatedByTag.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import {Box, Tag} from '@dagster-io/ui-components'; | ||
import {memo} from 'react'; | ||
import {Link} from 'react-router-dom'; | ||
import {UserDisplay} from 'shared/runs/UserDisplay.oss'; | ||
import styled from 'styled-components'; | ||
|
||
import {DagsterTag} from './RunTag'; | ||
import {RunFilterToken} from './RunsFilterInput'; | ||
import {RunTagsFragment} from './types/RunTagsFragment.types'; | ||
import {TagActionsPopover} from '../ui/TagActions'; | ||
import {RepoAddress} from '../workspace/types'; | ||
import {workspacePathFromAddress} from '../workspace/workspacePath'; | ||
|
||
type Props = { | ||
repoAddress?: RepoAddress | null; | ||
tag: RunTagsFragment; | ||
onAddTag?: (token: RunFilterToken) => void; | ||
}; | ||
|
||
export const CreatedByTagCell = memo(({repoAddress, tag, onAddTag}: Props) => { | ||
return ( | ||
<CreatedByTagCellWrapper flex={{direction: 'column', alignItems: 'flex-start'}}> | ||
<CreatedByTag repoAddress={repoAddress} tag={tag} onAddTag={onAddTag} /> | ||
</CreatedByTagCellWrapper> | ||
); | ||
}); | ||
|
||
export const CreatedByTagCellWrapper = styled(Box)``; | ||
|
||
export const CreatedByTag = ({repoAddress, tag, onAddTag}: Props) => { | ||
const {key, value} = tag | ||
|
||
if (key === 'manual') { | ||
return <Tag icon="account_circle">Manually launched</Tag>; | ||
} | ||
|
||
const buildTagElement = () => { | ||
switch (key) { | ||
case DagsterTag.User: | ||
return <UserDisplay email={value} />; | ||
case DagsterTag.ScheduleName: { | ||
return ( | ||
<Tag icon="schedule"> | ||
{repoAddress ? ( | ||
<Link to={workspacePathFromAddress(repoAddress, `/schedules/${value}`)}>{value}</Link> | ||
) : ( | ||
value | ||
)} | ||
</Tag> | ||
); | ||
} | ||
case DagsterTag.SensorName: { | ||
return ( | ||
<Tag icon="sensors"> | ||
{repoAddress ? ( | ||
<Link to={workspacePathFromAddress(repoAddress, `/sensors/${value}`)}>{value}</Link> | ||
) : ( | ||
value | ||
)} | ||
</Tag> | ||
); | ||
} | ||
case DagsterTag.Automaterialize: | ||
return <Tag icon="auto_materialize_policy">Auto-materialize policy</Tag>; | ||
case DagsterTag.AutoObserve: | ||
return <Tag icon="auto_observe">Auto-observation</Tag>; | ||
} | ||
return <Tag icon="account_circle">Unknown</Tag>; // shouldn't reach | ||
}; | ||
|
||
const tagElement = buildTagElement(); | ||
if (!onAddTag) { | ||
return tagElement; | ||
} | ||
|
||
return ( | ||
<TagActionsPopover | ||
data={tag} | ||
actions={[ | ||
{ | ||
label: 'Add to filter', | ||
onClick: () => onAddTag({token: 'tag', value: `${key}=${value}`}), | ||
}, | ||
]} | ||
> | ||
{tagElement} | ||
</TagActionsPopover> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
js_modules/dagster-ui/packages/ui-core/src/runs/types/RunsFeedRoot.types.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
js_modules/dagster-ui/packages/ui-core/src/runs/types/RunsFeedRow.types.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters