|
@@ -21,92 +21,73 @@ var App = require('app');
|
|
|
App.MainAdminClusterController = Em.Controller.extend({
|
|
|
name:'mainAdminClusterController',
|
|
|
services: [],
|
|
|
- installedServices: function(){
|
|
|
- return App.Service.find().mapProperty('serviceName');
|
|
|
- }.property(),
|
|
|
- currentVersion: function(){
|
|
|
- return App.get('currentStackVersion');
|
|
|
- }.property('App.currentStackVersion'),
|
|
|
upgradeVersion: '',
|
|
|
/**
|
|
|
* get the newest version of HDP from server
|
|
|
- * and update if it newer than current
|
|
|
*/
|
|
|
updateUpgradeVersion: function(){
|
|
|
- var url = App.formatUrl(
|
|
|
- App.apiPrefix + "/stacks",
|
|
|
- {},
|
|
|
- '/data/wizard/stack/stacks.json'
|
|
|
- );
|
|
|
- var result = this.get('upgradeVersion') || App.defaultStackVersion;
|
|
|
- $.ajax({
|
|
|
- type: "GET",
|
|
|
- url: url,
|
|
|
- async: false,
|
|
|
- dataType: 'json',
|
|
|
- timeout: App.timeout,
|
|
|
- success: function (data) {
|
|
|
- result = result.replace(/HDP-/, '');
|
|
|
- data.filterProperty('name', 'HDP').mapProperty('version').forEach(function(version){
|
|
|
- result = (result < version) ? version : result;
|
|
|
- });
|
|
|
- result = 'HDP-' + result;
|
|
|
- },
|
|
|
- error: function (request, ajaxOptions, error) {
|
|
|
- console.log('Error message is: ' + request.responseText);
|
|
|
- },
|
|
|
- statusCode: require('data/statusCodes')
|
|
|
- });
|
|
|
- if(result && result !== this.get('upgradeVersion')){
|
|
|
- this.set('upgradeVersion', result);
|
|
|
+ if(App.router.get('clusterController.isLoaded')){
|
|
|
+ var url = App.formatUrl(
|
|
|
+ App.apiPrefix + "/stacks",
|
|
|
+ {},
|
|
|
+ '/data/wizard/stack/stacks.json'
|
|
|
+ );
|
|
|
+ var upgradeVersion = this.get('upgradeVersion') || App.defaultStackVersion;
|
|
|
+ var installedServices = [];
|
|
|
+ var newServices = [];
|
|
|
+ $.ajax({
|
|
|
+ type: "GET",
|
|
|
+ url: url,
|
|
|
+ async: false,
|
|
|
+ dataType: 'json',
|
|
|
+ timeout: App.timeout,
|
|
|
+ success: function (data) {
|
|
|
+ upgradeVersion = upgradeVersion.replace(/HDP-/, '');
|
|
|
+ data.filterProperty('name', 'HDP').mapProperty('version').forEach(function(version){
|
|
|
+ upgradeVersion = (upgradeVersion < version) ? version : upgradeVersion;
|
|
|
+ });
|
|
|
+ installedServices = data.findProperty('version', App.currentStackVersion.replace(/HDP-/, ''));
|
|
|
+ newServices = data.findProperty('version', upgradeVersion);
|
|
|
+ upgradeVersion = 'HDP-' + upgradeVersion;
|
|
|
+ },
|
|
|
+ error: function (request, ajaxOptions, error) {
|
|
|
+ console.log('Error message is: ' + request.responseText);
|
|
|
+ },
|
|
|
+ statusCode: require('data/statusCodes')
|
|
|
+ });
|
|
|
+ this.set('upgradeVersion', upgradeVersion);
|
|
|
+ this.parseServicesInfo(installedServices, newServices);
|
|
|
}
|
|
|
- },
|
|
|
+ }.observes('App.router.clusterController.isLoaded'),
|
|
|
/**
|
|
|
- * load services info(versions, description)
|
|
|
+ * parse services info(versions, description) by version
|
|
|
*/
|
|
|
- loadServicesFromServer: function () {
|
|
|
- var displayOrderConfig = require('data/services');
|
|
|
+ parseServicesInfo: function (oldServices, newServices) {
|
|
|
var result = [];
|
|
|
- var method = 'GET';
|
|
|
- var url = App.formatUrl(
|
|
|
- App.apiPrefix + App.get('stackVersionURL'),
|
|
|
- {},
|
|
|
- '/data/wizard/stack/hdp/version/1.2.0.json'
|
|
|
- );
|
|
|
- var self = this;
|
|
|
- $.ajax({
|
|
|
- type: method,
|
|
|
- url: url,
|
|
|
- async: false,
|
|
|
- dataType: 'text',
|
|
|
- timeout: App.timeout,
|
|
|
- success: function (data) {
|
|
|
- var jsonData = jQuery.parseJSON(data);
|
|
|
-
|
|
|
- // loop through all the service components
|
|
|
- for (var i = 0; i < displayOrderConfig.length; i++) {
|
|
|
- var entry = jsonData.services.findProperty("name", displayOrderConfig[i].serviceName);
|
|
|
- if(self.get('installedServices').contains(entry.name)){
|
|
|
- var myService = Em.Object.create({
|
|
|
- serviceName: entry.name,
|
|
|
- displayName: displayOrderConfig[i].displayName,
|
|
|
- isDisabled: i === 0,
|
|
|
- isSelected: true,
|
|
|
- isInstalled: false,
|
|
|
- isHidden: displayOrderConfig[i].isHidden,
|
|
|
- description: entry.comment,
|
|
|
- version: entry.version,
|
|
|
- newVersion: '1.3.0'
|
|
|
- });
|
|
|
- result.push(myService);
|
|
|
- }
|
|
|
+ var installedServices = App.Service.find().mapProperty('serviceName');
|
|
|
+ var displayOrderConfig = require('data/services');
|
|
|
+ // loop through all the service components
|
|
|
+ for (var i = 0; i < displayOrderConfig.length; i++) {
|
|
|
+ var entry = oldServices.services.findProperty("name", displayOrderConfig[i].serviceName);
|
|
|
+ if (installedServices.contains(entry.name)) {
|
|
|
+ var myService = Em.Object.create({
|
|
|
+ serviceName: entry.name,
|
|
|
+ displayName: displayOrderConfig[i].displayName,
|
|
|
+ isDisabled: i === 0,
|
|
|
+ isSelected: true,
|
|
|
+ isInstalled: false,
|
|
|
+ isHidden: displayOrderConfig[i].isHidden,
|
|
|
+ description: entry.comment,
|
|
|
+ version: entry.version,
|
|
|
+ newVersion: newServices.services.findProperty("name", displayOrderConfig[i].serviceName).version
|
|
|
+ });
|
|
|
+ //From 1.3.0 for Hive we display only "Hive" (but it installes HCat and WebHCat as well)
|
|
|
+ if (this.get('upgradeVersion').replace(/HDP-/, '') >= '1.3.0' && displayOrderConfig[i].serviceName == 'HIVE') {
|
|
|
+ myService.set('displayName', 'Hive');
|
|
|
}
|
|
|
- },
|
|
|
- error: function (request, ajaxOptions, error) {
|
|
|
- console.log('Error message is: ' + request.responseText);
|
|
|
- },
|
|
|
- statusCode: require('data/statusCodes')
|
|
|
- });
|
|
|
+ result.push(myService);
|
|
|
+ }
|
|
|
+ }
|
|
|
this.set('services', result);
|
|
|
- }.observes('upgradeVersion')
|
|
|
+ }
|
|
|
});
|