summaryrefslogtreecommitdiff
path: root/ambari-web
diff options
context:
space:
mode:
authorYusaku Sako <yusaku@apache.org>2012-12-09 14:30:27 +0000
committerYusaku Sako <yusaku@apache.org>2012-12-09 14:30:27 +0000
commit18f6dd5c550d39e8658f8bf16a3edf2e98a2a2d8 (patch)
tree2fedf214083125e7d5453e7a8193466dfed25a41 /ambari-web
parent762191fe315b95f9c7a6626ad5c1ab425e156649 (diff)
AMBARI-1059. Refactor cluster management. (yusaku)
git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1418974 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'ambari-web')
-rw-r--r--ambari-web/app/assets/data/wizard/bootstrap/poll_1.json7
-rw-r--r--ambari-web/app/assets/data/wizard/bootstrap/poll_2.json7
-rw-r--r--ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json13
-rw-r--r--ambari-web/app/assets/data/wizard/bootstrap/single_host_registration.json11
-rw-r--r--ambari-web/app/controllers/wizard/step3_controller.js29
-rw-r--r--ambari-web/app/controllers/wizard/step5_controller.js2
-rw-r--r--ambari-web/app/controllers/wizard/step6_controller.js2
-rw-r--r--ambari-web/app/controllers/wizard/step9_controller.js4
8 files changed, 52 insertions, 23 deletions
diff --git a/ambari-web/app/assets/data/wizard/bootstrap/poll_1.json b/ambari-web/app/assets/data/wizard/bootstrap/poll_1.json
index ac9bbbbf84..8ca91dcde6 100644
--- a/ambari-web/app/assets/data/wizard/bootstrap/poll_1.json
+++ b/ambari-web/app/assets/data/wizard/bootstrap/poll_1.json
@@ -3,13 +3,8 @@
"hostsStatus": [
{
"status": "RUNNING",
- "hostName": "dev001",
+ "hostName": "localhost.localdomain",
"log": "STDOUT\n\nSTDERR\nWarning: Permanently added 'dev001,10.0.2.15' (RSA) to the list of known hosts.\n"
- },
- {
- "status": "RUNNING",
- "hostName": "dev002",
- "log": "STDOUT\n\nSTDERR\nWarning: Permanently added 'dev002,10.0.2.16' (RSA) to the list of known hosts.\n"
}
],
"log": ""
diff --git a/ambari-web/app/assets/data/wizard/bootstrap/poll_2.json b/ambari-web/app/assets/data/wizard/bootstrap/poll_2.json
index 7208d5670d..0926b40151 100644
--- a/ambari-web/app/assets/data/wizard/bootstrap/poll_2.json
+++ b/ambari-web/app/assets/data/wizard/bootstrap/poll_2.json
@@ -2,13 +2,8 @@
"status": "SUCCESS",
"hostsStatus": [
{
- "status": "FAILED",
- "hostName": "dev001",
- "log": "STDOUT\n\nSTDERR\nWarning: Permanently added 'dev001,10.0.2.15' (RSA) to the list of known hosts.\r\n/etc/yum.repos.d/ambari.repo: No such file or directory\nSTDOUT\n\nSTDERR\nPermission denied, please try again.\r\nConnection closed by UNKNOWN\r\nlost connection\nSTDOUT\n\nSTDERR\npython: can't open file '/tmp/setupAgent.py': [Errno 2] No such file or directory\n"
- },
- {
"status": "DONE",
- "hostName": "dev002",
+ "hostName": "localhost.localdomain",
"log": "STDOUT\n\nSTDERR\nWarning: Permanently added 'dev002,10.0.2.16' (RSA) to the list of known hosts.\r\n/etc/yum.repos.d/ambari.repo: No such file or directory\nSTDOUT\n\nSTDERR\nPermission denied, please try again.\r\nConnection closed by UNKNOWN\r\nlost connection\nSTDOUT\n\nSTDERR\npython: can't open file '/tmp/setupAgent.py': [Errno 2] No such file or directory\n"
}
],
diff --git a/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json b/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json
new file mode 100644
index 0000000000..eefe832f12
--- /dev/null
+++ b/ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json
@@ -0,0 +1,13 @@
+{
+ "href" : "http://localhost:8080/api/v1/hosts?fields=Hosts/total_mem,Hosts/cpu_count",
+ "items" : [
+ {
+ "href" : "http://localhost:8080/api/v1/hosts/localhost.localdomain",
+ "Hosts" : {
+ "cpu_count" : 1,
+ "total_mem" : 4057989,
+ "host_name" : "localhost.localdomain"
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/ambari-web/app/assets/data/wizard/bootstrap/single_host_registration.json b/ambari-web/app/assets/data/wizard/bootstrap/single_host_registration.json
new file mode 100644
index 0000000000..ba10a4930c
--- /dev/null
+++ b/ambari-web/app/assets/data/wizard/bootstrap/single_host_registration.json
@@ -0,0 +1,11 @@
+{
+ "href" : "http://localhost:8080/api/v1/hosts",
+ "items" : [
+ {
+ "href" : "http://localhost:8080/api/v1/hosts/localhost.localdomain",
+ "Hosts" : {
+ "host_name" : "localhost.localdomain"
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index 2fbbdce35c..2bf06980d0 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -247,20 +247,30 @@ App.WizardStep3Controller = Em.Controller.extend({
isHostsRegistered: function (callback) {
var self = this;
var hosts = this.get('bootHosts');
- var url = App.apiPrefix + '/hosts';
+ var url = App.testMode ? '/data/wizard/bootstrap/single_host_registration.json' : App.apiPrefix + '/hosts';
var method = 'GET';
$.ajax({
type: 'GET',
url: url,
timeout: App.timeout,
success: function (data) {
- var jsonData = jQuery.parseJSON(data);
- if (jsonData && jsonData.items.length === 0) {
+ var jsonData;
+ if (App.testMode) {
+ jsonData = data;
+ } else {
+ jsonData = jQuery.parseJSON(data);
+ }
+ if (!jsonData) {
+ console.log("Error: jsonData is null");
+ return;
+ }
+ if (jsonData.items.length === 0) {
if (self.get('registrationAttempt') !== 0) {
count--;
window.setTimeout(function () {
self.isHostsRegistered(callback);
}, 3000);
+ return;
} else {
self.registerErrPopup(Em.I18n.t('installer.step3.hostRegister.popup.header'), Em.I18n.t('installer.step3.hostRegister.popup.body'));
return;
@@ -303,7 +313,7 @@ App.WizardStep3Controller = Em.Controller.extend({
var self = this;
var kbPerGb = 1024;
var hosts = this.get('bootHosts');
- var url = App.apiPrefix + '/hosts?fields=Hosts/total_mem,Hosts/cpu_count';
+ var url = App.testMode ? '/data/wizard/bootstrap/single_host_information.json' : App.apiPrefix + '/hosts?fields=Hosts/total_mem,Hosts/cpu_count';
var method = 'GET';
$.ajax({
type: 'GET',
@@ -311,16 +321,21 @@ App.WizardStep3Controller = Em.Controller.extend({
contentType: 'application/json',
timeout: App.timeout,
success: function (data) {
- var jsonData = jQuery.parseJSON(data);
+ var jsonData;
+ if (App.testMode) {
+ jsonData = data;
+ } else {
+ jsonData = jQuery.parseJSON(data);
+ }
hosts.forEach(function (_host) {
if (jsonData.items.someProperty('Hosts.host_name', _host.name)) {
var host = jsonData.items.findProperty('Hosts.host_name', _host.name);
_host.cpu = host.Hosts.cpu_count;
- _host.memory = ((parseInt(host.Hosts.total_mem)) / kbPerGb).toFixed(2);
+ _host.memory = ((parseInt(host.Hosts.total_mem))).toFixed(2);
console.log("The value of memory is: " + _host.memory);
}
}, this);
- self.set('bootHosts',hosts);
+ self.set('bootHosts', hosts);
console.log("The value of hosts: " + JSON.stringify(hosts));
self.stopRegistrataion();
},
diff --git a/ambari-web/app/controllers/wizard/step5_controller.js b/ambari-web/app/controllers/wizard/step5_controller.js
index ffec0beb53..3202fdf37f 100644
--- a/ambari-web/app/controllers/wizard/step5_controller.js
+++ b/ambari-web/app/controllers/wizard/step5_controller.js
@@ -58,7 +58,7 @@ App.WizardStep5Controller = Em.Controller.extend({
for (var index in hostInfo) {
var _host = hostInfo[index];
- if (_host.bootStatus === 'success' || true) { // TODO: remove "true" after integrating with bootstrap
+ if (_host.bootStatus === 'DONE') { // TODO: remove "true" after integrating with bootstrap
var hostObj = Ember.Object.create({
host_name:_host.name,
diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js
index 6d51941506..6d3957ba65 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -166,7 +166,7 @@ App.WizardStep6Controller = Em.Controller.extend({
var hostInfo = this.get('content.hostsInfo');
var hostNames = [];
for (var index in hostInfo) {
- if (hostInfo[index].bootStatus === 'success' || true) //TODO: remove true after integration with bootstrap
+ if (hostInfo[index].bootStatus === 'DONE') //TODO: remove true after integration with bootstrap
hostNames.push(hostInfo[index].name);
}
return hostNames;
diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js
index ab15be1f62..fb5519f3d8 100644
--- a/ambari-web/app/controllers/wizard/step9_controller.js
+++ b/ambari-web/app/controllers/wizard/step9_controller.js
@@ -91,8 +91,8 @@ App.WizardStep9Controller = Em.Controller.extend({
hosts.add(obj);
console.log("TRACE: host name is: " + hostInfo[index].name);
}
- return hosts;
- //return hosts.filterProperty('bootStatus', 'success'); //TODO: uncomment after actual hookup with bootstrap
+ // return hosts;
+ return hosts.filterProperty('bootStatus', 'DONE'); //TODO: uncomment after actual hookup with bootstrap
},
renderHosts: function (hostsInfo) {