You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/03/17 13:46:20 UTC
git commit: AMBARI-5102. Mirroring: instance table should be shown
most recent first. (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk aa3b00d9c -> d3e0602c4
AMBARI-5102. Mirroring: instance table should be shown most recent first. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d3e0602c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d3e0602c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d3e0602c
Branch: refs/heads/trunk
Commit: d3e0602c49aa3f65453cbec2a523387cd8bca382
Parents: aa3b00d
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Mon Mar 17 14:19:36 2014 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Mon Mar 17 14:45:54 2014 +0200
----------------------------------------------------------------------
.../main/mirroring/edit_dataset_controller.js | 2 +-
.../controllers/main/mirroring_controller.js | 40 ++++++++++----------
ambari-web/app/views/common/sort_view.js | 17 +++++++++
ambari-web/app/views/common/table_view.js | 2 +-
.../app/views/main/mirroring/jobs_view.js | 12 +++++-
5 files changed, 51 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d3e0602c/ambari-web/app/controllers/main/mirroring/edit_dataset_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/mirroring/edit_dataset_controller.js b/ambari-web/app/controllers/main/mirroring/edit_dataset_controller.js
index 224583b..cbf21d1 100644
--- a/ambari-web/app/controllers/main/mirroring/edit_dataset_controller.js
+++ b/ambari-web/app/controllers/main/mirroring/edit_dataset_controller.js
@@ -199,7 +199,7 @@ App.MainMirroringEditDataSetController = Ember.Controller.extend({
// Convert date to TZ format
toTZFormat: function (date) {
- return date.getFullYear() + '-' + this.addZero(date.getMonth() + 1) + '-' + this.addZero(date.getDate()) + 'T' + this.addZero(date.getHours()) + ':' + this.addZero(date.getMinutes()) + 'Z';
+ return date.toISOString().replace(/\:\d{2}\.\d{3}/,'');
},
// Converts hours value from 24-hours format to AM/PM format
http://git-wip-us.apache.org/repos/asf/ambari/blob/d3e0602c/ambari-web/app/controllers/main/mirroring_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/mirroring_controller.js b/ambari-web/app/controllers/main/mirroring_controller.js
index e7e9a51..dd8cdf0 100644
--- a/ambari-web/app/controllers/main/mirroring_controller.js
+++ b/ambari-web/app/controllers/main/mirroring_controller.js
@@ -139,18 +139,23 @@ App.MainMirroringController = Em.ArrayController.extend({
instances: []
})
);
- App.ajax.send({
- name: 'mirroring.dataset.get_all_instances',
- sender: this,
- data: {
- dataset: parsedData.feed['@attributes'].name,
- start: sourceCluster.validity['@attributes'].start,
- end: sourceCluster.validity['@attributes'].end,
- falconServer: App.get('falconServerURL')
- },
- success: 'onLoadDatasetInstancesSuccess',
- error: 'onLoadDatasetsInstancesError'
- });
+ var currentDate = new Date(App.dateTime());
+ if (currentDate > new Date(sourceCluster.validity['@attributes'].start)) {
+ App.ajax.send({
+ name: 'mirroring.dataset.get_all_instances',
+ sender: this,
+ data: {
+ dataset: parsedData.feed['@attributes'].name,
+ start: sourceCluster.validity['@attributes'].start,
+ end: App.router.get('mainMirroringEditDataSetController').toTZFormat(currentDate),
+ falconServer: App.get('falconServerURL')
+ },
+ success: 'onLoadDatasetInstancesSuccess',
+ error: 'onLoadDatasetsInstancesError'
+ });
+ } else {
+ this.saveDataset();
+ }
},
onLoadDatasetDefinitionError: function () {
@@ -173,8 +178,6 @@ App.MainMirroringController = Em.ArrayController.extend({
});
}, this);
datasetsData.findProperty('name', opts.dataset).set('instances', datasetJobs);
- } else {
- datasetsData.findProperty('name', opts.dataset).set('instances', []);
}
this.saveDataset();
},
@@ -194,8 +197,6 @@ App.MainMirroringController = Em.ArrayController.extend({
onLoadDatasetsInstancesError: function () {
console.error('Failed to load dataset instances.');
- var datasetName = arguments[4].dataset;
- this.get('datasetsData').findProperty('name', datasetName).set('instances', []);
this.saveDataset();
},
@@ -235,14 +236,15 @@ App.MainMirroringController = Em.ArrayController.extend({
}, this);
} else {
var defaultFS = this.loadDefaultFS();
+ var clusterName = App.get('clusterName');
var sourceCluster = Ember.Object.create({
- name: App.get('clusterName'),
+ name: clusterName,
execute: App.HostComponent.find().findProperty('componentName', 'RESOURCEMANAGER').get('host.hostName') + ':8050',
readonly: 'hftp://' + App.HostComponent.find().findProperty('componentName', 'NAMENODE').get('host.hostName') + ':50070',
workflow: 'http://' + App.HostComponent.find().findProperty('componentName', 'OOZIE_SERVER').get('host.hostName') + ':11000/oozie',
write: defaultFS,
- staging: '/apps/falcon/sandbox/staging',
- working: '/apps/falcon/sandbox/working',
+ staging: '/apps/falcon/' + clusterName + '/staging',
+ working: '/apps/falcon/' + clusterName + '/working',
temp: '/tmp'
});
var sourceClusterData = App.router.get('mainMirroringManageClustersController').formatClusterXML(sourceCluster);
http://git-wip-us.apache.org/repos/asf/ambari/blob/d3e0602c/ambari-web/app/views/common/sort_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/sort_view.js b/ambari-web/app/views/common/sort_view.js
index 3d970d6..690d9d1 100644
--- a/ambari-web/app/views/common/sort_view.js
+++ b/ambari-web/app/views/common/sort_view.js
@@ -98,6 +98,23 @@ var wrapperView = Em.View.extend({
this.set('content', content);
}
},
+
+ isSorting: false,
+
+ onContentChange: function () {
+ if (!this.get('isSorting') && this.get('content.length')) {
+ this.get('childViews').forEach(function (view) {
+ if (view.status !== 'sorting') {
+ var status = view.get('status');
+ this.set('isSorting', true);
+ this.sort(view, status == 'sorting_desc');
+ this.set('isSorting', false);
+ view.set('status', status);
+ }
+ }, this);
+ }
+ }.observes('content.length'),
+
/**
* reset all sorts fields
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/d3e0602c/ambari-web/app/views/common/table_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/table_view.js b/ambari-web/app/views/common/table_view.js
index faa56d5..4e4eb90 100644
--- a/ambari-web/app/views/common/table_view.js
+++ b/ambari-web/app/views/common/table_view.js
@@ -353,7 +353,7 @@ App.TableView = Em.View.extend(App.UserPref, {
} else {
this.set('filteredContent', content.toArray());
}
- }.observes('content'),
+ }.observes('content.length'),
/**
* Does any filter is used on the page
http://git-wip-us.apache.org/repos/asf/ambari/blob/d3e0602c/ambari-web/app/views/main/mirroring/jobs_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/mirroring/jobs_view.js b/ambari-web/app/views/main/mirroring/jobs_view.js
index b8f1bfa..f4a0661 100644
--- a/ambari-web/app/views/main/mirroring/jobs_view.js
+++ b/ambari-web/app/views/main/mirroring/jobs_view.js
@@ -37,7 +37,17 @@ App.MainDatasetJobsView = App.TableView.extend({
return this.get('controller.content');
}.property('controller.content'),
- sortView: sort.wrapperView,
+ sortView: sort.wrapperView.extend({
+ loadSortStatuses: function(){
+ this._super();
+ var statuses = App.db.getSortingStatuses(this.get('controller.name'));
+ if (!statuses || statuses.everyProperty('status', 'sorting')) {
+ var sorting = this.get('childViews').findProperty('name', 'startDate');
+ this.sort(sorting, true);
+ sorting.set('status', 'sorting_desc');
+ }
+ }.observes('parentView.filteringComplete')
+ }),
idSort: sort.fieldView.extend({
column: 1,
name: 'name',