Skip to content

Commit 67b7628

Browse files
committed
allow scope across workspace when milestone scoped page
1 parent 015dc96 commit 67b7628

File tree

3 files changed

+54
-10
lines changed

3 files changed

+54
-10
lines changed

src/javascript/app.js

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Ext.define("custom-grid-with-deep-export", {
1313
query: '',
1414
showControls: true,
1515
type: 'HierarchicalRequirement',
16-
pageSize: 50
16+
pageSize: 50,
17+
searchAllProjects: [{checked: false}],
1718
}
1819
},
1920

@@ -51,12 +52,17 @@ Ext.define("custom-grid-with-deep-export", {
5152
this.modelNames = [this.getSetting('type')];
5253
this.logger.log('_buildStore', this.modelNames);
5354
var fetch = ['FormattedID', 'Name'];
55+
var dataContext = this.getContext().getDataContext();
56+
if (this.searchAllProjects()) {
57+
dataContext.project = null;
58+
}
5459

5560
Ext.create('Rally.data.wsapi.TreeStoreBuilder').build({
5661
models: this.modelNames,
5762
enableHierarchy: true,
5863
remoteSort: true,
59-
fetch: fetch
64+
fetch: fetch,
65+
context: dataContext
6066
}).then({
6167
success: this._addGridboard,
6268
scope: this
@@ -75,10 +81,14 @@ Ext.define("custom-grid-with-deep-export", {
7581
}
7682
this.logger.log('_addGridboard', store);
7783

78-
84+
var context = this.getContext();
85+
var dataContext = context.getDataContext();
86+
if (this.searchAllProjects()) {
87+
dataContext.project = null;
88+
}
7989
this.gridboard = this.down('#display_box').add({
8090
xtype: 'rallygridboard',
81-
context: this.getContext(),
91+
context: context,
8292
modelNames: this.modelNames,
8393
toggleState: 'grid',
8494
plugins: [
@@ -126,7 +136,8 @@ Ext.define("custom-grid-with-deep-export", {
126136
gridConfig: {
127137
store: store,
128138
storeConfig: {
129-
filters: filters
139+
filters: filters,
140+
context: dataContext
130141
},
131142
columnCfgs: [
132143
'Name'
@@ -266,14 +277,18 @@ Ext.define("custom-grid-with-deep-export", {
266277
exporter.on('exporterror', this._showError, this);
267278
exporter.on('exportcomplete', this._showStatus, this);
268279

280+
var dataContext = this.getContext().getDataContext();
281+
if (this.searchAllProjects()) {
282+
dataContext.project = null;
283+
}
269284
var hierarchyLoader = Ext.create('Rally.technicalservices.HierarchyLoader',{
270285
model: modelName,
271286
fetch: fetch,
272287
filters: filters,
273288
sorters: sorters,
274289
loadChildModels: childModels,
275290
portfolioItemTypes: this.portfolioItemTypes,
276-
context: this.getContext().getDataContext()
291+
context: dataContext
277292
});
278293
hierarchyLoader.on('statusupdate', this._showStatus, this);
279294
hierarchyLoader.on('hierarchyloadartifactsloaded', exporter.setRecords, exporter);
@@ -315,8 +330,26 @@ Ext.define("custom-grid-with-deep-export", {
315330
isExternal: function(){
316331
return typeof(this.getAppId()) == 'undefined';
317332
},
333+
334+
isMilestoneScoped: function() {
335+
var result = false;
336+
337+
var tbscope = this.getContext().getTimeboxScope();
338+
if (tbscope && tbscope.getType() == 'milestone') {
339+
result = true;
340+
}
341+
return result
342+
},
343+
344+
searchAllProjects: function() {
345+
var searchAllProjects = this.getSetting('searchAllProjects');
346+
return this.isMilestoneScoped() && searchAllProjects;
347+
},
348+
318349
getSettingsFields: function(){
319-
return Rally.technicalservices.CustomGridWithDeepExportSettings.getFields();
350+
return Rally.technicalservices.CustomGridWithDeepExportSettings.getFields({
351+
showSearchAllProjects: this.isMilestoneScoped()
352+
});
320353
},
321354
//onSettingsUpdate: Override
322355
onSettingsUpdate: function (settings){

src/javascript/utils/hierarchy-loader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ Ext.define('Rally.technicalservices.HierarchyLoader',{
9797
model: this.model,
9898
fetch: fetch,
9999
filters: this.filters,
100-
sorters: this.sorters
100+
sorters: this.sorters,
101+
context: this.context
101102
};
102103
this.logger.log('fetchRoot config', config);
103104

src/javascript/utils/settings.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,31 @@
2222
'Rally.ui.CheckboxField'
2323
],
2424

25-
getFields: function (context) {
25+
getFields: function (config) {
2626

2727
var type_filters = Rally.data.wsapi.Filter.or([
2828
{property: 'TypePath', value: 'HierarchicalRequirement'},
2929
{property: 'TypePath', operator: 'contains', value: 'PortfolioItem/'}
3030
]);
3131

3232
return [
33+
{
34+
id:'searchAllProjects',
35+
name:'searchAllProjects',
36+
fieldLabel: 'Scope Across Workspace',
37+
labelAlign: 'left',
38+
xtype:'rallycheckboxfield',
39+
labelWidth: 150,
40+
margin: 10,
41+
hidden: !config.showSearchAllProjects
42+
},
3343
{
3444
name: 'type',
3545
xtype: 'rallycombobox',
3646
allowBlank: false,
3747
autoSelect: false,
3848
shouldRespondToScopeChange: true,
39-
context: context,
49+
context: config.context,
4050
initialValue: 'HierarchicalRequirement',
4151
storeConfig: {
4252
model: Ext.identityFn('TypeDefinition'),

0 commit comments

Comments
 (0)