You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/12/09 15:21:45 UTC
svn commit: r1418969 [2/4] - in
/incubator/ambari/branches/AMBARI-666/ambari-web: app/ app/controllers/
app/controllers/global/ app/controllers/main/ app/controllers/main/host/
app/controllers/main/service/ app/controllers/main/service/info/
app/contro...
Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/update_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/update_mapper.js?rev=1418969&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/update_mapper.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/update_mapper.js Sun Dec 9 14:21:37 2012
@@ -0,0 +1,372 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+App.updateMapper = App.QuickDataMapper.create({
+ map:function (json) {
+ var self=this;
+ var result = [];
+
+ json.items.forEach(function (service) {
+ switch(service.ServiceInfo.service_name){
+ case 'NAGIOS':
+ self.nagiosMapper(service);
+ break;
+ case 'GANGLIA':
+ self.gangliaMapper(service);
+ break;
+ case 'HDFS':
+ self.hdfsMapper(service);
+ break;
+ case 'MAPREDUCE':
+ self.mapreduceMapper(service);
+ break;
+ case 'HBASE':
+ self.hbaseMapper(service);
+ break;
+ }
+ })
+
+ if (json.items) {
+
+ if(this.get('model2').find().get("content").length<1)
+ {
+ result = [];
+ json.items.forEach(function (item) {
+ item.components.forEach(function (component) {
+ result.push(this.parseIt(component, this.config2));
+ }, this)
+ }, this);
+ App.store.loadMany(this.get('model2'), result);
+ }
+ if(this.get('model3').find().get("content").length<1)
+ {
+ result = [];
+ json.items.forEach(function (item) {
+ item.components.forEach(function (component) {
+ component.host_components.forEach(function (host_component) {
+ result.push(this.parseIt(host_component, this.config3));
+ }, this)
+ }, this)
+ }, this);
+ App.store.loadMany(this.get('model3'), result);
+ }
+ }
+ },
+
+ nagiosMapper:function(item){
+
+ },
+ gangliaMapper:function(item){
+
+ },
+ hdfsMapper:function(item){
+ var result=[];
+ var finalConfig = jQuery.extend({}, this.config);
+ // Change the JSON so that it is easy to map
+ var hdfsConfig = this.hdfsConfig;
+ item.components.forEach(function (component) {
+ if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "NAMENODE") {
+ item.nameNodeComponent = component;
+ finalConfig = jQuery.extend(finalConfig, hdfsConfig);
+ // Get the live, dead & decommision nodes from string json
+ var liveNodesJson = App.parseJSON(component.ServiceComponentInfo.LiveNodes);
+ var deadNodesJson = App.parseJSON(component.ServiceComponentInfo.DeadNodes);
+ var decommisionNodesJson = App.parseJSON(component.ServiceComponentInfo.DecomNodes);
+ item.live_data_nodes = [];
+ item.dead_data_nodes = [];
+ item.decommision_data_nodes = [];
+ for (var ln in liveNodesJson) {
+ item.live_data_nodes.push(ln);
+ }
+ for (var dn in deadNodesJson) {
+ item.dead_data_nodes.push(dn);
+ }
+ for (var dcn in decommisionNodesJson) {
+ item.decommision_data_nodes.push(dcn);
+ }
+ }
+ if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "SECONDARY_NAMENODE") {
+ item.snameNodeComponent = component;
+ }
+ if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "DATANODE") {
+ if (!item.data_nodes) {
+ item.data_nodes = [];
+ }
+ if (component.host_components) {
+ component.host_components.forEach(function (hc) {
+ item.data_nodes.push(hc.HostRoles.host_name);
+ });
+ }
+ }
+ });
+ // Map
+ var finalJson = this.parseIt(item, finalConfig);
+ finalJson.quick_links = [1, 2, 3, 4];
+
+ if(App.HDFSService.find().get("content").length<1)
+ {
+ App.store.load(App.HDFSService, finalJson);
+ result.push(finalJson);
+ App.store.loadMany(App.Service, result);
+ }else
+ {
+ App.HDFSService.find().map(function(e){
+ e.set("version",finalJson.version);
+ e.set("nameNodeStartTime",finalJson.name_node_start_time);
+ e.set("jvmMemoryHeapCommitted",finalJson.jvm_memory_heap_committed);
+ e.set("capacityUsed",finalJson.capacity_used);
+ e.set("capacityTotal",finalJson.capacity_total);
+ e.set("dfsTotalBlocks",finalJson.dfs_total_blocks);
+ e.set("dfsCorruptBlocks",finalJson.dfs_corrupt_blocks);
+ e.set("dfsMissingBlocks",finalJson.dfs_missing_blocks);
+ e.set("dfsUnderReplicatedBlocks",finalJson.dfs_under_replicated_blocks);
+ e.set("dfsTotalFiles",finalJson.dfs_total_files);
+ e.set("upgradeStatus",finalJson.upgrade_status);
+ e.set("safeModeStatus",finalJson.safe_mode_status);
+ })
+ }
+ },
+ mapreduceMapper:function(item){
+ // Change the JSON so that it is easy to map
+ var result=[];
+ var finalConfig = jQuery.extend({}, this.config);
+ var mapReduceConfig = this.mapReduceConfig;
+ item.components.forEach(function (component) {
+ if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "JOBTRACKER") {
+ item.jobTrackerComponent = component;
+ finalConfig = jQuery.extend(finalConfig, mapReduceConfig);
+ // Get the live, gray & black nodes from string json
+ item.map_slots = 0;
+ item.reduce_slots = 0;
+ var liveNodesJson = App.parseJSON(component.ServiceComponentInfo.AliveNodes);
+ var grayNodesJson = App.parseJSON(component.ServiceComponentInfo.GrayListedNodes);
+ var blackNodesJson = App.parseJSON(component.ServiceComponentInfo.BlackListedNodes);
+ item.alive_trackers = [];
+ item.gray_list_trackers = [];
+ item.black_list_trackers = [];
+ if (liveNodesJson != null) {
+ liveNodesJson.forEach(function (nj) {
+ item.alive_trackers.push(nj.hostname);
+ if (nj.slots && nj.slots.map_slots)
+ item.map_slots += nj.slots.map_slots;
+ if (nj.slots && nj.slots.map_slots_used)
+ item.map_slots_used += nj.slots.map_slots_used;
+ if (nj.slots && nj.slots.reduce_slots)
+ item.reduce_slots += nj.slots.reduce_slots;
+ if (nj.slots && nj.slots.reduce_slots_used)
+ item.reduce_slots_used += nj.slots.reduce_slots_used;
+ });
+ }
+ if (grayNodesJson != null) {
+ grayNodesJson.forEach(function (nj) {
+ item.gray_list_trackers.push(nj.hostname);
+ });
+ }
+ if (blackNodesJson != null) {
+ blackNodesJson.forEach(function (nj) {
+ item.black_list_trackers.push(nj.hostname);
+ });
+ }
+ }
+ if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "TASKTRACKER") {
+ if (!item.task_trackers) {
+ item.task_trackers = [];
+ }
+ if (component.host_components) {
+ component.host_components.forEach(function (hc) {
+ item.task_trackers.push(hc.HostRoles.host_name);
+ });
+ }
+ }
+ });
+ // Map
+ finalJson = this.parseIt(item, finalConfig);
+ finalJson.quick_links = [5, 6, 7, 8, 9, 10, 11, 12];
+
+ if(App.MapReduceService.find().get("content").length<1)
+ {
+ result.push(finalJson);
+ App.store.load(App.MapReduceService, finalJson);
+ App.store.loadMany(App.Service, result);
+ }else
+ {
+ App.MapReduceService.find().map(function(e){
+ e.set("version",finalJson.version);
+ e.set("jobTrackerStartTime",finalJson.job_tracker_start_time);
+ e.set("jobTrackerHeapUsed",finalJson.job_tracker_heap_used);
+ e.set("jobTrackerHeapMax",finalJson.job_tracker_heap_max);
+ e.set("mapSlots",finalJson.map_slots);
+ e.set("reduceSlots",finalJson.reduce_slots);
+ e.set("jobsSubmitted",finalJson.jobs_submitted);
+ e.set("jobsCompleted",finalJson.jobs_completed);
+ e.set("mapSlotsOccupied",finalJson.map_slots_occupied);
+ e.set("mapSlotsReserved",finalJson.map_slots_reserved);
+ e.set("reduceSlotsOccupied",finalJson.reduce_slots_occupied);
+ e.set("reduceSlotsReserved",finalJson.reduce_slots_reserved);
+ e.set("mapsRunning",finalJson.maps_running);
+ e.set("mapsWaiting",finalJson.maps_waiting);
+ e.set("reducesRunning",finalJson.reduces_running);
+ e.set("reducesWaiting",finalJson.reduces_waiting);
+ e.set("trackersDecommisioned",finalJson.trackers_decommisioned);
+ })
+ }
+
+
+ },
+ hbaseMapper:function(item){
+ // Change the JSON so that it is easy to map
+ var result=[];
+ var finalConfig = jQuery.extend({}, this.config);
+ var hbaseConfig = this.hbaseConfig;
+ item.components.forEach(function (component) {
+ if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "HBASE_MASTER") {
+ item.masterComponent = component;
+ finalConfig = jQuery.extend(finalConfig, hbaseConfig);
+ var regionsArray = App.parseJSON(component.ServiceComponentInfo.RegionsInTransition);
+ item.regions_in_transition = regionsArray == null ? 0 : regionsArray.length;
+ }
+ if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "HBASE_REGIONSERVER") {
+ if (!item.region_servers) {
+ item.region_servers = [];
+ }
+ if (component.host_components) {
+ component.host_components.forEach(function (hc) {
+ item.region_servers.push(hc.HostRoles.host_name);
+ });
+ }
+ }
+ });
+ // Map
+ finalJson = this.parseIt(item, finalConfig);
+ finalJson.quick_links = [13, 14, 15, 16, 17, 18];
+
+ if(App.HBaseService.find().get("content").length<1)
+ {
+ result.push(finalJson);
+ App.store.load(App.HBaseService, finalJson);
+ App.store.loadMany(App.Service, result);
+ }else
+ {
+ App.HBaseService.find().map(function(e){
+ e.set("version",finalJson.version);
+ e.set("masterStartTime",finalJson.master_start_time);
+ e.set("masterActiveTime",finalJson.master_active_time);
+ e.set("averageLoad",finalJson.average_load);
+ e.set("regionsInTransition",finalJson.regions_in_transition);
+ e.set("revision",finalJson.revision);
+ e.set("heapMemoryUsed",finalJson.heap_memory_used);
+ e.set("heapMemoryMax",finalJson.heap_memory_max);
+ })
+ }
+ },
+
+
+ model2:App.Component,
+ config2:{
+ id:'ServiceComponentInfo.component_name',
+ component_name:'ServiceComponentInfo.component_name',
+ service_id:'ServiceComponentInfo.service_name',
+ work_status:'host_components[0].HostRoles.state',
+ host_id:'host_components[0].HostRoles.host_name',
+ $decommissioned:false
+ },
+ model3:App.HostComponent,
+ config3:{
+ id:'id',
+ work_status:'HostRoles.state',
+ component_name:'HostRoles.component_name',
+ host_id:'HostRoles.host_name',
+ service_id:'component[0].ServiceComponentInfo.service_name'
+ },
+
+ hbaseConfig:{
+ version:'masterComponent.ServiceComponentInfo.Version',
+ master_id:'masterComponent.host_components[0].HostRoles.host_name',
+ region_servers:'region_servers',
+ master_start_time:'masterComponent.ServiceComponentInfo.MasterStartTime',
+ master_active_time:'masterComponent.ServiceComponentInfo.MasterActiveTime',
+ average_load:'masterComponent.ServiceComponentInfo.AverageLoad',
+ regions_in_transition:'regions_in_transition',
+ revision:'masterComponent.ServiceComponentInfo.Revision',
+ heap_memory_used:'masterComponent.ServiceComponentInfo.HeapMemoryUsed',
+ heap_memory_max:'masterComponent.ServiceComponentInfo.HeapMemoryMax'
+ },
+
+ mapReduceConfig:{
+ version:'jobTrackerComponent.ServiceComponentInfo.Version',
+ job_tracker_id:'jobTrackerComponent.host_components[0].HostRoles.host_name',
+ task_trackers:'task_trackers',
+ job_tracker_start_time:'jobTrackerComponent.ServiceComponentInfo.StartTime',
+ job_tracker_heap_used:'jobTrackerComponent.ServiceComponentInfo.HeapMemoryUsed',
+ job_tracker_heap_max:'jobTrackerComponent.ServiceComponentInfo.HeapMemoryMax',
+ alive_trackers:'alive_trackers',
+ black_list_trackers:'black_list_trackers',
+ gray_list_trackers:'gray_list_trackers',
+ map_slots:'map_slots',
+ reduce_slots:'reduce_slots',
+ jobs_submitted:'jobTrackerComponent.ServiceComponentInfo.jobtracker.jobs_submitted',
+ jobs_completed:'jobTrackerComponent.ServiceComponentInfo.jobtracker.jobs_completed',
+ map_slots_occupied:'jobTrackerComponent.ServiceComponentInfo.jobtracker.occupied_map_slots',
+ map_slots_reserved:'jobTrackerComponent.ServiceComponentInfo.jobtracker.reserved_map_slots',
+ reduce_slots_occupied:'jobTrackerComponent.ServiceComponentInfo.jobtracker.occupied_reduce_slots',
+ reduce_slots_reserved:'jobTrackerComponent.ServiceComponentInfo.jobtracker.reserved_reduce_slots',
+ maps_running:'jobTrackerComponent.ServiceComponentInfo.jobtracker.running_maps',
+ maps_waiting:'jobTrackerComponent.ServiceComponentInfo.jobtracker.waiting_maps',
+ reduces_running:'jobTrackerComponent.ServiceComponentInfo.jobtracker.running_reduces',
+ reduces_waiting:'jobTrackerComponent.ServiceComponentInfo.jobtracker.waiting_reduces',
+ trackers_decommisioned:'jobTrackerComponent.host_components[0].metrics.mapred.jobtracker.trackers_decommissioned'
+ },
+
+ hdfsConfig:{
+ version:'nameNodeComponent.ServiceComponentInfo.Version',
+ name_node_id:'nameNodeComponent.host_components[0].HostRoles.host_name',
+ sname_node_id:'snameNodeComponent.host_components[0].HostRoles.host_name',
+ data_nodes:'data_nodes',
+ name_node_start_time:'nameNodeComponent.ServiceComponentInfo.StartTime',
+ jvm_memory_heap_used:'nameNodeComponent.host_components[0].metrics.jvm.memHeapUsedM',
+ jvm_memory_heap_committed:'nameNodeComponent.host_components[0].metrics.jvm.memHeapCommittedM',
+ live_data_nodes:'live_data_nodes',
+ dead_data_nodes:'dead_data_nodes',
+ decommision_data_nodes:'decommission_data_nodes',
+ capacity_used:'nameNodeComponent.ServiceComponentInfo.CapacityUsed',
+ capacity_total:'nameNodeComponent.ServiceComponentInfo.CapacityTotal',
+ dfs_total_blocks:'nameNodeComponent.ServiceComponentInfo.BlocksTotal',
+ dfs_corrupt_blocks:'nameNodeComponent.ServiceComponentInfo.CorruptBlocks',
+ dfs_missing_blocks:'nameNodeComponent.ServiceComponentInfo.MissingBlocks',
+ dfs_under_replicated_blocks:'nameNodeComponent.ServiceComponentInfo.UnderReplicatedBlocks',
+ dfs_total_files:'nameNodeComponent.ServiceComponentInfo.TotalFiles',
+ upgrade_status:'nameNodeComponent.ServiceComponentInfo.UpgradeFinalized',
+ safe_mode_status:'nameNodeComponent.ServiceComponentInfo.Safemode'
+ },
+
+ config:{
+ id:'ServiceInfo.service_name',
+ service_name:'ServiceInfo.service_name',
+ work_status:'ServiceInfo.state',
+ $service_audit:[ 1, 2, 3 ],
+ $alerts:[ 1, 2, 3 ],
+ components_key:'components',
+ components_type:'array',
+ components:{
+ item:'ServiceComponentInfo.component_name'
+ },
+ host_components:'host_components'
+ }
+
+});
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/models/host.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/models/host.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/models/host.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/models/host.js Sun Dec 9 14:21:37 2012
@@ -58,7 +58,6 @@ App.Host = DS.Model.extend({
}.property('lastHeartBeatTime'),
loadAvg: function() {
- console.log(this.get('loadOne'), this.get('loadFive'), this.get('loadFifteen'));
if (this.get('loadOne') != null) return this.get('loadOne');
if (this.get('loadFive') != null) return this.get('loadFive');
if (this.get('loadFifteen') != null) return this.get('loadFifteen');
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/models/hosts.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/models/hosts.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/models/hosts.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/models/hosts.js Sun Dec 9 14:21:37 2012
@@ -26,12 +26,10 @@ App.HostInfo = Ember.Object.extend({
message: 'Information',
barColor: 'progress-info',
isChecked: true,
-
- bootLog: null,
-
- bootStatus: 'RUNNING',
-
- bootStatusForDisplay: function() {
+ bootLog:null,
+ bootStatus:'RUNNING',
+
+ bootStatusForDisplay:function () {
switch (this.get('bootStatus')) {
case 'DONE':
return 'Success';
@@ -42,7 +40,7 @@ App.HostInfo = Ember.Object.extend({
}
}.property('bootStatus'),
- bootBarColor: function() {
+ bootBarColor:function () {
switch (this.get('bootStatus')) {
case 'DONE':
return 'progress-success';
@@ -54,7 +52,7 @@ App.HostInfo = Ember.Object.extend({
}
}.property('bootStatus'),
- isBootDone: function() {
+ isBootDone:function () {
switch (this.get('bootStatus')) {
case 'DONE':
case 'FAILED':
@@ -66,5 +64,5 @@ App.HostInfo = Ember.Object.extend({
}.property('bootStatus')
/* horizonData:
- [{"cpu":"61","date":"2012-09-05T11:03:00+03:00","id":"0","memory":"44","name":"Node-0.0","network":"36","status":"LIVE","rackName":"Rack-0","io":"23"},{"cpu":"1","date":"2012-09-05T11:06:00+03:00","id":"0","memory":"46","name":"Node-0.0","network":"54","status":"LIVE","rackName":"Rack-0","io":"96"},{"cpu":"36","date":"2012-09-05T11:09:00+03:00","id":"0","memory":"65","name":"Node-0.0","network":"42","status":"LIVE","rackName":"Rack-0","io":"49"},{"cpu":"50","date":"2012-09-05T11:12:00+03:00","id":"0","memory":"46","name":"Node-0.0","network":"76","status":"LIVE","rackName":"Rack-0","io":"67"},{"cpu":"79","date":"2012-09-05T11:15:00+03:00","id":"0","memory":"91","name":"Node-0.0","network":"14","status":"LIVE","rackName":"Rack-0","io":"47"},{"cpu":"65","date":"2012-09-05T11:18:00+03:00","id":"0","memory":"44","name":"Node-0.0","network":"90","status":"LIVE","rackName":"Rack-0","io":"74"},{"cpu":"42","date":"2012-09-05T11:21:00+03:00","id":"0","memory":"96","name":"Node-0.
0","network":"29","status":"LIVE","rackName":"Rack-0","io":"6"},{"cpu":"76","date":"2012-09-05T11:24:00+03:00","id":"0","memory":"28","name":"Node-0.0","network":"52","status":"LIVE","rackName":"Rack-0","io":"1"},{"cpu":"24","date":"2012-09-05T11:27:00+03:00","id":"0","memory":"66","name":"Node-0.0","network":"75","status":"LIVE","rackName":"Rack-0","io":"31"},{"cpu":"71","date":"2012-09-05T11:30:00+03:00","id":"0","memory":"8","name":"Node-0.0","network":"1","status":"LIVE","rackName":"Rack-0","io":"36"},{"cpu":"3","date":"2012-09-05T11:33:00+03:00","id":"0","memory":"57","name":"Node-0.0","network":"12","status":"LIVE","rackName":"Rack-0","io":"71"},{"cpu":"85","date":"2012-09-05T11:36:00+03:00","id":"0","memory":"44","name":"Node-0.0","network":"76","status":"LIVE","rackName":"Rack-0","io":"54"},{"cpu":"49","date":"2012-09-05T11:39:00+03:00","id":"0","memory":"8","name":"Node-0.0","network":"28","status":"LIVE","rackName":"Rack-0","io":"60"},{"cpu":"46","date":"2012-09-05
T11:42:00+03:00","id":"0","memory":"75","name":"Node-0.0","network":"7","status":"LIVE","rackName":"Rack-0","io":"86"},{"cpu":"61","date":"2012-09-05T11:45:00+03:00","id":"0","memory":"11","name":"Node-0.0","network":"65","status":"LIVE","rackName":"Rack-0","io":"65"},{"cpu":"5","date":"2012-09-05T11:48:00+03:00","id":"0","memory":"24","name":"Node-0.0","network":"14","status":"LIVE","rackName":"Rack-0","io":"62"},{"cpu":"30","date":"2012-09-05T11:51:00+03:00","id":"0","memory":"40","name":"Node-0.0","network":"52","status":"LIVE","rackName":"Rack-0","io":"98"},{"cpu":"5","date":"2012-09-05T11:54:00+03:00","id":"0","memory":"38","name":"Node-0.0","network":"17","status":"LIVE","rackName":"Rack-0","io":"27"},{"cpu":"22","date":"2012-09-05T11:57:00+03:00","id":"0","memory":"80","name":"Node-0.0","network":"62","status":"LIVE","rackName":"Rack-0","io":"38"}] */
+ [{"cpu":"61","date":"2012-09-05T11:03:00+03:00","id":"0","memory":"44","name":"Node-0.0","network":"36","status":"LIVE","rackName":"Rack-0","io":"23"},{"cpu":"1","date":"2012-09-05T11:06:00+03:00","id":"0","memory":"46","name":"Node-0.0","network":"54","status":"LIVE","rackName":"Rack-0","io":"96"},{"cpu":"36","date":"2012-09-05T11:09:00+03:00","id":"0","memory":"65","name":"Node-0.0","network":"42","status":"LIVE","rackName":"Rack-0","io":"49"},{"cpu":"50","date":"2012-09-05T11:12:00+03:00","id":"0","memory":"46","name":"Node-0.0","network":"76","status":"LIVE","rackName":"Rack-0","io":"67"},{"cpu":"79","date":"2012-09-05T11:15:00+03:00","id":"0","memory":"91","name":"Node-0.0","network":"14","status":"LIVE","rackName":"Rack-0","io":"47"},{"cpu":"65","date":"2012-09-05T11:18:00+03:00","id":"0","memory":"44","name":"Node-0.0","network":"90","status":"LIVE","rackName":"Rack-0","io":"74"},{"cpu":"42","date":"2012-09-05T11:21:00+03:00","id":"0","memory":"96","name":"Node-0.0
","network":"29","status":"LIVE","rackName":"Rack-0","io":"6"},{"cpu":"76","date":"2012-09-05T11:24:00+03:00","id":"0","memory":"28","name":"Node-0.0","network":"52","status":"LIVE","rackName":"Rack-0","io":"1"},{"cpu":"24","date":"2012-09-05T11:27:00+03:00","id":"0","memory":"66","name":"Node-0.0","network":"75","status":"LIVE","rackName":"Rack-0","io":"31"},{"cpu":"71","date":"2012-09-05T11:30:00+03:00","id":"0","memory":"8","name":"Node-0.0","network":"1","status":"LIVE","rackName":"Rack-0","io":"36"},{"cpu":"3","date":"2012-09-05T11:33:00+03:00","id":"0","memory":"57","name":"Node-0.0","network":"12","status":"LIVE","rackName":"Rack-0","io":"71"},{"cpu":"85","date":"2012-09-05T11:36:00+03:00","id":"0","memory":"44","name":"Node-0.0","network":"76","status":"LIVE","rackName":"Rack-0","io":"54"},{"cpu":"49","date":"2012-09-05T11:39:00+03:00","id":"0","memory":"8","name":"Node-0.0","network":"28","status":"LIVE","rackName":"Rack-0","io":"60"},{"cpu":"46","date":"2012-09-05T
11:42:00+03:00","id":"0","memory":"75","name":"Node-0.0","network":"7","status":"LIVE","rackName":"Rack-0","io":"86"},{"cpu":"61","date":"2012-09-05T11:45:00+03:00","id":"0","memory":"11","name":"Node-0.0","network":"65","status":"LIVE","rackName":"Rack-0","io":"65"},{"cpu":"5","date":"2012-09-05T11:48:00+03:00","id":"0","memory":"24","name":"Node-0.0","network":"14","status":"LIVE","rackName":"Rack-0","io":"62"},{"cpu":"30","date":"2012-09-05T11:51:00+03:00","id":"0","memory":"40","name":"Node-0.0","network":"52","status":"LIVE","rackName":"Rack-0","io":"98"},{"cpu":"5","date":"2012-09-05T11:54:00+03:00","id":"0","memory":"38","name":"Node-0.0","network":"17","status":"LIVE","rackName":"Rack-0","io":"27"},{"cpu":"22","date":"2012-09-05T11:57:00+03:00","id":"0","memory":"80","name":"Node-0.0","network":"62","status":"LIVE","rackName":"Rack-0","io":"38"}] */
});
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/models/user.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/models/user.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/models/user.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/models/user.js Sun Dec 9 14:21:37 2012
@@ -35,9 +35,7 @@ App.User = DS.Model.extend({
return 'Local';
}.property('isLdap'),
auditItems:DS.hasMany('App.ServiceAudit'),
- admin:function () {
- return !!(/^admin/.test(this.get('roles')))
- }.property('userName')
+ admin: DS.attr('boolean')
});
App.EditUserForm = App.Form.extend({
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/router.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/router.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/router.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/router.js Sun Dec 9 14:21:37 2012
@@ -134,7 +134,6 @@ App.Router = Em.Router.extend({
var loginName = controller.get('loginName');
var hash = window.btoa(loginName + ":" + controller.get('password'));
var router = this;
-
$.ajax({
url : App.apiPrefix + '/users/' + loginName,
dataType : 'text',
@@ -158,13 +157,36 @@ App.Router = Em.Router.extend({
var resp = $.parseJSON(data);
var isAdmin = resp.Users.roles.indexOf('admin') >= 0;
-
- router.setAuthenticated(true);
- router.setLoginName(loginName);
-
- router.setUser(App.store.createRecord(App.User, { userName: loginName, admin: isAdmin }));
- router.transitionTo(router.getSection());
- postLogin(true);
+ if(isAdmin){
+ router.setAuthenticated(true);
+ router.setLoginName(loginName);
+
+ router.setUser(App.store.createRecord(App.User, { userName: loginName, admin: isAdmin }));
+ router.transitionTo(router.getSection());
+ postLogin(true);
+ } else {
+ $.ajax({
+ url: App.apiPrefix + '/clusters',
+ dataType: 'text',
+ type: 'GET',
+ success: function (data) {
+ var clusterResp = $.parseJSON(data);
+ if (clusterResp.items.length) {
+ router.setAuthenticated(true);
+ router.setLoginName(loginName);
+
+ router.setUser(App.store.createRecord(App.User, { userName: loginName, admin: isAdmin }));
+ router.transitionTo(router.getSection());
+ postLogin(true);
+ } else {
+ controller.set('errorMessage', "Your administrator has not set up a Hadoop cluster yet.");
+ }
+ },
+ error: function (req) {
+ console.log("Server not responding: " + req.statusCode);
+ }
+ });
+ }
},
error: function (req) {
console.log("login error: " + req.statusCode);
@@ -172,6 +194,7 @@ App.Router = Em.Router.extend({
postLogin(false);
}
});
+
},
setAmbariStacks: function () {
@@ -213,19 +236,49 @@ App.Router = Em.Router.extend({
mockLogin: function (postLogin) {
var controller = this.get('loginController');
var loginName = controller.get('loginName');
-
+ var router = this;
if ((loginName === 'admin' && controller.get('password') === 'admin') ||
- (loginName === 'user' && controller.get('password') === 'user')) {
- this.setAuthenticated(true);
- this.setLoginName(loginName);
- this.setUser(App.store.createRecord(App.User, { userName: loginName, admin: loginName === 'admin' }));
- this.setAmbariStacks();
- this.transitionTo(this.getSection());
- postLogin(true);
+ (loginName === 'user' && controller.get('password') === 'user')) {
+ if(loginName === 'admin'){
+ router.setAuthenticated(true);
+ router.setLoginName(loginName);
+
+ router.setUser(App.store.createRecord(App.User, { userName: loginName, admin: loginName === 'admin' }));
+ router.setAmbariStacks();
+
+ router.transitionTo(router.getSection());
+ postLogin(true);
+ } else {
+ $.ajax({
+ url: '/data/clusters/info.json',
+ dataType: 'text',
+ type: 'GET',
+ success: function (data) {
+ var clusterResp = $.parseJSON(data);
+ if (clusterResp.items.length) {
+ router.setAuthenticated(true);
+ router.setLoginName(loginName);
+
+ router.setUser(App.store.createRecord(App.User, { userName: loginName, admin: loginName === 'admin' }));
+ router.setAmbariStacks();
+
+ router.transitionTo(router.getSection());
+ postLogin(true);
+ } else {
+ controller.set('errorMessage', "Your administrator has not set up a Hadoop cluster yet.");
+ }
+ },
+ error: function (req) {
+ console.log("Server not responding: " + req.statusCode);
+ }
+ });
+ }
} else {
- this.setAuthenticated(false);
+ router.setAuthenticated(false);
postLogin(false);
}
+
+
},
getSection: function () {
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_host_routes.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_host_routes.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_host_routes.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_host_routes.js Sun Dec 9 14:21:37 2012
@@ -41,8 +41,10 @@ module.exports = Em.Route.extend({
var controller = router.get('addHostController');
controller.setCurrentStep('1', false);
controller.set('hideBackButton', true);
+ controller.dataLoading().done(function () {
controller.loadAllPriorSteps();
controller.connectOutlet('wizardStep2', controller.get('content.hosts'));
+ })
},
next: function (router) {
@@ -69,17 +71,19 @@ module.exports = Em.Route.extend({
console.log('in addHost.step2:connectOutlets');
var controller = router.get('addHostController');
controller.setCurrentStep('2', false);
+ controller.dataLoading().done(function () {
controller.loadAllPriorSteps();
controller.connectOutlet('wizardStep3', controller.get('content'));
+ })
},
back: Em.Router.transitionTo('step1'),
next: function (router, context) {
var addHostController = router.get('addHostController');
var wizardStep3Controller = router.get('wizardStep3Controller');
addHostController.saveConfirmedHosts(wizardStep3Controller);
+ addHostController.saveClients();
App.db.setBootStatus(true);
- App.db.setService(require('data/mock/services'));
router.transitionTo('step3');
},
/**
@@ -101,116 +105,84 @@ module.exports = Em.Route.extend({
console.log('in addHost.step3:connectOutlets');
var controller = router.get('addHostController');
controller.setCurrentStep('3', false);
- controller.set('hideBackButton', false);
- controller.loadAllPriorSteps();
- controller.connectOutlet('wizardStep4', controller.get('content.services'));
+ controller.dataLoading().done(function () {
+ controller.loadAllPriorSteps();
+ controller.connectOutlet('wizardStep6', controller.get('content'));
+ })
},
back: Em.Router.transitionTo('step2'),
- next: function (router, context) {
- var addHostController = router.get('addHostController');
- var wizardStep4Controller = router.get('wizardStep4Controller');
- addHostController.saveServices(wizardStep4Controller);
- addHostController.saveClients(wizardStep4Controller);
- App.db.setMasterComponentHosts(undefined);
- router.transitionTo('step4');
- }
- }),
-
- step4: Em.Route.extend({
- route: '/step4',
- connectOutlets: function (router, context) {
- console.log('in addHost.step4:connectOutlets');
- var controller = router.get('addHostController');
- controller.setCurrentStep('4', false);
- controller.loadAllPriorSteps();
- controller.connectOutlet('wizardStep5', controller.get('content'));
-
- },
- back: Em.Router.transitionTo('step3'),
- next: function (router, context) {
- var addHostController = router.get('addHostController');
- var wizardStep5Controller = router.get('wizardStep5Controller');
- addHostController.saveMasterComponentHosts(wizardStep5Controller);
- App.db.setSlaveComponentHosts(undefined);
- router.transitionTo('step5');
- }
- }),
-
- step5: Em.Route.extend({
- route: '/step5',
- connectOutlets: function (router, context) {
- console.log('in addHost.step5:connectOutlets');
- var controller = router.get('addHostController');
- controller.setCurrentStep('5', false);
- controller.loadAllPriorSteps();
- controller.connectOutlet('wizardStep6', controller.get('content'));
- },
- back: Em.Router.transitionTo('step4'),
next: function (router) {
var addHostController = router.get('addHostController');
var wizardStep6Controller = router.get('wizardStep6Controller');
if (wizardStep6Controller.validate()) {
addHostController.saveSlaveComponentHosts(wizardStep6Controller);
+ addHostController.get('content').set('serviceConfigProperties', null);
App.db.setServiceConfigProperties(null);
- router.transitionTo('step6');
+ addHostController.loadAdvancedConfigs();
+ router.transitionTo('step4');
}
}
}),
- step6: Em.Route.extend({
- route: '/step6',
+ step4: Em.Route.extend({
+ route: '/step4',
connectOutlets: function (router) {
- console.log('in addhost.step6:connectOutlets');
+ console.log('in addHost.step4:connectOutlets');
var controller = router.get('addHostController');
- controller.setCurrentStep('6', false);
- controller.loadAllPriorSteps();
- controller.connectOutlet('wizardStep7', controller.get('content'));
+ controller.setCurrentStep('4', false);
+ controller.dataLoading().done(function () {
+ controller.loadAllPriorSteps();
+ controller.connectOutlet('wizardStep7', controller.get('content'));
+ })
},
- back: Em.Router.transitionTo('step5'),
+ back: Em.Router.transitionTo('step3'),
next: function (router) {
var addHostController = router.get('addHostController');
var wizardStep7Controller = router.get('wizardStep7Controller');
addHostController.saveServiceConfigProperties(wizardStep7Controller);
- router.transitionTo('step7');
+ router.transitionTo('step5');
}
}),
- step7: Em.Route.extend({
- route: '/step7',
+ step5: Em.Route.extend({
+ route: '/step5',
connectOutlets: function (router, context) {
- console.log('in addHost.step7:connectOutlets');
+ console.log('in addHost.step5:connectOutlets');
var controller = router.get('addHostController');
- controller.setCurrentStep('7', false);
- controller.loadAllPriorSteps();
- controller.connectOutlet('wizardStep8', controller.get('content'));
+ controller.setCurrentStep('5', false);
+ controller.dataLoading().done(function () {
+ controller.loadAllPriorSteps();
+ controller.connectOutlet('wizardStep8', controller.get('content'));
+ })
},
- back: Em.Router.transitionTo('step6'),
+ back: Em.Router.transitionTo('step4'),
next: function (router) {
var addHostController = router.get('addHostController');
var wizardStep8Controller = router.get('wizardStep8Controller');
addHostController.installServices();
addHostController.setInfoForStep9();
- router.transitionTo('step8');
+ router.transitionTo('step6');
}
}),
- step8: Em.Route.extend({
- route: '/step8',
+ step6: Em.Route.extend({
+ route: '/step6',
connectOutlets: function (router, context) {
- console.log('in addHost.step8:connectOutlets');
+ console.log('in addHost.step6:connectOutlets');
var controller = router.get('addHostController');
- controller.setInfoForStep9();
- controller.setCurrentStep('8', false);
- controller.loadAllPriorSteps();
- controller.connectOutlet('wizardStep9', controller.get('content'));
+ controller.setCurrentStep('6', false);
+ controller.dataLoading().done(function () {
+ controller.loadAllPriorSteps();
+ controller.connectOutlet('wizardStep9', controller.get('content'));
+ })
},
- back: Em.Router.transitionTo('step7'),
+ back: Em.Router.transitionTo('step5'),
retry: function(router,context) {
var addHostController = router.get('addHostController');
var wizardStep9Controller = router.get('wizardStep9Controller');
if (!wizardStep9Controller.get('isSubmitDisabled')) {
- addHostController.installServices(true);
+ addHostController.installServices();
addHostController.setInfoForStep9();
wizardStep9Controller.navigateStep();
}
@@ -219,20 +191,22 @@ module.exports = Em.Route.extend({
var addHostController = router.get('addHostController');
var wizardStep9Controller = router.get('wizardStep9Controller');
addHostController.saveInstalledHosts(wizardStep9Controller);
- router.transitionTo('step9');
+ router.transitionTo('step7');
}
}),
- step9: Em.Route.extend({
- route: '/step9',
+ step7: Em.Route.extend({
+ route: '/step7',
connectOutlets: function (router, context) {
- console.log('in addHost.step9:connectOutlets');
+ console.log('in addHost.step7:connectOutlets');
var controller = router.get('addHostController');
- controller.setCurrentStep('9', false);
- controller.loadAllPriorSteps();
- controller.connectOutlet('wizardStep10');
+ controller.setCurrentStep('7', false);
+ controller.dataLoading().done(function () {
+ controller.loadAllPriorSteps();
+ controller.connectOutlet('wizardStep10', controller.get('content'));
+ })
},
- back: Em.Router.transitionTo('step8'),
+ back: Em.Router.transitionTo('step6'),
complete: function (router, context) {
if (true) { // this function will be moved to installerController where it will validate
var addHostController = router.get('addHostController');
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_service_routes.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_service_routes.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_service_routes.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/add_service_routes.js Sun Dec 9 14:21:37 2012
@@ -21,11 +21,16 @@ module.exports = Em.Route.extend({
enter: function (router) {
console.log('in /service/add:enter');
-
- Ember.run.next(function () {
- var addServiceController = router.get('addServiceController');
- router.transitionTo('step' + addServiceController.get('currentStep'));
- });
+ if (App.db.getUser().admin) {
+ Em.run.next(function () {
+ var addServiceController = router.get('addServiceController');
+ router.transitionTo('step' + addServiceController.get('currentStep'));
+ });
+ } else {
+ Em.run.next(function () {
+ App.router.transitionTo('main.services');
+ });
+ }
},
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js Sun Dec 9 14:21:37 2012
@@ -26,14 +26,19 @@ module.exports = Em.Route.extend({
console.log('in /installer:enter');
if (router.getAuthenticated()) {
- router.get('mainController').stopLoadOperationsPeriodically();
- console.log('In installer with successful authenticated');
- console.log('current step=' + router.get('installerController.currentStep'));
- Ember.run.next(function () {
- var installerController = router.get('installerController');
- router.transitionTo('step' + installerController.get('currentStep'));
- });
-
+ if (App.db.getUser().admin) {
+ router.get('mainController').stopLoadOperationsPeriodically();
+ console.log('In installer with successful authenticated');
+ console.log('current step=' + router.get('installerController.currentStep'));
+ Ember.run.next(function () {
+ var installerController = router.get('installerController');
+ router.transitionTo('step' + installerController.get('currentStep'));
+ });
+ } else {
+ Em.run.next(function () {
+ App.router.transitionTo('main.services');
+ });
+ }
} else {
console.log('In installer but its not authenticated');
console.log('value of authenticated is: ' + router.getAuthenticated());
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/main.js Sun Dec 9 14:21:37 2012
@@ -97,7 +97,7 @@ module.exports = Em.Route.extend({
showDetails:function (router, event) {
router.get('mainHostDetailsController').setBack(true);
- router.transitionTo('hostDetails.index', event.context)
+ router.transitionTo('hostDetails.summary', event.context)
},
addHost:function (router) {
@@ -154,7 +154,13 @@ module.exports = Em.Route.extend({
admin:Em.Route.extend({
route:'/admin',
-
+ enter: function(){
+ if(!App.db.getUser().admin){
+ Em.run.next(function () {
+ App.router.transitionTo('main.dashboard');
+ });
+ }
+ },
connectOutlets:function (router, context) {
router.get('mainController').connectOutlet('mainAdmin');
},
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less Sun Dec 9 14:21:37 2012
@@ -533,7 +533,7 @@ a:focus {
width: 100%;
text-align: left;
}
- }
+ }
.chartLabel {
font-size: 11px;
color: #7b7b7b;
@@ -644,6 +644,7 @@ a:focus {
}
.modal-graph-line {
+ width: 750px;
.modal-body {
min-height: 320px !important;
}
@@ -678,9 +679,9 @@ a:focus {
z-index: 2;
}
.chart-legend {
+ font-family: 'Courier New';
position: absolute;
top: 180px;
- left: 35%;
z-index: 2;
}
.rickshaw_legend {
@@ -743,6 +744,12 @@ a:focus {
padding: 3px 10px;
}
}
+
+ li.clients {
+ a {
+ padding-left: 37px;
+ }
+ }
}
.add-service-button {
margin: 20px 20px 10px;
@@ -1503,7 +1510,7 @@ ul.filter {
margin-right: 10px;
}
}
-
+
h4{
color: #777777;
margin-top: 5px;
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/apps.less
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/apps.less?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/apps.less (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/apps.less Sun Dec 9 14:21:37 2012
@@ -278,6 +278,10 @@
margin-bottom: 0;
}
+ #bars {
+ height: 350px;
+ }
+
#jobs, #bars{
border: 1px solid #ddd;
border-top: none;
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/charts/linear_time.hbs Sun Dec 9 14:21:37 2012
@@ -18,8 +18,10 @@
<div id="{{unbound view.id}}-container" class="chart-container" {{action showGraphInPopup target="view"}}>
<div id="{{unbound view.id}}-yaxis" class="chart-y-axis"></div>
<div id="{{unbound view.id}}-xaxis" class="chart-x-axis"></div>
+ <div id="{{unbound view.id}}-timeline" class="timeline"></div>
<div id="{{unbound view.id}}-legend" class="chart-legend"></div>
<div id="{{unbound view.id}}-overlay" class="chart-overlay"></div>
<div id="{{unbound view.id}}-chart" class="chart"></div>
+
<div id="{{unbound view.id}}-title" class="chart-title">{{view.title}}</div>
</div>
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/hdfs.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/hdfs.hbs?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/hdfs.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/hdfs.hbs Sun Dec 9 14:21:37 2012
@@ -137,7 +137,7 @@
</a>
<ul class="dropdown-menu">
{{#each view.quickLinks}}
- <li><a {{bindAttr href="url"}}>{{label}}</a></li>
+ <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li>
{{/each}}
</ul>
</div>
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard/service/mapreduce.hbs Sun Dec 9 14:21:37 2012
@@ -124,7 +124,7 @@
</a>
<ul class="dropdown-menu">
{{#each view.quickLinks}}
- <li><a {{bindAttr href="url"}}>{{label}}</a></li>
+ <li><a {{bindAttr href="url"}} target="_blank">{{label}}</a></li>
{{/each}}
</ul>
</div>
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs Sun Dec 9 14:21:37 2012
@@ -17,6 +17,7 @@
}}
<div id="hosts">
+ {{#if controller.isAdmin}}
<div class="box-header">
<div class="button-section">
<button class="btn btn-inverse add-host-button" {{action addHost}}>
@@ -25,6 +26,7 @@
</button>
</div>
</div>
+ {{/if}}
<table class="datatable table table-bordered table-striped" id="hosts-table">
<thead>
<tr>
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/add.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/add.hbs?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/add.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/add.hbs Sun Dec 9 14:21:37 2012
@@ -30,13 +30,11 @@
<li class="nav-header">{{t hosts.add.header}}</li>
<li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep1 target="controller"}}>{{t installer.step2.header}}</a></li>
<li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep2 target="controller"}}>{{t installer.step3.header}}</a></li>
- <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep3 target="controller"}}>{{t installer.step4.header}}</a></li>
- <li {{bindAttr class="isStep4:active view.isStep4Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep4 target="controller"}}>{{t installer.step5.header}}</a></li>
- <li {{bindAttr class="isStep5:active view.isStep5Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep5 target="controller"}}>{{t installer.step6.header}}</a></li>
- <li {{bindAttr class="isStep6:active view.isStep6Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep6 target="controller"}}>{{t installer.step7.header}}</a></li>
- <li {{bindAttr class="isStep7:active view.isStep7Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep7 target="controller"}}>{{t installer.step8.header}}</a></li>
- <li {{bindAttr class="isStep8:active view.isStep8Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep8 target="controller"}}>{{t installer.step9.header}}</a></li>
- <li {{bindAttr class="isStep9:active view.isStep9Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep9 target="controller"}}>{{t installer.step10.header}}</a></li>
+ <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep3 target="controller"}}>{{t installer.step6.header}}</a></li>
+ <li {{bindAttr class="isStep4:active view.isStep4Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep4 target="controller"}}>{{t installer.step7.header}}</a></li>
+ <li {{bindAttr class="isStep5:active view.isStep5Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep5 target="controller"}}>{{t installer.step8.header}}</a></li>
+ <li {{bindAttr class="isStep6:active view.isStep6Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep6 target="controller"}}>{{t installer.step9.header}}</a></li>
+ <li {{bindAttr class="isStep7:active view.isStep7Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep7 target="controller"}}>{{t installer.step10.header}}</a></li>
</ul>
</div>
</div>
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/details.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/details.hbs?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/details.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/details.hbs Sun Dec 9 14:21:37 2012
@@ -20,6 +20,7 @@
<a href='#' {{action "routeHome" target="controller"}}><i class="icon-home"></i></a> /
<a href="javascript:void(null)" data-toggle="modal" {{action backToHostsList}}>Hosts</a> /
<span {{bindAttr class=":host-title view.content.healthClass"}}>{{unbound view.content.hostName}}</span>
+ {{#if controller.isAdmin}}
<div class="host-maintenance">
<div class="host-maintenance-btn btn-group display-inline-block">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
@@ -36,6 +37,7 @@
</ul>
</div>
</div>
+ {{/if}}
<div class="content">
{{view App.MainHostMenuView}}
{{outlet}}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service.hbs?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service.hbs Sun Dec 9 14:21:37 2012
@@ -19,12 +19,14 @@
<div class="row-fluid">
<div id="services-menu" class="well span2" style="padding: 8px 0">
{{view App.MainServiceMenuView}}
+ {{#if controller.isAdmin}}
<div class="add-service-button">
<a class="btn" {{action addService href="true"}}>
<i class="icon-plus"></i>
Add Service
</a>
</div>
+ {{/if}}
</div>
<div class="span10">
{{outlet}}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/configs.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/configs.hbs?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/configs.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/configs.hbs Sun Dec 9 14:21:37 2012
@@ -136,12 +136,21 @@
<div id="serviceConfig">
<div class="accordion">
{{#each category in selectedService.configCategories}}
+
<div class="accordion-group">
+ {{#if category.isAdvanced}}
+ <div class="accordion-heading">
+ <a class="accordion-toggle" {{action "onToggleBlock" category.name target="view"}}>
+ {{category.name}}
+ </a>
+ </div>
+ {{else}}
<div class="accordion-heading">
<a class="accordion-toggle">
{{category.name}}
</a>
</div>
+ {{/if}}
{{#unless category.isForSlaveComponent}}
{{#view App.ServiceConfigsByCategoryView categoryBinding="category" serviceConfigsBinding="selectedService.configs"}}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs Sun Dec 9 14:21:37 2012
@@ -22,10 +22,10 @@
{{#view App.QuickViewLinks contentBinding="view.service"}}
<ul class="nav nav-pills move">
<li class="dropdown">
- <a class="dropdown-toggle" data-toggle="dropdown" href="#">Quick Links <b class="caret"></b></a>
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">Quick Links<b class="caret"></b></a>
<ul class="dropdown-menu">
{{#each view.quickLinks}}
- <a {{bindAttr href="url"}}>{{label}}</a>
+ <a {{bindAttr href="url"}} {{bindAttr target="view.linkTarget"}}>{{label}}</a>
{{/each}}
</ul>
</li>
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/item.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/item.hbs?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/item.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/item.hbs Sun Dec 9 14:21:37 2012
@@ -18,6 +18,7 @@
{{view App.MainServiceInfoMenuView configTabBinding="view.hasConfigTab"}}
{{#unless controller.content.isClients}}
+{{#if controller.isAdmin}}
<div class="service-button">
{{#if view.hasMaintenanceControl}}
<div class="btn-group display-inline-block">
@@ -46,5 +47,6 @@
Stop
</a>
</div>
+{{/if}}
{{/unless}}
{{outlet}}
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/graph.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/graph.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/graph.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/graph.js Sun Dec 9 14:21:37 2012
@@ -19,9 +19,9 @@
module.exports = {
drawJobTimeLine:function (map, shuffle, reduce, w, h, element, legend_id, timeline_id) {
- var map = $.parseJSON(map);
- var shuffle = $.parseJSON(shuffle);
- var reduce = $.parseJSON(reduce);
+ map = $.parseJSON(map);
+ shuffle = $.parseJSON(shuffle);
+ reduce = $.parseJSON(reduce);
if (!map || !shuffle || !reduce) {
console.warn('drawJobTimeLine');
return;
@@ -99,12 +99,11 @@ module.exports = {
element:document.getElementById(timeline_id)
});
},
- drawJobTasks:function (mapNodeLocal, mapRackLocal, mapOffSwitch, reduceOffSwitch, w, h, element, legend_id, timeline_id) {
- var mapNodeLocal = $.parseJSON(mapNodeLocal);
- var mapRackLocal = $.parseJSON(mapRackLocal);
- var mapOffSwitch = $.parseJSON(mapOffSwitch);
- var reduceOffSwitch = $.parseJSON(reduceOffSwitch);
- console.log(mapNodeLocal, mapRackLocal, mapOffSwitch, reduceOffSwitch);
+ drawJobTasks:function (mapNodeLocal, mapRackLocal, mapOffSwitch, reduceOffSwitch, submitTime, w, h, element, legend_id, timeline_id) {
+ mapNodeLocal = $.parseJSON(mapNodeLocal);
+ mapRackLocal = $.parseJSON(mapRackLocal);
+ mapOffSwitch = $.parseJSON(mapOffSwitch);
+ reduceOffSwitch = $.parseJSON(reduceOffSwitch);
if (!mapNodeLocal || !mapRackLocal || !mapOffSwitch || !reduceOffSwitch) {
console.warn('drawJobTasks');
return;
@@ -177,14 +176,14 @@ module.exports = {
var hoverDetail = new Rickshaw.Graph.HoverDetail({
graph:graph,
xFormatter:function (x) {
- return (x - json.submitTime) + 's'
+ return (x - submitTime) + 's'
},
yFormatter:function (y) {
return y / 1000 + 's'
},
formatter:function (series, x, y, formattedX, formattedY, d) {
var swatch = '<span class="detail_swatch" style="background-color: ' + series.color + '"></span>';
- return swatch + d.label +
+ return swatch + (d.label? d.label: d.name) +
'<br>Run-time: ' + formattedY + '<br>Wait-time: ' + formattedX;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js Sun Dec 9 14:21:37 2012
@@ -20,6 +20,41 @@ String.prototype.trim = function () {
return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
};
+/**
+ * convert ip address string to long int
+ * @return {*}
+ */
+String.prototype.ip2long = function () {
+ // * example 1: ip2long('192.0.34.166');
+ // * returns 1: 3221234342
+ // * example 2: ip2long('0.0xABCDEF');
+ // * returns 2: 11259375
+ // * example 3: ip2long('255.255.255.256');
+ // * returns 3: false
+ var i = 0;
+ // PHP allows decimal, octal, and hexadecimal IP components.
+ // PHP allows between 1 (e.g. 127) to 4 (e.g 127.0.0.1) components.
+ var IP = this.match(/^([1-9]\d*|0[0-7]*|0x[\da-f]+)(?:\.([1-9]\d*|0[0-7]*|0x[\da-f]+))?(?:\.([1-9]\d*|0[0-7]*|0x[\da-f]+))?(?:\.([1-9]\d*|0[0-7]*|0x[\da-f]+))?$/i); // Verify IP format.
+ if (!IP) {
+ return false; // Invalid format.
+ }
+ // Reuse IP variable for component counter.
+ IP[0] = 0;
+ for (i = 1; i < 5; i += 1) {
+ IP[0] += !!((IP[i] || '').length);
+ IP[i] = parseInt(IP[i]) || 0;
+ }
+ // Continue to use IP for overflow values.
+ // PHP does not allow any component to overflow.
+ IP.push(256, 256, 256, 256);
+ // Recalculate overflow of last component supplied to make up for missing components.
+ IP[4 + IP[0]] *= Math.pow(256, 4 - IP[0]);
+ if (IP[1] >= IP[5] || IP[2] >= IP[6] || IP[3] >= IP[7] || IP[4] >= IP[8]) {
+ return false;
+ }
+ return IP[1] * (IP[0] === 1 || 16777216) + IP[2] * (IP[0] <= 2 || 65536) + IP[3] * (IP[0] <= 3 || 256) + IP[4] * 1;
+};
+
String.prototype.capitalize = function () {
return this.charAt(0).toUpperCase() + this.slice(1);
}
@@ -30,30 +65,32 @@ Em.CoreObject.reopen({
}
});
-Handlebars.registerHelper('log', function (variable) {
+Em.Handlebars.registerHelper('log', function (variable) {
console.log(variable);
});
-Handlebars.registerHelper('warn', function (variable) {
+Em.Handlebars.registerHelper('warn', function (variable) {
console.warn(variable);
});
-Handlebars.registerHelper('highlight', function (variable, words) {
+Em.Handlebars.registerHelper('highlight', function (property, words, fn) {
+ var context = (fn.contexts && fn.contexts[0]) || this;
+ property = Em.Handlebars.getPath(context, property, fn);
+
words = words.split(";");
-// var self = this;
// if (highlightTemplate == undefined) {
var highlightTemplate = "<b>{0}</b>";
// }
words.forEach(function (word) {
var searchRegExp = new RegExp("\\b" + word + "\\b", "gi");
- variable = variable.replace(searchRegExp, function (found) {
+ property = property.replace(searchRegExp, function (found) {
return highlightTemplate.format(found);
});
});
- return new Handlebars.SafeString(variable);
+ return new Em.Handlebars.SafeString(property);
})
/**
* Replace {i} with argument. where i is number of argument to replace with
@@ -130,6 +167,17 @@ Number.prototype.countPercentageRatio =
return Math.round((usedValue / maxValue) * 100) + "%";
}
+Number.prototype.long2ip = function () {
+ // http://kevin.vanzonneveld.net
+ // + original by: Waldo Malqui Silva
+ // * example 1: long2ip( 3221234342 );
+ // * returns 1: '192.0.34.166'
+ if (!isFinite(this))
+ return false;
+
+ return [this >>> 24, this >>> 16 & 0xFF, this >>> 8 & 0xFF, this & 0xFF].join('.');
+}
+
/**
* Formats the given URL template by replacing keys in 'substitutes'
* with their values. If not in App.testMode, the testUrl is used.
Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/string_utils.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/string_utils.js?rev=1418969&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/string_utils.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/string_utils.js Sun Dec 9 14:21:37 2012
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+module.exports = {
+
+ pad: function(str, len, pad, dir) {
+
+ var STR_PAD_LEFT = 1;
+ var STR_PAD_RIGHT = 2;
+ var STR_PAD_BOTH = 3;
+
+ if (typeof(len) == "undefined") { var len = 0; }
+ if (typeof(pad) == "undefined") { var pad = ' '; }
+ if (typeof(dir) == "undefined") { var dir = STR_PAD_RIGHT; }
+
+ if (len + 1 >= str.length) {
+
+ switch (dir){
+
+ case STR_PAD_LEFT:
+ str = Array(len + 1 - str.length).join(pad) + str;
+ break;
+
+ case STR_PAD_BOTH:
+ var right = Math.ceil((padlen = len - str.length) / 2);
+ var left = padlen - right;
+ str = Array(left+1).join(pad) + str + Array(right+1).join(pad);
+ break;
+
+ default:
+ str = str + Array(len + 1 - str.length).join(pad);
+ break;
+
+ } // switch
+
+ }
+ return str;
+
+ }
+}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/chart/linear_time.js Sun Dec 9 14:21:37 2012
@@ -16,6 +16,7 @@
*/
var App = require('app');
+var string_utils = require('utils/string_utils');
/**
* @class
@@ -81,6 +82,8 @@ App.ChartLinearTimeView = Ember.View.ext
*/
_graph: null,
+ _popupGraph: null,
+
popupSuffix: '-popup',
isPopup: false,
@@ -108,6 +111,14 @@ App.ChartLinearTimeView = Ember.View.ext
didInsertElement: function () {
this._super();
this.loadData();
+ this.registerGraph()
+ },
+ registerGraph: function(){
+ var graph = {
+ name: this.get('title'),
+ id: this.get('elementId')
+ };
+ App.router.get('clusterController.graphs').push(graph);
},
loadData: function() {
@@ -193,12 +204,26 @@ App.ChartLinearTimeView = Ember.View.ext
*
* @type Function
*/
- yAxisFormatter: Rickshaw.Fixtures.Number.formatKMBT,
+ yAxisFormatter: function(y) {
+ var value = Rickshaw.Fixtures.Number.formatKMBT(y);
+ if (value == '') return '0';
+ value = String(value);
+ var c = value[value.length - 1];
+ if (!isNaN(parseInt(c))) {
+ // c is digit
+ value = parseFloat(value).toFixed(3);
+ }
+ else {
+ // c in not digit
+ value = parseFloat(value.substr(0, value.length - 1)).toFixed(3) + c;
+ }
+ return value;
+ },
/**
* Provides the color (in any HTML color format) to use for a particular
* series.
- *
+ *
* @param series
* Series for which color is being requested
* @return color String. Returning null allows this chart to pick a color
@@ -250,82 +275,131 @@ App.ChartLinearTimeView = Ember.View.ext
},
draw: function(seriesData) {
- var isPopup = this.get('isPopup');
- var p = '';
+ var isPopup = this.get('isPopup');
+ var p = '';
+ if (isPopup) {
+ p = this.get('popupSuffix');
+ }
+ var palette = new Rickshaw.Color.Palette({
+ scheme: this._paletteScheme
+ });
+ seriesData.forEach(function (series) {
+ series.color = /*this.colorForSeries(series) ||*/ palette.color();
+ series.stroke = 'rgba(0,0,0,0.3)';
if (isPopup) {
- p = this.get('popupSuffix');
+ // calculate statistic data for popup legend
+ var avg = 0;
+ var min = Number.MAX_VALUE;
+ var max = Number.MIN_VALUE;
+ for (var i = 0; i < series.data.length; i++) {
+ avg += series.data[i]['y'];
+ if (series.data[i]['y'] < min) {
+ min = series.data[i]['y'];
+ }
+ else {
+ if (series.data[i]['y'] > max) {
+ max = series.data[i]['y'];
+ }
+ }
+ }
+ series.name = string_utils.pad(series.name, 30, ' ', 2) + string_utils.pad('min', 5, ' ', 3) + string_utils.pad(this.get('yAxisFormatter')(min), 12, ' ', 3) + string_utils.pad('avg', 5, ' ', 3) + string_utils.pad(this.get('yAxisFormatter')(avg/series.data.length), 12, ' ', 3) + string_utils.pad('max', 12, ' ', 3) + string_utils.pad(this.get('yAxisFormatter')(max), 5, ' ', 3);
}
- var palette = new Rickshaw.Color.Palette({
- scheme: this._paletteScheme
+ }.bind(this));
+ var chartId = "#" + this.id + "-chart" + p;
+ var chartOverlayId = "#" + this.id + "-overlay" + p;
+ var xaxisElementId = "#" + this.id + "-xaxis" + p;
+ var yaxisElementId = "#" + this.id + "-yaxis" + p;
+ var legendElementId = "#" + this.id + "-legend" + p;
+ var timelineElementId = "#" + this.id + "-timeline" + p;
+
+ var chartElement = document.querySelector(chartId);
+ var overlayElement = document.querySelector(chartOverlayId);
+ var xaxisElement = document.querySelector(xaxisElementId);
+ var yaxisElement = document.querySelector(yaxisElementId);
+ var legendElement = document.querySelector(legendElementId);
+ var timelineElement = document.querySelector(timelineElementId);
+
+ var _graph = new Rickshaw.Graph({
+ height: 150,
+ element: chartElement,
+ series: seriesData,
+ interpolation: 'step-after',
+ stroke: true,
+ renderer: 'area',
+ strokeWidth: 1
+ });
+ _graph.renderer.unstack = false;
+
+ xAxis = new Rickshaw.Graph.Axis.Time({
+ graph: _graph
+ });
+
+ yAxis = new Rickshaw.Graph.Axis.Y({
+ tickFormat: this.yAxisFormatter,
+ element: yaxisElement,
+ graph: _graph
+ });
+
+ var legend = new Rickshaw.Graph.Legend({
+ graph: _graph,
+ element: legendElement
+ });
+
+ if (!isPopup) {
+ overlayElement.addEventListener('mousemove', function () {
+ $(xaxisElement).removeClass('hide');
+ $(legendElement).removeClass('hide');
+ $(chartElement).children("div").removeClass('hide');
+ });
+ overlayElement.addEventListener('mouseout', function () {
+ $(legendElement).addClass('hide');
+ });
+ _graph.onUpdate(function () {
+ $(legendElement).addClass('hide');
});
- seriesData.forEach(function (series) {
- series.color = this.colorForSeries(series) || palette.color();
- series.stroke = 'rgba(0,0,0,0.3)';
- }.bind(this));
- var chartId = "#" + this.id + "-chart" + p;
- var chartOverlayId = "#" + this.id + "-overlay" + p;
- var xaxisElementId = "#" + this.id + "-xaxis" + p;
- var yaxisElementId = "#" + this.id + "-yaxis" + p;
- var legendElementId = "#" + this.id + "-legend" + p;
-
- var chartElement = document.querySelector(chartId);
- var overlayElement = document.querySelector(chartOverlayId);
- var xaxisElement = document.querySelector(xaxisElementId);
- var yaxisElement = document.querySelector(yaxisElementId);
- var legendElement = document.querySelector(legendElementId);
- this._graph = new Rickshaw.Graph({
- height: 150,
- element: chartElement,
- series: seriesData,
- interpolation: 'step-after',
- stroke: true,
- renderer: 'area',
- strokeWidth: 1
- });
- this._graph.renderer.unstack = true;
-
- xAxis = new Rickshaw.Graph.Axis.Time({
- graph: this._graph
- });
- yAxis = new Rickshaw.Graph.Axis.Y({
- tickFormat: this.yAxisFormatter,
- element: yaxisElement,
- graph: this._graph
- });
-
- overlayElement.addEventListener('mousemove', function () {
- $(xaxisElement).removeClass('hide');
- $(legendElement).removeClass('hide');
- $(chartElement).children("div").removeClass('hide');
- });
- overlayElement.addEventListener('mouseout', function () {
- //$(xaxisElement).addClass('hide');
- $(legendElement).addClass('hide');
- //$(chartElement).children("div").addClass('hide');
- });
- // Hide axes
- this._graph.onUpdate(function () {
- //$(xaxisElement).addClass('hide');
- $(legendElement).addClass('hide');
- //$(chartElement).children('div').addClass('hide');
- });
-
- new Rickshaw.Graph.Legend({
- graph: this._graph,
- element: legendElement
- });
-
- // The below code will be needed if we ever use curve
- // smoothing in our graphs. (see rickshaw defect below)
- // this._graph.onUpdate(jQuery.proxy(function () {
- // this._adjustSVGHeight();
- // }, this));
+ }
+
+ var shelving = new Rickshaw.Graph.Behavior.Series.Toggle({
+ graph: _graph,
+ legend:legend
+ });
+
+ var order = new Rickshaw.Graph.Behavior.Series.Order({
+ graph: _graph,
+ legend:legend
+ });
+
+ var annotator = new Rickshaw.Graph.Annotate({
+ graph: _graph,
+ element:timelineElement
+ });
+
+ _graph.render();
+
+ var hoverDetail = new Rickshaw.Graph.HoverDetail({
+ graph: _graph,
+ onShow: function() {
+ console.log('show');
+ },
+ onHide: function() {
+ console.log('hide');
+ },
+ onRender: function() {
+ console.log('render');
+ }
+ });
+
+ if (isPopup) {
+ this.set('_popupGraph', _graph);
+ }
+ else {
+ this.set('_graph', _graph);
+ }
- this._graph.render();
- this._graph = null;
this.set('isPopup', false);
},
+
showGraphInPopup: function() {
this.set('isPopup', true);
App.ModalPopup.show({
@@ -340,7 +414,17 @@ App.ChartLinearTimeView = Ember.View.ext
'</div>',
'<div class="modal-body">',
'{{#if bodyClass}}{{view bodyClass}}',
- '{{else}}<div id="'+this.get('id')+'-container'+this.get('popupSuffix')+'" class="chart-container"><div id="'+this.get('id')+'-yaxis'+this.get('popupSuffix')+'" class="'+this.get('id')+'-yaxis chart-y-axis"></div><div id="'+this.get('id')+'-xaxis'+this.get('popupSuffix')+'" class="'+this.get('id')+'-xaxis chart-x-axis"></div><div id="'+this.get('id')+'-legend'+this.get('popupSuffix')+'" class="'+this.get('id')+'-legend chart-legend"></div><div id="'+this.get('id')+'-overlay'+this.get('popupSuffix')+'" class="'+this.get('id')+'-overlay chart-overlay"></div><div id="'+this.get('id')+'-chart'+this.get('popupSuffix')+'" class="'+this.get('id')+'-chart chart"></div><div id="'+this.get('id')+'-title'+this.get('popupSuffix')+'" class="'+this.get('id')+'-title chart-title">{{view.title}}</div></div>{{/if}}',
+ '{{else}}'+
+ '<div id="'+this.get('id')+'-container'+this.get('popupSuffix')+'" class="chart-container">'+
+ '<div id="'+this.get('id')+'-yaxis'+this.get('popupSuffix')+'" class="'+this.get('id')+'-yaxis chart-y-axis"></div>'+
+ '<div id="'+this.get('id')+'-xaxis'+this.get('popupSuffix')+'" class="'+this.get('id')+'-xaxis chart-x-axis"></div>'+
+ '<div id="'+this.get('id')+'-legend'+this.get('popupSuffix')+'" class="'+this.get('id')+'-legend chart-legend"></div>'+
+ '<div id="'+this.get('id')+'-overlay'+this.get('popupSuffix')+'" class="'+this.get('id')+'-overlay chart-overlay"></div>'+
+ '<div id="'+this.get('id')+'-chart'+this.get('popupSuffix')+'" class="'+this.get('id')+'-chart chart"></div>'+
+ '<div id="'+this.get('id')+'-title'+this.get('popupSuffix')+'" class="'+this.get('id')+'-title chart-title">{{view.title}}</div>'+
+ '<div id="'+this.get('id')+'-timeline'+this.get('popupSuffix')+'" class="'+this.get('id')+'-timeline timeline"></div>'+
+ '</div>'+
+ '{{/if}}',
'</div>',
'<div class="modal-footer">',
'{{#if view.primary}}<a class="btn btn-success" {{action onPrimary target="view"}}>{{view.primary}}</a>{{/if}}',
@@ -368,10 +452,12 @@ App.ChartLinearTimeView = Ember.View.ext
* @type Function
*/
App.ChartLinearTimeView.BytesFormatter = function (y) {
+ if (y == 0) return '0 B';
var value = Rickshaw.Fixtures.Number.formatBase1024KMGTP(y);
if (!y || y.length < 1) {
- value = '';
- } else {
+ value = '0 B';
+ }
+ else {
if ("number" == typeof value) {
value = String(value);
}
@@ -395,9 +481,9 @@ App.ChartLinearTimeView.BytesFormatter =
App.ChartLinearTimeView.PercentageFormatter = function (percentage) {
var value = percentage;
if (!value || value.length < 1) {
- value = '';
+ value = '0 %';
} else {
- value = value + '%';
+ value = value.toFixed(3) + '%';
}
return value;
};
@@ -411,7 +497,7 @@ App.ChartLinearTimeView.PercentageFormat
App.ChartLinearTimeView.TimeElapsedFormatter = function (millis) {
var value = millis;
if (!value || value.length < 1) {
- value = '';
+ value = '0 ms';
} else if ("number" == typeof millis) {
var seconds = millis > 1000 ? Math.round(millis / 1000) : 0;
var minutes = seconds > 60 ? Math.round(seconds / 60) : 0;
@@ -426,9 +512,9 @@ App.ChartLinearTimeView.TimeElapsedForma
} else if (seconds > 0) {
value = seconds + ' s';
} else if (millis > 0) {
- value = millis + ' ms';
+ value = millis.toFixed(3) + ' ms';
} else {
- value = millis + ' ms';
+ value = millis.toFixed(3) + ' ms';
}
}
return value;
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/quick_view_link_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/quick_view_link_view.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/quick_view_link_view.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/quick_view_link_view.js Sun Dec 9 14:21:37 2012
@@ -23,26 +23,39 @@ App.QuickViewLinks = Em.View.extend({
/**
* Updated quick links. Here we put correct hostname to url
*/
- quickLinks : function(){
+ quickLinks:function () {
var serviceName = this.get('content.serviceName');
var components = this.get('content.components');
var host;
- if(serviceName === 'HDFS'){
+ if (serviceName === 'HDFS') {
host = components.filterProperty('id', 'NAMENODE').objectAt(0).get('host.hostName');
- } else if(serviceName === 'MAPREDUCE'){
+ } else if (serviceName === 'MAPREDUCE') {
host = components.filterProperty('id', 'JOBTRACKER').objectAt(0).get('host.hostName');
- } else if(serviceName === 'HBASE'){
+ } else if (serviceName === 'HBASE') {
host = components.filterProperty('id', 'HBASE_MASTER').objectAt(0).get('host.hostName');
}
- if(!host){
+ if (!host) {
return [];
}
- return this.get('content.quickLinks').map(function(item){
- if(item.get('url')){
+ return this.get('content.quickLinks').map(function (item) {
+ if (item.get('url')) {
item.set('url', item.get('url').fmt(host));
}
return item;
});
- }.property('content.quickLinks.@each.label')
+ }.property('content.quickLinks.@each.label'),
+
+ linkTarget:function () {
+ switch (this.get('content.serviceName').toLowerCase()) {
+ case "hdfs":
+ case "mapreduce":
+ return "_blank";
+ break;
+ default:
+ return "";
+ break;
+ }
+ }.property('service')
+
});
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/item/bar_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/item/bar_view.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/item/bar_view.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/apps/item/bar_view.js Sun Dec 9 14:21:37 2012
@@ -71,8 +71,8 @@ App.MainAppsItemBarView = Em.View.extend
mapRackLocal:false,
mapOffSwitch:false,
reduceOffSwitch:false,
- submitTime:false,
- finishTime:false,
+ submit:false,
+ finish:false,
updateTimeLine:function () {
var url = App.testMode ? '/data/apps/jobs/timeline.json' : App.apiPrefix + "/jobhistory/task?jobId=" + this.get('activeJob').get('id') +
@@ -93,6 +93,7 @@ App.MainAppsItemBarView = Em.View.extend
var map = JSON.stringify(this.get('map'));
var shuffle = JSON.stringify(this.get('shuffle'));
var reduce = JSON.stringify(this.get('reduce'));
+ if (!this.get('map') || !this.get('shuffle') || !this.get('reduce')) {return;}
$('#chart, #legend, #timeline1').html('');
graph.drawJobTimeLine(map, shuffle, reduce, this.get('width'), this.get('height'), '#chart', 'legend', 'timeline1');
}.observes('map', 'shuffle', 'reduce'),
@@ -102,8 +103,9 @@ App.MainAppsItemBarView = Em.View.extend
var mapRackLocal = JSON.stringify(this.get('mapRackLocal'));
var mapOffSwitch = JSON.stringify(this.get('mapOffSwitch'));
var reduceOffSwitch = JSON.stringify(this.get('reduceOffSwitch'));
+ if (!this.get('mapNodeLocal') || !this.get('mapRackLocal') || !this.get('mapOffSwitch') || !this.get('reduceOffSwitch')) {return;}
$('#job_tasks, #tasks_legend, #timeline2').html('');
- graph.drawJobTasks(mapNodeLocal, mapRackLocal, mapOffSwitch, reduceOffSwitch, this.get('width'), this.get('height'), '#job_tasks', 'tasks_legend', 'timeline2');
- }.observes('mapNodeLocal', 'mapRackLocal', 'mapOffSwitch', 'reduceOffSwitch')
+ graph.drawJobTasks(mapNodeLocal, mapRackLocal, mapOffSwitch, reduceOffSwitch, this.get('submit'), this.get('width'), this.get('height'), '#job_tasks', 'tasks_legend', 'timeline2');
+ }.observes('mapNodeLocal', 'mapRackLocal', 'mapOffSwitch', 'reduceOffSwitch', 'submit')
});
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard.js Sun Dec 9 14:21:37 2012
@@ -63,7 +63,7 @@ App.MainDashboardView = Em.View.extend({
})
}, this);
- }.observes('App.router.clusterController.dataLoadList.services'),
+ }.observes('App.router.updateController.isUpdated'),
gangliaUrl: function () {
return App.router.get('clusterController.gangliaUrl') + "/?r=hour&cs=&ce=&m=&s=by+name&c=HDPSlaves&tab=m&vn=";
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/cluster_metrics/network.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/cluster_metrics/network.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/cluster_metrics/network.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/cluster_metrics/network.js Sun Dec 9 14:21:37 2012
@@ -58,6 +58,7 @@ App.ChartClusterMetricsNetwork = App.Cha
y: seriesData[index][0]
});
}
+
seriesArray.push(series);
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/hbase.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/hbase.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/hbase.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/hbase.js Sun Dec 9 14:21:37 2012
@@ -59,6 +59,6 @@ App.MainDashboardServiceHbaseView = App.
}.property('components'),
toggleInfoView: function() {
- $('#hbase-info').toggle('blind', 1000);
+ $('#hbase-info').toggle('blind', 200);
}
});
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/hdfs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/hdfs.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/hdfs.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/hdfs.js Sun Dec 9 14:21:37 2012
@@ -74,6 +74,6 @@ App.MainDashboardServiceHdfsView = App.M
}.property('+'),
toggleInfoView: function() {
- $('#hdfs-info').toggle('blind', 1000);
+ $('#hdfs-info').toggle('blind', 200);
}
});
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/mapreduce.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/mapreduce.js?rev=1418969&r1=1418968&r2=1418969&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/mapreduce.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/dashboard/service/mapreduce.js Sun Dec 9 14:21:37 2012
@@ -104,6 +104,6 @@ App.MainDashboardServiceMapreduceView =
}.property('components'),
toggleInfoView: function() {
- $('#mapreduce-info').toggle('blind', 1000);
+ $('#mapreduce-info').toggle('blind', 200);
}
});
\ No newline at end of file