You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aggregation-platform/plugins/configs/ts/shareController.ts

81 lines
1.8 KiB

/// <reference path="../../includes.ts"/>
/// <reference path="configPlugin.ts"/>
/// <reference path="configsDataService.ts"/>
module Configs{
export var TableEdit = controller('TableEdit', ['$scope', ($scope) => {
$scope.editRow = (entity)=>{
$scope.$emit('editRow', entity);
}
$scope.deleteRow = (entity) =>{
$scope.$emit('deleteRow', entity);
}
}]);
export var VolumeController = controller('VolumeController', ['$scope', '$http', ($scope, $http) => {
$scope.save = (entity) =>{
changeStatus(entity);
$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, //存储块的状态
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){
});
}
}]);
}