Commits

Enis Afgan committed 4e36a7c

Streamline the shutdown procedure in the UI

Comments (0)

Files changed (3)

cm/util/master.py

     OFF="OFF",
     ON="ON",
     STARTING="STARTING",
+    SHUTTING_DOWN="SHUTTING_DOWN",
     SHUT_DOWN="SHUT_DOWN" # Because we don't really support cluster restart
  )
 
         self.app = app
         self.console_monitor = ConsoleMonitor(self.app)
         self.root_pub_key = None
-        self.cluster_status = cluster_status.OFF
+        self.cluster_status = cluster_status.STARTING
         self.master_state = master_states.INITIAL_STARTUP
         self.num_workers_requested = 0 # Number of worker nodes requested by user
         # The actual number of worker nodes (note: this is a list of Instance objects)
                 .format(self.initial_cluster_type)
         else:
             cc_detail = "This seems to be a new cluster; waiting to configure the type"
+        self.cluster_status = cluster_status.ON
         log.info( "Completed initial cluster configuration. {0}".format(cc_detail))
         return True
     
             log.debug("Shutting down the cluster but the TESTFLAG is set")
             return
         log.debug("List of services before shutdown: %s" % [s.get_full_name() for s in self.services])
+        self.cluster_status = cluster_status.SHUTTING_DOWN
+        self.master_state = master_states.SHUTTING_DOWN
         # Services need to be shut down in particular order
         if sd_autoscaling:
             self.stop_autoscaling()

static/style/base.css

     border: 1px solid black;
     font-size: smaller;
 }
+#snapshotoverlay_msg_box {
+    text-align: justify;
+}
+#snapshotoverlay_msg_box_important {
+    background: #BB0011;
+    width: 700px;
+    margin: 80px auto 0;
+    min-height: 72px;
+    padding: 10px;
+    color: white;
+    -moz-border-radius: 10px;
+    -webkit-border-radius:10px;
+    -khtml-border-radius:10px;
+}
+#snapshotoverlay_msg_box_warning {
+    background: #FFB400;
+    width: 700px;
+    margin: 71px auto 0;
+    min-height: 72px;
+    padding: 10px;
+    color: white;
+    -moz-border-radius: 10px;
+    -webkit-border-radius:10px;
+    -khtml-border-radius:10px;
+}
 .info_msg_box {
     text-align: center;
 }

templates/index.mako

 </div>
 
 ## Overlay that prevents any future clicking, see CSS
-<div id="snapshotoverlay" style="display:none"></div>
+<div id="snapshotoverlay" style="display:none">
+    <div id="snapshotoverlay_msg_box" style="display:none"></div>
+</div>
 <div id="no_click_clear_overlay" style="display:none"></div>
 <div id="snapshot_status_box" class="box">
     <h2>Volume Manipulation In Progress</h2>
             any worker nodes (instances) associated with this cluster. Unless you
             choose to have the cluster deleted, all of your data will be preserved
             beyond the life of this instance. Next time you wish to start this same
-            cluster, simply use the same user data (i.e., cluster name and AWS account)
+            cluster, simply use the same user data (i.e., cluster name and credentials)
             and CloudMan will reactivate your cluster with your data.</p>
             <label>Automatically terminate the master instance?</label>
             <input type="checkbox" name="terminate_master_instance" id="terminate_master_instance" checked>
         fsdet += "</ul>";
         $('#fs_detail').html(fsdet);
         cluster_status = data.cluster_status;
-        if (cluster_status === "SHUT_DOWN"){
-            $('#main_text').html("<div id='main_text_important'><h4>Important:</h4><p>This cluster has terminated. If not done automatically, please terminate the master instance from the AWS console.</p></div>");
+        if (cluster_status === "SHUTTING_DOWN"){
+            shutting_down();
+            return true; // Must return here because the remaining code clears the UI
+        }
+        else if (cluster_status === "SHUT_DOWN"){
             $('.action-button').addClass('ab_disabled');
             $('#snapshotoverlay').show(); // Overlay that prevents any future clicking
-            // Cluster has shut down.  There is nothing else to update after disabling inputs.
-            return true;
+            $('#snapshotoverlay_msg_box').html("<div id='snapshotoverlay_msg_box_important'> \
+                <h4>Important:</h4><p>This cluster has terminated. If not done automatically, \
+                please terminate the master instance from the cloud console.</p></div>");
+            $('#snapshotoverlay_msg_box').show();
+            return true; // Must return here because the remaining code clears the UI
         }
         if (data.autoscaling.use_autoscaling === true) {
             use_autoscaling = true;
             $('#scale_up_button > img').hide();
             $('#scale_down_button').addClass('ab_disabled');
             $('#scale_down_button > img').hide();
-        } else {
+        } else if (data.autoscaling.use_autoscaling === false) {
             use_autoscaling = false;
             as_min = 0;
             as_max = 0;
     $('#log_container_body').slideDown('fast');
 }
 
+function shutting_down() {
+    // Do the UI updates to indicate the cluster is in the 'SHUTTING_DOWN' state
+    $('#snapshotoverlay_msg_box').html("<div id='snapshotoverlay_msg_box_warning'> \
+        <h4>Important:</h4><p>This cluster is terminating. Please wait for all the services \
+        to stop and for all the nodes to be removed. Then, if not done automatically, \
+        terminate the master instance from the cloud console. All of the buttons on the \
+        console have been disabled at this point.</p></div>");
+    $('#snapshotoverlay_msg_box').show();
+    $('.action-button').addClass('ab_disabled');
+    // Show and scroll the log
+    show_log_container_body();
+    update_log();
+    $('#log_container_body').animate({
+        scrollTop: $("#log_container_body").attr("scrollHeight") + 100
+    }, 1000);
+    $('#snapshotoverlay').show(); // Overlay that prevents any future clicking
+}
+
 $(document).ready(function() {
     var initial_cluster_type = '${initial_cluster_type}';
     var permanent_storage_size = ${permanent_storage_size};
         type: 'POST',
         dataType: 'json',
         beforeSubmit: function(data){
-            cluster_status = "OFF";
-            $('#main_text').html("<div id='main_text_warning'><h4>Important:</h4><p>This cluster is terminating. Please wait for all services to stop and for all nodes to be removed, and then, if not done automatically, terminate the master instance from the AWS console. All of the buttons on the console have been disabled at this point.</p></div>");
+            shutting_down();
             hidebox();
-            show_log_container_body();
-            update_log();
-            $('#log_container_body').animate({
-                scrollTop: $("#log_container_body").attr("scrollHeight") + 100
-            }, 1000);
-            $('#no_click_clear_overlay').show(); // Overlay that prevents any future clicking
         },
         success: function( data ) {
             update_ui(data);