forked from RallyApps/app-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.js
125 lines (122 loc) · 5.02 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
(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.picker.FieldPicker',
'Rally.ui.TextField',
'Rally.ui.NumberField'
],
getFields: function(context) {
var alwaysSelectedValues = ['FormattedID', 'Name', 'Owner', 'BlockedReason'];
return [
{
name: 'type',
xtype: 'rallycombobox',
shouldRespondToScopeChange: true,
context: context,
storeConfig: {
model: Ext.identityFn('TypeDefinition'),
sorters: [
{
property: 'Name'
}
],
fetch: ['DisplayName', 'ElementName', 'TypePath'],
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');
Rally.data.ModelFactory.getModels({
context: combo.context.getDataContext(),
types: Ext.Array.map(combo.store.getRange(), function(record) {
return record.get('TypePath');
}),
success: function(models) {
combo.store.filterBy(function(record) {
return models[record.get('TypePath')].hasField('FormattedID');
});
combo.fireEvent('typeselected', combo.getRecord().get('TypePath'), combo.context);
}
});
}
},
bubbleEvents: ['typeselected'],
readyEvent: 'ready',
handlesEvents: {
projectscopechanged: function(context) {
this.refreshWithNewContext(context);
}
}
},
{
name: 'groupByField',
fieldLabel: 'Group By',
xtype: 'rallyfieldcombobox',
readyEvent: 'ready',
handlesEvents: {
typeselected: function(type, context) {
this.refreshWithNewModelType(type, context);
}
},
listeners: {
ready: function(combo) {
combo.store.filterBy(function(record) {
var attr = record.get('fieldDefinition').attributeDefinition;
return attr && !attr.ReadOnly && attr.Constrained && attr.AttributeType !== 'COLLECTION';
});
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: 'fields',
fieldLabel: 'Card Fields',
xtype: 'rallyfieldpicker',
alwaysSelectedValues: alwaysSelectedValues,
handlesEvents: {
typeselected: function(type, context) {
this.refreshWithNewModelTypes([type], context);
}
}
},
{
name: 'order',
xtype: 'rallytextfield'
},
{
name: 'pageSize',
xtype: 'rallynumberfield',
fieldLabel: 'Page Size'
},
{
type: 'query'
}
];
}
});
})();