forked from Echo3ToEcho7/app-catalog
-
Notifications
You must be signed in to change notification settings - Fork 192
/
Copy pathSettings.js
140 lines (138 loc) · 6.46 KB
/
Settings.js
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
(function () {
var Ext = window.Ext4 || window.Ext;
Ext.define('Rally.apps.board.Settings', {
singleton: true,
requires: [
'Rally.ui.combobox.FieldComboBox',
'Rally.ui.combobox.ComboBox',
'Rally.ui.TextField',
'Rally.ui.NumberField',
'Rally.apps.common.RowSettingsField',
'Rally.data.wsapi.Filter'
],
getFields: function (context) {
return [
{
name: 'type',
xtype: 'rallycombobox',
shouldRespondToScopeChange: true,
context: context,
storeConfig: {
model: Ext.identityFn('TypeDefinition'),
sorters: [
{
property: 'Name'
}
],
fetch: ['DisplayName', 'ElementName', 'TypePath', 'Parent'],
filters: [
{
property: 'Creatable',
value: true
}
],
autoLoad: false,
remoteSort: false,
remoteFilter: true
},
displayField: 'DisplayName',
valueField: 'TypePath',
listeners: {
select: function (combo, records) {
combo.fireEvent('typeselected', records[0].get('TypePath'), combo.context);
},
ready: function (combo) {
combo.store.sort('DisplayName');
combo.store.filterBy(function(record) {
var parent = record.get('Parent'),
parentName = parent.ElementName;
return _.contains(['Artifact', 'SchedulableArtifact', 'Requirement', 'PortfolioItem'], parentName);
});
combo.fireEvent('typeselected', combo.getRecord().get('TypePath'), combo.context);
}
},
bubbleEvents: ['typeselected'],
readyEvent: 'ready',
handlesEvents: {
projectscopechanged: function (context) {
this.refreshWithNewContext(context);
}
}
},
{
name: 'groupByField',
fieldLabel: 'Columns',
xtype: 'rallyfieldcombobox',
readyEvent: 'ready',
handlesEvents: {
typeselected: function (type, context) {
this.refreshWithNewModelType(type, context);
}
},
listeners: {
ready: function (combo) {
combo.store.filterBy(function (record) {
var field = record.get('fieldDefinition'),
attr = field.attributeDefinition;
return attr && !attr.ReadOnly && !attr.Hidden && attr.Constrained && attr.AttributeType !== 'COLLECTION' &&
(!attr.AllowedValueType || attr.AllowedValueType._refObjectName !== 'User') &&
!_.contains(['Iteration', 'Release', 'Project'], attr.Name) &&
!field.isMappedFromArtifact;
});
var fields = Ext.Array.map(combo.store.getRange(), function (record) {
return record.get(combo.getValueField());
});
if (!Ext.Array.contains(fields, combo.getValue())) {
combo.setValue(fields[0]);
}
}
}
},
{
name: 'groupHorizontallyByField',
xtype: 'rowsettingsfield',
fieldLabel: 'Swimlanes',
mapsToMultiplePreferenceKeys: ['showRows', 'rowsField'],
readyEvent: 'ready',
isAllowedFieldFn: function(field) {
var attr = field.attributeDefinition;
return (attr.Custom && (attr.Constrained || attr.AttributeType.toLowerCase() !== 'string') ||
attr.Constrained || _.contains(['quantity', 'boolean'], attr.AttributeType.toLowerCase()) ||
(!attr.Constrained && attr.AttributeType.toLowerCase() === 'object')) &&
!_.contains(['web_link', 'text', 'date'], attr.AttributeType.toLowerCase()) &&
!_.contains(['PortfolioItemType', 'LastResult'], attr.ElementName);
},
handlesEvents: {
typeselected: function(type, context) {
this.refreshWithNewModelType(type, context);
}
}
},
{
name: 'order',
fieldLabel: 'Order',
xtype: 'rallyfieldcombobox',
readyEvent: 'ready',
handlesEvents: {
typeselected: function(type, context) {
this.refreshWithNewModelType(type, context);
}
},
listeners: {
ready: function (combo) {
combo.store.filterBy(function (record) {
var field = record.get('fieldDefinition'),
attr = field.attributeDefinition;
return attr && attr.Sortable && !field.isMappedFromArtifact;
});
}
},
initialValue: context.getWorkspace().WorkspaceConfiguration.DragDropRankingEnabled ? 'DragAndDropRank' : 'Rank'
},
{
type: 'query'
}
];
}
});
})();