Skip to content

Commit 70de9c4

Browse files
authored
Merge pull request #36 from RallyTechServices/listener
Listener
2 parents 67022e5 + 30ecbd8 commit 70de9c4

File tree

6 files changed

+59
-22
lines changed

6 files changed

+59
-22
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
Note that as with other custom lists, the filter is only applied at the root level.
66

77
Additionally, items can be filtered by an ancestor portfolio item. (e.g. filter Features that are ultimately children of the higher level Theme).
8+
If placed on a page that also has a [pi-ancestor-filter-broadcaster](https://github.com/RallyTechServices/pi-ancestor-filter-broadcaster),
9+
and filter by ancestor portfolio item is enabled, it will listen to the broadcaster for the selected ancestor.
810

911
Several export options are provided and change depending on the root record type
1012
chosen in Edit App Settings...

config.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"apiKey": "_PUT_APIKEY_HERE_",
66
"javascript": [
77
"node_modules/@agile-central-technical-services/utils-shared-views/index.js",
8+
"node_modules/@agile-central-technical-services/utils-ancestor-pi-app-filter/index.js",
89
"node_modules/@agile-central-technical-services/utils-ancestor-pi-inline-filter/index.js",
910
"src/javascript/utils/*.js",
1011
"src/javascript/*.js"

deploy/Ugly.txt

+6-5
Large diffs are not rendered by default.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "custom-grid-with-deep-export",
3-
"version": "1.2.11",
3+
"version": "1.3.0",
44
"scripts": {
55
"debug": "grunt debug",
66
"debug:watch": "nodemon --exec grunt debug",
@@ -9,6 +9,7 @@
99
"deploy-debugsdk:watch": "nodemon --exec grunt deploy-debugsdk"
1010
},
1111
"dependencies": {
12+
"@agile-central-technical-services/utils-ancestor-pi-app-filter": "^2.1.0",
1213
"@agile-central-technical-services/utils-ancestor-pi-inline-filter": "^1.0.12",
1314
"@agile-central-technical-services/utils-shared-views": "^1.0.2"
1415
},

src/javascript/app.js

+44-16
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ Ext.define("custom-grid-with-deep-export", {
77
align: 'stretch'
88
},
99
items: [{
10+
id: Utils.AncestorPiAppFilter.RENDER_AREA_ID,
11+
xtype: 'container',
12+
layout: {
13+
type: 'hbox',
14+
align: 'middle',
15+
defaultMargins: '0 10 10 0',
16+
}
17+
}, {
1018
id: 'grid-area',
1119
xtype: 'container',
1220
flex: 1,
@@ -40,22 +48,37 @@ Ext.define("custom-grid-with-deep-export", {
4048
this._buildStore();
4149
},
4250
launch: function() {
43-
Rally.data.util.PortfolioItemHelper.getPortfolioItemTypes()
44-
.then({
45-
success: function(portfolioItemTypes) {
46-
this.portfolioItemTypes = _.sortBy(portfolioItemTypes, function(type) {
47-
return type.get('Ordinal');
48-
});
49-
this._buildStore();
50-
},
51-
failure: function(msg) {
52-
this._showError(msg);
51+
this.ancestorFilterPlugin = Ext.create('Utils.AncestorPiAppFilter', {
52+
ptype: 'UtilsAncestorPiAppFilter',
53+
pluginId: 'ancestorFilterPlugin',
54+
settingsConfig: {
55+
//labelWidth: 150,
56+
//margin: 10
57+
},
58+
listeners: {
59+
scope: this,
60+
ready: function(plugin) {
61+
Rally.data.util.PortfolioItemHelper.getPortfolioItemTypes().then({
62+
scope: this,
63+
success: function(portfolioItemTypes) {
64+
this.portfolioItemTypes = _.sortBy(portfolioItemTypes, function(type) {
65+
return type.get('Ordinal');
66+
});
67+
68+
plugin.addListener({
69+
scope: this,
70+
select: this.viewChange
71+
});
72+
this.viewChange();
73+
},
74+
failure: function(msg) {
75+
this._showError(msg);
76+
},
77+
})
5378
},
54-
scope: this
55-
});
56-
var listenerConfig = {
57-
scope: this
58-
}
79+
}
80+
});
81+
this.addPlugin(this.ancestorFilterPlugin);
5982
},
6083

6184
// Usual monkey business to size gridboards
@@ -93,11 +116,17 @@ Ext.define("custom-grid-with-deep-export", {
93116
var gridArea = this.down('#grid-area')
94117
gridArea.removeAll();
95118

119+
var currentModelName = this.modelNames[0];
120+
96121
var filters = this.getSetting('query') ? [Rally.data.wsapi.Filter.fromQueryString(this.getSetting('query'))] : [];
97122
var timeboxScope = this.getContext().getTimeboxScope();
98123
if (timeboxScope && timeboxScope.isApplicable(store.model)) {
99124
filters.push(timeboxScope.getQueryFilter());
100125
}
126+
var ancestorFilter = this.ancestorFilterPlugin.getFilterForType(currentModelName);
127+
if (ancestorFilter) {
128+
filters.push(ancestorFilter);
129+
}
101130
this.logger.log('_addGridboard', store);
102131

103132
var context = this.getContext();
@@ -106,7 +135,6 @@ Ext.define("custom-grid-with-deep-export", {
106135
dataContext.project = null;
107136
}
108137
var summaryRowFeature = Ext.create('Rally.ui.grid.feature.SummaryRow');
109-
var currentModelName = this.modelNames[0];
110138
this.gridboard = gridArea.add({
111139
xtype: 'rallygridboard',
112140
context: context,

yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# yarn lockfile v1
33

44

5+
"@agile-central-technical-services/utils-ancestor-pi-app-filter@^2.1.0":
6+
version "2.1.0"
7+
resolved "https://registry.yarnpkg.com/@agile-central-technical-services/utils-ancestor-pi-app-filter/-/utils-ancestor-pi-app-filter-2.1.0.tgz#a2417a0aa43cce28f6c0cc34a7f3d6a898f6e2bf"
8+
59
"@agile-central-technical-services/utils-ancestor-pi-inline-filter@^1.0.12":
610
version "1.0.12"
711
resolved "https://registry.yarnpkg.com/@agile-central-technical-services/utils-ancestor-pi-inline-filter/-/utils-ancestor-pi-inline-filter-1.0.12.tgz#eb82287496305bec975beea03ff7a510588e05ee"

0 commit comments

Comments
 (0)