- changed status to resolved
How to create custom widget?
Issue #83
resolved
I have a widget created by me and my job is not able to access this widget. Console.log putting it plots the information , but does not show in atlasboard . My widget is this:
widget = {
onData: function(el, data) {
$('.content', el).empty();
if (data.title) {
$('h2', el).text(data.issues);
if (data.issues.length) {
data.issues.forEach(function(issue) {
//console.log(issue)
$('.content', el).append(
"<div class='item-container'>" +
"<div class='issue'>" + issue.title + "</div>" +
"<div class='count'>" + issue.issue_id + "</div>" +
"</div>"
);
})
}
}
};
and I am accessing this information the jobs are as follows:
function getCreatedWorflowArray(issue_id){
var sla = {}
var issues = []
json_data.logs.forEach(function(log){
if(log.issue===issue_id && log.field === 'status'){
issues.push({issue_id: log.issue,
title: json_query(['issues[id=?].title', log.issue], {data: json_data}).value,
created_on: moment(log.created_on, moment.ISO_8601).format('YYYY-MM-DD HH:mm:ss'),
changed_from: log.changed_from,
changed_to: log.changed_to})
}
})
sla.issues = sortByKey(issues, 'created_on')
return sla
}
module.exports = function(config, dependencies, job_callback) {
/*issues = [{"issueType" : "New_to_Open", "frequency" : 28,},
{"issueType" : "Broken build", "frequency" : 20},
{"issueType" : "Usability Issue", "frequency" : 16},
{"issueType" : "Compilation Error", "frequency" : 13}]*/
getJsonData()
issues = JSON.stringify(getCreatedWorflowArray(24))
//console.log(issues)
job_callback(null, {issues: issues, title: config.widgetTitle})
};
Why is not appearing on my screen atlasboard , what's wrong ?
Comments (1)
-
- Log in to comment
I am resolving this issue as it doesn't report a bug or issue in Atlasboard itself.