ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [1/2] ambari git commit: AMBARI-10370. Slider View: Support multiple versions of the same app (alexantonenko)
Date Mon, 06 Apr 2015 17:04:53 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0de10b795 -> 75c9df821


AMBARI-10370. Slider View: Support multiple versions of the same app (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/75c9df82
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/75c9df82
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/75c9df82

Branch: refs/heads/trunk
Commit: 75c9df8216a0555023a143396bb9a218529fb043
Parents: 1afb7e6
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Mon Apr 6 20:01:16 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Mon Apr 6 20:04:48 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ambari/view/slider/SliderApp.java   |  9 +++++++++
 .../view/slider/SliderAppsViewControllerImpl.java  | 15 +++++++++------
 .../resources/ui/app/mappers/application_type.js   |  3 ++-
 .../resources/ui/app/mappers/slider_apps_mapper.js |  2 +-
 .../resources/ui/app/models/slider_app_type.js     | 17 ++++++++++++++---
 5 files changed, 35 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/75c9df82/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderApp.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderApp.java
b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderApp.java
index d75762e..25b1e17 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderApp.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderApp.java
@@ -30,6 +30,7 @@ public class SliderApp {
   private String appVersion;
   private String description;
   private String type;
+  private String typeId;
   private String user;
   private String state;
   private String diagnostics;
@@ -186,4 +187,12 @@ public class SliderApp {
   public void setAlerts(Map<String, Object> alerts) {
     this.alerts = alerts;
   }
+
+  public String getTypeId() {
+    return typeId;
+  }
+
+  public void setTypeId(String typeId) {
+    this.typeId = typeId;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/75c9df82/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
index 3b74239..339938a 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
@@ -625,8 +625,10 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController
{
           String value = tag.substring(index + 1).trim();
           if ("name".equals(key)) {
             app.setType(value);
+            app.setTypeId(value.toUpperCase() + "-" + app.getAppVersion());
           } else if ("version".equals(key)) {
             app.setAppVersion(value);
+            app.setTypeId(app.getType() + "-" + value);
           } else if ("description".equals(key)) {
             app.setDescription(value);
           }
@@ -643,6 +645,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController
{
               && (appType.getTypeVersion() != null && appType.getTypeVersion()
                   .equalsIgnoreCase(app.getAppVersion()))) {
             matchedAppType = appType;
+            app.setTypeId(appType.getId());
             break;
           }
         }
@@ -1040,7 +1043,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController
{
                 throw new IllegalStateException("Slider App package '" + appZip.getName()
+ "' does not contain 'resources-default.json' file");
               }
               SliderAppType appType = new SliderAppType();
-              appType.setId(application.getName());
+              appType.setId(application.getName() + "-" + application.getVersion());
               appType.setTypeName(application.getName());
               appType.setTypeDescription(application.getComment());
               appType.setTypeVersion(application.getVersion());
@@ -1167,7 +1170,8 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController
{
       YarnException, InterruptedException {
     if (json.has("name") && json.has("typeConfigs")
         && json.has("resources") && json.has("typeName")) {
-      final String appType = json.get("typeName").getAsString();
+      final String appTypeId = json.get("typeName").getAsString();
+      SliderAppType sliderAppType = getSliderAppType(appTypeId, null);
       final String appName = json.get("name").getAsString();
       final String queueName = json.has("queue") ? json.get("queue").getAsString() : null;
       final boolean securityEnabled = Boolean.valueOf(getHadoopConfigs().get("security_enabled"));
@@ -1202,7 +1206,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController
{
       appCreateFolder.mkdirs();
       File appConfigJsonFile = new File(appCreateFolder, "appConfig.json");
       File resourcesJsonFile = new File(appCreateFolder, "resources.json");
-      saveAppConfigs(configs, componentsArray, appName, appType, securityEnabled, appConfigJsonFile);
+      saveAppConfigs(configs, componentsArray, appName, sliderAppType.getTypeName(), securityEnabled,
appConfigJsonFile);
       saveAppResources(resourcesObj, resourcesJsonFile);
 
       final ActionCreateArgs createArgs = new ActionCreateArgs();
@@ -1213,15 +1217,14 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController
{
       }
 
       final ActionInstallPackageArgs installArgs = new ActionInstallPackageArgs();
-      SliderAppType sliderAppType = getSliderAppType(appType, null);
       String localAppPackageFileName = sliderAppType.getTypePackageFileName();
-      installArgs.name = appType;
+      installArgs.name = sliderAppType.getTypeName();
       installArgs.packageURI = getAppsFolderPath() + "/" + localAppPackageFileName;
       installArgs.replacePkg = true;
 
       final List<ActionInstallKeytabArgs> installKeytabActions = new ArrayList<ActionInstallKeytabArgs>();
       if (securityEnabled) {
-        for (String keytab : getUserToRunAsKeytabs(appType)) {
+        for (String keytab : getUserToRunAsKeytabs(sliderAppType.getTypeName())) {
           ActionInstallKeytabArgs keytabArgs = new ActionInstallKeytabArgs();
           keytabArgs.keytabUri = keytab;
           keytabArgs.folder = appName;

http://git-wip-us.apache.org/repos/asf/ambari/blob/75c9df82/contrib/views/slider/src/main/resources/ui/app/mappers/application_type.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/mappers/application_type.js b/contrib/views/slider/src/main/resources/ui/app/mappers/application_type.js
index e4bdd85..9fff2e3 100644
--- a/contrib/views/slider/src/main/resources/ui/app/mappers/application_type.js
+++ b/contrib/views/slider/src/main/resources/ui/app/mappers/application_type.js
@@ -53,7 +53,8 @@ App.ApplicationTypeMapper = App.Mapper.create({
   map: {
     id: 'id',
     configs: 'typeConfigs',
-    displayName: 'typeName',
+    typeName: 'typeName',
+    typeVersion: 'typeVersion',
     index: 'id',
     description: 'typeDescription',
     version: 'typeVersion',

http://git-wip-us.apache.org/repos/asf/ambari/blob/75c9df82/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
b/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
index 44ea18d..95750ce 100644
--- a/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
+++ b/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
@@ -264,7 +264,7 @@ App.SliderAppsMapper = App.Mapper.createWithMixins(App.RunPeriodically,
{
           user: app.user,
           started: app.startTime || 0,
           ended: app.endTime  || 0,
-          appType: app.type.toUpperCase(),
+          appType: app.typeId,
           diagnostics: app.diagnostics || "-",
           description: app.description || "-",
           components: componentsId,

http://git-wip-us.apache.org/repos/asf/ambari/blob/75c9df82/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type.js b/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type.js
index d161037..cb376bc 100644
--- a/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type.js
+++ b/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type.js
@@ -26,7 +26,12 @@ App.SliderAppType = DS.Model.extend({
   /**
    * @type {string}
    */
-  displayName: DS.attr('string'),
+  typeName: DS.attr('string'),
+
+  /**
+   * @type {string}
+   */
+  typeVersion: DS.attr('string'),
 
   /**
    * @type {App.SliderAppTypeComponent[]}
@@ -46,8 +51,14 @@ App.SliderAppType = DS.Model.extend({
   /**
    * @type {object}
    */
-  configs: DS.attr('object')
-
+  configs: DS.attr('object'),
+  
+  displayName : function() {
+    var typeName = this.get('typeName');
+    var typeVersion = this.get('typeVersion');
+    return (typeName == null ? '' : typeName) + " ("
+        + (typeVersion == null ? '' : typeVersion) + ")"
+  }.property('typeName', 'typeVersion')
 });
 
 App.SliderAppType.FIXTURES = [];
\ No newline at end of file


Mime
View raw message