Skip to content

Commit 7abd49a

Browse files
authored
Merge pull request #27 from RallyTechServices/projectScope
Project scope
2 parents 015dc96 + f942ff3 commit 7abd49a

File tree

6 files changed

+79
-22
lines changed

6 files changed

+79
-22
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ When user story is selected as the root type:
2626

2727
* **Export User Stories and Child Items...** Stories, tasks, defects, and test cases will be exported. Test cases that are children of defects (that are children of stories) will be exported, as will defects that are children of test cases that are children of stories. If a defect is a child of a story and is also a child of a test case that is displayed, the defect may not appear where you expect.
2828

29+
If this app is on a Timebox Scoped page, then the appropriate timebox filter
30+
will be applied if the Timebox is valid for the queried model. If the Timebox
31+
is not valid for the selected model, then the Timebox scope will be ignored.
32+
33+
If the page is scoped to a Milestone Timebox, there is an additional setting
34+
to allow the user to respect or ignore the global project setting. This is
35+
useful when Portfolio Items associated with a specific Milestone are not
36+
constrained to a specific subset of the Project Hierarchy tree.
37+
2938
### Caveats
3039
* If an item has a parent that is out of scope, then that item's relationship will not be seen.
3140

deploy/Ugly.txt

Lines changed: 15 additions & 11 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "custom-grid-with-deep-export",
3-
"version": "1.2.0",
3+
"version": "1.2.1-1",
44
"scripts": {
55
"debug": "grunt debug",
66
"debug:watch": "nodemon --exec grunt debug",

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)