添加gfs中brock的删增功能
This commit is contained in:
parent
ab2ccee7ff
commit
669d2c84ab
|
@ -5,6 +5,8 @@ declare module Configs {
|
||||||
ip: string;
|
ip: string;
|
||||||
path: string;
|
path: string;
|
||||||
status: boolean;
|
status: boolean;
|
||||||
|
availableSize?: number;
|
||||||
|
usedSize?: number;
|
||||||
}
|
}
|
||||||
interface oracleParam {
|
interface oracleParam {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -17,13 +19,21 @@ declare module Configs {
|
||||||
}
|
}
|
||||||
interface volume {
|
interface volume {
|
||||||
name: string;
|
name: string;
|
||||||
totalSize: number;
|
allSize: number;
|
||||||
usedSize: number;
|
usedSize: number;
|
||||||
brick: Block;
|
brick: Array<Block>;
|
||||||
folder?: Array<any>;
|
folder?: Array<any>;
|
||||||
status: string;
|
status: string;
|
||||||
path: string;
|
path: string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
刪除volume中指定的brock
|
||||||
|
*/
|
||||||
|
function deleteBrock(volume: volume, brock: Block): void;
|
||||||
|
/**
|
||||||
|
volume添加brock
|
||||||
|
*/
|
||||||
|
function addBrock(volume: volume, brock: Block): void;
|
||||||
class ConfigsModelService {
|
class ConfigsModelService {
|
||||||
cluster: Array<volume>;
|
cluster: Array<volume>;
|
||||||
oracleParam: Array<oracleParam>;
|
oracleParam: Array<oracleParam>;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
/// <reference path="configsUtils.d.ts" />
|
/// <reference path="configsUtils.d.ts" />
|
||||||
/// <reference path="configsDataService.d.ts" />
|
/// <reference path="configsDataService.d.ts" />
|
||||||
/// <reference path="../../kubernetes/ts/term.d.ts" />
|
/// <reference path="../../kubernetes/ts/term.d.ts" />
|
||||||
|
/// <reference path="shareController.d.ts" />
|
||||||
declare module Configs {
|
declare module Configs {
|
||||||
var GfsController: ng.IModule;
|
var GfsController: ng.IModule;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/// <reference path="../../includes.d.ts" />
|
/// <reference path="../../includes.d.ts" />
|
||||||
/// <reference path="configPlugin.d.ts" />
|
/// <reference path="configPlugin.d.ts" />
|
||||||
|
/// <reference path="configsDataService.d.ts" />
|
||||||
declare module Configs {
|
declare module Configs {
|
||||||
var TableEdit: ng.IModule;
|
var TableEdit: ng.IModule;
|
||||||
|
var VolumeController: ng.IModule;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
/// <reference path="d.ts/kubernetes/ts/kubernetesPlugin.d.ts"/>
|
/// <reference path="d.ts/kubernetes/ts/kubernetesPlugin.d.ts"/>
|
||||||
/// <reference path="d.ts/kubernetes/ts/watcher.d.ts"/>
|
/// <reference path="d.ts/kubernetes/ts/watcher.d.ts"/>
|
||||||
/// <reference path="d.ts/kubernetes/ts/term.d.ts"/>
|
/// <reference path="d.ts/kubernetes/ts/term.d.ts"/>
|
||||||
|
/// <reference path="d.ts/configs/ts/shareController.d.ts"/>
|
||||||
/// <reference path="d.ts/configs/ts/glusterfsSetting.d.ts"/>
|
/// <reference path="d.ts/configs/ts/glusterfsSetting.d.ts"/>
|
||||||
/// <reference path="d.ts/configs/ts/kubeClusterSetting.d.ts"/>
|
/// <reference path="d.ts/configs/ts/kubeClusterSetting.d.ts"/>
|
||||||
/// <reference path="d.ts/configs/ts/regionalismCodeSearch.d.ts"/>
|
/// <reference path="d.ts/configs/ts/regionalismCodeSearch.d.ts"/>
|
||||||
/// <reference path="d.ts/configs/ts/shareController.d.ts"/>
|
|
||||||
/// <reference path="d.ts/configs/ts/systemCodeSearch.d.ts"/>
|
/// <reference path="d.ts/configs/ts/systemCodeSearch.d.ts"/>
|
||||||
/// <reference path="d.ts/developer/ts/developerPlugin.d.ts"/>
|
/// <reference path="d.ts/developer/ts/developerPlugin.d.ts"/>
|
||||||
/// <reference path="d.ts/developer/ts/dataManagerModel.d.ts"/>
|
/// <reference path="d.ts/developer/ts/dataManagerModel.d.ts"/>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -30,7 +30,7 @@
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th class="no-fade table-header">
|
<th class="no-fade table-header">
|
||||||
<span class="">已用 {{volume.usedSize}} / 共 {{volume.allSize}}</span>
|
<span class="">已用 {{volume.formatUsedSize}} / 共 {{volume.formatTotalSize}}</span>
|
||||||
|
|
||||||
</th>
|
</th>
|
||||||
<th class="no-fade table-header sj_table_td01">
|
<th class="no-fade table-header sj_table_td01">
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
<span class="sj_table_td02">存储路径:{{row.path}}</span>
|
<span class="sj_table_td02">存储路径:{{row.path}}</span>
|
||||||
</td>
|
</td>
|
||||||
<td >
|
<td >
|
||||||
<span class="">已用 {{row.usedSize}} / 共 {{row.availableSize}}</span>
|
<span class="">已用 {{row.formatUsedSize}} / 共 {{row.formatAllSize}}</span>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -38,7 +38,10 @@
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr ng-repeat = "row in ngDialogData.brick">
|
<tr ng-repeat = "row in ngDialogData.brick">
|
||||||
<th class="new_left"><span ng-show ="row.status" class="sj_icon_ok"></span><span ng-hide = "row.status" class="sj_icon_warning"></th>
|
<th class="new_left">
|
||||||
|
<span ng-show ="row.status" class="sj_icon_ok"></span>
|
||||||
|
<span ng-hide = "row.status" class="sj_icon_warning">
|
||||||
|
</th>
|
||||||
<th colspan="3">
|
<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}} "/>
|
||||||
</th>
|
</th>
|
||||||
|
@ -62,7 +65,9 @@
|
||||||
<input type="text" class="sj_txt_box02 mr5" ng-model="row.path" />
|
<input type="text" class="sj_txt_box02 mr5" ng-model="row.path" />
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<button class="sj_btn_grey fl">连接</button><a href="#" class="sj_icon_del ml5 fl"></a><a href="#"ng-hide ="$index < ngDialogData.brick.length-1" class="sj_icon_add ml5 fl"></a>
|
<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>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -76,10 +81,11 @@
|
||||||
<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 colspan="5"> </th>
|
<!--<th colspan="5"> {{message}}</th>-->
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="alert alert-warning" role="alert" ng-show="showMessage">"删除存储块失败:集群中至少包含一个存储块!"</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -4,8 +4,10 @@ module Configs{
|
||||||
|
|
||||||
export interface Block{
|
export interface Block{
|
||||||
ip:string; //存储块的机器ip地址
|
ip:string; //存储块的机器ip地址
|
||||||
path: string; //路径
|
path: string; //存储块路径
|
||||||
status: boolean;
|
status: boolean; //存储块的状态
|
||||||
|
availableSize?: number, //存储块的大小
|
||||||
|
usedSize?: number //存储块已使用空间
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface oracleParam{
|
export interface oracleParam{
|
||||||
|
@ -20,26 +22,65 @@ module Configs{
|
||||||
|
|
||||||
export interface volume{
|
export interface volume{
|
||||||
name: string; //volume的名字
|
name: string; //volume的名字
|
||||||
totalSize: number; //volume空间大小
|
allSize: number; //volume空间大小
|
||||||
usedSize: number; // volume已使用空间大小
|
usedSize: number; // volume已使用空间大小
|
||||||
brick: Block; //volume中的存储块
|
brick: Array<Block>; //volume中的存储块
|
||||||
folder?: Array<any>; //volume的文件
|
folder?: Array<any>; //volume的文件
|
||||||
status: string;
|
status: string;
|
||||||
path: string;
|
path: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
//字节大小转换成字符大小
|
//字节大小转换成字符大小
|
||||||
function getStringSize(size: number){
|
function getStringSize(size: number){
|
||||||
var result = size;
|
var result = size;
|
||||||
var suffix =["B", "KB" ,"MB", "GB", "GB", "TB"];
|
var suffix =["B", "KB" ,"MB", "GB", "TB", "PB"];
|
||||||
var count=1;
|
var count=1;
|
||||||
while(result > 1024){
|
while(result >= 1024){
|
||||||
result = result/1024;
|
result = result/1024;
|
||||||
count ++;
|
count ++;
|
||||||
}
|
}
|
||||||
return result + suffix[count];
|
return result.toFixed(2) + suffix[count];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatVolume(volume:volume){
|
||||||
|
volume["formatTotalSize"] = getStringSize(volume.allSize);
|
||||||
|
volume["formatUsedSize"] = getStringSize(volume.usedSize);
|
||||||
|
angular.forEach(volume.brick, (brock) =>{
|
||||||
|
brock["formatUsedSize"] = getStringSize(brock.usedSize);
|
||||||
|
brock["formatAllSize"] = getStringSize(brock.availableSize);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatVolumes(volumes:Array<volume>){
|
||||||
|
angular.forEach(volumes, (volume) => {
|
||||||
|
formatVolume(volume);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function IsBrockEquals(brock1: Block, brock2: Block){
|
||||||
|
return brock1.ip == brock2.ip && brock1.path == brock2.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
刪除volume中指定的brock
|
||||||
|
*/
|
||||||
|
export function deleteBrock(volume:volume, brock:Block){
|
||||||
|
for(var i = 0; i < volume.brick.length; i++){
|
||||||
|
var brick = volume.brick[i];
|
||||||
|
if(IsBrockEquals(brick, brock)){
|
||||||
|
volume.brick.splice(i, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
volume添加brock
|
||||||
|
*/
|
||||||
|
export function addBrock(volume:volume, brock:Block){
|
||||||
|
if(brock != null && brock != undefined)
|
||||||
|
volume.brick.push(brock);
|
||||||
|
}
|
||||||
|
|
||||||
export class ConfigsModelService{
|
export class ConfigsModelService{
|
||||||
public cluster: Array<volume>=[];
|
public cluster: Array<volume>=[];
|
||||||
|
@ -69,7 +110,7 @@ module Configs{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.cluster = result;
|
this.cluster = result;
|
||||||
|
formatVolumes(this.cluster);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateCodeInfo(){
|
public updateCodeInfo(){
|
||||||
|
|
|
@ -4,17 +4,19 @@
|
||||||
/// <reference path="configsUtils.ts"/>
|
/// <reference path="configsUtils.ts"/>
|
||||||
/// <reference path="configsDataService.ts"/>
|
/// <reference path="configsDataService.ts"/>
|
||||||
/// <reference path="../../kubernetes/ts/term.ts"/>
|
/// <reference path="../../kubernetes/ts/term.ts"/>
|
||||||
|
/// <reference path="shareController.ts"/>
|
||||||
module Configs{
|
module Configs{
|
||||||
|
|
||||||
export var GfsController = controller('GfsController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", 'ConfigsModel', 'ngDialog',
|
export var GfsController = controller('GfsController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", 'ConfigsModel', 'ngDialog',
|
||||||
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel, ngDialog) =>{
|
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel, ngDialog) =>{
|
||||||
$scope.model = ConfigsModel;
|
$scope.model = ConfigsModel;
|
||||||
$scope.volumes = ConfigsModel.cluster;
|
$scope.volumes = ConfigsModel.cluster;
|
||||||
shareInit($scope, $location, $routeParams);
|
shareInit($scope, $location, $routeParams);
|
||||||
|
|
||||||
$scope.createGfs = () => {
|
$scope.createGfs = () => {
|
||||||
ngDialog.open({
|
ngDialog.open({
|
||||||
template: 'newDialog.html',
|
template: 'newDialog.html',
|
||||||
|
controller:'Configs.VolumeController',
|
||||||
width: 1005,
|
width: 1005,
|
||||||
data: {
|
data: {
|
||||||
name: null,
|
name: null,
|
||||||
|
@ -26,15 +28,7 @@ module Configs{
|
||||||
status: false
|
status: false
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
className: 'ngdialog-theme-default',
|
className: 'ngdialog-theme-default'
|
||||||
controller: ['$scope', function($scope) {
|
|
||||||
$scope.save = () =>{
|
|
||||||
$scope.closeThisDialog();
|
|
||||||
}
|
|
||||||
$scope. cancel = () =>{
|
|
||||||
$scope.closeThisDialog();
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,15 +39,7 @@ module Configs{
|
||||||
width: 1005,
|
width: 1005,
|
||||||
data: fVolume,
|
data: fVolume,
|
||||||
className: 'ngdialog-theme-default',
|
className: 'ngdialog-theme-default',
|
||||||
controller: ['$scope', function($scope) {
|
controller: 'Configs.VolumeController'
|
||||||
console.log($scope);
|
|
||||||
$scope.save = () =>{
|
|
||||||
$scope.closeThisDialog();
|
|
||||||
}
|
|
||||||
$scope. cancel = () =>{
|
|
||||||
$scope.closeThisDialog();
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/// <reference path="../../includes.ts"/>
|
/// <reference path="../../includes.ts"/>
|
||||||
/// <reference path="configPlugin.ts"/>
|
/// <reference path="configPlugin.ts"/>
|
||||||
|
/// <reference path="configsDataService.ts"/>
|
||||||
module Configs{
|
module Configs{
|
||||||
export var TableEdit = controller('TableEdit', ['$scope', ($scope) => {
|
export var TableEdit = controller('TableEdit', ['$scope', ($scope) => {
|
||||||
$scope.editRow = (entity)=>{
|
$scope.editRow = (entity)=>{
|
||||||
|
@ -9,5 +10,31 @@ module Configs{
|
||||||
$scope.deleteRow = (entity) =>{
|
$scope.deleteRow = (entity) =>{
|
||||||
$scope.$emit('deleteRow', entity);
|
$scope.$emit('deleteRow', entity);
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
export var VolumeController = controller('VolumeController', ['$scope', ($scope) => {
|
||||||
|
$scope.save = () =>{
|
||||||
|
$scope.closeThisDialog();
|
||||||
|
}
|
||||||
|
$scope. cancel = () =>{
|
||||||
|
$scope.closeThisDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.deleteBrock = (volume:volume, brock) => {
|
||||||
|
if(volume.brick.length>1)
|
||||||
|
deleteBrock(volume, brock);
|
||||||
|
else
|
||||||
|
$scope.showMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.addBrock = (volume) => {
|
||||||
|
var block = {
|
||||||
|
ip: "", //存储块的机器ip地址
|
||||||
|
path: "", //存储块路径
|
||||||
|
status: false, //存储块的状态
|
||||||
|
};
|
||||||
|
addBrock(volume, block);
|
||||||
|
$scope.showMessage = false;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
}
|
}
|
|
@ -47,7 +47,7 @@ module Kubernetes {
|
||||||
export class resourceRCTemplate{
|
export class resourceRCTemplate{
|
||||||
|
|
||||||
public image="oracle:utf8";
|
public image="oracle:utf8";
|
||||||
public names = ["admin","cfgtoollogs","checkpoints","diag","flash-recovery-area","oradata"];
|
public names = ["oradata"];
|
||||||
|
|
||||||
public createRC(Obj){
|
public createRC(Obj){
|
||||||
var labels = {
|
var labels = {
|
||||||
|
|
Loading…
Reference in New Issue