Skip to content

Commit

Permalink
[dagit] Rename isAssetGroup => isHiddenAssetGroupJob for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
bengotow committed May 31, 2022
1 parent 79a86ec commit 24c7161
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 34 deletions.
6 changes: 4 additions & 2 deletions js_modules/dagit/packages/core/src/app/FallthroughRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Box, ExternalAnchorButton, Colors, NonIdealState, Spinner} from '@dagste
import * as React from 'react';
import {Redirect, Route, Switch, useLocation} from 'react-router-dom';

import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {WorkspaceContext} from '../workspace/WorkspaceContext';
import {workspacePipelinePath} from '../workspace/workspacePath';

Expand Down Expand Up @@ -53,7 +53,9 @@ const FinalRedirectOrLoadingRoot = () => {

// If every loaded repo only contains asset jobs, route to the asset catalog
if (
reposWithAJob.every(({repository}) => repository.pipelines.every((p) => isAssetGroup(p.name)))
reposWithAJob.every(({repository}) =>
repository.pipelines.every((p) => isHiddenAssetGroupJob(p.name)),
)
) {
return <Redirect to="/instance/assets" />;
}
Expand Down
2 changes: 1 addition & 1 deletion js_modules/dagit/packages/core/src/asset-graph/Utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type AssetKey = AssetGraphQuery_assetNodes_assetKey;

export const __ASSET_GROUP_PREFIX = '__ASSET_GROUP';

export function isAssetGroup(jobName: string) {
export function isHiddenAssetGroupJob(jobName: string) {
return jobName.startsWith(__ASSET_GROUP_PREFIX);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';

import {AssetKeyInput} from '../types/globalTypes';

import {isAssetGroup} from './Utils';
import {isHiddenAssetGroupJob} from './Utils';
import {
AssetForNavigationQuery,
AssetForNavigationQueryVariables,
Expand All @@ -22,7 +22,7 @@ export function useFindJobForAsset() {
const def = data.assetOrError.definition;
return {
opNames: def.opNames,
jobName: def.jobNames.find((jobName) => !isAssetGroup(jobName)) || null,
jobName: def.jobNames.find((jobName) => !isHiddenAssetGroupJob(jobName)) || null,
};
}
return {opNames: [], jobName: null};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {Timestamp} from '../app/time/Timestamp';
import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {MetadataEntry} from '../metadata/MetadataEntry';
import {PipelineReference} from '../pipelines/PipelineReference';
import {RunStatusWithStats} from '../runs/RunStatusDots';
Expand Down Expand Up @@ -230,7 +230,7 @@ const EventGroupRow: React.FC<{
</Group>
</td>
<td>
{!isAssetGroup(run.pipelineName) && (
{!isHiddenAssetGroupJob(run.pipelineName) && (
<Box margin={{bottom: 4}}>
<Box padding={{left: 8}}>
<PipelineReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
displayNameForAssetKey,
isSourceAsset,
LiveData,
isAssetGroup,
isHiddenAssetGroupJob,
__ASSET_GROUP_PREFIX,
} from '../asset-graph/Utils';
import {DagsterTypeSummary} from '../dagstertype/DagsterType';
Expand Down Expand Up @@ -139,7 +139,7 @@ const DefinitionLocation: React.FC<{
}> = ({assetNode, repoAddress}) => (
<Box flex={{alignItems: 'baseline', gap: 16, wrap: 'wrap'}} style={{lineHeight: 0}}>
{assetNode.jobNames
.filter((jobName) => !isAssetGroup(jobName))
.filter((jobName) => !isHiddenAssetGroupJob(jobName))
.map((jobName) => (
<Mono key={jobName}>
<PipelineReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {Timestamp} from '../app/time/Timestamp';
import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {MetadataEntry, METADATA_ENTRY_FRAGMENT} from '../metadata/MetadataEntry';
import {PipelineReference} from '../pipelines/PipelineReference';
import {linkToRunEvent, titleForRun} from '../runs/RunUtils';
Expand Down Expand Up @@ -56,7 +56,7 @@ export const LatestMaterializationMetadata: React.FC<{
<Mono>{titleForRun({runId: latestEvent.runId})}</Mono>
</Link>
</Box>
{!isAssetGroup(latestRun.pipelineName) && (
{!isHiddenAssetGroupJob(latestRun.pipelineName) && (
<>
<Box padding={{left: 8, top: 4}}>
<PipelineReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as React from 'react';

import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {FIFTEEN_SECONDS, useMergedRefresh, useQueryRefreshAtInterval} from '../app/QueryRefresh';
import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {ScheduleOrSensorTag} from '../nav/ScheduleOrSensorTag';
import {LegacyPipelineTag} from '../pipelines/LegacyPipelineTag';
import {PipelineReference} from '../pipelines/PipelineReference';
Expand Down Expand Up @@ -210,7 +210,7 @@ export const InstanceOverviewPage = () => {
r.repositoryLocation.name === repoAddress.location,
) &&
job.name.toLocaleLowerCase().includes(searchToLower) &&
!isAssetGroup(job.name);
!isHiddenAssetGroupJob(job.name);

const {failed, inProgress, queued, succeeded, neverRan} = bucketed;
return {
Expand Down
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/nav/FlatContentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {LegacyPipelineTag} from '../pipelines/LegacyPipelineTag';
import {humanCronString} from '../schedules/humanCronString';
import {InstigationStatus} from '../types/globalTypes';
Expand Down Expand Up @@ -97,7 +97,7 @@ export const getJobItemsForOption = (option: DagsterRepoOption) => {

const {schedules, sensors} = repository;
for (const pipeline of repository.pipelines) {
if (isAssetGroup(pipeline.name)) {
if (isHiddenAssetGroupJob(pipeline.name)) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {breakOnUnderscores} from '../app/Util';
import {displayNameForAssetKey, isAssetGroup} from '../asset-graph/Utils';
import {displayNameForAssetKey, isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {OpTypeSignature, OP_TYPE_SIGNATURE_FRAGMENT} from '../ops/OpTypeSignature';
import {pluginForMetadata} from '../plugins';
import {ConfigTypeSchema, CONFIG_TYPE_SCHEMA_FRAGMENT} from '../typeexplorer/ConfigTypeSchema';
Expand Down Expand Up @@ -258,7 +258,7 @@ const InvocationList: React.FC<{
onClickInvocation: (arg: SidebarOpInvocationInfo) => void;
}> = ({invocations, onClickInvocation}) => {
const [showAll, setShowAll] = React.useState<boolean>(false);
const visible = invocations.filter((i) => !isAssetGroup(i.pipelineName || ''));
const visible = invocations.filter((i) => !isHiddenAssetGroupJob(i.pipelineName || ''));
const clipped = showAll ? visible : visible.slice(0, DEFAULT_INVOCATIONS_SHOWN);

return (
Expand Down
9 changes: 5 additions & 4 deletions js_modules/dagit/packages/core/src/runs/Run.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styled from 'styled-components/macro';
import {showCustomAlert} from '../app/CustomAlertProvider';
import {filterByQuery} from '../app/GraphQueryImpl';
import {PythonErrorInfo} from '../app/PythonErrorInfo';
import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {GanttChart, GanttChartLoadingState, GanttChartMode, QueuedState} from '../gantt/GanttChart';
import {toGraphQueryItems} from '../gantt/toGraphQueryItems';
import {useDocumentTitle} from '../hooks/useDocumentTitle';
Expand Down Expand Up @@ -57,9 +57,10 @@ export const Run: React.FC<RunProps> = (props) => {
useFavicon(run ? runStatusFavicon(run.status) : '/favicon.svg');
useDocumentTitle(
run
? `${!isAssetGroup(run.pipelineName) ? run.pipelineName : ''} ${runId.slice(0, 8)} [${
run.status
}]`
? `${!isHiddenAssetGroupJob(run.pipelineName) ? run.pipelineName : ''} ${runId.slice(
0,
8,
)} [${run.status}]`
: `Run: ${runId}`,
);

Expand Down
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/runs/RunRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from 'react';
import {useParams} from 'react-router-dom';

import {formatElapsedTime} from '../app/Util';
import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {PipelineReference} from '../pipelines/PipelineReference';
import {TimestampDisplay} from '../schedules/TimestampDisplay';
import {isThisThingAJob} from '../workspace/WorkspaceContext';
Expand Down Expand Up @@ -69,7 +69,7 @@ export const RunRoot = () => {
run ? (
<>
<RunStatusTag status={run.status} />
{isAssetGroup(run.pipelineName) ? (
{isHiddenAssetGroupJob(run.pipelineName) ? (
<RunAssetKeyTags assetKeys={assetKeysForRun(run)} clickableTags />
) : (
<>
Expand Down
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/runs/RunTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {usePermissions} from '../app/Permissions';
import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {useSelectionReducer} from '../hooks/useSelectionReducer';
import {PipelineSnapshotLink} from '../pipelines/PipelinePathUtils';
import {PipelineReference} from '../pipelines/PipelineReference';
Expand Down Expand Up @@ -241,7 +241,7 @@ const RunRow: React.FC<{
</td>
<td>
<Box flex={{direction: 'column', gap: 5}}>
{isAssetGroup(run.pipelineName) ? (
{isHiddenAssetGroupJob(run.pipelineName) ? (
<RunAssetKeyTags assetKeys={assetKeysForRun(run)} />
) : (
<Box flex={{direction: 'row', gap: 8, alignItems: 'center'}}>
Expand Down
6 changes: 3 additions & 3 deletions js_modules/dagit/packages/core/src/search/useRepoSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Fuse from 'fuse.js';
import * as React from 'react';

import {PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo';
import {displayNameForAssetKey, isAssetGroup} from '../asset-graph/Utils';
import {displayNameForAssetKey, isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {buildRepoPath} from '../workspace/buildRepoAddress';
import {workspacePath} from '../workspace/workspacePath';

Expand Down Expand Up @@ -44,7 +44,7 @@ const bootstrapDataToSearchResults = (data?: SearchBootstrapQuery) => {
const repoPath = buildRepoPath(repoName, locationName);

const allPipelinesAndJobs = pipelines
.filter((item) => !isAssetGroup(item.name))
.filter((item) => !isHiddenAssetGroupJob(item.name))
.reduce((flat, pipelineOrJob) => {
const {name, isJob} = pipelineOrJob;
return [
Expand Down Expand Up @@ -81,7 +81,7 @@ const bootstrapDataToSearchResults = (data?: SearchBootstrapQuery) => {
}));

const allPartitionSets: SearchResult[] = partitionSets
.filter((item) => !isAssetGroup(item.pipelineName))
.filter((item) => !isHiddenAssetGroupJob(item.pipelineName))
.map((partitionSet) => ({
label: partitionSet.name,
description: manyRepos ? `Partition set in ${repoPath}` : 'Partition set',
Expand Down
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/ui/SectionedLeftNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import styled from 'styled-components/macro';

import {AppContext} from '../app/AppContext';
import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {useStateWithStorage} from '../hooks/useStateWithStorage';
import {getJobItemsForOption, JobItem} from '../nav/FlatContentList';
import {DagsterRepoOption, WorkspaceContext} from '../workspace/WorkspaceContext';
Expand Down Expand Up @@ -62,7 +62,7 @@ export const SectionedLeftNav = () => {
const reposWithoutJobs = [];
for (const repo of alphaSorted) {
const jobs = repo.repository.pipelines;
if (jobs.length > 0 && jobs.some((job) => !isAssetGroup(job.name))) {
if (jobs.length > 0 && jobs.some((job) => !isHiddenAssetGroupJob(job.name))) {
reposWithJobs.push(repo);
} else {
reposWithoutJobs.push(repo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from 'react';
import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';

import {repoAddressAsString} from './repoAddressAsString';
import {repoAddressToSelector} from './repoAddressToSelector';
Expand Down Expand Up @@ -83,7 +83,9 @@ export const RepositoryGraphsList: React.FC<Props> = (props) => {
return null;
}
const jobGraphNames = new Set<string>(
repo.pipelines.filter((p) => p.isJob && !isAssetGroup(p.name)).map((p) => p.graphName),
repo.pipelines
.filter((p) => p.isJob && !isHiddenAssetGroupJob(p.name))
.map((p) => p.graphName),
);
const items: Item[] = Array.from(jobGraphNames).map((graphName) => ({
name: graphName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {gql, useQuery} from '@apollo/client';
import {Box, NonIdealState} from '@dagster-io/ui';
import * as React from 'react';

import {isAssetGroup} from '../asset-graph/Utils';
import {isHiddenAssetGroupJob} from '../asset-graph/Utils';
import {PipelineTable, PIPELINE_TABLE_FRAGMENT} from '../pipelines/PipelineTable';

import {repoAddressAsString} from './repoAddressAsString';
Expand Down Expand Up @@ -55,7 +55,7 @@ export const RepositoryPipelinesList: React.FC<Props> = (props) => {
return null;
}
return repo.pipelines
.filter((pipelineOrJob) => !isAssetGroup(pipelineOrJob.name))
.filter((pipelineOrJob) => !isHiddenAssetGroupJob(pipelineOrJob.name))
.map((pipelineOrJob) => ({
pipelineOrJob,
repoAddress,
Expand Down

0 comments on commit 24c7161

Please sign in to comment.