';
- });
- }
- });
-
- /* Link the newly-generated serviceMasterHostsMarkup into the DOM. */
- Y.one('#assignHostsDynamicRenderDivId').setContent( serviceMasterHostsMarkup );
-}
diff --git a/hmc/js/assignHosts.js_fancyUIV2 b/hmc/js/assignHosts.js_fancyUIV2
deleted file mode 100644
index b1ddc0b..0000000
--- a/hmc/js/assignHosts.js_fancyUIV2
+++ /dev/null
@@ -1,236 +0,0 @@
-//var globalClusterInfo;
-
-function generateServiceMasterOptions (Y, masterHost, allHosts) {
-
- var generatedOptions = "";
-
- /* The dropdown hosts are allHosts minus masterHost. */
- Y.Array.each( allHosts, function(host) {
-
- if( host != masterHost ) {
- generatedOptions += "";
- }
- });
-
- return generatedOptions;
-}
-
-var registeredAssignHostsEventHandlers = false;
-
-function renderAssignHosts (Y, clusterInfo) {
-
- //globalClusterInfo = clusterInfo;
- // REZ XXX Remove.
- //setNavigationContent(Y, "Clusters > New cluster");
- //activateStage(Y, "#masterHostsSideBarId");
-
- if( !registeredAssignHostsEventHandlers ) {
-
- Y.one('#assignHostsSubmitButtonId').on('click', function (e) {
- e.target.set('disabled', true);
-
- var selections = Y.all("#assignHostsFieldSetId select");
-
- var assignHostsRequestData = {};
-
- selections.each( function(selection) {
-
- var selectedHostIndex = selection.get('selectedIndex');
-
- assignHostsRequestData[ selection.get('name') ] = selection.get('options').item(selectedHostIndex).get('text');
- });
-
- Y.io("../php/frontend/assignHosts.php?clusterName="+clusterInfo.clusterName, {
-
- method: 'POST',
- data: Y.JSON.stringify(assignHostsRequestData),
- timeout : 10000,
- on: {
- start: function(x, o) {
- showLoadingImg(Y);
- //waitPanel.show();
- },
- complete: function(x, o) {
- e.target.set('disabled', false);
- hideLoadingImg(Y);
- //waitPanel.hide();
- },
-
- success: function (x,o) {
- e.target.set('disabled', false);
- Y.log("RAW JSON DATA: " + o.responseText);
-
- // Process the JSON data returned from the server
- try {
- clusterConfigJson = Y.JSON.parse(o.responseText);
- }
- catch (e) {
- alert("JSON Parse failed!");
- return;
- }
-
- //Y.log("PARSED DATA: " + Y.Lang.dump(clusterConfigJson));
-
- if (clusterConfigJson.result != 0) {
- // Error!
- alert("Got error!" + clusterConfigJson.error);
- return;
- }
-
- clusterConfigJson = clusterConfigJson.response;
-
- /* Done with this stage, transition to the next. */
- transitionToNextStage( "#assignHostsCoreDivId", assignHostsRequestData,
- "#configureClusterCoreDivId", clusterConfigJson, renderConfigureCluster );
- },
- failure: function (x,o) {
- e.target.set('disabled', false);
- alert("Async call failed!");
- }
- }
- });
- });
-
- registeredAssignHostsEventHandlers = true;
- }
-
- var allHosts = Y.Array( clusterInfo.allHosts.sort(Y.ArraySort.compare) );
- var servicesInfo = Y.Array( clusterInfo.services );
-
- var serviceMasterHostsMarkup = "";
-
- /* Given recommendations for all the services, generate serviceMasterHostsMarkup
- * to contain only those that are actually enabled for this cluster.
- */
- Y.Array.each(servicesInfo, function(serviceInfo) {
-
- if( serviceInfo.enabled == true ) {
-
- Y.Array.each(serviceInfo.masters, function(masterInfo) {
-
- var masterHostName = masterInfo.name;
- var masterHostNameID = masterHostName + 'Id';
-
- /* Inefficient, with all the string concatenations, but clear to read. */
- serviceMasterHostsMarkup +=
- '
' +
- '' +
- '' +
- '
';
- });
- }
- });
-
- /* Link the newly-generated serviceMasterHostsMarkup into the DOM. */
- Y.one('#assignHostsDynamicRenderDivId').setContent( serviceMasterHostsMarkup );
-
-
-
-///////////////////////// New stuff //////////////
-
-var currentMaster="";
-var nodeGroups = [ "A", "B"];
-var serviceMasters = [ "NameNode", "JobTracker" , "HBaseMaster" ]
-var slotContents = {};
-var serviceLocations = {};
-
-function renderSlots(Y) {
- for (nodeGroupIndex in nodeGroups) {
- for (serviceMasterIndex in serviceMasters) {
- var content= "";
- var thisId = 'slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex;
- for (master in slotContents[thisId]) {
- content += master + " ";
- }
- Y.one('#' + thisId).setContent(content);
- }
- }
-}
-
- ////////////////// Render service links ///////////////////
- var serviceMastersLinksMarkup ="";
- for (key in serviceMasters) {
- serviceMastersLinksMarkup += '
' + serviceMasters[key] + '
';
- }
- Y.one("#serviceMastersLinksDivId").setContent(serviceMastersLinksMarkup);
- ////////////////// End of rendering service links ////////
-
- ////////////////// Register click handlers for all masters ///////////////////
- for (key in serviceMasters) {
- var serviceLinkId = "#" + serviceMasters[key];
- Y.one(serviceLinkId).on('click', function(e) {
- if ( currentMaster != this.get('id')) {
- activate(Y, this.get('id'));
- }
- });
- }
- ////////////////// End of registering click handlers for all masters ///////////////////
-
- ////////////////// Render node groups ////////
- var nodeGroupsMarkup = '
';
- for (nodeGroupIndex in nodeGroups) {
- nodeGroupsMarkup += '
Node group ' + nodeGroups[nodeGroupIndex] + '
';
-
- // Number of boxes equal to number of service-masters
- for (serviceMasterIndex in serviceMasters) {
- nodeGroupsMarkup += '';
- }
- nodeGroupsMarkup += '
';
- }
- nodeGroupsMarkup += '
';
- Y.one("#nodeGroupsDivId").setContent(nodeGroupsMarkup);
- ////////////////// End of rendering node groups ////////
-
- // Register click handlers for all node-slots
- for (nodeGroupIndex in nodeGroups) {
- for (serviceMasterIndex in serviceMasters) {
- var slotDivId = '#slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex;
- Y.log("registering for " + slotDivId);
- Y.one(slotDivId).on('click', function(e) {
- Y.log("Clicked on " + this.get('id'));
- //Y.log(currentMaster + " " + nodeGroups[nodeGroupIndex] + " " + serviceMasterIndex);
- //Y.log('#slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex);
- //Y.one('#slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex).setContent("hello");
- // this.setContent(serviceMasters[currentMaster]);
- var oldSlotId = serviceLocations[currentMaster];
- if (oldSlotId != this.get('id')) {
- delete slotContents[oldSlotId][currentMaster];
- serviceLocations[currentMaster] = this.get('id');
- if (slotContents[this.get('id')] === undefined) {
- slotContents[this.get('id')] = {};
- }
- slotContents[this.get('id')][currentMaster] = [currentMaster];
- renderSlots(Y);
- }
- });
- }
- }
-
- ////////////////// Initialize all slots ///////////////////
- var thisId = 'slotForGroup' + nodeGroups[0] + 0;
- for (serviceMasterIndex in serviceMasters) {
- if (slotContents[thisId] === undefined) {
- slotContents[thisId] = {};
- }
- var masterName = serviceMasters[serviceMasterIndex];
- slotContents[thisId][masterName] = masterName;
- serviceLocations[masterName] = thisId;
- }
- renderSlots(Y);
- ////////////////// End of initializing all slots ///////////////////
-
-function activate(Y, serviceMaster) {
- Y.log("Activated " + serviceMaster + " from " + currentMaster);
- Y.one("#" + serviceMaster).replaceClass("aServiceMasterLink", "aServiceMasterLinkVisited");
- if (currentMaster != "") {
- Y.one("#" + currentMaster).replaceClass("aServiceMasterLinkVisited", "aServiceMasterLink");
- }
- currentMaster = serviceMaster;
-}
-
-
-}
diff --git a/hmc/js/backup_progress.js b/hmc/js/backup_progress.js
deleted file mode 100644
index 2525e09..0000000
--- a/hmc/js/backup_progress.js
+++ /dev/null
@@ -1,207 +0,0 @@
-var tmpY1;
-
-function generateSingleDiscoverProgressStateMarkup( discoverProgressStateTitle, discoverProgressStateCssClass ) {
-
- tmpY1.log( 'Generating: ' + discoverProgressStateTitle + '-' + discoverProgressStateCssClass );
-
- var markup =
- '
';
- installationStatusDivCssClass = 'statusOk';
- }
- }
-
- if( noNeedForFurtherPolling ) {
-
- /* We've made all the progress we could have, so stop polling. */
- discoverProgressDataSource.clearInterval( discoverProgressPollHandle );
-
- var installationStatusDiv = Y.one('#displayProgressStatusDivId');
-
- installationStatusDiv.set('className', installationStatusDivCssClass);
- installationStatusDiv.setContent(installationStatusDivContent);
- installationStatusDiv.setStyle('display', 'block');
-
- /* If we stopped polling due to error, we need to do more work. */
- if( installationStatusDivCssClass == 'statusError' ) {
-
- /* Create the panel that'll display our error info. */
- errorInformationPanel =
- createInformationalPanel( Y, '#informationalPanelContainerDivId', 'Deploy Logs' );
-
- /* Augment errorInformationPanel with the relevant buttons. */
- var backToInstallationWizardButton = {
- value: 'I will tame the wild \'uns!',
- action: function (e) {
- e.preventDefault();
- Y.one('#displayProgressStatusDivId').setStyle('display', 'none');
- Y.one('#displayProgressCoreDivId').setStyle('display', 'none');
- Y.one('#installationWizardProgressBarDivId').setStyle('display',
- 'block');
- Y.one("#initializeClusterCoreDivId").setStyle('display', 'block');
- alert("HIDING!");
- errorInformationPanel.hide();
- },
- section: 'footer'
- };
-
- var goToServicesSelectPageButton = {
- value: 'I dont mind the wild ones!',
- action: function (e) {
- e.preventDefault();
- Y.one('#installationWizardProgressBarDivId').setStyle('display', 'block');
- Y.one('#displayProgressStatusDivId').setStyle('display', 'none');
- transitionToNextStage( "#displayProgressCoreDivId", discoverProgressInfo, "#selectServicesCoreDivId", discoverProgressInfo, renderSelectServicesBlock);
- alert("HIDING!");
- errorInformationPanel.hide();
- errorInformationPanel = null;
- },
- section: 'footer'
- };
-
- errorInformationPanel.addButton( backToInstallationWizardButton );
- errorInformationPanel.addButton( goToServicesSelectPageButton );
-
- Y.one("#errorInfoLinkId").on( "click", function(err) {
-
- Y.log("ERROR LINK RENDER: " + Y.Lang.dump(e.response.meta.stateInfo));
- errorInformationPanel.set( 'bodyContent', Y.Lang.dump( e.response.meta.stateInfo ) );
- alert("SHOWING! " + Y.Lang.dump(errorInformationPanel));
- errorInformationPanel.show();
- });
- } else {
- Y.one("#successInfoLinkId").on( "click", function(e) {
- Y.one('#installationWizardProgressBarDivId').setStyle('display', 'block');
- Y.one('#displayProgressStatusDivId').setStyle('display', 'none');
- transitionToNextStage( "#displayProgressCoreDivId", discoverProgressInfo, "#selectServicesCoreDivId", discoverProgressInfo, renderSelectServicesBlock);
- });
- }
- }
-
- discoverProgressMarkup += '
';
-
-// Y.log('About to generate markup: ' + discoverProgressMarkup);
- Y.one('#displayProgressDynamicRenderDivId').setContent( discoverProgressMarkup );
- },
- failure: function (e) {
- alert('Failed to fetch more progress!');
- /* No point making any more attempts. */
- discoverProgressDataSource.clearInterval( discoverProgressPollHandle );
- }
- }
- });
-}
diff --git a/hmc/js/deploy_backup.js b/hmc/js/deploy_backup.js
deleted file mode 100644
index 5292699..0000000
--- a/hmc/js/deploy_backup.js
+++ /dev/null
@@ -1,61 +0,0 @@
-function generateServiceMasterOptions (Y, masterHost, allHosts) {
-
- var generatedOptions = "";
-
- /* The dropdown hosts are allHosts minus masterHost. */
- Y.Array.each( allHosts, function(host) {
-
- if( host != masterHost ) {
- generatedOptions += "";
- }
- });
-
- return generatedOptions;
-}
-
-function renderDeploy (Y, deployInfo) {
-
- Y.one('#deploySubmitButtonId').on('click',function (e) {
-
- e.target.set('disabled', true);
-
- var deployRequestData = {};
-
- Y.io("../php/deploy.php?clusterName="+deployInfo.clusterName, {
-
- method: 'POST',
- data: Y.JSON.stringify(deployRequestData),
- timeout : 10000,
- on: {
- success: function (x,o) {
- e.target.set('disabled', false);
- Y.log("RAW JSON DATA: " + o.responseText);
-
- // Process the JSON data returned from the server
- try {
- xxxJson = Y.JSON.parse(o.responseText);
- }
- catch (e) {
- alert("JSON Parse failed!");
- return;
- }
-
- Y.log("PARSED DATA: " + Y.Lang.dump(xxxJson));
-
-// /* Done with this stage, hide it. */
-// Y.one("#deployCoreDivId").setStyle('display','none');
-//
-// /* Render the next stage. */
-// renderConfigureCluster(Y, xxxJson);
-//
-// /* Show off our rendering. */
-// Y.one("#configureClusterCoreDivId").setStyle('display','block');
- },
- failure: function (x,o) {
- e.target.set('disabled', false);
- alert("Async call failed!");
- }
- }
- });
- });
-}
diff --git a/hmc/js/displayLogs.js b/hmc/js/displayLogs.js
deleted file mode 100644
index 23a835b..0000000
--- a/hmc/js/displayLogs.js
+++ /dev/null
@@ -1,100 +0,0 @@
-function getGsInstallLogs(Y, clusterName) {
- var errorCount = 0;
- var lastSize = 0;
- var sizeRepeatedCount = 0;
-
- YUI().use("node", "io", "dump", "json", "datasource", "datasource-io", "datasource-jsonschema", "datasource-polling", function(Y) {
-
-/*
- var getLogFunction = function() {
- Y.io("../php/displayLogs.php?clusterName=" + clusterName + "&lines=all", {
- method: 'GET',
- timeout : 1000,
- on: {
- success: function (x,o) {
- Y.log("RAW LOG DATA: " + o.responseText);
- return o.responseText;
- },
- failure: function (x,o) {
- alert("Async call failed!");
- }
- }
- });
-
- };
-*/
-
- var id;
-// var myDataSource = new Y.DataSource.Function({source:getLogFunction});
- var myDataSource = new Y.DataSource.IO({source:"../php/displayLogs.php?clusterName=" + clusterName + "&lines=all"});
- myDataSource.plug(Y.Plugin.DataSourceJSONSchema, {
- schema: {
- metaFields: {logs:"logs", clusterName:"clusterName", gsInstallDone:"gsInstallDone"}
- }
- });
- var callback = {
- success: function(e){
- var logs = e.response.meta.logs;
- Y.log("IN LOG CALLBACK: got logs of length: " + logs.length);
- errorCount=0;
- var length = logs.length;
- var newlogs;
- if (length > lastSize ) {
- newlogs = logs.split('\n').join(' ');
- }
-/*
- if (length == lastSize) {
- ++sizeRepeatedCount;
- } else {
- sizeRepeatedCount = 0;
- lastSize = length;
- }
- if (sizeRepeatedCount == 5 ) {
- Y.log("In log callback: stopping, repeat count=" + sizeRepeatedCount);
- myDataSource.clearInterval(id); // end polling
- }
-*/
- Y.log("IN LOG CALLBACK: got installdone as " + e.response.meta.gsInstallDone);
- if (e.response.meta.gsInstallDone) {
- Y.log("In log callback: stopping, got installdone as " + e.response.meta.gsInstallDone);
- myDataSource.clearInterval(id); // end polling
- newlogs += 'Installation script finished... ';
- // Y.one("#installDoneDivId").setStyle('display', 'block');
- } else {
- newlogs += ' ';
- }
- Y.one("#displayLogsContentDivId").setContent(newlogs);
- Y.one("#displayLogsContentDivId").scrollTop = Y.one("#displayLogsContentDivId").scrollHeight;
- },
- failure: function(e){
- ++errorCount;
- Y.log("In log callback: failed, error count=" + errorCount);
- if (errorCount > 3 ){
- myDataSource.clearInterval(id); // end polling
- }
- }
- };
- id = myDataSource.setInterval(5000, {'request': {},'callback':callback}); // Starts polling
- });
-}
-
-
-function renderDisplayLogs(Y, clusterName) {
- /*
- Y.one('#installDoneDivId').on('click',function (e) {
-
- e.target.set('disabled', true);
- */
-
- /* Done with this stage, hide it. */
- // Y.one("#displayLogsCoreDivId").setStyle('display','none');
-
- /* Render the next stage. */
- // getServicesStatus(Y, clusterName);
-
- // /* Show off our rendering. */
- // Y.one("#displayServiceStatusCoreDivId").setStyle('display','block');
- // });
-
- getGsInstallLogs(Y, clusterName);
-}
diff --git a/hmc/js/initializeCluster_old.js b/hmc/js/initializeCluster_old.js
deleted file mode 100644
index 17adee0..0000000
--- a/hmc/js/initializeCluster_old.js
+++ /dev/null
@@ -1,119 +0,0 @@
-// Create business logic in a YUI sandbox using the 'io' and 'json' modules
-function renderInitializeClusterBlockABC(Y, infoInitializeCluster) {
-
- var clusterName = infoInitializeCluster.clusterName;
-
- // REZ XXX Remove.
- //setNavigationContent(Y, "Clusters > New cluster");
-
- // REZ XXX Remove.
- //activateStage(Y, "#selectServicesSideBarId");
-
- var initializeClusterSubmitButton = Y.one('#initializeClusterSubmitButtonId');
-
- initializeClusterSubmitButton.on('click',function (e) {
-
- initializeClusterSubmitButton.set('disabled', true);
-
- var initializeClusterFilesForm = Y.one("#initializeClusterFilesFormId");
-
- initializeClusterFilesForm.set('action', '../php/frontend/uploadFiles.php?clusterName=' + clusterName);
-
- /* Set the target of the first form's upload to be a hidden iframe
- * on the page so as not to redirect to the PHP page we're POSTing
- * to.
- *
- * See http://www.openjs.com/articles/ajax/ajax_file_upload/ for
- * more on this.
- */
- initializeClusterFilesForm.set('target', 'fileUploadTarget');
-
- /* And then programmatically submit the first of the 2 forms. */
- initializeClusterFilesForm.submit();
-
- /* The 2nd form will be sequentially submitted after the first one is
- * done (which we are notified of by listening for the 'load' event on
- * #fileUploadTargetId).
- */
- });
-
- /* Only once the #fileUploadTargetId is done loading do we know that the
- * first form upload is done, so use this as a trigger to fire off the
- * 2nd upload; we need to be sequential to avoid race conditions at the
- * back-end.
- */
- Y.one("#fileUploadTargetId").on('load', function (e1) {
-
- var initializeClusterRequestData = {
- "ClusterDeployUser" : Y.one("#clusterDeployUserId").get('value'),
- "services" : [
- { "serviceName" : "HDFS", "isEnabled" : Y.one("#installHDFSId").get('checked') },
- { "serviceName" : "MAPREDUCE", "isEnabled" : Y.one("#installMRId").get('checked') },
- { "serviceName" : "HBASE", "isEnabled" : Y.one("#installHBaseId").get('checked') },
- { "serviceName" : "HCATALOG", "isEnabled" : Y.one("#installHCatalogId").get('checked') },
- { "serviceName" : "TEMPLETON", "isEnabled" : Y.one("#installTempletonId").get('checked') },
- { "serviceName" : "OOZIE", "isEnabled" : Y.one("#installOozieId").get('checked') },
- { "serviceName" : "PIG", "isEnabled" : Y.one("#installPigId").get('checked') },
- { "serviceName" : "SQOOP", "isEnabled" : Y.one("#installSqoopId").get('checked') }
- ]
- };
-
- Y.io("../php/frontend/initializeCluster.php?clusterName=" + clusterName, {
-
- method: 'POST',
- data: Y.JSON.stringify(initializeClusterRequestData),
- timeout : 10000,
- on: {
- start: function(x, o) {
- Y.log("In start function");
- // waitPanel.set('headerContent' ,'Loading, please wait...');
- // waitPanel.set('bodyContent', 'Discovering nodes, doing complicated things which are too hard to explain so please wait ... ( we may get back to you someday)');
- // waitPanel.render(document.body);
- // waitPanel.set('display', 'block');
- // Y.one("#initializeClusterStatusDivId").setStyle('background-color','red');
- // Y.one("#initializeClusterStatusDivId").setStyle('font-color','white');
- // Y.one("#initializeClusterStatusDivId").setStyle('border','1px solid');
- showLoadingImg(Y);
- //waitPanel.show();
- // Y.one("#initializeClusterStatusDivId").setStyle('visible','true');
- },
- complete: function(x, o) {
- initializeClusterSubmitButton.set('disabled', false);
- Y.log("In stop function");
- hideLoadingImg(Y);
- //waitPanel.hide();
- },
- success: function (x,o) {
- initializeClusterSubmitButton.set('disabled', false);
- Y.log("RAW JSON DATA: " + o.responseText);
-
- // Process the JSON data returned from the server
- try {
- clusterInfoJson = Y.JSON.parse(o.responseText);
- }
- catch (e) {
- alert("JSON Parse failed!");
- return;
- }
-
- Y.log("PARSED DATA: " + Y.Lang.dump(clusterInfoJson));
-
- if (clusterInfoJson.result != 0) {
- // Error!
- alert("Got error!" + clusterInfoJson.error);
- return;
- }
- clusterInfoJson = clusterInfoJson.response;
-
- /* Done with this stage, transition to the next. */
- transitionToNextStage( "#initializeClusterCoreDivId", initializeClusterRequestData,
- "#assignHostsCoreDivId", clusterInfoJson, renderAssignHosts );
- },
- failure: function (x,o) {
- initializeClusterSubmitButton.set('disabled', false);
- alert("Async call failed!");
- }
- }
- });
- });
-}
diff --git a/hmc/js/rezConfigureCluster_backup.js b/hmc/js/rezConfigureCluster_backup.js
deleted file mode 100644
index be28f2a..0000000
--- a/hmc/js/rezConfigureCluster_backup.js
+++ /dev/null
@@ -1,192 +0,0 @@
-function generateEligibleMountPoints (Y) {
-
- /* The list we're about to build up. */
- var desiredMountPoints = [];
-
- var selections = Y.all("#configureClusterMountPointsInputDivId input[type=checkbox]");
-
- selections.each( function(selection) {
-
- if( selection.get('checked') == true ) {
- desiredMountPoints.push( selection.get('value') );
- }
- });
-
- var customMountPointsString = Y.Lang.trim( Y.one("#customMountPointsId").get('value') );
-
- if( customMountPointsString.length != 0 ) {
-
- Y.log("custom string = " + customMountPointsString);
-
- /* Merge the split version of customMountPointsString into our final list
- * of mount points to send back to the server for committing...
- */
- desiredMountPoints.push.apply( desiredMountPoints, customMountPointsString.split(',') );
- Y.log(customMountPointsString.split(',').length);
- Y.log(desiredMountPoints.join(','));
- }
-
- /* ...But not before performing a de-dupe, just to be safe. */
- return Y.Array.dedupe( desiredMountPoints );
-}
-
-function generateServiceDirs (Y, servicesInfo) {
-
- var generatedServiceDirs = {};
-
- var eligibleMountPoints = generateEligibleMountPoints(Y);
-
- Y.Array.each( servicesInfo, function (serviceInfo) {
-
- var serviceDirs = [];
-
- for( currentDirNum = 0; currentDirNum < serviceInfo.maxDirectoriesNeeded; ++currentDirNum ) {
-
- /* serviceInfo.maxDirectoriesNeeded that we get from the server is a cap
- * on how many directories need to be generated for that service - the
- * user can always pick fewer than that, so guard against going out of
- * bounds.
- */
- if( currentDirNum < eligibleMountPoints.length ) {
-
- var currentDirName = eligibleMountPoints[currentDirNum];
-
- /* Add a trailing slash if it doesn't exist already. */
- if( currentDirName.substr(-1) != '/' ) {
- currentDirName += '/';
- }
-
- serviceDirs.push( currentDirName + serviceInfo.suffix );
- }
- }
-
- var serviceDirValue = serviceDirs.join(',');
-
- generatedServiceDirs[serviceInfo.keyName] = {
- 'value' : serviceDirValue,
- 'displayName' : serviceInfo.displayName
- };
- });
-
- return generatedServiceDirs;
-}
-
-function renderEffectiveClusterConfig (Y,generatedClusterConfig) {
-
- var clusterConfigDisplayMarkup = "";
-
- for (var configKey in generatedClusterConfig) {
- if (generatedClusterConfig.hasOwnProperty( configKey )) {
-
- var configElement = generatedClusterConfig[configKey];
-
- var configElementName = configKey;
- var configElementIdName = configElementName + 'Id';
-
- /* Inefficient, with all the string concatenations, but clear to read. */
- clusterConfigDisplayMarkup +=
- '
' +
- '' +
- '' +
- ' ' +
- '
';
- }
- }
-
- /* Link the newly-generated clusterConfigInputMarkup into the DOM (making
- * sure it comes before the existing #configureClusterSubmitButtonId), thus
- * rendering it.
- */
- Y.one("#configureClusterMountPointsDisplayDivId").setContent( clusterConfigDisplayMarkup );
-}
-
-/* Modify the working version of generatedClusterConfig to make it fit for
- * sending to our backend.
- */
-function polishClusterConfig (generatedClusterConfig) {
-
- var polishedClusterConfig = {};
-
- for (var configKey in generatedClusterConfig) {
- if (generatedClusterConfig.hasOwnProperty( configKey )) {
- polishedClusterConfig[ configKey ] = generatedClusterConfig[configKey].value;
- }
- }
-
- return polishedClusterConfig;
-}
-
-function renderConfigureCluster (Y, clusterConfig) {
-
- var servicesInfo = Y.Array( clusterConfig.servicesInfo );
-
- Y.one('#configureClusterSubmitButtonId').on('click',function (e) {
-
- /* For now, our cluster config consists solely of the generated service directories. */
- var generatedClusterConfig = generateServiceDirs(Y, servicesInfo);
-
- var configureClusterRequestData = {
- mountPoints : generateEligibleMountPoints(Y),
- clusterConfig : polishClusterConfig(generatedClusterConfig)
- };
-
- Y.io("../php/configureCluster.php?clusterName="+clusterConfig.clusterName, {
-
- method: 'POST',
- data: Y.JSON.stringify(configureClusterRequestData),
- timeout : 10000,
- on: {
- success: function (x,o) {
- Y.log("RAW JSON DATA: " + o.responseText);
-
- // Process the JSON data returned from the server
- try {
- deployInfoJson = Y.JSON.parse(o.responseText);
- }
- catch (e) {
- alert("JSON Parse failed!");
- return;
- }
-
- Y.log("PARSED DATA: " + Y.Lang.dump(deployInfoJson));
-
- /* Done with this stage, hide it. */
- // Y.one("#configureClusterCoreDivId").setStyle('display','none');
-
- /* Render the next stage. */
- //renderConfigureCluster(Y, clusterConfigJson);
-
- /* Show off our rendering. */
- // Y.one("#configureClusterCoreDivId").setStyle('display','block');
- },
- failure: function (x,o) {
- alert("Async call failed!");
- }
- }
- });
- });
-
- /* Generate the key form elements into clusterConfigInputMarkup. */
- var mountPoints = Y.Array( clusterConfig.mountPoints.sort(Y.ArraySort.compare) );
-
- var clusterConfigInputMarkup = "";
-
- Y.Array.each(mountPoints, function(mountPoint) {
-
- /* Inefficient, with all the string concatenations, but clear to read. */
- clusterConfigInputMarkup +=
- '
' +
- '' +
- mountPoint +
- ' ' +
- '
';
- });
-
- /* Link the newly-generated clusterConfigInputMarkup into the DOM (making
- * sure it comes before the existing #configureClusterSubmitButtonId), thus
- * rendering it.
- */
- Y.one("#configureClusterMountPointsInputDivId").prepend( clusterConfigInputMarkup );
-
- renderEffectiveClusterConfig(Y, generateServiceDirs(Y, servicesInfo));
-}
diff --git a/hmc/js/serviceStatus.js b/hmc/js/serviceStatus.js
deleted file mode 100644
index 9eff7b5..0000000
--- a/hmc/js/serviceStatus.js
+++ /dev/null
@@ -1,73 +0,0 @@
-function getServicesStatus(clusterName) {
- YUI().use("node", "dump", "io", "datatable", "json", "arraysort", "datasource", "datasource-io", "datasource-jsonschema", "datasource-polling", function (Y) {
-
- // setNavigationContent(Y, "Clusters > Cluster - " + clusterName);
-
- var id;
- var errorCount = 0;
- var myDataSource = new Y.DataSource.IO({source:"../php/frontend/servicesStatus.php?clusterName=" + clusterName });
- myDataSource.plug(Y.Plugin.DataSourceJSONSchema, {
- schema: {
- metaFields: { serviceStatus: "serviceStatus" }
- }
- });
-
- Y.one("#displayServiceStatusContentDivId").setContent("Getting status of all services");
-
- var callback = {
- success: function (e) {
- Y.log("RAW DATA: " + e.response.meta.serviceStatus);
-
- serviceStatusInfo = e.response.meta.serviceStatus;
-
- /* Render the obtained service status info */
- renderServicesStatus(Y, clusterName, serviceStatusInfo);
- },
- failure: function (x,o) {
- alert("Async call failed!");
- ++errorCount;
- Y.log("In serviceStatus callback: failed, error count=" + errorCount);
- if (errorCount > 3 ){
- myDataSource.clearInterval(id); // end polling
- }
- }
- };
- id = myDataSource.setInterval(5000, {'request': {},'callback':callback}); // Starts polling
- });
-}
-
-function renderServicesStatus(Y, clusterName, servicesStatusInfo) {
-
- var svcStatusMarkup = "
" +
- "
Installed services
" +
- "
Name
Description
Status
Management
";
-
- for (var svcKey in servicesStatusInfo) {
- if (servicesStatusInfo.hasOwnProperty( svcKey )) {
-
- var statusNum = serviceStatusInfo[svcKey]["statusNum"];
- if (statusNum == 4) {
- // Separate tables for installed services
- continue;
- }
-
- var status = serviceStatusInfo[svcKey]["status"];
- if (statusNum == 5) {
- status = status + ' ';
- }
-
- /* Inefficient, with all the string concatenations, but clear to read. */
- svcStatusMarkup +=
- '