Skip to content

Commit

Permalink
example launched by
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Oct 15, 2024
1 parent 611d0b1 commit 5da2cde
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js_modules/dagster-ui/packages/ui-core/client.json

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

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>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as React from 'react';
import {Link} from 'react-router-dom';
import styled from 'styled-components';

import {CreatedByTagCell, CreatedByTagCellWrapper} from './CreatedByTag';
import {CreatedByTagCell, CreatedByTagCellWrapper} from './NewCreatedByTag';
import {QueuedRunCriteriaDialog} from './QueuedRunCriteriaDialog';
import {RUN_ACTIONS_MENU_RUN_FRAGMENT, RunActionsMenu} from './RunActionsMenu';
import {RunRowTags} from './RunRowTags';
Expand Down Expand Up @@ -138,7 +138,7 @@ export const RunsFeedRow = ({
</Tag>
</RowCell>
<RowCell>
<CreatedByTagCell tags={entry.tags || []} onAddTag={onAddTag} />
<CreatedByTagCell tag={entry.launchedBy} onAddTag={onAddTag} />
</RowCell>
<RowCell>
<div>
Expand Down Expand Up @@ -225,6 +225,10 @@ export const RUNS_FEED_TABLE_ENTRY_FRAGMENT = gql`
key
value
}
launchedBy {
key
value
}
jobName
assetSelection {
... on AssetKey {
Expand Down

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def resolve_launchedBy(self, _graphene_info: ResolveInfo):
return GraphenePipelineTag(
key=AUTO_OBSERVE_TAG, value=self._backfill_job.tags[AUTO_OBSERVE_TAG]
)
return GraphenePipelineTag(kind="manual", value="")
return GraphenePipelineTag(key="manual", value="")

def resolve_runStatus(self, _graphene_info: ResolveInfo) -> GrapheneRunStatus:
return GrapheneBulkActionStatus(self.status).to_dagster_run_status()
Expand Down

0 comments on commit 5da2cde

Please sign in to comment.