-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
52 lines (47 loc) · 1.5 KB
/
App.js
File metadata and controls
52 lines (47 loc) · 1.5 KB
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
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
Rally.data.wsapi.ModelFactory.getModels({
types: ['userstory', 'attributedefinition', 'allowedattributevalue']
}).then({
success: this._createField,
scope: this
});
},
_createField: function(models) {
this.models = models;
//hack to make required fields persistable
_.each(['AttributeType', 'RealAttributeType', 'Constrained', 'TypeDefinition'], function(fieldName) {
this.models.attributedefinition.getField(fieldName).persist = true;
}, this);
//end hack
var newField = Ext.create(this.models.attributedefinition, {
AttributeType: 'STRING',
RealAttributeType: 'DROP_DOWN',
Constrained: true,
Custom: true,
Filterable: true,
Sortable: true,
Name: 'MyDropdownField',
TypeDefinition: this.models.userstory.typeDefinition._ref
});
newField.save().then({
success: this._createValue,
scope: this
});
},
_createValue: function(field) {
var newValue = Ext.create(this.models.allowedattributevalue, {
StringValue: 'D',
ValueIndex: 0,
AttributeDefinition: Rally.util.Ref.getRelativeUri(field)
});
newValue.save().then({
success: function() {
console.log('winning');
},
scope: this
});
}
});