update partition inline edit

Change-Id: I5ddf795ff87995c9b124fe04edd87e3a81f8055c
This commit is contained in:
Chi Zhang 2014-09-04 18:48:31 -07:00
parent ae5d96550d
commit 0a8b074ac4
6 changed files with 251 additions and 212 deletions

View File

@ -5,21 +5,20 @@ html {
font-size: 14px !important;
height: 100%;
font-family: "Trebuchet MS", san sarif !important;
color:rgba(83, 83, 83, 1) !important;
color: rgba(83, 83, 83, 1) !important;
}
body {
min-width: 1024px;
font-size: 14px !important;
font-family: "Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,Verdana,sans-serif !important;
color:rgba(83, 83, 83, 1) !important;
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif !important;
color: rgba(83, 83, 83, 1) !important;
}
.main-container {
position: relative;
}
body, .main-content {
background: #fff;
/* right: 0px;
background: #fff;
/* right: 0px;
bottom: 0px;
left: 0px;
background-size: cover;
@ -27,12 +26,10 @@ body, .main-content {
background-image: url('../img/body_bg3.jpg');*/
}
.page-content {
background: inherit !important;
background: inherit !important;
}
.table-responsive
{
background-color:white;
.table-responsive {
background-color: white;
}
.notification-msg {
white-space: normal;
@ -52,13 +49,13 @@ body, .main-content {
}
}
.btn-login {
border-radius:7px;
border-radius: 7px;
}
.btn-topdown{
border-radius:7px !important;
.btn-topdown {
border-radius: 7px !important;
}
.btn-dropdown {
border-radius:7px !important;
border-radius: 7px !important;
}
/*
.cssSlideUp {
@ -94,8 +91,8 @@ body, .main-content {
color: white;
}
.role-tag {
background-color: #6fb3e0;
border-color: rgba(0,0,0,0);
background-color: #6fb3e0;
border-color: rgba(0, 0, 0, 0);
border-radius: 10px;
color: #fff;
display: inline-block;
@ -125,7 +122,7 @@ body, .main-content {
select {
padding-left: 1px !important;
border-radius: 7px;
height:33px;
height: 33px;
}
.opacity-zero {
opacity: 0;
@ -220,7 +217,7 @@ input[type="text"]:focus, input[type="password"]:focus {
input.ace[type="checkbox"] + .lbl:before, input.ace[type="radio"] + .lbl:before {
content: "\00A0";
border-radius:4px !important;
border-radius: 4px !important;
}
.progress {
position: relative;
@ -309,16 +306,12 @@ button[disabled] {
font-size: 15px;
line-height: 1.5;
padding: 4px 12px;
border-radius:7px !important;
border-radius: 7px !important;
}
.btn-cancel
{
.btn-cancel {
border-color: #909AA1;
background-color: #909AA1 !important;
}
.btn-group > .btn {
border-radius: 7px !important;
}
@ -413,7 +406,7 @@ a:active {
margin-top: 26px !important;
}
.input-icon {
/* margin-top: 5px !important;*/
/* margin-top: 5px !important;*/
}
.ng-table th.sortable {
cursor: pointer
@ -552,11 +545,11 @@ div.center-align {
border: 1px solid rgba(190, 210, 219, .5) !important;
min-height: 60px !important;
border-radius: 4px;
background-color:rgba(221, 221, 221, 0.32);
background-color: rgba(221, 221, 221, 0.32);
}
.network-margin-border {
border: 1px solid rgba(190, 210, 219, .5) !important;
border-radius:4px;
border-radius: 4px;
}
.network-margin {
margin-left: 10px !important;
@ -568,7 +561,6 @@ div.center-align {
.network-background {
background-image: url();
}
/* adjustments to draggable */
.network-draggable {
@ -598,18 +590,18 @@ div.center-align {
padding: 10px;
}
.wizard-steps li.complete:before, .wizard-steps li.complete .step {
/* border-color: #93cbf9 !important;*/}
/* border-color: #93cbf9 !important;*/
}
.a.wizard-steps li.active:before, .wizard-steps li.active .step {
border-color: #80afd4 !important;
border-color: #80afd4 !important;
transform: scale(1.25) !important;
font-weight: bold;
}
li.incomplete:before, li.incomplete .step {
border-color: #d15b47 !important;
border-color: #d15b47 !important;
font-weight: bold;
}
.modal-body
{
.modal-body {
padding-top: 30px;
padding-right-value: 20px;
padding-bottom: 0px;
@ -619,32 +611,27 @@ li.incomplete:before, li.incomplete .step {
padding-right-ltr-source: physical;
padding-right-rtl-source: physical;
}
.modal-header
{
.modal-header {
/*background-color: #EFF3F8;*/
background-image: url('../img/header.png');
background-size:cover;
background-size: cover;
/*background-position: 50% 50%;*/
}
.modal-warning-header
{
padding-top: 13px;
.modal-warning-header {
padding-top: 13px;
padding-bottom: 13px;
}
.modal-warning-body
{
padding-top: 30px;
.modal-warning-body {
padding-top: 30px;
padding-bottom: 20px;
}
.modal-warning-footer
{
padding-top: 8px;
.modal-warning-footer {
padding-top: 8px;
padding-bottom: 8px;
}
.bkg-fullscreen
{
.bkg-fullscreen {
/*background-color:#EFF3F8;*/
background-image:url(../img/datacenter.jpg);
background-image: url(../img/datacenter.jpg);
position: fixed;
right: 0px;
bottom: 0px;
@ -652,34 +639,27 @@ li.incomplete:before, li.incomplete .step {
background-size: cover;
background-position: 50% 50%;
top: 0px;
}
.bkg-fullscreen:before
{
content:"";
.bkg-fullscreen:before {
content: "";
position: fixed;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
background-color: rgba(68, 57, 170, 0.3);
background-image:none;
background-image: none;
opacity: 0.6;
}
.bar-white
{
background-color:white;
.bar-white {
background-color: white;
}
.page-header h1
{
font-weight:bold;
.page-header h1 {
font-weight: bold;
font-size: 20px !important;
}
.navbar
{
background-image:url('../img/header.png');
.navbar {
background-image: url('../img/header.png');
/*position: fixed;*/
right: 0px;
bottom: 0px;
@ -688,99 +668,80 @@ li.incomplete:before, li.incomplete .step {
background-position: 50% 50%;
top: 0px;
}
.ace-nav > li > a
{
padding: 8px 8px;
.ace-nav > li > a {
padding: 8px 8px;
}
.modal-footer
{
.modal-footer {
/*background-image: url('../img/dialogue-bar1.jpg');*/
background-size:cover;
background-size: cover;
}
.modal-title
{
color:white;
.modal-title {
color: white;
}
.gritter-error .gritter-close
{
.gritter-error .gritter-close {
color: rgba(192, 116, 80, 1);
}
.gritter-close:hover
{
color:rgba(219, 101, 68, 1) !important;
.gritter-close:hover {
color: rgba(219, 101, 68, 1) !important;
}
.gritter-item-wrapper.gritter-error
{
.gritter-item-wrapper.gritter-error {
background-image: url('../img/grey.png') !important;
background-size: cover;
border-radius: 7px;
opacity: 0.9;
}
.error-text
{
color:rgba(219, 101, 68, 1);
.error-text {
color: rgba(219, 101, 68, 1);
font-size: 20px;
font-weight: bold;
padding-left: 10px;
}
#side
{
position:absolute;
overflow:hidden;
right:30px;
#side {
position: absolute;
overflow: hidden;
right: 30px;
width: 0px;
height: 30%;
content:"";
background:#fff;
content: "";
background: #fff;
}
#side-content
{
position:absolute;
right:0px;
top:5px;
height:100%;
overflow:hidden;
width:200px;
background:#fff;
#side-content {
position: absolute;
right: 0px;
top: 5px;
height: 100%;
overflow: hidden;
width: 200px;
background: #fff;
font-size: 13px;
}
#side-ctrl
{
position: absolute;
right:5px;
top:0px;
height: 1.5%;
width: 15px;
#side-ctrl {
position: absolute;
right: 5px;
top: 0px;
height: 1.5%;
width: 15px;
/*background:yellow;*/
}
.label-lg.arrowed:before
{
.label-lg.arrowed:before {
left: -11px;
}
.glyphicon
{
top:0px;
.glyphicon {
top: 0px;
}
.widget-main
{
.widget-main {
padding-top: 25px;
padding-bottom: 5px;
}
.login-form {
background-color: rgba(221, 221, 221, 0.6);
background-color: rgba(221, 221, 221, 0.6);
padding: 20px 15px 10px;
}
.login-dialogue
{
margin:0 auto;
top:10%;
position:relative;
width:400px;
.login-dialogue {
margin: 0 auto;
top: 10%;
position: relative;
width: 400px;
/*margin-top: -241px;*/
padding: 50px 30px 30px;
}
@ -788,7 +749,7 @@ li.incomplete:before, li.incomplete .step {
transform: translate(0px, 100px);
}
address, caption, cite, code, dfn, em, strong, th, var {
opacity: 0.8 !important;
opacity: 0.8 !important;
}
div.toc ul li a {
border-radius: 7px;
@ -798,10 +759,9 @@ circle.parent {
stroke: none !important;
fill: #E6E6E6!important;
}
circle
{
fill-opacity:1 !important;
stroke:none !important;
circle {
fill-opacity: 1 !important;
stroke: none !important;
}
circle[depth='1'] {
fill: #27AA37 !important;
@ -815,23 +775,12 @@ circle[depth='3'] {
circle[depth='4'] {
fill: #D15B47 !important;
}
.table-hover > tbody > tr > td.success:hover,
.table-hover > tbody > tr > th.success:hover,
.table-hover > tbody > tr.success:hover > td,
.table-hover > tbody > tr.success:hover > th {
background-color:rgba(194, 221, 240, 1);
.red-border {
border-color: red !important;
}
.table > thead > tr > td.success,
.table > tbody > tr > td.success,
.table > tfoot > tr > td.success,
.table > thead > tr > th.success,
.table > tbody > tr > th.success,
.table > tfoot > tr > th.success,
.table > thead > tr.success > td,
.table > tbody > tr.success > td,
.table > tfoot > tr.success > td,
.table > thead > tr.success > th,
.table > tbody > tr.success > th,
.table > tfoot > tr.success > th {
background-color:rgba(239, 243, 252, 0.98);
.table-hover > tbody > tr > td.success:hover, .table-hover > tbody > tr > th.success:hover, .table-hover > tbody > tr.success:hover > td, .table-hover > tbody > tr.success:hover > th {
background-color: rgba(194, 221, 240, 1);
}
.table > thead > tr > td.success, .table > tbody > tr > td.success, .table > tfoot > tr > td.success, .table > thead > tr > th.success, .table > tbody > tr > th.success, .table > tfoot > tr > th.success, .table > thead > tr.success > td, .table > tbody > tr.success > td, .table > tfoot > tr.success > td, .table > thead > tr.success > th, .table > tbody > tr.success > th, .table > tfoot > tr.success > th {
background-color: rgba(239, 243, 252, 0.98);
}

View File

@ -7,10 +7,12 @@
},
"partition": {
"/var": {
"percentage": 30
"percentage": 30,
"max_size": 10
},
"/home": {
"percentage": 30
"percentage": 30,
"max_size": 10
}
},
"interface": {

View File

@ -28,3 +28,22 @@ angular.module('compass.login', [
})
}
})
.directive('setFocus', function() {
return function(scope, element) {
element[0].focus();
};
})
.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if (event.which === 13) { // 13 is enter key
if (scope.email.trim() != "" && scope.password.trim() != "") {
scope.$eval(attrs.ngEnter);
}
event.preventDefault();
}
});
};
});

View File

@ -9,14 +9,14 @@
<fieldset>
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="text" placeholder="Email" ng-model="email" class="form-control" required>
<input type="text" placeholder="Email" ng-model="email" class="form-control" ng-enter="login()" set-Focus required>
<i class="ace-icon fa fa-user"></i>
</span>
</label>
<label class="block clearfix" style="margin-top: 8px">
<span class="block input-icon input-icon-right">
<input type="password" placeholder="Password" ng-model="password" class="form-control" required>
<input type="password" placeholder="Password" ng-model="password" class="form-control" ng-enter="login()" required>
<i class="ace-icon fa fa-lock"></i>
</span>
</label>

View File

@ -11,51 +11,25 @@
</tr>
</thead>
<tbody>
<tr>
<tr ng-repeat="partitionInfo in partitionInforArray">
<td>
<input ng-model="newPartition.mount_point" type="text" placeholder="Mount Point" class="input-medium">
<input ng-class="{'red-border': duplicated == true && duplicatedIndexArray.indexOf($index) >= 0}" ng-model="partitionInfo.name" ng-change="mount_point_change($index,partitionInfo.name)" ng-disabled ="duplicated == true && duplicatedIndexArray.indexOf($index) < 0" type="text" placeholder="Mount Point">
</td>
<td>
<input ng-model="newPartition.percentage" type="number" min="1" max="100" placeholder="Size Percentage" class="input-medium">
<input ng-model="partitionInfo.percentage" type="number" min="1" max="100" placeholder="Size Percentage" class="input-medium">
</td>
<td>
<input ng-model="newPartition.max_size" type="number" min="1" max="100" placeholder="Max Size" class="input-medium">
<input ng-model="partitionInfo.max_size" type="number" min="1" max="100" placeholder="Max Size" class="input-medium">
</td>
<td>
<span ng-click="addPartition()" class="action" style="padding-left: 31px;" >
<!-- add button -->
<span ng-click="addPartition()" class="action" style="padding-left: 31px;" >
<i class="fa fa-plus-circle bigger-140 blue"S></i>
</span>
</td>
</tr>
<tr ng-repeat="(key, data) in partition">
<td>
<span>{{key}}</span>
</td>
<td>
<span ng-hide="editPartitionMode">{{data.percentage}}</span>
<input ng-show="editPartitionMode" ng-model="data.percentage" type="number" min="1" max="100" placeholder="Size Percentage" class="input-medium">
</td>
<td>
<span ng-hide="editPartitionMode">{{data.max_size}}</span>
<input ng-show="editPartitionMode" ng-model="data.max_size" type="number" min="1" max="100" placeholder="Max Size" class="input-medium">
</td>
<td>
<!--edit button-->
<button ng-hide="editPartitionMode" ng-click="editPartitionMode = true;" class="btn btn-xs btn-black-white btn-edit-hover border-radius-4">
<i class="ace-icon fa fa-pencil bigger-120"></i>
</button>
<!--delete button-->
<span ng-hide="editPartitionMode" ng-click="editPartitionMode = true; deletePartition(key)" class="action border-radius-4">
<span ng-if="partitionInforArray.length > 1" ng-click="deletePartition($index)" class="action border-radius-4">
<i class="fa fa-minus-circle bigger-140 blue"></i>
</span>
<!--save button-->
<button ng-show="editPartitionMode" ng-click="editPartitionMode = false;" class="btn btn-xs btn-black-white btn-topmargin-8 btn-sumbit-hover border-radius-4">
<i class="ace-icon fa fa-check bigger-120"></i>
</button>
<!--cancel button-->
<button ng-show="editPartitionMode" ng-click="editPartitionMode = false; cancel()" class="btn btn-xs btn-black-white btn-topmargin-8 btn-trash-hover border-radius-4">
<i class="ace-icon fa fa-times bigger-120"></i>
</button>
</td>
</tr>
</tbody>

View File

@ -798,27 +798,76 @@ angular.module('compass.wizard', [
.controller('partitionCtrl', function($scope, wizardFactory, dataService) {
var cluster = wizardFactory.getClusterInfo();
$scope.partition = wizardFactory.getPartition();
$scope.partitionInforArray = [];
$scope.duplicated = false;
$scope.duplicatedIndexArray = [];
$scope.addPartition = function() {
angular.forEach($scope.partition, function(value, key) {
$scope.partitionInforArray.push({
"name": key,
"percentage": value.percentage,
"max_size": value.max_size
});
});
/*$scope.addPartition = function() {
var mount_point = $scope.newPartition.mount_point;
$scope.partition[mount_point] = {};
$scope.partition[mount_point].percentage = $scope.newPartition.percentage;
$scope.partition[mount_point].max_size = $scope.newPartition.max_size;
$scope.newPartition = {};
};*/
$scope.addPartition = function() {
var newRowExist = false;
angular.forEach($scope.partitionInforArray, function(partitionInfo) {
if (partitionInfo.name == "") {
newRowExist = true;
}
});
if (newRowExist == false && $scope.duplicated == false) {
$scope.partitionInforArray.push({
"name": "",
"percentage": 0,
"max_size": 0
})
}
}
$scope.deletePartition = function(index) {
var emptyRowIndex = -1; // no empty row
if ($scope.partitionInforArray.length <= 2) {
if ($scope.partitionInforArray[0]['name'] == "") {
emptyRowIndex = 0;
} else if ($scope.partitionInforArray[1]['name'] == "") {
emptyRowIndex = 1;
}
if (emptyRowIndex == index || emptyRowIndex == -1) {
$scope.partitionInforArray.splice(index, 1);
}
} else {
$scope.partitionInforArray.splice(index, 1);
}
if ($scope.duplicatedIndexArray.indexOf(index) >= 0) {
$scope.duplicated = false;
}
};
$scope.deletePartition = function(mount_point) {
delete $scope.partition[mount_point];
};
$scope.$watch('partition', function() {
$scope.$watch('partitionInforArray', function() {
$scope.partitionarray = [];
var total = 0;
angular.forEach($scope.partition, function(value, key) {
total += parseFloat(value.percentage);
angular.forEach($scope.partitionInforArray, function(partitionInfo) {
total += parseFloat(partitionInfo.percentage);
$scope.partitionarray.push({
"name": key,
"number": value.percentage
"name": partitionInfo.name,
"number": partitionInfo.percentage
});
});
$scope.partitionarray.push({
@ -827,6 +876,27 @@ angular.module('compass.wizard', [
})
}, true);
$scope.mount_point_change = function(index, name) {
var duplicatedIndexContainer = [];
$scope.duplicatedIndexArray = [];
var count = 0;
$scope.duplicated = false;
var numberOfNames = 0;
angular.forEach($scope.partitionInforArray, function(partitionInfo) {
if (partitionInfo.name == name) {
numberOfNames++;
duplicatedIndexContainer.push(count);
}
count++;
});
if (numberOfNames > 1) {
$scope.duplicated = true;
$scope.duplicatedIndexArray = angular.copy(duplicatedIndexContainer);
}
}
$scope.$watch(function() {
return wizardFactory.getCommitState()
}, function(newCommitState, oldCommitState) {
@ -838,27 +908,52 @@ angular.module('compass.wizard', [
});
$scope.commit = function() {
var os_partition = {
"os_config": {
"partition": $scope.partition
if ($scope.duplicated == true) {
var message = {
"message": "Mount Point cannot be the same"
}
};
dataService.updateClusterConfig(cluster.id, os_partition).success(function(configData) {
wizardFactory.getPartition(configData["os_config"]["partition"]);
var commitState = {
"name": "partition",
"state": "success",
"message": ""
};
wizardFactory.setCommitState(commitState);
}).error(function(response) {
var commitState = {
"name": "partition",
"state": "error",
"message": response
"message": message
};
wizardFactory.setCommitState(commitState);
});
} else {
var newPartition = {};
var data = {};
angular.forEach($scope.partitionInforArray, function(partitionInfo) {
newPartition[partitionInfo['name']] = {};
newPartition[partitionInfo['name']]['percentage'] = partitionInfo['percentage'];
newPartition[partitionInfo['name']]['max_size'] = partitionInfo['max_size'];
});
$scope.partition = angular.copy(newPartition);
var os_partition = {
"os_config": {
"partition": $scope.partition
}
};
dataService.updateClusterConfig(cluster.id, os_partition).success(function(configData) {
wizardFactory.setPartition(configData["os_config"]["partition"]);
var commitState = {
"name": "partition",
"state": "success",
"message": ""
};
wizardFactory.setCommitState(commitState);
}).error(function(response) {
var commitState = {
"name": "partition",
"state": "error",
"message": response
};
wizardFactory.setCommitState(commitState);
});
}
};
})
@ -1001,7 +1096,7 @@ angular.module('compass.wizard', [
.controller('roleAssignCtrl', function($scope, wizardFactory, dataService, $filter, ngTableParams, sortingService, $q) {
var cluster = wizardFactory.getClusterInfo();
$scope.servers = wizardFactory.getServers();
var colors = ['#8EA16C','#C2CF30', '#FEC700', '#FF8900', '#D3432B','#BB2952','#8E1E5F','#DE4AB6','#9900EC','#3A1AA8','#3932FE','#278BC0','#35B9F6','#91E0CB','#42BC6A','#5B4141'];
var colors = ['#8EA16C', '#C2CF30', '#FEC700', '#FF8900', '#D3432B', '#BB2952', '#8E1E5F', '#DE4AB6', '#9900EC', '#3A1AA8', '#3932FE', '#278BC0', '#35B9F6', '#91E0CB', '#42BC6A', '#5B4141'];
dataService.getClusterById(cluster.id).success(function(data) {
// wizardFactory.setAdapter(data);
$scope.roles = data.flavor.roles;