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

refactor(core): Convert executionDetailsSectionNav, executionStepDetails, statusGlyph to react #4273

Merged
merged 2 commits into from
Oct 16, 2017
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
3 changes: 2 additions & 1 deletion app/scripts/modules/core/src/delivery/delivery.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { EXECUTION_DETAILS_COMPONENT } from './details/executionDetails.componen
import { EXECUTION_DETAILS_CONTROLLER } from './details/executionDetails.controller';
import { BUILD_DISPLAY_NAME_FILTER } from './executionBuild/buildDisplayName.filter';
import { EXECUTION_COMPONENT } from './executionGroup/execution/execution.component';
import { EXECUTION_DETAILS_SECTION_NAV } from './details/executionDetailsSectionNav.component';
import { STAGE_FAILURE_MESSAGE_COMPONENT } from './stageFailureMessage/stageFailureMessage.component';
import { CORE_DELIVERY_DETAILS_SINGLEEXECUTIONDETAILS } from './details/singleExecutionDetails.component';

Expand All @@ -16,7 +17,7 @@ module.exports = angular.module('spinnaker.delivery', [
CORE_DELIVERY_DETAILS_SINGLEEXECUTIONDETAILS,
EXECUTION_COMPONENT,
EXECUTION_DETAILS_COMPONENT,
require('./details/executionDetailsSectionNav.directive.js').name,
EXECUTION_DETAILS_SECTION_NAV,

BUILD_DISPLAY_NAME_FILTER,

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as React from 'react';
import * as ReactGA from 'react-ga';
import { UISref, UISrefActive } from '@uirouter/react';
import { UIRouterContext } from '@uirouter/react-hybrid';

import { robotToHuman } from 'core/presentation/robotToHumanFilter/robotToHuman.filter';

export interface IExecutionDetailsSectionNavProps {
sections: string[];
}

@UIRouterContext
export class ExecutionDetailsSectionNav extends React.Component<IExecutionDetailsSectionNavProps> {
public render() {
return (
<ul className="nav nav-pills">
{this.props.sections.map((section) => <Section key={section} section={section}/>)}
</ul>
);
}
}

const Section = (props: { section: string }): JSX.Element => {
const clicked = () => {
ReactGA.event({category: 'Pipeline', action: 'Execution details section selected', label: props.section});
}
return (
<li>
<UISrefActive class="active">
<UISref to=".execution" params={{details: props.section}}>
<span onClick={clicked}>{robotToHuman(props.section)}</span>
</UISref>
</UISrefActive>
</li>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { module } from 'angular';
import { react2angular } from 'react2angular';

import { ExecutionDetailsSectionNav } from './ExecutionDetailsSectionNav';

export const EXECUTION_DETAILS_SECTION_NAV = 'spinnaker.core.delivery.details.executionDetailsSectionNav';
module(EXECUTION_DETAILS_SECTION_NAV, [])
.component('executionDetailsSectionNav', react2angular(ExecutionDetailsSectionNav, ['sections']));

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { IController, module } from 'angular';

import { IStageStep } from 'core/domain/IStageStep';
import { IExecutionStage } from 'core/domain/IExecutionStage';
import { IExecutionStage, ITaskStep } from 'core/domain';

interface IFailureOnChanges extends ng.IOnChangesObject {
isFailed: ng.IChangesObject<boolean>;
Expand All @@ -14,7 +13,7 @@ class StageFailureMessageCtrl implements IController {
public message: string;
public messages: string[];
public stage: IExecutionStage;
public failedTask: IStageStep;
public failedTask: ITaskStep;

public $onInit(): void {
if (this.stage && (this.stage.isFailed || this.stage.isStopped)) {
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/modules/core/src/domain/IExecutionStage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Application } from 'core/application/application.model';
import { IExecution } from './IExecution';
import { IOrchestratedItem } from './IOrchestratedItem';
import { IStage } from './IStage';
import { IStageStep } from './IStageStep';
import { ITaskStep } from './ITaskStep';

export interface IRestartDetails {
restartedBy: string;
Expand All @@ -24,7 +24,7 @@ export interface IExecutionStage extends IOrchestratedItem, IStage {
before?: IExecutionStage[];
context: IExecutionContext;
id: string;
tasks: IStageStep[];
tasks: ITaskStep[];
}

export interface IExecutionStageLabelComponentProps {
Expand Down
5 changes: 0 additions & 5 deletions app/scripts/modules/core/src/domain/IStageStep.ts

This file was deleted.

4 changes: 2 additions & 2 deletions app/scripts/modules/core/src/domain/ITaskStep.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ITimedItem} from './IOrchestratedItem';
import { IOrchestratedItem } from './IOrchestratedItem';

export interface ITaskStep extends ITimedItem {
export interface ITaskStep extends IOrchestratedItem {
name: string;
status: string;
}
1 change: 0 additions & 1 deletion app/scripts/modules/core/src/domain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export * from './IServerGroup';
export * from './IStage';
export * from './IStageContext';
export * from './IStageOrTriggerTypeConfig';
export * from './IStageStep';
export * from './IStageTypeConfig';
export * from './IStrategy'
export * from './ISubnet';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

const angular = require('angular');

import { STAGE_CORE_MODULE } from '../core/stage.core.module';

module.exports = angular.module('spinnaker.pipelines.stage.checkPreconditions', [
require('../stage.module.js').name,
require('../core/stage.core.module.js').name,
STAGE_CORE_MODULE,
require('./checkPreconditionsStage.js').name,
]);
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

const angular = require('angular');

import { STAGE_CORE_MODULE } from '../core/stage.core.module';

module.exports = angular.module('spinnaker.core.pipeline.stage.cloneServerGroup', [
require('./cloneServerGroupStage.js').name,
require('../stage.module.js').name,
require('../core/stage.core.module.js').name,
STAGE_CORE_MODULE,
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as React from 'react';

import { IExecutionStage } from 'core/domain';
import { StatusGlyph } from 'core/task/StatusGlyph';
import { displayableTasks } from 'core/task/displayableTasks.filter';
import { duration } from 'core/utils/timeFormatters';
import { robotToHuman } from 'core/presentation/robotToHumanFilter/robotToHuman.filter';

export interface IExecutionStepDetailsProps {
stage: IExecutionStage;
}

export class ExecutionStepDetails extends React.Component<IExecutionStepDetailsProps> {
public render() {
return (
<div className="col-md-9">
<div className="row">
<div className="col-md-9">
<strong>Task</strong>
</div>
<div className="col-md-3 text-right">
<strong>Duration</strong>
</div>
</div>
{ displayableTasks(this.props.stage.tasks).map((task) => (
<div className="row">
<div className="col-md-9">
<span className="small"><StatusGlyph item={task}/></span> {robotToHuman(task.name)}
</div>
<div className="col-md-3 text-right">
{duration(task.runningTimeInMs)}
</div>
</div>
))}
</div>
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { module } from 'angular';
import { react2angular } from 'react2angular';

import { ExecutionStepDetails } from './ExecutionStepDetails';

export const EXECUTION_STEP_DETAILS_COMPONENT = 'spinnaker.core.pipeline.config.stages.core.executionStepDetails.component';
module(EXECUTION_STEP_DETAILS_COMPONENT, [])
.component('executionStepDetails', react2angular(ExecutionStepDetails, ['stage']));

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { module } from 'angular';

import { DISPLAYABLE_TASKS_FILTER } from 'core/task/displayableTasks.filter';
import { EXECUTION_STEP_DETAILS_COMPONENT } from './executionStepDetails.component';

export const STAGE_CORE_MODULE = 'spinnaker.core.pipeline.stage.core';

module(STAGE_CORE_MODULE, [
EXECUTION_STEP_DETAILS_COMPONENT,
DISPLAYABLE_TASKS_FILTER,
]);
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
'use strict';
import {CLUSTER_NAME_FILTER} from './clusterName.filter';

const angular = require('angular');

import { CLUSTER_NAME_FILTER } from './clusterName.filter';
import { STAGE_CORE_MODULE } from '../core/stage.core.module';

module.exports = angular.module('spinnaker.core.pipeline.stage.deploy', [
require('./deployStage.js').name,
require('./deployStage.transformer.js').name,
require('./deployExecutionDetails.controller.js').name,
CLUSTER_NAME_FILTER,
require('../core/stage.core.module.js').name,
STAGE_CORE_MODULE,
])
.run(function(pipelineConfig, deployStageTransformer) {
pipelineConfig.registerTransformer(deployStageTransformer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const angular = require('angular');

import { EXECUTION_WINDOW_ACTIONS_COMPONENT } from './executionWindowActions.component';
import { STAGE_CORE_MODULE } from '../core/stage.core.module';

import './executionWindows.less';

Expand All @@ -12,5 +13,5 @@ module.exports = angular.module('spinnaker.core.pipeline.stage.executionWindows'
require('./executionWindows.directive.js').name,
EXECUTION_WINDOW_ACTIONS_COMPONENT,
require('../stage.module.js').name,
require('../core/stage.core.module.js').name,
STAGE_CORE_MODULE,
]);
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

const angular = require('angular');

import { STAGE_CORE_MODULE } from '../core/stage.core.module';

module.exports = angular.module('spinnaker.core.pipeline.stage.findImageFromTags', [
require('../stage.module.js').name,
require('../core/stage.core.module.js').name,
STAGE_CORE_MODULE,
require('./findImageFromTagsStage.js').name,
]);
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
'use strict';

const angular = require('angular');
import {IGOR_SERVICE} from 'core/ci/igor.service';
import {TIME_FORMATTERS} from 'core/utils/timeFormatters';

import { IGOR_SERVICE } from 'core/ci/igor.service';
import { STAGE_CORE_MODULE } from '../core/stage.core.module';
import { TIME_FORMATTERS } from 'core/utils/timeFormatters';

module.exports = angular.module('spinnaker.core.pipeline.stage.jenkins', [
require('./jenkinsStage.js').name,
require('../stage.module.js').name,
require('../core/stage.core.module.js').name,
STAGE_CORE_MODULE,
TIME_FORMATTERS,
IGOR_SERVICE,
require('./jenkinsExecutionDetails.controller.js').name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

const angular = require('angular');

import { STAGE_CORE_MODULE } from '../core/stage.core.module';

import './manualJudgmentExecutionDetails.less';

module.exports = angular.module('spinnaker.core.pipeline.stage.manualJudgment', [
require('../stage.module.js').name,
require('../core/stage.core.module.js').name,
STAGE_CORE_MODULE,
require('./manualJudgmentExecutionDetails.controller.js').name,
require('./manualJudgmentStage.js').name,
require('../../../../notification/modal/editNotification.controller.modal.js').name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

const angular = require('angular');

import { STAGE_CORE_MODULE } from '../core/stage.core.module';

module.exports = angular.module('spinnaker.core.pipeline.stage.tagImage', [
require('../stage.module.js').name,
require('../core/stage.core.module.js').name,
STAGE_CORE_MODULE,
require('./tagImageStage.js').name,
]);
Loading