This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | /* global Q */ |
||
2 | |||
3 | var React = require("react"); |
||
4 | |||
5 | var Events = require('./events.js'); |
||
6 | var Helpers = require('./helpers.js'); |
||
7 | var SummaryTable = require('./SummaryTable.jsx'); |
||
8 | |||
9 | var DeployPlan = React.createClass({ |
||
10 | |||
11 | getInitialState: function() { |
||
12 | return { |
||
13 | loading_changes: false, |
||
14 | deploy_disabled: false, |
||
15 | deployHover: false |
||
16 | }; |
||
17 | }, |
||
18 | componentDidMount: function() { |
||
19 | var self = this; |
||
20 | // register subscribers |
||
21 | this.loadingSub = Events.subscribe('change_loading', function () { |
||
22 | self.setState({ |
||
23 | loading_changes: true |
||
24 | }); |
||
25 | }); |
||
26 | this.loadingDoneSub = Events.subscribe('change_loading/done', function () { |
||
27 | self.setState({ |
||
28 | loading_changes: false |
||
29 | }); |
||
30 | }); |
||
31 | }, |
||
32 | loadingSub: null, |
||
33 | loadingDoneSub: null, |
||
34 | deployHandler: function(event) { |
||
35 | event.preventDefault(); |
||
36 | this.setState({ |
||
37 | deploy_disabled: true |
||
38 | }); |
||
39 | |||
40 | Q($.ajax({ |
||
41 | type: "POST", |
||
42 | dataType: 'json', |
||
43 | url: this.props.context.envUrl + '/start-deploy', |
||
44 | data: { |
||
45 | // Pass the strategy object the user has just signed off back to the backend. |
||
46 | strategy: this.props.summary, |
||
47 | DispatcherSecurityID: this.props.summary.SecurityID |
||
48 | } |
||
49 | })).then(function(data) { |
||
50 | window.location = data.url; |
||
51 | }, function(data) { |
||
52 | console.error(data); // eslint-disable-line no-console |
||
53 | }); |
||
54 | }, |
||
55 | mouseEnterHandler: function() { |
||
56 | this.setState({deployHover: true}); |
||
57 | }, |
||
58 | mouseLeaveHandler: function() { |
||
59 | this.setState({deployHover: false}); |
||
60 | }, |
||
61 | canDeploy: function() { |
||
62 | return (this.props.summary.validationCode === "success" || this.props.summary.validationCode === "warning"); |
||
63 | }, |
||
64 | actionTitle: function() { |
||
65 | var actionTitle = this.props.summary.actionTitle; |
||
66 | if (typeof actionTitle === 'undefined' || actionTitle === '') { |
||
67 | return 'Make a selection'; |
||
68 | } |
||
69 | return this.props.summary.actionTitle; |
||
70 | }, |
||
71 | render: function() { |
||
72 | var messages = this.props.summary.messages; |
||
73 | var deployAction; |
||
74 | if (this.canDeploy()) { |
||
75 | deployAction = ( |
||
76 | <div |
||
77 | className="section" |
||
78 | onMouseEnter={this.mouseEnterHandler} |
||
79 | onMouseLeave={this.mouseLeaveHandler} |
||
80 | > |
||
81 | <button |
||
82 | value="Confirm Deployment" |
||
83 | className="deploy pull-left" |
||
84 | disabled={this.state.deploy_disabled} |
||
85 | onClick={this.deployHandler} |
||
86 | > |
||
87 | {this.actionTitle()} |
||
88 | </button> |
||
89 | <QuickSummary |
||
90 | activated={this.state.deployHover} |
||
91 | context={this.props.context} |
||
92 | summary={this.props.summary} |
||
93 | /> |
||
94 | </div> |
||
95 | ); |
||
96 | } |
||
97 | |||
98 | var headerClasses = Helpers.classNames({ |
||
99 | header: true, |
||
100 | inactive: !this.canDeploy(), |
||
101 | loading: this.state.loading_changes |
||
102 | }); |
||
103 | |||
104 | return ( |
||
105 | <div> |
||
106 | <div className="section"> |
||
107 | <div className={headerClasses}> |
||
108 | <span className="status-icon"></span> |
||
109 | <span className="numberCircle">2</span> |
||
110 | Review changes |
||
111 | </div> |
||
112 | <MessageList messages={messages} /> |
||
113 | <SummaryTable changes={this.props.summary.changes} /> |
||
114 | </div> |
||
115 | {deployAction} |
||
116 | </div> |
||
117 | ); |
||
118 | } |
||
119 | }); |
||
120 | |||
121 | function QuickSummary(props) { |
||
122 | |||
123 | var type = (props.summary.actionCode === 'fast' ? 'code-only' : 'full'); |
||
124 | var extraDefinitions = []; |
||
125 | if (props.summary.estimatedTime && props.summary.estimatedTime > 0) { |
||
126 | extraDefinitions.push(<dt key="duration_term">Duration:</dt>); |
||
127 | extraDefinitions.push( |
||
128 | <dd key="duration_definition">{props.summary.estimatedTime} min approx.</dd>); |
||
129 | } |
||
130 | |||
131 | var dlClasses = Helpers.classNames({ |
||
132 | activated: props.activated, |
||
133 | 'quick-summary': true |
||
134 | }); |
||
135 | |||
136 | var moreInfo = null; |
||
137 | if (typeof props.context.deployHelp !== 'undefined' && props.context.deployHelp) { |
||
138 | moreInfo = ( |
||
139 | <a className="small" href={props.context.deployHelp}>more info</a> |
||
140 | ); |
||
141 | } |
||
142 | |||
143 | var env; |
||
144 | if (props.context.siteUrl) { |
||
145 | env = ( |
||
146 | <a href={props.context.siteUrl}>{props.context.envName}</a> |
||
147 | ); |
||
148 | } else { |
||
149 | env = <span>{props.context.envName}</span>; |
||
150 | } |
||
151 | |||
152 | return ( |
||
153 | <dl className={dlClasses}> |
||
154 | <dt>Environment:</dt> |
||
155 | <dd>{env}</dd> |
||
156 | <dt>Deploy type:</dt> |
||
157 | <dd>{type} {moreInfo}</dd> |
||
158 | {extraDefinitions} |
||
159 | </dl> |
||
160 | ); |
||
161 | } |
||
162 | |||
163 | var MessageList = React.createClass({ |
||
164 | render: function() { |
||
165 | if (this.props.messages.length < 1) { |
||
166 | return null; |
||
167 | } |
||
168 | if (typeof this.props.messages === 'undefined') { |
||
169 | return null; |
||
170 | } |
||
171 | var idx = 0; |
||
172 | var messages = this.props.messages.map(function(message) { |
||
173 | idx++; |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
174 | return <Message key={idx} message={message} />; |
||
175 | }); |
||
176 | return ( |
||
177 | <div> |
||
178 | {messages} |
||
179 | </div> |
||
180 | ); |
||
181 | } |
||
182 | }); |
||
183 | |||
184 | function Message(props) { |
||
185 | var classMap = { |
||
186 | error: 'alert alert-danger', |
||
187 | warning: 'alert alert-warning', |
||
188 | success: 'alert alert-info' |
||
189 | }; |
||
190 | var classname = classMap[props.message.code]; |
||
191 | return ( |
||
192 | <div |
||
193 | className={classname} |
||
194 | role="alert" |
||
195 | dangerouslySetInnerHTML={{__html: props.message.text}} |
||
0 ignored issues
–
show
|
|||
196 | /> |
||
197 | ); |
||
198 | } |
||
199 | |||
200 | module.exports = DeployPlan; |
||
201 |