@@ -62,7 +62,7 @@ const html = `
62
62
level = "is-warning";
63
63
}
64
64
return (
65
- <div className={ "tag " + level }>
65
+ <div className="tag { level }" >
66
66
{ this.props.label }: { this.props.level }
67
67
</div>
68
68
);
@@ -100,24 +100,24 @@ const html = `
100
100
render: function() {
101
101
return (
102
102
<p className="help">
103
- Scanned { this.props.data.metrics .files.toLocaleString() } files
104
- with { this.props.data.metrics .lines.toLocaleString() } lines of code.
103
+ Scanned { this.props.data.Stats .files.toLocaleString() } files
104
+ with { this.props.data.Stats .lines.toLocaleString() } lines of code.
105
105
</p>
106
106
);
107
107
}
108
108
});
109
109
110
110
var Issues = React.createClass({
111
111
render: function() {
112
- if (this.props.data.metrics .files === 0) {
112
+ if (this.props.data.Stats .files === 0) {
113
113
return (
114
114
<div className="notification">
115
115
No source files found. Do you even Go?
116
116
</div>
117
117
);
118
118
}
119
119
120
- if (this.props.data.issues .length === 0) {
120
+ if (this.props.data.Issues .length === 0) {
121
121
return (
122
122
<div>
123
123
<div className="notification">
@@ -128,7 +128,7 @@ const html = `
128
128
);
129
129
}
130
130
131
- var issues = this.props.data.issues
131
+ var issues = this.props.data.Issues
132
132
.filter(function(issue) {
133
133
return this.props.severity.includes(issue.severity);
134
134
}.bind(this))
@@ -151,7 +151,7 @@ const html = `
151
151
<div>
152
152
<div className="notification">
153
153
No issues matched given filters
154
- (of total { this.props.data.issues .length } issues).
154
+ (of total { this.props.data.Issues .length } issues).
155
155
</div>
156
156
<Stats data={ this.props.data } />
157
157
</div>
@@ -182,31 +182,32 @@ const html = `
182
182
var highDisabled = !this.props.available.includes("HIGH");
183
183
var mediumDisabled = !this.props.available.includes("MEDIUM");
184
184
var lowDisabled = !this.props.available.includes("LOW");
185
-
185
+ var on = "", off = "disabled";
186
+ var HIGH = "HIGH", MEDIUM = "MEDIUM", LOW = "LOW";
186
187
return (
187
188
<span>
188
- <label className={ "label checkbox " + (highDisabled ? "disabled" : "") } >
189
+ <label className="label checkbox { (highDisabled ? off : on )}" >
189
190
<input
190
191
type="checkbox"
191
- checked={ this.props.selected.includes(" HIGH" ) }
192
+ checked={ this.props.selected.includes(HIGH) }
192
193
disabled={ highDisabled }
193
- onChange={ this.handleChange(" HIGH" ) }/>
194
+ onChange={ this.handleChange(HIGH) }/>
194
195
High
195
196
</label>
196
- <label className={ "label checkbox " + ( mediumDisabled ? "disabled" : "") } >
197
+ <label className="label checkbox {( mediumDisabled ? off : on )}" >
197
198
<input
198
199
type="checkbox"
199
- checked={ this.props.selected.includes(" MEDIUM" ) }
200
+ checked={ this.props.selected.includes(MEDIUM) }
200
201
disabled={ mediumDisabled }
201
- onChange={ this.handleChange(" MEDIUM" ) }/>
202
+ onChange={ this.handleChange(MEDIUM) }/>
202
203
Medium
203
204
</label>
204
- <label className={ "label checkbox " + ( lowDisabled ? "disabled" : "") } >
205
+ <label className="label checkbox {( lowDisabled ? off : on )}" >
205
206
<input
206
207
type="checkbox"
207
- checked={ this.props.selected.includes(" LOW" ) }
208
+ checked={ this.props.selected.includes(LOW) }
208
209
disabled={ lowDisabled }
209
- onChange={ this.handleChange(" LOW" ) }/>
210
+ onChange={ this.handleChange(LOW) }/>
210
211
Low
211
212
</label>
212
213
</span>
@@ -231,13 +232,13 @@ const html = `
231
232
render: function() {
232
233
var issueTypes = this.props.allIssueTypes
233
234
.map(function(it) {
235
+ var matches = this.props.issueType == it
234
236
return (
235
- <option value={ it } selected={ this.props.issueType == it }>
237
+ <option value={ it } selected={ matches }>
236
238
{ it }
237
239
</option>
238
240
);
239
241
}.bind(this));
240
-
241
242
return (
242
243
<nav className="panel">
243
244
<div className="panel-heading">
@@ -282,7 +283,6 @@ const html = `
282
283
);
283
284
}
284
285
});
285
-
286
286
var IssueBrowser = React.createClass({
287
287
getInitialState: function() {
288
288
return {};
@@ -291,11 +291,11 @@ const html = `
291
291
this.updateIssues(this.props.data);
292
292
},
293
293
handleSeverity: function(val) {
294
- this.updateIssueTypes(this.props.data.issues , val, this.state.confidence);
294
+ this.updateIssueTypes(this.props.data.Issues , val, this.state.confidence);
295
295
this.setState({severity: val});
296
296
},
297
297
handleConfidence: function(val) {
298
- this.updateIssueTypes(this.props.data.issues , this.state.severity, val);
298
+ this.updateIssueTypes(this.props.data.Issues , this.state.severity, val);
299
299
this.setState({confidence: val});
300
300
},
301
301
handleIssueType: function(val) {
@@ -306,30 +306,25 @@ const html = `
306
306
this.setState({data: data});
307
307
return;
308
308
}
309
-
310
- var allSeverities = data.issues
309
+ var allSeverities = data.Issues
311
310
.map(function(issue) {
312
311
return issue.severity
313
312
})
314
313
.sort()
315
314
.filter(function(item, pos, ary) {
316
315
return !pos || item != ary[pos - 1];
317
316
});
318
-
319
- var allConfidences = data.issues
317
+ var allConfidences = data.Issues
320
318
.map(function(issue) {
321
319
return issue.confidence
322
320
})
323
321
.sort()
324
322
.filter(function(item, pos, ary) {
325
323
return !pos || item != ary[pos - 1];
326
324
});
327
-
328
325
var selectedSeverities = allSeverities;
329
326
var selectedConfidences = allConfidences;
330
-
331
- this.updateIssueTypes(data.issues, selectedSeverities, selectedConfidences);
332
-
327
+ this.updateIssueTypes(data.Issues, selectedSeverities, selectedConfidences);
333
328
this.setState({
334
329
data: data,
335
330
severity: selectedSeverities,
@@ -358,7 +353,7 @@ const html = `
358
353
if (this.state.issueType && !allTypes.includes(this.state.issueType)) {
359
354
this.setState({issueType: null});
360
355
}
361
-
356
+
362
357
this.setState({allIssueTypes: allTypes});
363
358
},
364
359
render: function() {
@@ -391,7 +386,7 @@ const html = `
391
386
);
392
387
}
393
388
});
394
-
389
+
395
390
ReactDOM.render(
396
391
<IssueBrowser data={ data } />,
397
392
document.getElementById("content")
0 commit comments