You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2014/11/12 01:43:08 UTC
ambari git commit: AMBARI-8291. Implement model and mapper for Ambari
as root service. (jaimin)
Repository: ambari
Updated Branches:
refs/heads/trunk b2acb75c3 -> bc0772f57
AMBARI-8291. Implement model and mapper for Ambari as root service. (jaimin)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bc0772f5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bc0772f5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bc0772f5
Branch: refs/heads/trunk
Commit: bc0772f574162a4ada67217a6abd1d6535c34e15
Parents: b2acb75
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Tue Nov 11 16:41:18 2014 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Tue Nov 11 16:42:46 2014 -0800
----------------------------------------------------------------------
ambari-web/app/assets/data/services/ambari.json | 70 ++++++++++++++++++++
.../controllers/global/cluster_controller.js | 29 +++++---
ambari-web/app/mappers.js | 1 +
ambari-web/app/mappers/root_service_mapper.js | 58 ++++++++++++++++
ambari-web/app/models.js | 1 +
ambari-web/app/models/root_service.js | 48 ++++++++++++++
ambari-web/app/utils/ajax/ajax.js | 5 ++
7 files changed, 204 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0772f5/ambari-web/app/assets/data/services/ambari.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/services/ambari.json b/ambari-web/app/assets/data/services/ambari.json
new file mode 100644
index 0000000..0d54fc8
--- /dev/null
+++ b/ambari-web/app/assets/data/services/ambari.json
@@ -0,0 +1,70 @@
+
+{
+ "href" : "http://c6402.ambari.apache.org:8080/api/v1/services/AMBARI?fields=components/RootServiceComponents",
+ "RootService" : {
+ "service_name" : "AMBARI"
+ },
+ "components" : [
+ {
+ "href" : "http://c6402.ambari.apache.org:8080/api/v1/services/AMBARI/components/AMBARI_AGENT",
+ "RootServiceComponents" : {
+ "component_name" : "AMBARI_AGENT",
+ "component_version" : "NOT_APPLICABLE",
+ "service_name" : "AMBARI",
+ "properties" : { }
+ }
+ },
+ {
+ "href" : "http://c6402.ambari.apache.org:8080/api/v1/services/AMBARI/components/AMBARI_SERVER",
+ "RootServiceComponents" : {
+ "component_name" : "AMBARI_SERVER",
+ "component_version" : "1.7.0",
+ "server_clock" : 1415658874,
+ "service_name" : "AMBARI",
+ "properties" : {
+ "agent.task.timeout" : "600",
+ "agent.threadpool.size.max" : "25",
+ "ambari-server.user" : "root",
+ "api.authenticate" : "true",
+ "bootstrap.dir" : "/var/run/ambari-server/bootstrap",
+ "bootstrap.script" : "/usr/lib/python2.6/site-packages/ambari_server/bootstrap.py",
+ "bootstrap.setup_agent.script" : "/usr/lib/python2.6/site-packages/ambari_server/setupAgent.py",
+ "client.threadpool.size.max" : "25",
+ "custom.action.definitions" : "/var/lib/ambari-server/resources/custom_action_definitions",
+ "java.home" : "/usr/jdk64/jdk1.7.0_67",
+ "jce.name" : "UnlimitedJCEPolicyJDK7.zip",
+ "jce_policy1.6.url" : "http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-6.zip",
+ "jce_policy1.7.url" : "http://public-repo-1.hortonworks.com/ARTIFACTS/UnlimitedJCEPolicyJDK7.zip",
+ "jdk.name" : "jdk-7u67-linux-x64.tar.gz",
+ "jdk1.6.url" : "http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-6u31-linux-x64.bin",
+ "jdk1.7.url" : "http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-7u67-linux-x64.tar.gz",
+ "jdk_location" : "http://c6402.ambari.apache.org:8080/resources/",
+ "metadata.path" : "/var/lib/ambari-server/resources/stacks",
+ "recommendations.dir" : "/var/run/ambari-server/stack-recommendations",
+ "resources.dir" : "/var/lib/ambari-server/resources",
+ "security.server.keys_dir" : "/var/lib/ambari-server/keys",
+ "server.connection.max.idle.millis" : "900000",
+ "server.execution.scheduler.isClustered" : "false",
+ "server.execution.scheduler.maxDbConnections" : "5",
+ "server.execution.scheduler.maxThreads" : "5",
+ "server.execution.scheduler.misfire.toleration.minutes" : "480",
+ "server.fqdn.service.url" : "http://169.254.169.254/latest/meta-data/public-hostname",
+ "server.http.session.inactive_timeout" : "1800",
+ "server.jdbc.database" : "postgres",
+ "server.jdbc.database_name" : "ambari",
+ "server.jdbc.postgres.schema" : "ambari",
+ "server.jdbc.user.name" : "ambari",
+ "server.jdbc.user.passwd" : "/etc/ambari-server/conf/password.dat",
+ "server.os_type" : "redhat6",
+ "server.persistence.type" : "local",
+ "server.stages.parallel" : "true",
+ "server.tmp.dir" : "/var/lib/ambari-server/tmp",
+ "server.version.file" : "/var/lib/ambari-server/resources/version",
+ "stackadvisor.script" : "/var/lib/ambari-server/resources/scripts/stack_advisor.py",
+ "ulimit.open.files" : "10000",
+ "webapp.dir" : "/usr/lib/ambari-server/web"
+ }
+ }
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0772f5/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index c405c0d..1cebb43 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -86,6 +86,7 @@ App.ClusterController = Em.Controller.extend({
'racks': false,
'componentConfigs': false,
'componentsState': false,
+ 'rootService': false,
'alertDefinitions': false
}),
@@ -104,11 +105,11 @@ App.ClusterController = Em.Controller.extend({
success: 'loadClusterNameSuccessCallback',
error: 'loadClusterNameErrorCallback'
}).complete(function () {
- if (!App.get('currentStackVersion')) {
- App.set('currentStackVersion', App.defaultStackVersion);
- }
- dfd.resolve();
- });
+ if (!App.get('currentStackVersion')) {
+ App.set('currentStackVersion', App.defaultStackVersion);
+ }
+ dfd.resolve();
+ });
}
return dfd.promise()
},
@@ -310,13 +311,14 @@ App.ClusterController = Em.Controller.extend({
* 8. load hosts to model
* 9. load services from cache with metrics to model
* 10. update stale_configs of host-components (depends on App.supports.hostOverrides)
- * 11. load alert definitions to model
+ * 11. load root service (Ambari)
+ * 12. load alert definitions to model
*/
- this.loadStackServiceComponents(function (data) {
+ self.loadStackServiceComponents(function (data) {
data.items.forEach(function (service) {
service.StackServices.is_selected = true;
service.StackServices.is_installed = false;
- }, this);
+ }, self);
App.stackServiceMapper.mapStackServices(data);
App.config.setPreDefinedServiceConfigs();
var updater = App.router.get('updateController');
@@ -343,6 +345,17 @@ App.ClusterController = Em.Controller.extend({
});
});
});
+ self.loadRootService().done(function (data) {
+ App.rootServiceMapper.map(data);
+ self.updateLoadStatus('rootService');
+ });
+ });
+ },
+
+ loadRootService: function () {
+ return App.ajax.send({
+ name: 'service.ambari',
+ sender: this
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0772f5/ambari-web/app/mappers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers.js b/ambari-web/app/mappers.js
index 2f974df..917dedf 100644
--- a/ambari-web/app/mappers.js
+++ b/ambari-web/app/mappers.js
@@ -36,3 +36,4 @@ require('mappers/components_state_mapper');
require('mappers/service_config_version_mapper');
require('mappers/alert_definitions_mapper');
require('mappers/alert_instances_mapper');
+require('mappers/root_service_mapper');
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0772f5/ambari-web/app/mappers/root_service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/root_service_mapper.js b/ambari-web/app/mappers/root_service_mapper.js
new file mode 100644
index 0000000..1e0e070
--- /dev/null
+++ b/ambari-web/app/mappers/root_service_mapper.js
@@ -0,0 +1,58 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.rootServiceMapper = App.QuickDataMapper.create({
+ root_service_model: App.RootService,
+ root_service_component_model: App.RootServiceComponents,
+
+ configRootService: {
+ id: 'service_name',
+ service_name: 'service_name',
+ components_key: 'components',
+ components_type: 'array',
+ components: {
+ item: 'id'
+ }
+ },
+
+ configRootServiceComponents: {
+ id: 'component_name',
+ component_name: 'component_name',
+ component_version: 'component_version',
+ server_clock: 'server_clock',
+ service_name: 'service_name',
+ properties: 'properties'
+ },
+
+ map: function (data) {
+ var rootServiceModel = this.get('root_service_model');
+ var rootServiceComponentModel = this.get('root_service_component_model');
+ var rootService = {}, rootServiceComponents = [];
+ rootService.id = rootService.service_name = data.RootService.service_name;
+ data.components.forEach(function (item) {
+ item.RootServiceComponents.id = item.RootServiceComponents.component_name;
+ rootServiceComponents.push(this.parseIt(item.RootServiceComponents, this.configRootServiceComponents));
+ }, this);
+ rootService.components = rootServiceComponents;
+ App.store.commit();
+ App.store.loadMany(rootServiceComponentModel, rootServiceComponents);
+ App.store.load(rootServiceModel, this.parseIt(rootService, this.configRootService));
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0772f5/ambari-web/app/models.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models.js b/ambari-web/app/models.js
index df19e28..1b9e9be 100644
--- a/ambari-web/app/models.js
+++ b/ambari-web/app/models.js
@@ -63,3 +63,4 @@ require('classes/job_class');
require('models/config_group');
require('models/service_config_version');
require('models/host_stack_version');
+require('models/root_service');
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0772f5/ambari-web/app/models/root_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/root_service.js b/ambari-web/app/models/root_service.js
new file mode 100644
index 0000000..af42a1f
--- /dev/null
+++ b/ambari-web/app/models/root_service.js
@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+/**
+ * This model loads the rootService (Ambari)
+ * The model maps to the http://localhost:8080/api/v1/services/AMBARI?fields=components/RootServiceComponents
+ * @type {*}
+ */
+App.RootService = DS.Model.extend({
+ serviceName: DS.attr('string'),
+ displayName: function() {
+ return App.format.role(this.get('serviceName'));
+ }.property('serviceName'),
+ components: DS.hasMany('App.RootServiceComponents')
+});
+
+App.RootService.FIXTURES = [];
+
+App.RootServiceComponents = DS.Model.extend({
+ componentName: DS.attr('string'),
+ displayName: function() {
+ return App.format.role(this.get('componentName'));
+ }.property('componentName'),
+ componentVersion: DS.attr('string'),
+ serverClock: DS.attr('number'),
+ serviceName: DS.attr('string'),
+ properties: DS.attr('object')
+});
+
+App.RootServiceComponents.FIXTURES = [];
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc0772f5/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index ef26ba8..dfdeb00 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -170,6 +170,11 @@ var urls = {
}
},
+ 'service.ambari': {
+ 'real': '/services/AMBARI?fields=components/RootServiceComponents',
+ 'mock': '/data/services/ambari.json'
+ },
+
'service.flume.agent.command': {
'real': '/clusters/{clusterName}/hosts/{host}/host_components/FLUME_HANDLER',
'mock': '',