-
Notifications
You must be signed in to change notification settings - Fork 526
/
GitCompletedStep.jsx
55 lines (45 loc) · 1.56 KB
/
GitCompletedStep.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React, { PropTypes } from 'react';
import { observer } from 'mobx-react';
import { UrlBuilder } from '@jenkins-cd/blueocean-core-js';
import FlowStep from '../flow2/FlowStep';
import StepStatus from '../flow2/FlowStepStatus';
import STATE from './GitCreationState';
let t = null;
/**
* Shows the current progress after creation was initiated.
*/
@observer
export default class GitCompletedStep extends React.Component {
constructor(props) {
super(props);
t = this.props.flowManager.translate;
}
finish() {
const pipeline = this.props.flowManager.pipeline;
const url = UrlBuilder.buildPipelineUrl(pipeline.organization, pipeline.fullName, 'activity');
this.props.flowManager.completeFlow({ url });
}
render() {
const { stateId } = this.props.flowManager;
let status;
let percentage = -1;
let title = t('creation.git.step3.title_completed');
let content = null;
if (stateId === STATE.CREATE_PIPELINE) {
percentage = 50;
title = t('creation.git.step3.title_pipeline_create');
} else if (stateId === STATE.STEP_COMPLETE_SUCCESS) {
percentage = 100;
setTimeout(() => this.finish(), 2000);
status = StepStatus.COMPLETE;
}
return (
<FlowStep {...this.props} className="git-step-completed" title={title} status={status} percentage={percentage}>
{content}
</FlowStep>
);
}
}
GitCompletedStep.propTypes = {
flowManager: PropTypes.string,
};