Skip to content

Commit

Permalink
Merge pull request #495 from schubergphilis/issues/492-finding-histor…
Browse files Browse the repository at this point in the history
…y-missing

Issues/492 finding history missing
  • Loading branch information
MrSeccubus committed Jul 3, 2017
2 parents d28bc24 + eabcb7f commit 3841ec4
Show file tree
Hide file tree
Showing 4 changed files with 272 additions and 268 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,4 @@ Enhancements

Bug Fixes
* #490 - --cdn switch doesn't work as expected
* #492 - Finding history wasn't showing in the GUI
198 changes: 99 additions & 99 deletions jmvc/seccubus/finding/edit/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
steal( 'jquery/controller',
'jquery/view/ejs',
'jquery/controller/view',
'jquery/dom/form_params',
'seccubus/models',
'seccubus/issue/table',
'seccubus/history/table'
steal( 'jquery/controller',
'jquery/view/ejs',
'jquery/controller/view',
'jquery/dom/form_params',
'seccubus/models',
'seccubus/issue/table',
'seccubus/history/table'
).then( './views/init.ejs',
function($){

Expand All @@ -37,102 +37,102 @@ function($){
$.Controller('Seccubus.Finding.Edit',
/** @Static */
{
/*
* @attribute options
* Object that contains the options
*/
defaults : {
/* @attribute options.findings
* Array of findings to edit
*/
findings : [],
/* @attribute options.index
* Index of which finding in the array to edit
* Default: 0
*/
index : 0,
/* @attribute options.hostory
* jQuery query that defines where the history will be displayed
* Default : null
* If this attribute is null there will be no history displayed
*/
history : null,
/* @attribute options.workspace
* Id of the current workspace
*/
workspace : -1
/*
* @attribute options
* Object that contains the options
*/
defaults : {
/* @attribute options.findings
* Array of findings to edit
*/
findings : [],
/* @attribute options.index
* Index of which finding in the array to edit
* Default: 0
*/
index : 0,
/* @attribute options.hostory
* jQuery query that defines where the history will be displayed
* Default : null
* If this attribute is null there will be no history displayed
*/
history : null,
/* @attribute options.workspace
* Id of the current workspace
*/
workspace : -1

}
}
},
/** @Prototype */
{
init : function(){
this.updateView();
},
updateView : function() {
if ( this.options.findings.length == 0 ) {
alert("Seccubus.Findings.Edit : No findings to edit");
} else if ( this.options.workspace == -1 ) {
alert("Seccubus.Findings.Edit : Workspace not set");
} else {
this.element.html(
this.view(
'init',
this.options.findings[this.options.index],
{
index : this.options.index,
length: this.options.findings.length
}
)
);
$('#issue_table_findings').seccubus_issue_table({
workspace : this.options.workspace,
finding : this.options.findings[this.options.index].id
});
}
if ( this.options.history != null ) {
/* Display the finding history */
$(this.options.history).seccubus_history_table({
workspace : this.options.workspace,
findingId : this.options.findings[this.options.index].id
});
}
},
".editSetStatus click" : function(el,ev) {
ev.preventDefault();
var newState = $(el).attr("newstatus");
var param = this.element.formParams();
var f = this.options.findings[this.options.index];
f.attr("status",newState);
f.attr("remark",param.remark);
f.attr("append",0);
f.attr("workspace",this.options.workspace);
f.save();
},
".move click" : function(el,ev) {
ev.preventDefault();
this.options.index = $(el).attr("index");
this.updateView();
},
"{Seccubus.Models.Finding} updated" : function(Finding, ev, finding) {
var n = 0;
while(n < this.options.findings.length && this.options.findings[n].id != finding.id) {
n++;
}
if(n < this.options.findings.length) {
this.options.findings[n] = finding;
}
if(n == this.options.index) {
this.updateView();
}
},
/*
* Update, overloaded to reder the control after and update even
*/
update : function(options) {
this._super(options);
this.updateView();
}
init : function(){
this.updateView();
},
updateView : function() {
if ( this.options.findings.length == 0 ) {
alert("Seccubus.Findings.Edit : No findings to edit");
} else if ( this.options.workspace == -1 ) {
alert("Seccubus.Findings.Edit : Workspace not set");
} else {
this.element.html(
this.view(
'init',
this.options.findings[this.options.index],
{
index : this.options.index,
length: this.options.findings.length
}
)
);
$('#issue_table_findings').seccubus_issue_table({
workspace : this.options.workspace,
finding : this.options.findings[this.options.index].id
});
}
if ( this.options.history != null ) {
/* Display the finding history */
$(this.options.history).seccubus_history_table({
workspace : this.options.workspace,
findingId : this.options.findings[this.options.index].id
});
}
},
".editSetStatus click" : function(el,ev) {
ev.preventDefault();
var newState = $(el).attr("newstatus");
var param = this.element.formParams();
var f = this.options.findings[this.options.index];
f.attr("status",newState);
f.attr("remark",param.remark);
f.attr("append",0);
f.attr("workspace",this.options.workspace);
f.save();
},
".move click" : function(el,ev) {
ev.preventDefault();
this.options.index = $(el).attr("index");
this.updateView();
},
"{Seccubus.Models.Finding} updated" : function(Finding, ev, finding) {
var n = 0;
while(n < this.options.findings.length && this.options.findings[n].id != finding.id) {
n++;
}
if(n < this.options.findings.length) {
this.options.findings[n] = finding;
}
if(n == this.options.index) {
this.updateView();
}
},
/*
* Update, overloaded to reder the control after and update even
*/
update : function(options) {
this._super(options);
this.updateView();
}
})

});
Loading

0 comments on commit 3841ec4

Please sign in to comment.