Dynamic input parameters on query_editor.html


new to this…

so i build a rest api based datasource from the IBM APM example. ( Netcool Impact based)

question i have now is…
is there a way to create input fields in the query window .( like the “condition” option) , but have it be dynamic. i.e.
the REST interface provides all available parameters through a URL .http://server:port/…/datasets/Mydataset/parameters

i know how to parse these, and the number of parameters is unknown, because each dataset can be different…
but how do i get it into the query_editor.html page/pane ?

having some success in mean time… but how do i stop javascript/angular from modifying the html i send back? it strips out my input fields… (

i guess i have to do something in datasource.js or query_ctrl.js for that return value ParameterDiv.
i hardcoded an example for testing…
i am looking for a way to get $sce.trustAsHtml( ParameterDiv) . but from the datasource plugin, i cannot find how to reference $sce… is it even included?
i do see Sanitize in the $injector.modules but thats as far as my knowledge goes…
so HEEELLLEEEP :slight_smile:
IPMDatasource.prototype.getParameterDiv = function (agentType, attributeGroup ) { var aT = agentType.replace(/^.*--> /, ''); var aG = attributeGroup.replace(/^.*--> /, ''); var ids = []; var request = { url: this.url + '/datasources/' + encodeURIComponent(aT) + '/datasets/' + encodeURIComponent(aG) + '/parameters' }; return this.httpGet(request) .then(function (result) { var items = result.response.items; var ParameterDiv=''; items.forEach(function (item) { ParameterDiv = ParameterDiv + '<div class="gf-form gf-form--grow">' + '<label class="gf-form-label query-keyword width-9">'+ item.id + '</label>' + '<input class="gf-form-input"'+ ' ng-blur="ctrl.refresh()"' + ' ng-model="ctrl.target.' + item.id + '"' + ' type="text"></input>'+ '</div>'; //ids.push({ id: item.id, label: item.label }); }); ParameterDiv='<div class="gf-form gf-form--grow"><label class="gf-form-label query-keyword width-9">SITE</label><input class="gf-form-input" ng-blur="ctrl.refresh()" ng-model="ctrl.target.SITE" type="text"></input></div><div class="gf-form gf-form--grow"><label class="gf-form-label query-keyword width-9">MONITOR</label><input class="gf-form-input" ng-blur="ctrl.refresh()" ng-model="ctrl.target.MONITOR" type="text"></input></div><div class="gf-form gf-form--grow"><label class="gf-form-label query-keyword width-9">executePolicy</label><input class="gf-form-input" ng-blur="ctrl.refresh()" ng-model="ctrl.target.executePolicy" type="text"></input></div>'; return ParameterDiv; }); };