Revert "[APPS-1905] Using the new requirements JS API to fetch requirements"
This commit is contained in:
Родитель
0dd9efe8b4
Коммит
f91dd9c644
26
app.js
26
app.js
|
@ -16,6 +16,15 @@
|
|||
)
|
||||
};
|
||||
},
|
||||
fetchRequirements: function() {
|
||||
return {
|
||||
url: helpers.fmt(
|
||||
'/api/v2/apps/installations/%@/requirements.json',
|
||||
this.installationId()
|
||||
),
|
||||
dataType: 'json'
|
||||
};
|
||||
},
|
||||
fetchTicketForms: function(url) {
|
||||
return {
|
||||
url: url || '/api/v2/ticket_forms.json'
|
||||
|
@ -31,6 +40,7 @@
|
|||
'ticket.save' : 'onTicketSave',
|
||||
'ticket.submit.done' : 'onTicketSubmitDone',
|
||||
'ticket.form.id.changed' : 'onTicketFormChanged',
|
||||
'fetchRequirements.done' : 'onFetchRequirementsDone',
|
||||
'fetchAuditsPage.done' : 'onFetchAuditsPageDone',
|
||||
'fetchAllAudits.done' : 'onFetchAllAuditsDone',
|
||||
'click .pause' : 'onPauseClicked',
|
||||
|
@ -49,12 +59,7 @@
|
|||
*/
|
||||
onAppCreated: function() {
|
||||
if (this.installationId()) {
|
||||
var totalTimeField = this.requirement('total_time_field'),
|
||||
timeLastUpdateField = this.requirement('time_last_update_field');
|
||||
this.storage.totalTimeFieldId = totalTimeField && totalTimeField.requirement_id;
|
||||
this.storage.timeFieldId = timeLastUpdateField && timeLastUpdateField.requirement_id;
|
||||
|
||||
this.initialize();
|
||||
this.ajax('fetchRequirements');
|
||||
} else {
|
||||
_.defer(this.initialize.bind(this));
|
||||
this.storage.totalTimeFieldId = parseInt(this.setting('total_time_field_id'), 10);
|
||||
|
@ -141,6 +146,15 @@
|
|||
this.renderTimelogs(timelogs.reverse());
|
||||
},
|
||||
|
||||
onFetchRequirementsDone: function(data) {
|
||||
var totalTimeField = this._findWhere(data.requirements, {identifier: 'total_time_field'});
|
||||
var timeLastUpdateField = this._findWhere(data.requirements, {identifier: 'time_last_update_field'});
|
||||
this.storage.totalTimeFieldId = totalTimeField && totalTimeField.requirement_id;
|
||||
this.storage.timeFieldId = timeLastUpdateField && timeLastUpdateField.requirement_id;
|
||||
|
||||
this.initialize();
|
||||
},
|
||||
|
||||
onPauseClicked: function(e) {
|
||||
var $el = this.$(e.currentTarget);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче