Skip to content

Commit

Permalink
fix(cf): Share / unshare execution details (spinnaker#6710)
Browse files Browse the repository at this point in the history
spinnaker/spinnaker#4135

Co-Authored-By: Stu Pollock <spollock@pivotal.io>
  • Loading branch information
2 people authored and jkschneider committed Mar 18, 2019
1 parent 8c4104f commit b4ca2b8
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CloudfoundryShareServiceStageConfig } from './CloudfoundryShareServiceStageConfig';
import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core';
import { CloudfoundryServiceExecutionDetails } from 'cloudfoundry/presentation';
import { CloudfoundryShareServiceExecutionDetails } from 'cloudfoundry/presentation';

Registry.pipeline.registerStage({
accountExtractor: (stage: IStage) => stage.context.credentials,
Expand All @@ -9,7 +9,7 @@ Registry.pipeline.registerStage({
key: 'shareService',
cloudProvider: 'cloudfoundry',
component: CloudfoundryShareServiceStageConfig,
executionDetailsSections: [CloudfoundryServiceExecutionDetails, ExecutionDetailsTasks],
executionDetailsSections: [CloudfoundryShareServiceExecutionDetails, ExecutionDetailsTasks],
defaultTimeoutMs: 30 * 60 * 1000,
validators: [
{ type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CloudfoundryUnshareServiceStageConfig } from './CloudfoundryUnshareServiceStageConfig';
import { ExecutionDetailsTasks, IStage, Registry } from '@spinnaker/core';
import { CloudfoundryServiceExecutionDetails } from 'cloudfoundry/presentation';
import { CloudfoundryUnshareServiceExecutionDetails } from 'cloudfoundry/presentation';

Registry.pipeline.registerStage({
accountExtractor: (stage: IStage) => stage.context.credentials,
Expand All @@ -11,7 +11,7 @@ Registry.pipeline.registerStage({
component: CloudfoundryUnshareServiceStageConfig,
templateUrl: require('./cloudfoundryUnshareServiceStage.html'),
controller: 'cfUnshareServiceStageCtrl',
executionDetailsSections: [CloudfoundryServiceExecutionDetails, ExecutionDetailsTasks],
executionDetailsSections: [CloudfoundryUnshareServiceExecutionDetails, ExecutionDetailsTasks],
defaultTimeoutMs: 30 * 60 * 1000,
validators: [
{ type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import * as React from 'react';
import { get } from 'lodash';

import {
AccountTag,
ExecutionDetailsSection,
IExecutionDetailsSectionProps,
StageExecutionLogs,
StageFailureMessage,
} from '@spinnaker/core';

export function CloudfoundryShareServiceExecutionDetails(props: IExecutionDetailsSectionProps) {
const { stage } = props;
const { context } = stage;
const account = get(context, 'service.account', undefined);
const region = get(context, 'service.region', undefined);
const serviceInstanceName = get(context, 'serviceInstanceName', undefined);
const shareToRegions = get(context, 'shareToRegions', undefined);
return (
<ExecutionDetailsSection name={props.name} current={props.current}>
<div className="step-section-details">
<div className="row">
<div className="col-md-12">
<dl className="dl-horizontal">
<dt>Account</dt>
<dd>
<AccountTag account={account} />
</dd>
<dt>Region</dt>
<dd>
{region}
<br />
</dd>
<dt>Service Instance Name</dt>
<dd>
{serviceInstanceName}
<br />
</dd>
<dt>Sharing Regions</dt>
<dd>
{shareToRegions.join(', ')}
<br />
</dd>
</dl>
</div>
</div>
</div>
<StageFailureMessage stage={stage} message={stage.failureMessage} />
<StageExecutionLogs stage={stage} />
</ExecutionDetailsSection>
);
}

// eslint-disable-next-line
export namespace CloudfoundryShareServiceExecutionDetails {
export const title = 'cloudfoundryShareServiceConfig';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import * as React from 'react';
import { get } from 'lodash';

import {
AccountTag,
ExecutionDetailsSection,
IExecutionDetailsSectionProps,
StageExecutionLogs,
StageFailureMessage,
} from '@spinnaker/core';

export function CloudfoundryUnshareServiceExecutionDetails(props: IExecutionDetailsSectionProps) {
const { stage } = props;
const { context } = stage;
const account = get(context, 'service.account', undefined);
const serviceInstanceName = get(context, 'serviceInstanceName', undefined);
const unshareFromRegions = get(context, 'unshareFromRegions', undefined);
return (
<ExecutionDetailsSection name={props.name} current={props.current}>
<div className="step-section-details">
<div className="row">
<div className="col-md-12">
<dl className="dl-horizontal">
<dt>Account</dt>
<dd>
<AccountTag account={account} />
</dd>
<dt>Service Instance Name</dt>
<dd>
{serviceInstanceName}
<br />
</dd>
<dt>Unsharing Regions</dt>
<dd>
{unshareFromRegions.join(', ')}
<br />
</dd>
</dl>
</div>
</div>
</div>
<StageFailureMessage stage={stage} message={stage.failureMessage} />
<StageExecutionLogs stage={stage} />
</ExecutionDetailsSection>
);
}

// eslint-disable-next-line
export namespace CloudfoundryUnshareServiceExecutionDetails {
export const title = 'cloudfoundryUnshareServiceConfig';
}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './CloudfoundryServiceExecutionDetails';
export * from './CloudfoundryShareServiceExecutionDetails';
export * from './CloudfoundryUnshareServiceExecutionDetails';

0 comments on commit b4ca2b8

Please sign in to comment.