|
|
@ -18,7 +18,7 @@ function staticAnalysisView (localRegistry) { |
|
|
|
this.event = new EventManager() |
|
|
|
this.event = new EventManager() |
|
|
|
this.view = null |
|
|
|
this.view = null |
|
|
|
this.runner = new StaticAnalysisRunner() |
|
|
|
this.runner = new StaticAnalysisRunner() |
|
|
|
this.modulesView = renderModules(this.runner.modules()) |
|
|
|
this.modulesView = this.renderModules() |
|
|
|
this.lastCompilationResult = null |
|
|
|
this.lastCompilationResult = null |
|
|
|
this.lastCompilationSource = null |
|
|
|
this.lastCompilationSource = null |
|
|
|
self._components = {} |
|
|
|
self._components = {} |
|
|
@ -53,7 +53,23 @@ staticAnalysisView.prototype.render = function () { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="${css.buttons}"> |
|
|
|
<div class="${css.buttons}"> |
|
|
|
<button class=${css.buttonRun} onclick=${function () { self.run() }} >Run</button> |
|
|
|
<button class=${css.buttonRun} onclick=${function () { self.run() }} >Run</button> |
|
|
|
<label class="${css.label}" for="autorunstaticanalysis"><input id="autorunstaticanalysis" type="checkbox" style="vertical-align:bottom" checked="true">Auto run</label> |
|
|
|
<label class="${css.label}" for="autorunstaticanalysis"> |
|
|
|
|
|
|
|
<input id="autorunstaticanalysis" |
|
|
|
|
|
|
|
type="checkbox" |
|
|
|
|
|
|
|
style="vertical-align:bottom" |
|
|
|
|
|
|
|
checked="true" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
Auto run |
|
|
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
<label class="${css.label}" for="checkallstaticanalysis"> |
|
|
|
|
|
|
|
<input id="checkallstaticanalysis" |
|
|
|
|
|
|
|
type="checkbox" |
|
|
|
|
|
|
|
onclick="${function (event) { self.checkAll(event) }}" |
|
|
|
|
|
|
|
style="vertical-align:bottom" |
|
|
|
|
|
|
|
checked="true" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
Check/Uncheck all |
|
|
|
|
|
|
|
</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="${css.result}" "id='staticanalysisresult'></div> |
|
|
|
<div class="${css.result}" "id='staticanalysisresult'></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -118,10 +134,34 @@ staticAnalysisView.prototype.run = function () { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = staticAnalysisView |
|
|
|
staticAnalysisView.prototype.checkAll = function (event) { |
|
|
|
|
|
|
|
if (!this.view) { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var all = this.view.querySelectorAll('[name="staticanalysismodule"]') |
|
|
|
|
|
|
|
var isAnySelected = false |
|
|
|
|
|
|
|
for (var i = 0; i < all.length; i++) { |
|
|
|
|
|
|
|
if (all[i].checked === true) { |
|
|
|
|
|
|
|
isAnySelected = true |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (var j = 0; j < all.length; j++) { |
|
|
|
|
|
|
|
all[j].checked = !isAnySelected |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
event.target.checked = !isAnySelected |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function renderModules (modules) { |
|
|
|
staticAnalysisView.prototype.checkModule = function (event) { |
|
|
|
var groupedModules = utils.groupBy(preProcessModules(modules), 'categoryId') |
|
|
|
var selectAll = this.view.querySelector('[id="checkallstaticanalysis" ]') |
|
|
|
|
|
|
|
if (event.target.checked) { |
|
|
|
|
|
|
|
selectAll.checked = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
staticAnalysisView.prototype.renderModules = function () { |
|
|
|
|
|
|
|
var self = this |
|
|
|
|
|
|
|
var groupedModules = utils.groupBy(preProcessModules(self.runner.modules()), 'categoryId') |
|
|
|
return Object.keys(groupedModules).map((categoryId, i) => { |
|
|
|
return Object.keys(groupedModules).map((categoryId, i) => { |
|
|
|
var category = groupedModules[categoryId] |
|
|
|
var category = groupedModules[categoryId] |
|
|
|
var entriesDom = category.map((item, i) => { |
|
|
|
var entriesDom = category.map((item, i) => { |
|
|
@ -131,7 +171,10 @@ function renderModules (modules) { |
|
|
|
type="checkbox" |
|
|
|
type="checkbox" |
|
|
|
name="staticanalysismodule" |
|
|
|
name="staticanalysismodule" |
|
|
|
index=${item._index} |
|
|
|
index=${item._index} |
|
|
|
checked="true" style="vertical-align:bottom"> |
|
|
|
checked="true" |
|
|
|
|
|
|
|
style="vertical-align:bottom" |
|
|
|
|
|
|
|
onclick="${function (event) { self.checkModule(event) }}" |
|
|
|
|
|
|
|
> |
|
|
|
${item.name} |
|
|
|
${item.name} |
|
|
|
${item.description} |
|
|
|
${item.description} |
|
|
|
</label> |
|
|
|
</label> |
|
|
@ -144,6 +187,8 @@ function renderModules (modules) { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = staticAnalysisView |
|
|
|
|
|
|
|
|
|
|
|
function preProcessModules (arr) { |
|
|
|
function preProcessModules (arr) { |
|
|
|
return arr.map((item, i) => { |
|
|
|
return arr.map((item, i) => { |
|
|
|
item['_index'] = i |
|
|
|
item['_index'] = i |
|
|
|