Repository: ambari Updated Branches: refs/heads/branch-2.5 65be27b59 -> 8474d83ec
AMBARI-19771. Hive View 2.0 - query duration changes to 0 when expanded. (dipayanb) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8474d83e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8474d83e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8474d83e Branch: refs/heads/branch-2.5 Commit: 8474d83ecfe322ade36c2b357930c0b0bd23560e Parents: 65be27b Author: Dipayan Bhowmick <[email protected]> Authored: Tue Jan 31 16:07:09 2017 +0530 Committer: Dipayan Bhowmick <[email protected]> Committed: Tue Jan 31 16:07:09 2017 +0530 ---------------------------------------------------------------------- .../resources/ui/app/components/job-item.js | 21 ++++++++++++-------- .../src/main/resources/ui/app/models/job.js | 2 +- .../src/main/resources/ui/app/services/jobs.js | 10 +++++++--- 3 files changed, 21 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8474d83e/contrib/views/hive20/src/main/resources/ui/app/components/job-item.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/components/job-item.js b/contrib/views/hive20/src/main/resources/ui/app/components/job-item.js index 3d37df8..8a6d318 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/components/job-item.js +++ b/contrib/views/hive20/src/main/resources/ui/app/components/job-item.js @@ -25,14 +25,19 @@ export default Ember.Component.extend({ expandedValue: null, actions: { toggleExpandJob(jobId) { - this.toggleProperty('expanded'); - this.set('valueLoading', true); - this.get('jobs').getQuery(jobId).then((queryFile) => { - this.set('queryFile', queryFile); - this.set('valueLoading', false); - }).catch((err) => { - this.set('valueLoading', false); - }) + if(this.get('expanded')) { + this.set('expanded', false); + } else { + this.set('expanded', true); + this.set('valueLoading', true); + this.get('jobs').getQuery(jobId).then((queryFile) => { + this.set('queryFile', queryFile); + this.set('valueLoading', false); + }).catch((err) => { + this.set('valueLoading', false); + }); + } + } } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/8474d83e/contrib/views/hive20/src/main/resources/ui/app/models/job.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/models/job.js b/contrib/views/hive20/src/main/resources/ui/app/models/job.js index 76132d1..fb39a88 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/models/job.js +++ b/contrib/views/hive20/src/main/resources/ui/app/models/job.js @@ -25,7 +25,7 @@ export default DS.Model.extend({ queryFile: DS.attr('string'), owner: DS.attr('string'), dataBase: DS.attr('string'), - duration: DS.attr(), + duration: DS.attr('number'), status: DS.attr('string'), statusMessage: DS.attr('string'), dateSubmitted: DS.attr('date'), http://git-wip-us.apache.org/repos/asf/ambari/blob/8474d83e/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js b/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js index 5db22d0..b3c2725 100644 --- a/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js +++ b/contrib/views/hive20/src/main/resources/ui/app/services/jobs.js @@ -21,18 +21,22 @@ import Ember from 'ember'; export default Ember.Service.extend({ store: Ember.inject.service(), getQuery(jobId) { - return this.get('store').findRecord('job', jobId).then((job) => { + let job = this.get('store').peekRecord('job', jobId); + if (job) { return this.get('store').findRecord('file', job.get('queryFile')); - }) + } }, waitForJobToComplete(jobId, after, fetchDummyResult = true) { return new Ember.RSVP.Promise((resolve, reject) => { Ember.run.later(() => { - this.get('store').findRecord('job', jobId, { reload: true }) + this.get('store').findRecord('job', jobId, {reload: true}) .then((job) => { let status = job.get('status').toLowerCase(); if (status === 'succeeded') { + if (fetchDummyResult) { + this._fetchDummyResult(jobId); + } resolve(status); } else if (status === 'error') { reject(status)
