Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI refactoring for kfp 1.0.0 rebase #247

Merged
merged 4 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/lib/WorkflowParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class WorkflowParser {

for (const edge of edges || []) graph.setEdge(edge['parent'], edge['child']);

const status = this.getStatus(statusMap.get(task['name']))
const status = this.getStatus(statusMap.get(task['name']));
const phase = statusToPhase(status);
const statusColoring = exitHandlers.includes(task['name'])
? '#fef7f0'
Expand Down
60 changes: 35 additions & 25 deletions frontend/src/pages/RunDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ import {
getTfxRunContext,
} from 'src/lib/MlmdUtils';
import { classes, stylesheet } from 'typestyle';
import {
NodePhase as ArgoNodePhase,
NodeStatus,
Workflow,
} from '../../third_party/argo-ui/argo_template';
import { NodePhase as ArgoNodePhase, NodeStatus } from '../../third_party/argo-ui/argo_template';
import { ApiExperiment } from '../apis/experiment';
import { ApiRun, RunStorageState } from '../apis/run';
import { ApiVisualization, ApiVisualizationType } from '../apis/visualization';
Expand Down Expand Up @@ -88,10 +84,9 @@ enum SidePaneTab {
EVENTS,
MANIFEST,
}
// TODO: kfp 1.0.0 merge

interface SelectedNodeDetails {
id: string;
mode?: Mode;
logs?: string;
phase?: string;
phaseMessage?: string;
Expand Down Expand Up @@ -311,7 +306,7 @@ class RunDetails extends Page<RunDetailsInternalProps, RunDetailsState> {
<React.Fragment>
{!!selectedNodeDetails.phaseMessage && (
<Banner
mode={selectedNodeDetails.mode || 'warning'}
mode={sidepanelBannerMode}
message={selectedNodeDetails.phaseMessage}
/>
)}
Expand Down Expand Up @@ -677,9 +672,7 @@ class RunDetails extends Page<RunDetailsInternalProps, RunDetailsState> {
runFinished = true;
}

const workflow = JSON.parse(
runDetail.pipeline_runtime!.workflow_manifest || '{}',
) as Workflow;
const workflow = JSON.parse(runDetail.pipeline_runtime!.workflow_manifest || '{}');

// Show workflow errors
const workflowError = WorkflowParser.getWorkflowError(workflow);
Expand Down Expand Up @@ -847,7 +840,7 @@ class RunDetails extends Page<RunDetailsInternalProps, RunDetailsState> {
return !workflow.status
? []
: [
['Status', workflow.status.conditions[0].reason],
['Status', workflow.status.conditions ? workflow.status.conditions[0].reason : 'Pending'],
['Description', runMetadata ? runMetadata!.description! : ''],
[
'Created at',
Expand All @@ -866,14 +859,13 @@ class RunDetails extends Page<RunDetailsInternalProps, RunDetailsState> {
);
}

// TODO: kfp 1.0.0 merge
private async _loadSidePaneTab(tab: SidePaneTab): Promise<void> {
const workflow = this.state.workflow;
const selectedNodeDetails = this.state.selectedNodeDetails;

let sidepanelBannerMode: Mode = 'warning';

if (workflow && workflow.status && workflow.status && selectedNodeDetails) {
if (workflow && workflow.status && workflow.status.taskRuns && selectedNodeDetails) {
let node: any;

for (const podName of Object.getOwnPropertyNames(workflow.status.taskRuns)) {
Expand All @@ -887,18 +879,36 @@ class RunDetails extends Page<RunDetailsInternalProps, RunDetailsState> {
}
}

if (node && node.status && node.status.conditions[0].type !== 'Succeeded') {
selectedNodeDetails.phaseMessage =
node && node.status
? `This step is in ${node.status.conditions[0].type} state with this message: ` +
node.status.conditions[0].message
: undefined;
} else if (node && node.status && node.status.conditions && node.conditionChecks) {
if (node.status.conditions[0].reason === 'Succeeded') {
selectedNodeDetails.mode = 'info';
selectedNodeDetails.phaseMessage = 'All ConditionChecks have completed executing';
} else selectedNodeDetails.phaseMessage = node.status.conditions[0].message;
if (node) {
selectedNodeDetails.phase = statusToPhase(node.status.conditions[0].reason);

switch (selectedNodeDetails.phase) {
// TODO: make distinction between system and pipelines error clear
case NodePhase.ERROR:
case NodePhase.SKIPPED:
sidepanelBannerMode = 'warning';
break;
case NodePhase.FAILED:
sidepanelBannerMode = 'error';
break;
default:
sidepanelBannerMode = 'info';
break;
}

if (node.status.conditions[0].type !== 'Succeeded') {
selectedNodeDetails.phaseMessage =
node && node.status
? `This step is in ${node.status.conditions[0].type} state with this message: ` +
node.status.conditions[0].message
: undefined;
} else if (node.status.conditions && node.conditionChecks) {
if (node.status.conditions[0].reason === 'Succeeded') {
selectedNodeDetails.phaseMessage = 'All ConditionChecks have completed executing';
} else selectedNodeDetails.phaseMessage = node.status.conditions[0].message;
}
}

this.setStateSafe({ selectedNodeDetails, sidepanelSelectedTab: tab, sidepanelBannerMode });

switch (tab) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function statusToIcon(
case NodePhase.PIPELINERUNCOULDNTCANCEL:
IconComponent = TerminatedIcon;
iconColor = color.terminated;
title = 'PipelineRun couldn\'t cancel';
title = 'PipelineRun could not cancel';
break;
case NodePhase.TASKRUNCANCELLED:
IconComponent = TerminatedIcon;
Expand All @@ -121,7 +121,7 @@ export function statusToIcon(
case NodePhase.TASKRUNCOULDNTCANCEL:
IconComponent = TerminatedIcon;
iconColor = color.terminated;
title = 'TaskRun couldn\'t cancel';
title = 'TaskRun could not cancel';
break;
case NodePhase.UNKNOWN:
break;
Expand Down