Major update to code structure

   * Split files into independent files based on functionality.
   * Switch to bower/gulp for build.

Change-Id: Ibc775dd9b7f6a0a49f63c22162b7582e781e2d9c
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
diff --git a/app/overview/controllers/bmc-reboot-controller.html b/app/overview/controllers/bmc-reboot-controller.html
new file mode 100644
index 0000000..22df0c2
--- /dev/null
+++ b/app/overview/controllers/bmc-reboot-controller.html
@@ -0,0 +1,25 @@
+<div id="bmc-reboot">
+    <div class="row column">
+        <h1>Reboot BMC</h1>
+    </div>
+
+    <div class="row column  btm-border-grey">
+        <span class="bmc-reboot__status-log inline">BMC last reboot at {{dataService.last_updated |date:'h:mm:ss on MM/dd/yyyy'}}</span>
+    </div>
+
+    <div class="row column btm-border-grey bmc-reboot-option"
+         ng-class="{transitionAll: confirm && immediately_confirm}">
+        <ul>
+            <li>Rebooting the BMC causes your browser to lose contact with the BMC for several minutes.</li>
+            <li>When the BMC software has started, you can then log in again.</li>
+            <li>If the Log In button is not enabled after several minutes, you may need to point your browser to the
+                BMC’s address and log in again.
+            </li>
+        </ul>
+        <button id="bmc__reboot" class="btn-secondary" ng-click="bmcRebootConfirm()"><i>&#x21BB</i> Reboot BMC
+        </button>
+        <confirm title="Reboot the BMC"
+                 message="Rebooting the BMC causes your browser to lose contact with the BMC for several minutes."
+                 confirm="bmcReboot_confirm" cancel="bmcRebootCancel"></confirm>
+    </div>
+</div>
diff --git a/app/overview/controllers/bmc-reboot-controller.js b/app/overview/controllers/bmc-reboot-controller.js
new file mode 100644
index 0000000..040b444
--- /dev/null
+++ b/app/overview/controllers/bmc-reboot-controller.js
@@ -0,0 +1,26 @@
+/**
+ * Controller for bmc-reboot
+ *
+ * @module app/overview
+ * @exports bmcRebootController
+ * @name bmcRebootController
+ * @version 0.1.0
+ */
+
+window.angular && (function (angular) {
+    'use strict';
+
+    angular
+        .module('app.overview')
+        .controller('bmcRebootController', [
+            '$scope', 
+            '$window', 
+            'APIUtils', 
+            'dataService',
+            function($scope, $window, APIUtils, dataService, userModel){
+                $scope.dataService = dataService;
+            }
+        ]
+    );
+
+})(angular);
diff --git a/app/overview/controllers/log-controller.html b/app/overview/controllers/log-controller.html
new file mode 100644
index 0000000..cf70c95
--- /dev/null
+++ b/app/overview/controllers/log-controller.html
@@ -0,0 +1,3 @@
+<div id="uid-log">
+    Log contents here
+</div>
\ No newline at end of file
diff --git a/app/overview/controllers/log-controller.js b/app/overview/controllers/log-controller.js
new file mode 100644
index 0000000..3b85605
--- /dev/null
+++ b/app/overview/controllers/log-controller.js
@@ -0,0 +1,26 @@
+/**
+ * Controller for log
+ *
+ * @module app/overview
+ * @exports logController
+ * @name logController
+ * @version 0.1.0
+ */
+
+window.angular && (function (angular) {
+    'use strict';
+
+    angular
+        .module('app.overview')
+        .controller('logController', [
+            '$scope', 
+            '$window', 
+            'APIUtils', 
+            'dataService',
+            function($scope, $window, APIUtils, dataService, userModel){
+                $scope.dataService = dataService;
+            }
+        ]
+    );
+
+})(angular);
diff --git a/app/overview/controllers/power-operations-controller.html b/app/overview/controllers/power-operations-controller.html
new file mode 100644
index 0000000..48d4357
--- /dev/null
+++ b/app/overview/controllers/power-operations-controller.html
@@ -0,0 +1,55 @@
+<div id="power-operations">
+
+    <div class="row column">
+        <h1>Server power operation</h1>
+    </div>
+
+    <!-- Current status and bar display the state of the server. Class 'power__state-off' is applied to bar and 'power__state' text switches to say "off"-->
+    <div class="row column">
+        <div class="power__current-status ">
+            <h2 class="inline h4">Current status</h2>
+            <span class="power__status-log inline float-right">Server last reset at {{dataService.last_updated |date:'h:mm:ss on MM/dd/yyyy'}}</span>
+        </div>
+    </div>
+    <div class="row column">
+        <div id="power-indicator-bar" class="power__indicator-bar" ng-class="{'power__state-on': dataService.server_state == 'Running', 'power__state-off': dataService.server_state == 'Off', 'power__state-indet': dataService.server_state == 'Quiesced'}">
+            <p class="inline">{{dataService.server_id}}</p>
+            <h3 class="power__state inline float-right h3"><span>{{dataService.server_state}}</span></h3>
+        </div>
+    </div>
+    <div class="row column">
+        <div class="row column">
+            <h3 class="h4">Select a power operation</h3>
+        </div>
+
+        <!-- Power on displays only when server is shutdown -->
+        <div class="row column power-option" ng-hide="dataService.server_state == 'Running'" ng-class="{disabled: (confirm && !power_confirm) || dataService.loading, transitionAll: confirm && power_confirm}">
+            <button id="power__power-on" class="btn-secondary" ng-click="togglePower()" role="button">Power On</button>
+            <p>Attempts to power on the server</p>
+
+            <!---<confirm title="power off" message="Power off the server" confirm="power_confirm" ng-show="power_confirm" callback="togglePower"></confirm>-->
+        </div>
+
+        <!-- Power reboot/shutdown options : when server is off all of these are hidden. When one option is selected, the others are disabled. -->
+        <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: (confirm && !warmboot_confirm) || dataService.loading, transitionAll: confirm && warmboot_confirm}">
+            <button id="power__warm-boot" class="btn-secondary" ng-click="warmRebootConfirm()" role="button"><i>&#x21BB</i> Warm reboot</button>
+            <p>Attempts to perform an orderly shutdown before restarting the server</p>
+            <confirm title="Warm Reboot" message="perform an orderly shutdown" confirm="warmboot_confirm" ng-show="warmboot_confirm" callback="warmReboot"></confirm>
+        </div>
+        <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: (confirm && !coldboot_confirm) || dataService.loading, transitionAll: confirm && coldboot_confirm}">
+            <button id="power__cold-boot" class="btn-secondary" ng-click="coldRebootConfirm()" role="button"><i>&#x21BB</i> Cold reboot</button>
+            <p>Shuts down the server immediately, then restarts it</p>
+            <confirm title="Cold Reboot" message="Shutdown server immediately." confirm="coldboot_confirm" ng-show="coldboot_confirm" cancel="coldbootCancel" callback="coldReboot"></confirm>
+        </div>
+        <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: (confirm && !orderly_confirm) || dataService.loading, transitionAll: confirm && orderly_confirm}">
+            <button id="power__soft-shutdown" class="btn-secondary" ng-click="orderlyShutdownConfirm()" role="button"><img src="assets/images/icon-power.svg" />Orderly shutdown</button>
+            <p>Attempts to stop all software on the server before removing power</p>
+            <confirm title="Orderly shutdown" message="Attempts to stop all software orderly." confirm="orderly_confirm" ng-show="orderly_confirm" cancel="orderlyShutdownCancel" callback="orderlyShutdown"></confirm>
+        </div>
+        <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: (confirm && !immediately_confirm) || dataService.loading, transitionAll: confirm && immediately_confirm}">
+            <button id="power__hard-shutdown" class="btn-secondary" ng-click="immediateShutdownConfirm()" role="button"><img src="assets/images/icon-power.svg" />Immediate shutdown</button>
+            <p>Removes power from the server without waiting for software to stop</p>
+            <confirm title="Immediate shutdown" message="Removes power from the server immediately." confirm="immediately_confirm" ng-show="immediately_confirm" cancel="immediatelyShutdownCancel" callback="immediateShutdown"></confirm>
+        </div>
+    </div>
+</div>
\ No newline at end of file
diff --git a/app/overview/controllers/power-operations-controller.js b/app/overview/controllers/power-operations-controller.js
new file mode 100644
index 0000000..1780da3
--- /dev/null
+++ b/app/overview/controllers/power-operations-controller.js
@@ -0,0 +1,134 @@
+/**
+ * Controller for power-operations
+ *
+ * @module app/overview
+ * @exports powerOperationsController
+ * @name powerOperationsController
+ * @version 0.1.0
+ */
+
+window.angular && (function (angular) {
+    'use strict';
+
+    angular
+        .module('app.overview')
+        .controller('powerOperationsController', [
+            '$scope', 
+            'APIUtils', 
+            'dataService', 
+            '$timeout', 
+            function($scope, APIUtils, dataService, $timeout){
+                $scope.dataService = dataService;
+                $scope.confirm = false;
+                $scope.power_confirm = false;
+                $scope.warmboot_confirm = false;
+                $scope.coldboot_confirm = false;
+                $scope.orderly_confirm = false;
+                $scope.immediately_confirm = false;
+
+                //@TODO: call api and get proper state
+                $scope.toggleState = function(){
+                    dataService.server_state = (dataService.server_state == 'Running') ? 'Off': 'Running';
+                }
+
+                $scope.togglePower = function(){
+                    var method = (dataService.server_state == 'Running') ? 'hostPowerOff' : 'hostPowerOn';
+                     //@TODO: show progress or set class orange
+                    APIUtils[method](function(response){
+                        //update state based on response
+                        //error case?
+                        if(response == null){
+                            console.log("Failed request.");
+                        }else{
+                            //@TODO::need to get the server status
+                            if(dataService.server_state == 'Running'){
+                                dataService.setPowerOffState();
+                            }else{
+                                dataService.setPowerOnState();
+                            }
+                        }
+                    });
+                }
+                $scope.powerOnConfirm = function(){
+                    if($scope.confirm) {
+                        return;
+                    }
+                    $scope.confirm = true;
+                    $scope.power_confirm = true;
+                };
+                $scope.warmReboot = function(){
+                    //@TODO:show progress
+                    dataService.setBootingState();
+                    APIUtils.hostPowerOff(function(response){
+                        if(response){
+                            APIUtils.hostPowerOn(function(response){
+                                if(response){
+                                    dataService.setPowerOnState();
+                                }else{
+                                    //@TODO:show error message
+                                }
+                            });
+                        }else{
+                        }
+                    });
+                };
+                $scope.testState = function(){
+                    $timeout(function(){
+                        dataService.setPowerOffState();
+                        $timeout(function(){
+                            dataService.setPowerOnState();
+                        }, 2000);
+                    }, 1000);
+                };
+                $scope.warmRebootConfirm = function(){
+                    if($scope.confirm) {
+                        return;
+                    }
+                    $scope.confirm = true;
+                    $scope.warmboot_confirm = true;
+                };
+
+                $scope.coldReboot = function(){
+                    $scope.warmReboot();
+                };
+                $scope.coldRebootConfirm = function(){
+                    if($scope.confirm) {
+                        return;
+                    }
+                    $scope.confirm = true;
+                    $scope.coldboot_confirm = true;
+                };
+
+                $scope.orderlyShutdown = function(){
+                    //@TODO:show progress
+                    APIUtils.hostPowerOff(function(response){
+                        if(response){
+                            dataService.setPowerOffState();
+                        }else{
+                            //@TODO:hide progress & show error message
+                        }
+                    });
+                };
+                $scope.orderlyShutdownConfirm = function(){
+                    if($scope.confirm) {
+                        return;
+                    }
+                    $scope.confirm = true;
+                    $scope.orderly_confirm = true;
+                };
+
+                $scope.immediateShutdown = function(){
+                    $scope.orderlyShutdown();
+                };
+                $scope.immediateShutdownConfirm = function(){
+                    if($scope.confirm) {
+                        return;
+                    }
+                    $scope.confirm = true;
+                    $scope.immediately_confirm = true;
+                };
+            }
+        ]
+    );
+
+})(angular);
diff --git a/app/overview/controllers/system-overview-controller.html b/app/overview/controllers/system-overview-controller.html
new file mode 100644
index 0000000..9f6a126
--- /dev/null
+++ b/app/overview/controllers/system-overview-controller.html
@@ -0,0 +1,4 @@
+<div class="row column">
+    <h1>System Overview</h1>
+    <p>System overview will be here.</p>
+</div>
\ No newline at end of file
diff --git a/app/overview/controllers/system-overview-controller.js b/app/overview/controllers/system-overview-controller.js
new file mode 100644
index 0000000..e3841cb
--- /dev/null
+++ b/app/overview/controllers/system-overview-controller.js
@@ -0,0 +1,26 @@
+/**
+ * Controller for system overview
+ *
+ * @module app/overview
+ * @exports systemOverviewController
+ * @name systemOverviewController
+ * @version 0.1.0
+ */
+
+window.angular && (function (angular) {
+    'use strict';
+
+    angular
+        .module('app.overview')
+        .controller('systemOverviewController', [
+            '$scope', 
+            '$window', 
+            'APIUtils', 
+            'dataService',
+            function($scope, $window, APIUtils, dataService, userModel){
+                $scope.dataService = dataService;
+            }
+        ]
+    );
+
+})(angular);
diff --git a/app/overview/controllers/unit-id-controller.html b/app/overview/controllers/unit-id-controller.html
new file mode 100644
index 0000000..6e6ba72
--- /dev/null
+++ b/app/overview/controllers/unit-id-controller.html
@@ -0,0 +1,27 @@
+<div id="uid-switch">
+    <div class="row column">
+        <h1>Unit ID Indicator</h1>
+    </div>
+
+    <div class="row column">
+        <h2 class="h4">Unit ID control</h2>
+    </div>
+
+    <div class="row column">
+        <div class="btm-border-grey">
+            <div class="toggle inline" ng-init="indicatorState = 'off'">
+                <input id="toggle__switch-round"
+                       class="toggle-switch toggle-switch__round-flat"
+                       type="checkbox"
+                       tabindex="0"
+                       ng-click="indicatorState = { 'on': 'off', 'off':'on'}[indicatorState]"
+                       >
+                <label for="toggle__switch-round" tabindex="0">Unit ID indicator is <span class="uid-switch__status">{{indicatorState}}</span></label>
+            </div>
+            <div class="uid-switch__label inline">
+                <p>Unit ID indicator is <span class="uid-switch__status">{{indicatorState}}</span></p>
+                <p>Control unit indicator to identify server unit.</p>
+            </div>
+        </div>
+    </div>
+</div>
\ No newline at end of file
diff --git a/app/overview/controllers/unit-id-controller.js b/app/overview/controllers/unit-id-controller.js
new file mode 100644
index 0000000..c59f411
--- /dev/null
+++ b/app/overview/controllers/unit-id-controller.js
@@ -0,0 +1,26 @@
+/**
+ * Controller for unit Id
+ *
+ * @module app/overview
+ * @exports unitIdController
+ * @name unitIdController
+ * @version 0.1.0
+ */
+
+window.angular && (function (angular) {
+    'use strict';
+
+    angular
+        .module('app.overview')
+        .controller('unitIdController', [
+            '$scope', 
+            '$window', 
+            'APIUtils', 
+            'dataService',
+            function($scope, $window, APIUtils, dataService, userModel){
+                $scope.dataService = dataService;
+            }
+        ]
+    );
+
+})(angular);