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.
118 lines
2.6 KiB
118 lines
2.6 KiB
/// <reference path="../../includes.ts"/>
|
|
/// <reference path="configPlugin.ts"/>
|
|
module Configs{
|
|
|
|
export interface Block{
|
|
ip:string; //存储块的机器ip地址
|
|
path: string; //路径
|
|
}
|
|
|
|
export interface oracleParam{
|
|
name: string
|
|
ip: string;
|
|
port: string;
|
|
serviceName: string;
|
|
tableName: string;
|
|
status: string;
|
|
id?:number;
|
|
}
|
|
|
|
export interface volume{
|
|
name: string; //volume的名字
|
|
totalSize: number; //volume空间大小
|
|
usedSize: number; // volume已使用空间大小
|
|
block: Block; //volume中的存储块
|
|
folder?: Array<any>; //volume的文件
|
|
}
|
|
|
|
//字节大小转换成字符大小
|
|
function getStringSize(size: number){
|
|
var result = size;
|
|
var suffix =["B", "KB" ,"MB", "GB", "GB", "TB"];
|
|
var count=1;
|
|
while(result > 1024){
|
|
result = result/1024;
|
|
count ++;
|
|
}
|
|
return result + suffix[count];
|
|
}
|
|
|
|
|
|
export class ConfigsModelService{
|
|
public cluster: Array<volume>=[];
|
|
public oracleParam: Array<oracleParam>=[];
|
|
public systemInfo: Array<any> =[];
|
|
public regionalismInfo: Array<any> = [];
|
|
|
|
public constructor(){
|
|
this.updateAllData();
|
|
}
|
|
|
|
public updateAllData(){
|
|
this.updateVolumeData();
|
|
this.updateOracleParam();
|
|
this.updateCodeInfo();
|
|
}
|
|
public updateVolumeData(){
|
|
var result=null;
|
|
$.ajax({
|
|
async: false,
|
|
type : "POST",
|
|
url : "/java/console/api/volume/list",
|
|
success : function(data) {
|
|
if(data){
|
|
result = data;
|
|
}
|
|
console.log(data);
|
|
}
|
|
});
|
|
this.cluster = result;
|
|
|
|
}
|
|
|
|
public updateCodeInfo(){
|
|
var result=null;
|
|
$.ajax({
|
|
async: false,
|
|
type : "POST",
|
|
url : "/java/console/api/code/list",
|
|
success : function(data) {
|
|
if(data){
|
|
result = data;
|
|
}
|
|
}
|
|
});
|
|
this.regionalismInfo = result.regionalism;
|
|
this.systemInfo = result.system;
|
|
}
|
|
|
|
public updateOracleParam(){
|
|
var result=null;
|
|
$.ajax({
|
|
async: false,
|
|
type : "POST",
|
|
url : "/java/console/api/oracle/list",
|
|
success : function(data) {
|
|
if(data){
|
|
result = data;
|
|
}
|
|
}
|
|
});
|
|
this.oracleParam = result;
|
|
}
|
|
|
|
public getFolderByVolumeName(name: string){
|
|
if(this.cluster===null)
|
|
return null;
|
|
for(var i=0; i< this.cluster.length; i++){
|
|
if(this.cluster[i].name === name)
|
|
return this.cluster[i].folder;
|
|
}
|
|
}
|
|
}
|
|
|
|
_module.factory('ConfigsModel', ['$rootScope', '$http', '$location', '$resource', ($rootScope, $http, $location, $resource) =>{
|
|
var $scope = new ConfigsModelService();
|
|
return $scope;
|
|
}]);
|
|
} |