-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStory Dependency Schedule
102 lines (76 loc) · 15.1 KB
/
Story Dependency Schedule
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
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html>
<head>
<title>CATS-Story Dependency Schedule-1.0.7</title>
<!-- (c) 2017 CA Technologies. All Rights Reserved. -->
<!-- Build Date: Wed Jul 11 2018 15:46:56 GMT+0000 (UTC) -->
<script type="text/javascript">
var APP_BUILD_DATE = "Wed Jul 11 2018 15:46:56 GMT+0000 (UTC)";
var ARTIFACT = "";
var BUILDER = "ec2-user";
var CHECKSUM = 10451217739;
</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("Renderers",{singleton:!0,alternateRowModifier:function(a,b,c,d,e){var f=[e.toLowerCase()],g=b.get(Constants.ID.STORY).id;if(0==c)b.alternateRow=!1;else{var h=d.getAt(c-1);g!=h.get(Constants.ID.STORY).id?(b.alternateRow=!h.alternateRow,f.push(Constants.CLASS.FIRST_IN_GROUP)):(b.alternateRow=h.alternateRow,e===Constants.ID.STORY&&f.push(Constants.CLASS.HIDDEN))}b.alternateRow&&f.push(Constants.CLASS.ALTERNATE_ROW),a.tdCls=a.tdCls+" "+f.join(" ")},featureRenderer:function(a,b,c,d,e,f){try{var g=b.get(e).get(f.dataIndex),h=Rally.nav.DetailLink.getLink({record:g,text:g.FormattedID})+": "+g._refObjectName}catch(i){h=""}return Renderers.alternateRowModifier(a,b,c,d,e),h}}),Ext.override(Rally.ui.grid.CellRendererFactory,{createRendererFunction:function(a){var b=this.callParent(arguments);return function(c,d,e,f,g,h,i){var j,k=e,l=a.__subDataIndex;return l&&(k=e.get(l)),j=k?b(c,d,k,f,g,h,i):"",Renderers.alternateRowModifier(d,e,f,h,l),j}}}),Ext.define("CA.technicalservices.userutilities.FieldPicker",{alias:"widget.tsfieldpickerbutton",extend:"Rally.ui.Button",requires:["Rally.ui.popover.Popover","Rally.ui.Button","Rally.ui.picker.FieldPicker","Ext.state.Manager"],toolTipConfig:{html:"Show Columns",anchor:"top"},iconCls:"icon-add-column",cls:"field-picker-btn secondary rly-small",alwaysSelectedValues:["FormattedID","Name"],fieldBlackList:[],fieldPickerConfig:{},buttonConfig:{},modelNames:["User"],rankingEnabled:!1,constructor:function(a){this.config=_.merge({},this.config||{},a||{}),this.callParent([a])},initComponent:function(){if(this.models)return this.on("click",this._createPopover,this),void this.callParent(arguments);if(this.context&&this.modelNames&&this.modelNames.length>0)Rally.data.ModelFactory.getModels({types:this.modelNames,context:this.context,success:function(a){this.models=a},failure:function(a){console.log("failedparam")},scope:this}),this.on("click",this._createPopover,this);else{this.iconCls="icon-none";var a="Please update the CA.technicalservices.FieldPicker configuration with modelNames and context";this.toolTipConfig={html:'<div style="color:red;">'+a+"</div>"},this.on("click",function(){Rally.ui.notify.Notifier.showError({message:a})})}this.callParent(arguments)},getFields:function(){return _.union(this._fields||[],this.alwaysSelectedValues)},_getPickerConfig:function(){var a;return a=_.extend({value:this._fields,fieldBlackList:this.fieldBlackList,alwaysSelectedValues:this.alwaysSelectedValues,context:this.context},this.fieldPickerConfig)},_createPopover:function(a){var b=a.getEl();this.popover=Ext.create("Rally.ui.popover.Popover",{target:b,placement:["bottom","left","top","right"],cls:"field-picker-popover",toFront:Ext.emptyFn,buttonAlign:"center",title:this.getTitle(),listeners:{destroy:function(){this.popover=null},scope:this},buttons:[{xtype:"rallybutton",text:"Apply",cls:"field-picker-apply-btn primary rly-small",listeners:{click:function(){this._onApply(this.popover)},scope:this}},{xtype:"rallybutton",text:"Cancel",cls:"field-picker-cancel-btn secondary dark rly-small",listeners:{click:function(){this.popover.close()},scope:this}}],items:[_.extend({xtype:"rallyfieldpicker",cls:"field-picker",itemId:"fieldpicker",modelTypes:this._getModelTypes(),alwaysExpanded:!0,width:200,emptyText:"Search",selectedTextLabel:"Selected",availableTextLabel:"Available",listeners:{specialkey:function(a,b){b.getKey()===b.ESC&&this.popover.close()},scope:this}},this._getPickerConfig())]})},_getModelTypes:function(){return _.pluck(this._getModels(),"typePath")},_getModels:function(){return _.reduce(this.models,function(a,b){return"artifact"===b.typePath?a=a.concat(b.getArtifactComponentModels()):a.push(b),a},[])},getTitle:function(){return"Show Columns"},updateFields:function(a,b){this._fields=a,this.popover&&this.popover.down("rallyfieldpicker")&&this.popover.down("rallyfieldpicker").setValue(a.join(",")),this.saveState()},getState:function(){return{fields:this._fields}},applyState:function(a){a&&(this._fields=a.fields)},_onApply:function(a){var b=a.down("rallyfieldpicker"),c=_.map(b.getValue(),function(a){return a.get("name")});this.updateFields(c),a.close(),this.fireEvent("fieldsupdated",c)}}),Ext.define("Constants",function(a){return{statics:{DEFAULT_COLUMNS:["FormattedID","Name","Project"],ARTIFACT_FETCH_FIELDS:["Predecessors","Successors","Release","ReleaseStartDate","Iteration","StartDate","Name"],CLASS:{OK:"ok",WARNING:"warning",ERROR:"error",UNKNOWN:"unknown",ALTERNATE_ROW:"alternate-row",HIDDEN:"hidden",FIRST_IN_GROUP:"first-in-group"},ID:{STORY:"STORY",PREDECESSOR:"PREDECESSOR",SUCCESSOR:"SUCCESSOR"},LABEL:{UNSCHEDULED:"Unscheduled",DEPENDENCY_TYPE:"Dependency Type",SHOW_ALL:"Include items with no dependencies",STORY:"Story",PREDECESSOR:"Predecessor(s)",SUCCESSOR:"Successor(s)"},SETTING:{DEPENDENCY_TYPE:"DEPENDENCY_TYPE",STORY:"STORY"}}}}),Ext.define("MetricsManager",function(a){function b(a){return c(a).then({success:function(a){var b=Ext.create("Rally.data.custom.Store",{data:a});return b}})}function c(a){if(!a||0==a.length)return Deft.promise.Promise.when([]);var b=[];return _.forEach(a,function(a){var c=a.get("Predecessors"),d=a.get("Successors"),e=[];c.Count>0&&(e=a.getCollection("Predecessors",{limit:1/0,fetch:Rally.getApp().artifactFetchFields}).load());var f=[];if(d.Count>0&&(f=a.getCollection("Successors",{limit:1/0,fetch:Rally.getApp().artifactFetchFields}).load()),Rally.getApp().showItemsWithoutDependencies||c.Count>0||d.Count>0){var g=Deft.promise.Promise.all([e,f]).then({scope:this,success:function(b){var c=_.zip([a],b[0],b[1]);return _.map(c,function(b){var c={};return c[Constants.ID.STORY]=a,c[Constants.ID.PREDECESSOR]=b[1],c[Constants.ID.SUCCESSOR]=b[2],c})}});b.push(g)}}),0==b.length?result=Deft.promise.Promise.when([]):result=Deft.promise.Promise.all(b).then({success:function(a){var b=_.flatten(a);return b}}),result}return{statics:{createDependencyStore:b}}}),Ext.define("CArABU.app.TSApp",{extend:"Rally.app.App",componentCls:"app",defaults:{margin:10},config:{defaultSettings:{DEPENDENCY_TYPE:Constants.SETTING.STORY}},layout:{type:"vbox",align:"stretch"},items:[{xtype:"container",layout:{type:"hbox"},items:[{xtype:"container",itemId:"controlsArea"},{xtype:"container",flex:1},{xtype:"container",itemId:"settingsArea"}]},{xtype:"container",itemId:"filtersArea"}],integrationHeaders:{name:"CArABU.app.TSApp"},showItemsWithoutDependencies:!1,onTimeboxScopeChange:function(a){this.callParent(arguments),this.loadPrimaryStories(this.modelName)},initLowestPortfolioItemTypeName:function(){return Ext.create("Rally.data.wsapi.Store",{model:Ext.identityFn("TypeDefinition"),fetch:["Name","Ordinal","TypePath"],sorters:{property:"Ordinal",direction:"ASC"},filters:[{property:"Creatable",operator:"=",value:"true"},{property:"Parent.Name",operator:"=",value:"Portfolio Item"}]}).load().then({scope:this,success:function(a){return a[0].get("Name")}})},showFeatureDependencies:function(){return this.getSetting(Constants.SETTING.DEPENDENCY_TYPE)!=Constants.SETTING.STORY},getViewType:function(){return this.getSetting(Constants.SETTING.DEPENDENCY_TYPE)},getLowestPortfolioItemTypeName:function(){return this.lowestPortfolioItemTypeName||"Feature"},launch:function(){this.initLowestPortfolioItemTypeName().then({scope:this,success:function(a){this.lowestPortfolioItemTypeName=a,this.modelName="hierarchicalrequirement",this.showFeatureDependencies()&&(this.modelName="portfolioitem/"+this.getLowestPortfolioItemTypeName())}}).then({scope:this,success:function(){return this.loadModel(this.modelName)}}).then({scope:this,success:function(a){this.model=a,this.addFilters(this.modelName),this.addSettingsControls()}})},loadPrimaryStories:function(a){var b=this.down("#grid");b?b.setLoading("Loading..."):this.setLoading("Loading..."),this.artifactFetchFields=this.getFieldNames().concat(Constants.ARTIFACT_FETCH_FIELDS);var c=[],d=this.getContext().getTimeboxScope();d&&c.push(d.getQueryFilter());var e=this.getFiltersFromButton();e&&c.push(e),Ext.create("Rally.data.wsapi.Store",{model:a,autoLoad:!0,filters:c,limit:1/0,listeners:{scope:this,load:function(a,b){MetricsManager.createDependencyStore(b).then({scope:this,success:function(a){this.addGrid(a),this.setLoading(!1)}})}},fetch:this.artifactFetchFields})},addFilters:function(a){var b=this.down("#controlsArea"),c=["FormattedID","Name"];this.showFeatureDependencies()?c.push("Release"):c.push("Iteration"),b.add({xtype:"tsfieldpickerbutton",modelNames:[a],context:this.getContext(),stateful:!0,stateId:this.getViewType()+"fields",alwaysSelectedValues:c,listeners:{fieldsupdated:function(a){this.loadPrimaryStories(this.modelName)},scope:this}}),b.add({xtype:"rallyinlinefilterbutton",modelNames:[a],context:this.getContext(),stateful:!0,stateId:this.getViewType()+"filters",listeners:{inlinefilterready:this.addInlineFilterPanel,inlinefilterchange:function(a){this.filterButton=a,this.loadPrimaryStories(this.modelName)},scope:this}})},addSettingsControls:function(){var a=this.down("#settingsArea");a.add({xtype:"rallycheckboxfield",fieldLabel:Constants.LABEL.SHOW_ALL,labelWidth:200,name:"showItemsWithoutDependencies",value:this.showItemsWithoutDependencies,listeners:{scope:this,change:function(a,b){this.showItemsWithoutDependencies=b,this.loadPrimaryStories(this.modelName)}}})},addInlineFilterPanel:function(a){this.down("#filtersArea").add(a)},getFiltersFromButton:function(){var a=null;try{a=this.filterButton.getWsapiFilter()}catch(b){}return a},addGrid:function(a){var b=this.down("#grid");b&&this.remove(b),this.add({xtype:"rallygrid",itemId:"grid",flex:1,showRowActionsColumn:!1,enableColumnHide:!1,sortableColumns:!1,enableEditing:!1,rowLines:!1,store:a,columnCfgs:this.getColumns()})},getFieldNames:function(){try{var a=this.down("tsfieldpickerbutton").getFields()||Constants.DEFAULT_COLUMNS}catch(b){a=Constants.DEFAULT_COLUMNS}return a},getColumns:function(){return[{xtype:"gridcolumn",text:this.showFeatureDependencies()?this.getLowestPortfolioItemTypeName():Constants.LABEL.STORY,__subDataIndex:Constants.ID.STORY,columns:this.getSubColumns(Constants.ID.STORY)},{xtype:"gridcolumn",tdCls:"group-separator",width:4},{xtype:"gridcolumn",text:Constants.LABEL.PREDECESSOR,__subDataIndex:Constants.ID.PREDECESSOR,columns:this.getSubColumns(Constants.ID.PREDECESSOR)},{xtype:"gridcolumn",tdCls:"group-separator",width:4},{xtype:"gridcolumn",text:Constants.LABEL.SUCCESSOR,__subDataIndex:Constants.ID.SUCCESSOR,columns:this.getSubColumns(Constants.ID.SUCCESSOR)}]},getSubColumns:function(a){var b=this.getFieldNames(),c=_.map(b,function(b){var c,d=this.getColumnConfigFromModel(b);switch(d.dataIndex){case this.getLowestPortfolioItemTypeName():c={xtype:"gridcolumn",text:d.modelField.displayName,scope:this,renderer:function(b,c,e,f,g,h,i){return Renderers.featureRenderer(c,e,f,h,a,d)}};break;case"Release":case"Iteration":c={xtype:"gridcolumn",text:d.text,scope:this,renderer:function(b,c,e,f,g,h,i){var j;try{switch(a){case Constants.ID.PREDECESSOR:j=this.predecessorIterationRenderer(e,d.dataIndex);break;case Constants.ID.SUCCESSOR:j=this.successorIterationRenderer(e,d.dataIndex);break;default:j=this.primaryIterationRenderer(e,d.dataIndex)}}catch(k){j=""}return Renderers.alternateRowModifier(c,e,f,h,a),j}};break;default:c=d}return c.height=30,c.__subDataIndex=a,c.isCellEditable=!1,c},this);return c},loadModel:function(a){var b=new Deft.promise.Deferred;return Rally.data.wsapi.ModelFactory.getModel({type:a,context:this.getContext(),success:function(a){b.resolve(a)}}),b.getPromise()},getColumnConfigFromModel:function(a){var b=this.model.getField(a);if(_.isUndefined(b))return null;var c=Rally.ui.grid.FieldColumnFactory.getColumnConfigFromField(b,this.model);return c},getStartDateField:function(a){return"Release"===a?"ReleaseStartDate":"StartDate"},primaryIterationRenderer:function(a,b){var c=Constants.CLASS.OK;try{var d=a.get(Constants.ID.STORY).get(b).Name}catch(e){d=Constants.LABEL.UNSCHEDULED,c=Constants.CLASS.UNKNOWN}return this.colorsRenderer(d,c)},predecessorIterationRenderer:function(a,b){var c,d=this.getStartDateField(b),e=a.get(Constants.ID.STORY),f=a.get(Constants.ID.PREDECESSOR);if(f){var g,h=Constants.CLASS.OK,i=e.get(b),j=f.get(b);if(j&&i){g=j.Name;var k=i[d],l=j[d];k>l||(h=l==k?Constants.CLASS.WARNING:Constants.CLASS.ERROR)}else!j&&i?(g=Constants.LABEL.UNSCHEDULED,h=Constants.CLASS.ERROR):j&&!i?g=j.Name:j||i||(g="");c=this.colorsRenderer(g,h)}return c},successorIterationRenderer:function(a,b){var c,d=this.getStartDateField(b),e=a.get(Constants.ID.STORY),f=a.get(Constants.ID.SUCCESSOR);if(f){var g,h=Constants.CLASS.OK,i=e.get(b),j=f.get(b);if(j&&i){g=j.Name;var k=i[d],l=j[d];l>k||(h=l==k?Constants.CLASS.WARNING:Constants.CLASS.ERROR)}else!j&&i?(g=Constants.LABEL.UNSCHEDULED,h=Constants.CLASS.UNKNOWN):j&&!i?g=j.Name:j||i||(g="");c=this.colorsRenderer(g,h)}return c},colorsRenderer:function(a,b){return'<div class="status-color '+b+'">'+a+"</div>"},getSettingsFields:function(){var a=Ext.create("Rally.data.custom.Store",{data:[{Name:"User Story",Value:Constants.SETTING.STORY},{Name:this.getLowestPortfolioItemTypeName(),Value:this.getLowestPortfolioItemTypeName()}]});return[{xtype:"rallycombobox",name:Constants.SETTING.DEPENDENCY_TYPE,label:Constants.LABEL.DEPENDENCY_TYPE,displayField:"Name",valueField:"Value",store:a}]}});
Rally.launchApp('CArABU.app.TSApp', {
name: 'Story Dependency Schedule'
});
});
</script>
<style type="text/css">
.app {}
/* fix for grid hscroll when rows are tall and push hscroll off bottom of screen. Force it on */
.x-grid-body.x-panel-body {
overflow-y: auto;
}
/* pills for status indicators */
.status-color {
padding: 0 5px 0 5px;
border-radius: 50px;
}
/* use the same colors as Agile Central for Late, At-Risk and Not Started */
.error {
background-color: #F66349;
}
.warning {
background-color: #FAD200;
}
.unknown {
background-color: #E0E0E0;
}
/* visually divide rows into groups */
.group-separator {
border-left: solid 2px rgb(213, 213, 213);
border-right: solid 2px rgb(213, 213, 213);
}
/* highlight the group headers */
.x-group-header>.x-column-header-inner {
background-color: rgb(213, 213, 213);
}
.alternate-row {
background-color: rgb(244, 244, 244) !important;
}
.first-in-group {
border-top: 1px solid rgb(186, 185, 186);
/*border-bottom: 1px solid rgb(186, 185, 186);*/
}
.predecessor {
border-top: 1px solid rgb(186, 185, 186);
/*border-bottom: 1px solid rgb(186, 185, 186);*/
}
.successor {
border-top: 1px solid rgb(186, 185, 186);
/*border-bottom: 1px solid rgb(186, 185, 186);*/
}
.hidden {
visibility: hidden;
}
</style>
</head>
<body></body>
</html>