Skip to content

Commit

Permalink
Merge pull request #1926 from gschueler/issue/1370
Browse files Browse the repository at this point in the history
Enhance execution step summary display
  • Loading branch information
gschueler committed Jun 30, 2016
2 parents 9a0ba56 + 13d6492 commit 1a43615
Show file tree
Hide file tree
Showing 23 changed files with 1,275 additions and 201 deletions.
599 changes: 593 additions & 6 deletions rundeckapp/grails-app/assets/javascripts/executionStateKO.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions rundeckapp/grails-app/assets/javascripts/ko/binding-popover.js
Expand Up @@ -17,11 +17,27 @@ ko.bindingHandlers.bootstrapPopover = {

/**
* Initializes bootstrap tooltip on the dom element. Usage: <div data-bind="bootstrapTooltip: true" title="blah" >
* tip: if the title of the element is bound to an observable, pass the same one as the binding, like
* <div data-bind="bootstrapTooltip: mytooltipObservable" title="blah" >, to trigger updates when it changes.
* @type {{init: ko.bindingHandlers.bootstrapTooltip.init}}
*/
ko.bindingHandlers.bootstrapTooltip = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
"use strict";
jQuery(element).tooltip({});

ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
jQuery(element).tooltip("destroy");
});
},
update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
"use strict";
var val = valueAccessor();
if(ko.isObservable(val)){
val = ko.unwrap(val);
jQuery(element).tooltip('destroy');
jQuery(element).data('original-title',null);
jQuery(element).tooltip({});
}
}
};
9 changes: 9 additions & 0 deletions rundeckapp/grails-app/assets/javascripts/util/testing.js
Expand Up @@ -54,6 +54,15 @@ var TestHarness = function (name,data) {
};
self.assert = function (msg, expect, val) {
total++;
if(null==expect && null==val && typeof(msg)!='string'){
expect=true;
val=msg;
msg='(assert)';
}else if(null==val && typeof(expect)=='string' && typeof(msg)=='boolean'){
val=msg;
msg=expect;
expect=true;
}
if (!self.compare(expect,val)) {
failed++;
var message = "FAIL: " +curPrefix+ msg + ": expected: " + JSON.stringify(expect) + ", was: " + JSON.stringify(val);
Expand Down
114 changes: 58 additions & 56 deletions rundeckapp/grails-app/assets/javascripts/workflow.js
Expand Up @@ -13,37 +13,70 @@
/**
* Represents a workflow
*/
function _wfTypeForStep(step){
"use strict";
if (typeof(step) != 'undefined') {
if (step['exec']) {
return 'command';
} else if (step['jobref']) {
return 'job';
} else if (step['script']) {
return 'script';
} else if (step['scriptfile']) {
return 'scriptfile';
} else if (step['type']) {//plugin
if (step['nodeStep'] ) {
return 'node-step-plugin plugin';
} else if (null != step['nodeStep'] && !step['nodeStep'] ) {
return 'workflow-step-plugin plugin';
}else{
return 'plugin';
}
}
}
return 'console';
}
function _wfStringForStep(step){
"use strict";
var string = "";
if (typeof(step) != 'undefined') {
if(step['description']){
string = step['description'];
}else if (step['exec']) {
// string+=' $ '+step['exec'];
string = 'Command';
} else if (step['jobref']) {
string = (step['jobref']['group'] ? step['jobref']['group'] + '/' : '') + step['jobref']['name'];
} else if (step['script']) {
string = "Script";
} else if (step['scriptfile']) {
string = step['scriptfile'];
} else if (step['type']) {//plugin
var title = "Plugin " + step['type'];
if (step['nodeStep'] && RDWorkflow.nodeSteppluginDescriptions && RDWorkflow.nodeSteppluginDescriptions[step['type']]) {
title = RDWorkflow.nodeSteppluginDescriptions[step['type']].title || title;
} else if (!step['nodeStep'] && RDWorkflow.wfSteppluginDescriptions && RDWorkflow.wfSteppluginDescriptions[step['type']]) {
title = RDWorkflow.wfSteppluginDescriptions[step['type']].title || title;
}
string = title;
}
}else{
return "[?]";
}
return string;
}
var RDWorkflow = Class.create({
workflow:null,
nodeSteppluginDescriptions:null,
wfSteppluginDescriptions:null,
initialize: function(wf,params){
this.workflow=wf;
Object.extend(this, params);
},
contextType: function (ctx) {
var string = "";
var step = this.workflow[RDWorkflow.workflowIndexForContextId(ctx[0])];
if (typeof(step) != 'undefined') {
if (step['exec']) {
return 'command';
} else if (step['jobref']) {
return 'job';
} else if (step['script']) {
return 'script';
} else if (step['scriptfile']) {
return 'scriptfile';
} else if (step['type']) {//plugin
if (step['nodeStep'] ) {
return 'node-step-plugin plugin';
} else if (null != step['nodeStep'] && !step['nodeStep'] ) {
return 'workflow-step-plugin plugin';
}else{
return 'plugin';
}
}
if(typeof(ctx)=='string'){
ctx= RDWorkflow.parseContextId(ctx);
}
return 'console';
var step = this.workflow[RDWorkflow.workflowIndexForContextId(ctx[0])];
return _wfTypeForStep(step);
},
renderContextStepNumber: function (ctx) {
if (typeof(ctx) == 'string') {
Expand All @@ -61,33 +94,8 @@ var RDWorkflow = Class.create({
if(typeof(ctx)=='string'){
ctx= RDWorkflow.parseContextId(ctx);
}
var string = "";
var step = this.workflow[RDWorkflow.workflowIndexForContextId(ctx[0])];
if (typeof(step) != 'undefined') {
if(step['description']){
string = step['description'];
}else if (step['exec']) {
// string+=' $ '+step['exec'];
string = 'Command';
} else if (step['jobref']) {
string = (step['jobref']['group'] ? step['jobref']['group'] + '/' : '') + step['jobref']['name'];
} else if (step['script']) {
string = "Script";
} else if (step['scriptfile']) {
string = step['scriptfile'];
} else if (step['type']) {//plugin
var title = "Plugin " + step['type'];
if (step['nodeStep'] && this.nodeSteppluginDescriptions && this.nodeSteppluginDescriptions[step['type']]) {
title = this.nodeSteppluginDescriptions[step['type']].title || title;
} else if (!step['nodeStep'] && this.wfSteppluginDescriptions && this.wfSteppluginDescriptions[step['type']]) {
title = this.wfSteppluginDescriptions[step['type']].title || title;
}
string = title;
}
}else{
return "[?]";
}
return string;
return _wfStringForStep(step);
}
});
/**
Expand Down Expand Up @@ -164,13 +172,7 @@ RDWorkflow.parseContextId= function (context) {
}
//split context into project,type,object
var t = RDWorkflow.splitEscaped(context,RDWorkflow.contextStringSeparator);
var i = 0;
var vals = new Array();
for (i = 0; i < t.length; i++) {
var x = t[i];
vals.push(x);
}
return vals;
return t.slice();
};

/**
Expand Down

0 comments on commit 1a43615

Please sign in to comment.