修改gfs配置界面

This commit is contained in:
wu ming 2016-09-26 19:39:18 +08:00
parent 669d2c84ab
commit db2884438d
10 changed files with 205 additions and 51 deletions

View File

@ -24,11 +24,13 @@ declare module Configs {
name: string;
path: string;
brick: Array<Brick>;
status: string;
status: boolean;
editable: boolean;
}
interface Brick {
ip: Array<string>;
status: boolean;
path: string;
editable: boolean;
}
}

View File

@ -7,6 +7,7 @@ declare module Configs {
status: boolean;
availableSize?: number;
usedSize?: number;
editable?: boolean;
}
interface oracleParam {
name: string;
@ -25,6 +26,8 @@ declare module Configs {
folder?: Array<any>;
status: string;
path: string;
editable?: boolean;
alive?: boolean;
}
/**
volume中指定的brock

File diff suppressed because one or more lines are too long

View File

@ -248,8 +248,8 @@ gulp.task('connect', ['watch'], function() {
targetPath: '/hawtio/git'
}, {
proto: "http",
port: "8080",
hostname: "192.168.0.101",
port: "8088",
hostname: "192.168.0.110",
path: '/java/console/api',
targetPath: "/"
}];

View File

@ -18,7 +18,8 @@
<table class="table sj_content_table sj_table_border" >
<thead class="no-scope">
<tr>
<th class="sj_c_green table-header sj_table_td00" >已启用</th>
<th ng-show="row.status == Started ||Created" class="sj_c_green table-header sj_table_td00" >已启用</th>
<th ng-show="row.status == Stopped" class="sj_c_green table-header sj_table_td00" >已停止</th>
<th class="no-fade table-header sj_table_td06">
<span class="">{{volume.name}}</span>
</th>
@ -37,13 +38,17 @@
<button class="btn sj_btn" ng-click="editRow(volume)">
<span class="glyphicon glyphicon-pencil"></span>&nbsp;&nbsp;编辑
</button>
<button class="btn sj_btn" ng-click="deleteRow(volume)">
<span class="glyphicon glyphicon-trash"></span>&nbsp;&nbsp;刪除
</button>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in volume.brick track by $index" class="row.class">
<td>
<span class="glyphicon glyphicon-ok sj_c_green " ></span>
<span ng-show="row.status" class="glyphicon glyphicon-ok sj_c_green " ></span>
<span ng-hide="row.status" class="glyphicon glyphicon-remove sj_c_green " ></span>
</td>
<td >
<span class="">服务器{{$index+1}}</span>

View File

@ -21,20 +21,22 @@
</script>
<script type="text/ng-template" id="newDialog.html">
<div class="sj_new_box">
<div class=" mb10">
<ng-form name="volumeForm" class=" mb10" novalidate="novalidate">
<table class="sj_new_table clear">
<tbody>
<tr>
<th class="new_left sj_c_green">已启用</th>
<th ng-show="ngDialogData.status" class="new_left sj_c_green">启用</th>
<th ng-hide="ngDialogData.status" class="new_left sj_c_green">停止</th>
<th colspan="10">
<input type="text" class="sj_txt_box03 mr10" ng-model="ngDialogData.name " />
<input type="text" class="sj_txt_box03 mr10" ng-model="ngDialogData.name " pattern="^\w{4,20}$" ng-disabled="!{{ngDialogData.editable}}"/>
</th>
<th>云目录:</th>
<th>
<input type="text" class="sj_txt_box02 mr5" ng-model="ngDialogData.path" />
<input type="text" class="sj_txt_box02 mr5" ng-model="ngDialogData.path" ng-disabled="!{{ngDialogData.editable}}"/>
</th>
<th>
<button class="sj_btn_red fl">停止</button>
<button ng-show="ngDialogData.status" class="sj_btn_red fl" ng-click="stopVolume(ngDialogData)">停止</button>
<button ng-hide="ngDialogData.status" class="sj_btn_red fl" ng-click="startVolume(ngDialogData)">启动</button>
</th>
</tr>
<tr ng-repeat = "row in ngDialogData.brick">
@ -43,29 +45,29 @@
<span ng-hide = "row.status" class="sj_icon_warning">
</th>
<th colspan="3">
<input type="text" class="sj_txt_box04 mr5" value="服务器 {{$index + 1}} "/>
<input type="text" class="sj_txt_box04 mr5" value="服务器 {{$index + 1}} " ng-disabled="true" />
</th>
<th>
<input type="text" class="sj_txt_box05" ng-model="row.ip[0]" />
<input type="text" class="sj_txt_box05" ng-model="row.ip[0]" ng-disabled="!{{row.editable}}" />
</th>
<th>.</th>
<th>
<input type="text" class="sj_txt_box05" ng-model="row.ip[1]" />
<input type="text" class="sj_txt_box05" ng-model="row.ip[1]" ng-disabled="!{{row.editable}}" />
</th>
<th>.</th>
<th>
<input type="text" class="sj_txt_box05" ng-model="row.ip[2]" />
<input type="text" class="sj_txt_box05" ng-model="row.ip[2]" ng-disabled="!{{row.editable}}" />
</th>
<th>.</th>
<th>
<input type="text" class="sj_txt_box05 mr10" ng-model="row.ip[3]"/>
<input type="text" class="sj_txt_box05 mr10" ng-model="row.ip[3]" ng-disabled="!{{row.editable}}" />
</th>
<th>存储块:</th>
<th>
<input type="text" class="sj_txt_box02 mr5" ng-model="row.path" />
<input type="text" class="sj_txt_box02 mr5" ng-model="row.path" ng-disabled="!{{row.editable}}"/>
</th>
<th>
<button class="sj_btn_grey fl">连接</button>
<!--<button class="sj_btn_grey fl">连接</button>-->
<a href="#" class="sj_icon_del ml5 fl" ng-click="deleteBrock(ngDialogData, row)"></a>
<a href="#" ng-hide ="$index < ngDialogData.brick.length-1" class="sj_icon_add ml5 fl" ng-click="addBrock(ngDialogData)"></a>
</th>
@ -73,12 +75,12 @@
<tr>
<th>&nbsp;</th>
<th>
<button class="sj_btn_blue mr5" ng-click="save()">保存</button>
<button class="sj_btn_blue mr5" ng-click="save(ngDialogData)" ng-disabled="volumeForm.$invalid">保存</button>
</th>
<th>
<button class="sj_btn_grey mr5" ng-click="cancel()">删除</button>
<button class="sj_btn_grey mr5" ng-click="cancel()">取消</button>
</th>
<th>
<!--<th>
<button class="sj_btn_grey mr5" ng-click="cancel()">取消</button>
</th>
<!--<th colspan="5">&nbsp;{{message}}</th>-->
@ -86,7 +88,7 @@
</tbody>
</table>
<div class="alert alert-warning" role="alert" ng-show="showMessage">"删除存储块失败:集群中至少包含一个存储块!"</div>
</div>
</ng-form>
</div>
</script>
<div ng-controller="Kubernetes.TopLevel">

View File

@ -130,14 +130,16 @@ module Configs{
brick.push({
ip: block.ip.split("."),
status: block.status,
path: block.path
path: block.path,
editable: block.editable || false
});
});
return {
name: volume.name,
path: volume.path,
brick: brick,
status: volume.status
status: volume.alive || false,
editable: volume.editable || false
}
}
@ -153,13 +155,15 @@ module Configs{
name: string
path: string
brick: Array<Brick>;
status: string;
status: boolean;
editable: boolean
}
export interface Brick{
ip: Array<string>;
status: boolean;
path: string;
editable: boolean
}
}

View File

@ -8,6 +8,7 @@ module Configs{
status: boolean; //存储块的状态
availableSize?: number, //存储块的大小
usedSize?: number //存储块已使用空间
editable?: boolean
}
export interface oracleParam{
@ -28,6 +29,8 @@ module Configs{
folder?: Array<any>; //volume的文件
status: string;
path: string;
editable?: boolean
alive?: boolean
}
//字节大小转换成字符大小
@ -45,9 +48,21 @@ module Configs{
function formatVolume(volume:volume){
volume["formatTotalSize"] = getStringSize(volume.allSize);
volume["formatUsedSize"] = getStringSize(volume.usedSize);
volume["editAble"] = false;
switch (volume.status) {
case "Stopped":
volume["alive"] = false;
break;
default:
volume["alive"] = true;
break;
}
angular.forEach(volume.brick, (brock) =>{
brock["formatUsedSize"] = getStringSize(brock.usedSize);
brock["formatAllSize"] = getStringSize(brock.availableSize);
brock["editAble"] = false;
})
}

View File

@ -19,14 +19,16 @@ module Configs{
controller:'Configs.VolumeController',
width: 1005,
data: {
name: null,
path: null,
status: "",
name: '',
path: '',
status: 'Stopped',
brick: [{
ip: ["0", "0", "0", "0"],
path: "",
status: false
}]
path: '',
status: false,
editAble: true
}],
editAble: true
},
className: 'ngdialog-theme-default'
});
@ -34,6 +36,7 @@ module Configs{
$scope.editRow = (volume) => {
var fVolume = formatVolume(volume);
console.log(fVolume);
ngDialog.open({
template: 'newDialog.html',
width: 1005,
@ -42,5 +45,22 @@ module Configs{
controller: 'Configs.VolumeController'
});
}
$scope.deleteRow = (volume) =>{
console.log(volume);
$http({
url: "/java/console/api/volume/delete",
method: 'POST',
data: volume
}).success(function(data,header,config,status){
/*
volume信息
*/
}).error(function(data,header,config,status){
});
}
}]);
}

View File

@ -12,10 +12,12 @@ module Configs{
}
}]);
export var VolumeController = controller('VolumeController', ['$scope', ($scope) => {
$scope.save = () =>{
export var VolumeController = controller('VolumeController', ['$scope', '$http', ($scope, $http) => {
$scope.save = (entity) =>{
changeStatus(entity);
$scope.closeThisDialog();
}
$scope. cancel = () =>{
$scope.closeThisDialog();
}
@ -32,9 +34,48 @@ module Configs{
ip: "", //存储块的机器ip地址
path: "", //存储块路径
status: false, //存储块的状态
editAble:true
};
addBrock(volume, block);
$scope.showMessage = false;
}
$scope.stopVolume = (volume) =>{
volume.status="false";
}
$scope.startVolume = (volume) =>{
volume.status="true";
}
$scope.$watch("ngDialogData.status", (newValue, oldValue) => {
if(newValue && newValue != oldValue){
$scope.$apply();
console.log($scope.volume)
}
});
function changeStatus(entity){
angular.forEach(entity.brick, (brick) =>{
brick["ip"] = brick.ip.join(".");
});
console.log(entity);
$http({
url: "/java/console/api/volume/update",
method: 'POST',
data: entity
}).success(function(data,header,config,status){
/*
volume信息
*/
}).error(function(data,header,config,status){
});
}
}]);
}