-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReactionsPerMonth.html
91 lines (82 loc) · 13.6 KB
/
ReactionsPerMonth.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<title>CATS-Reaction by Month-0.1</title>
<!-- (c) 2017 CA Technologies. All Rights Reserved. -->
<!-- Build Date: Wed Sep 23 2020 12:01:52 GMT-0600 (Mountain Daylight Time) -->
<script type="text/javascript">
var APP_BUILD_DATE = "Wed Sep 23 2020 12:01:52 GMT-0600 (Mountain Daylight Time)";
var ARTIFACT = "WIM-5528";
var BUILDER = "kc683795";
var CHECKSUM = 8364344461;
</script>
<script type="text/javascript" src="/apps/2.1/sdk.js"></script>
<!-- our highcharts (needed so that we can add patterns)
<script type="text/javascript" src="/apps/2.1/lib/analytics/analytics-all.js"></script>
-->
<script type="text/javascript">
Rally.onReady(function() {
Ext.define("Rally.technicalservices.InfoLink",{extend:"Rally.ui.dialog.Dialog",alias:"widget.tsinfolink",informationHtml:null,title:"Build Information",defaults:{padding:5,margin:5},closable:!0,draggable:!0,autoShow:!0,width:350,informationalConfig:null,showLog:!1,logger:null,items:[{xtype:"container",itemId:"information"},{xtype:"container",itemId:"button_box"}],initComponent:function(){Ext.id(this);this.title="<span class='icon-help'> </span>"+this.title,this.callParent(arguments)},_generateChecksum:function(t){var e,o=305419896;for(t=(t=(t=t.replace(/var CHECKSUM = .*;/,"")).replace(/var BUILDER = .*;/,"")).replace(/\s/g,""),e=0;e<t.length;e++)o+=t.charCodeAt(e)*e;return o},_checkChecksum:function(t){var o=Ext.create("Deft.Deferred"),i=this;return Ext.Ajax.request({url:document.URL,params:{id:1},success:function(t){if(text=t.responseText,CHECKSUM){var e=i._generateChecksum(text);if(CHECKSUM!==e)return void o.resolve(!1)}o.resolve(!0)}}),o.promise},_addToContainer:function(t){var e=Ext.apply({xtype:"container",height:200,overflowY:!0},this.informationalConfig);t.add(e)},afterRender:function(){var t=Rally.getApp();if(!Ext.isEmpty(this.informationalConfig)){var e=this.down("#information");this._addToContainer(e)}this.showLog&&this.logger&&this.down("#button_box").add({xtype:"rallybutton",text:"Show Log",listeners:{scope:this,click:function(){this.logger.displayLog()}}}),t.isExternal()?this.addDocked({xtype:"container",cls:"build-info",padding:2,dock:"bottom",html:"... Running externally"}):this._checkChecksum(t).then({scope:this,success:function(t){t||this.addDocked({xtype:"container",cls:"build-info",dock:"bottom",padding:2,html:'<span class="icon-warning"> </span>Checksums do not match'})},failure:function(t){console.log("oops:",t)}}),this.callParent(arguments)},beforeRender:function(){if(this.callParent(arguments),this.informationHtml&&this.addDocked({xtype:"component",componentCls:"intro-panel",padding:2,html:this.informationHtml,dock:"bottom"}),this.addDocked({xtype:"container",cls:"build-info",padding:2,dock:"bottom",html:"This app was created by the CA AC Technical Services Team."}),APP_BUILD_DATE){var t=Ext.String.format("Built on: {0} <br/>Built by: {1}",APP_BUILD_DATE,BUILDER);ARTIFACT&&(t=t+"<br/>Source artifact: "+ARTIFACT),this.addDocked({xtype:"container",cls:"build-info",padding:2,dock:"top",html:t})}}}),Ext.define("CArABU.technicalservices.Logger",{saveForLater:!1,saveLines:100,logArray:[],constructor:function(t){Ext.apply(this,t)},setSaveForLater:function(t){this.saveForLater=t},log:function(t){var e="[ "+Ext.util.Format.date(new Date,"Y-m-d H:i:s.u")+" ]",o=[];o=Ext.Array.push(o,[e]),o=Ext.Array.push(o,Ext.Array.slice(arguments,0)),this.saveForLater&&(this.logArray||(this.logArray=[]),this.logArray.push(o.join(" ")),this.logArray.length>this.saveLines&&this.logArray.shift()),window.console&&console.log.apply(console,o)},getLogText:function(){return this.logArray&&0!==this.logArray.length?this.logArray.join("<br/>"):"-- no log --"},displayLog:function(){var t=this.getLogText();this.popup=Ext.create("Rally.ui.dialog.Dialog",{width:Ext.getBody().getWidth()-20,height:Ext.getBody().getHeight()-20,closable:!0,title:"Log",autoShow:!0,layout:"border",defaults:{layout:"fit",width:"50%",border:!1},items:[{region:"center",xtype:"container",html:t,autoScroll:!0}]})}}),Ext.define("TSUtilities",{singleton:!0,loadWsapiRecords:function(t){var i=Ext.create("Deft.Deferred");return Ext.create("Rally.data.wsapi.Store",Ext.Object.merge({model:"Defect",fetch:["ObjectID"]},t)).load({callback:function(t,e,o){o?i.resolve(t):(console.error("Failed: ",e),i.reject("Problem loading: "+e.error.errors.join(". ")))}}),i.promise},loadAStoreWithAPromise:function(t,e){var i=Ext.create("Deft.Deferred");return Ext.create("Rally.data.wsapi.Store",{model:t,fetch:e}).load({callback:function(t,e,o){o?i.resolve(this):(console.error("Failed: ",e),i.reject("Problem loading: "+e.error.errors.join(". ")))}}),i.promise}}),Ext.define("gl.app.lac.Base",{extend:"Rally.app.App",componentCls:"app",logger:new CArABU.technicalservices.Logger,defaults:{margin:10},integrationHeaders:{name:"CArABU.app.TSApp"},config:{defaultSettings:{authToken:"mylacauthtoken",host:"my.lac.server.com"},slamUrl:"/rest/default/orchestrator/v1/mys:vw_slam_summary"},showErrorMessage:function(t){Rally.ui.notify.Notifier.showError({message:t,allowHTML:!0})},showAppBanner:function(t){Rally.ui.notify.Notifier.show({message:t,allowHTML:!0,timeout:1e4})},showAppMessage:function(t,e){t.add({xtype:"container",html:Ext.String.format('<div class="no-data-container"><div class="secondary-message">{0}</div></div>',e)})},loadData:function(t){var e=this,o=Ext.create("Deft.Deferred"),i=new XMLHttpRequest;return i.open("GET",t),i.setRequestHeader("Authorization","CALiveAPICreator "+this.getAuthToken()+":1"),i.onreadystatechange=function(){200==this.status&&4==this.readyState&&(e.logger.log("_loadLACData.response: ",this.responseText),o.resolve(Ext.JSON.decode(this.responseText)))},i.send(),o.promise},putData:function(t,e){var o=this,i=Ext.create("Deft.Deferred"),a=JSON.stringify(e),n=new XMLHttpRequest;return n.open("PUT",t),n.setRequestHeader("Authorization","CALiveAPICreator "+this.getAuthToken()+":1"),n.setRequestHeader("Content-type","application/json; charset=utf-8"),n.onreadystatechange=function(){200==this.status&&4==this.readyState&&(o.logger.log("putData.response: ",this.responseText),i.resolve(Ext.JSON.decode(this.responseText)))},n.send(a),i.promise},getUrl:function(t){var e=this.config[t]||this.getSetting(t);return this.getHost()+e},getHost:function(){return"https://"+this.getSetting("host")},getAuthToken:function(){return this.getSetting("authToken")},getSettingsFields:function(){return[{name:"authToken",xtype:"rallytextfield",fieldLabel:"Auth Token",labelWidth:150,width:400},{name:"host",xtype:"rallytextfield",fieldLabel:"Host (without protocol)",labelWidth:150,width:400}]},getOptions:function(){return[{text:"About...",handler:this._launchInfo,scope:this}]},_launchInfo:function(){this.about_dialog&&this.about_dialog.destroy(),this.about_dialog=Ext.create("Rally.technicalservices.InfoLink",{showLog:this.getSetting("saveLog"),logger:this.logger})},isExternal:function(){return void 0===this.getAppId()}}),Ext.define("Rally.technicalservices.InfoLink",{extend:"Rally.ui.dialog.Dialog",alias:"widget.tsinfolink",informationHtml:null,title:"Build Information",defaults:{padding:5,margin:5},closable:!0,draggable:!0,autoShow:!0,width:350,informationalConfig:null,showLog:!1,logger:null,items:[{xtype:"container",itemId:"information"},{xtype:"container",itemId:"button_box"}],initComponent:function(){Ext.id(this);this.title="<span class='icon-help'> </span>"+this.title,this.callParent(arguments)},_generateChecksum:function(t){var e,o=305419896;for(t=(t=(t=t.replace(/var CHECKSUM = .*;/,"")).replace(/var BUILDER = .*;/,"")).replace(/\s/g,""),e=0;e<t.length;e++)o+=t.charCodeAt(e)*e;return o},_checkChecksum:function(t){var o=Ext.create("Deft.Deferred"),i=this;return Ext.Ajax.request({url:document.URL,params:{id:1},success:function(t){if(text=t.responseText,CHECKSUM){var e=i._generateChecksum(text);if(CHECKSUM!==e)return void o.resolve(!1)}o.resolve(!0)}}),o.promise},_addToContainer:function(t){var e=Ext.apply({xtype:"container",height:200,overflowY:!0},this.informationalConfig);t.add(e)},afterRender:function(){var t=Rally.getApp();if(!Ext.isEmpty(this.informationalConfig)){var e=this.down("#information");this._addToContainer(e)}this.showLog&&this.logger&&this.down("#button_box").add({xtype:"rallybutton",text:"Show Log",listeners:{scope:this,click:function(){this.logger.displayLog()}}}),t.isExternal()?this.addDocked({xtype:"container",cls:"build-info",padding:2,dock:"bottom",html:"... Running externally"}):this._checkChecksum(t).then({scope:this,success:function(t){t||this.addDocked({xtype:"container",cls:"build-info",dock:"bottom",padding:2,html:'<span class="icon-warning"> </span>Checksums do not match'})},failure:function(t){console.log("oops:",t)}}),this.callParent(arguments)},beforeRender:function(){if(this.callParent(arguments),this.informationHtml&&this.addDocked({xtype:"component",componentCls:"intro-panel",padding:2,html:this.informationHtml,dock:"bottom"}),this.addDocked({xtype:"container",cls:"build-info",padding:2,dock:"bottom",html:"This app was created by the CA AC Technical Services Team."}),APP_BUILD_DATE){var t=Ext.String.format("Built on: {0} <br/>Built by: {1}",APP_BUILD_DATE,BUILDER);ARTIFACT&&(t=t+"<br/>Source artifact: "+ARTIFACT),this.addDocked({xtype:"container",cls:"build-info",padding:2,dock:"top",html:t})}}}),Ext.define("CArABU.technicalservices.Logger",{saveForLater:!1,saveLines:100,logArray:[],constructor:function(t){Ext.apply(this,t)},setSaveForLater:function(t){this.saveForLater=t},log:function(t){var e="[ "+Ext.util.Format.date(new Date,"Y-m-d H:i:s.u")+" ]",o=[];o=Ext.Array.push(o,[e]),o=Ext.Array.push(o,Ext.Array.slice(arguments,0)),this.saveForLater&&(this.logArray||(this.logArray=[]),this.logArray.push(o.join(" ")),this.logArray.length>this.saveLines&&this.logArray.shift()),window.console&&console.log.apply(console,o)},getLogText:function(){return this.logArray&&0!==this.logArray.length?this.logArray.join("<br/>"):"-- no log --"},displayLog:function(){var t=this.getLogText();this.popup=Ext.create("Rally.ui.dialog.Dialog",{width:Ext.getBody().getWidth()-20,height:Ext.getBody().getHeight()-20,closable:!0,title:"Log",autoShow:!0,layout:"border",defaults:{layout:"fit",width:"50%",border:!1},items:[{region:"center",xtype:"container",html:t,autoScroll:!0}]})}}),Ext.define("TSUtilities",{singleton:!0,loadWsapiRecords:function(t){var i=Ext.create("Deft.Deferred");return Ext.create("Rally.data.wsapi.Store",Ext.Object.merge({model:"Defect",fetch:["ObjectID"]},t)).load({callback:function(t,e,o){o?i.resolve(t):(console.error("Failed: ",e),i.reject("Problem loading: "+e.error.errors.join(". ")))}}),i.promise},loadAStoreWithAPromise:function(t,e){var i=Ext.create("Deft.Deferred");return Ext.create("Rally.data.wsapi.Store",{model:t,fetch:e}).load({callback:function(t,e,o){o?i.resolve(this):(console.error("Failed: ",e),i.reject("Problem loading: "+e.error.errors.join(". ")))}}),i.promise}}),Ext.define("gl.app.lac.performance.RxByMonth",{extend:"gl.app.lac.Base",componentCls:"app",logger:new CArABU.technicalservices.Logger,defaults:{margin:10},config:{rxUrl:"/rest/default/orchestrator/v1/mys:vw_metrics_rx_month_catalyst"},launch:function(){this.callParent(arguments),this._display()},_display:function(){this.setLoading("Loading reaction data...");var t=this;this.down("#displayBox")||this.add({xtype:"container",itemId:"displayBox"}),this.down("#displayBox").removeAll();Deft.Promise.all([this.loadData(this.getUrl("rxUrl")+"?sysfilter=greaterequal(year:2018)&sysorder=(year:asc, month:asc)&pagesize=1000")]).then({scope:this,success:this._buildVisual,failure:this.showErrorMessage}).always(function(){t.setLoading(!1)})},_buildVisual:function(t){var e=t&&t[0]||null;if(e&&0!==e.length){var o={categories:[],series:[]},i=[];_.each(e,function(t){i.push(t.reaction_count);var e=new Date(t.year,t.month-1);o.categories.push(Rally.util.DateTime.format(e,"F y"))}),o.series.push({data:i,name:"Reaction Count"}),this.add({xtype:"rallychart",itemId:"reactionsGraph",loadMask:!1,chartColors:["#8DC63F"],chartData:o,chartConfig:{chart:{type:"column"},title:{text:"Reactions per Month",style:{color:"#666",fontSize:"18px",fontFamily:"ProximaNova",fill:"#666"}},xAxis:{tickmarkPlacement:"on",labels:{rotation:45,style:{color:"#444",fontFamily:"ProximaNova",textTransform:"uppercase",fill:"#444"}},title:{text:"Month",margin:10,style:{color:"#444",fontFamily:"ProximaNova",textTransform:"uppercase",fill:"#444"}}},yAxis:{min:0,title:{text:"Reaction Count",style:{color:"#444",fontFamily:"ProximaNova",textTransform:"uppercase",fill:"#444"}}},legend:{enabled:!1}}})}else this.showAppMessage(this.down("#displayBox"),"No data to display")}});
Rally.launchApp('gl.app.lac.performance.RxByMonth', {
name: 'Reaction by Month'
});
});
</script>
<style type="text/css">
.app {
}
.tsinfolink {
position:absolute;
right:0px;
width: 14px;
height: 14px;
border-radius: 7px;
text-align: center;
color: white;
background: #C0C0C0;
border-style: solid;
border-width: 1px;
margin-top: 25px;
margin-right: 5px;
cursor: pointer;
}
.highcharts-tooltip {
font-family:NotoSansBold;
color:white;
}
.tooltip-point {
text-align: right;
color: white;
}
.tooltip-label {
font-family:NotoSans;
white-space:nowrap;
font-size:13px;
color:white;
}
.etlDate {
color: grey;
font-family:NotoSans;
font-style: italic;
}
.app {
}
.tsinfolink {
position:absolute;
right:0px;
width: 14px;
height: 14px;
border-radius: 7px;
text-align: center;
color: white;
background: #C0C0C0;
border-style: solid;
border-width: 1px;
margin-top: 25px;
margin-right: 5px;
cursor: pointer;
}
</style>
</head>
<body></body>
</html>