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.
166 lines
4.3 KiB
166 lines
4.3 KiB
/// <reference path="../../includes.ts"/>
|
|
/// <reference path="configPlugin.ts"/>
|
|
/// <reference path="configsDataService.ts"/>
|
|
/// <reference path="../../developer/ts/developerNavigation.ts"/>
|
|
/// <reference path="../../developer/ts/dataManagerHelper.ts"/>
|
|
module Configs{
|
|
export class OperateType{
|
|
public static get DELETE():string {return "delete"}
|
|
public static get UPDATE():string {return "update"}
|
|
public static get PUT():string{return "put"}
|
|
public static get MOVE():string{return "move"}
|
|
public static get EXTRACT():string{return "extract"}
|
|
}
|
|
|
|
_module.controller('Configs.MenuItemController',['$scope', '$location', ($scope, $location) => {
|
|
$scope.menuItem=[{
|
|
icon: "glyphicon glyphicon-cloud-upload",
|
|
label: "数据管理配置",
|
|
title: "配置数据存储信息",
|
|
href: UrlHelpers.join(context, "/gluster-fs/setting")
|
|
},
|
|
{
|
|
icon: "glyphicon glyphicon-th-list",
|
|
label: "服务集群配置",
|
|
title: "配置服务集群信息",
|
|
href: UrlHelpers.join(context, "/kube-cluster/setting")
|
|
}]
|
|
}]);
|
|
|
|
function createConfigBreadcrumbs($scope, $location, $routeParams){
|
|
var url = $location.url();
|
|
var label, title;
|
|
switch (url) {
|
|
case "/config/gluster-fs/setting":
|
|
label = "数据管理配置";
|
|
title= "配置数据存储信息";
|
|
break;
|
|
case "/config/kube-cluster/setting":
|
|
label = "服务集群配置";
|
|
title= "配置服务集群信息";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return Developer.activateCurrent([{
|
|
href: url,
|
|
label: label,//item.label,
|
|
title: title//item.title
|
|
}]);
|
|
}
|
|
|
|
export function createOracleInfo(array:Array<any>, id:number){
|
|
var result ={"id": id};
|
|
angular.forEach(array, (arr) => {
|
|
result[arr.field] = arr.value;
|
|
});
|
|
return result;
|
|
}
|
|
|
|
export function shareInit($scope, $location, $routeParams){
|
|
$scope. subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams);
|
|
}
|
|
|
|
export function createNewObejct(array:Array<any>, obj){
|
|
var result =[];
|
|
if(obj){
|
|
angular.forEach(array, (arr) =>{
|
|
result.push({
|
|
field: arr.field,
|
|
name: arr.displayName,
|
|
value: obj[arr.field]
|
|
});
|
|
});
|
|
}else{
|
|
angular.forEach(array, (arr) =>{
|
|
result.push({
|
|
field: arr.field,
|
|
name: arr.displayName,
|
|
value: null
|
|
});
|
|
});
|
|
}
|
|
return result;
|
|
}
|
|
|
|
export function oracleInfoOperate($http, url:string, operate:string, resource, fn?: (data, status)=>void ){
|
|
if(resource === null)
|
|
throw "不能操作空资源对象";
|
|
var id = resource["id"] || resource["name"] || resource["_id"] || resource["_key"];
|
|
var RESTfulUrl=url;
|
|
if(id == "undefined"){
|
|
RESTfulUrl = UrlHelpers.join(url, operate);
|
|
}else{
|
|
RESTfulUrl = UrlHelpers.join(url, id+"", operate);
|
|
}
|
|
|
|
$http({
|
|
method: "POST",
|
|
dataType: 'json',
|
|
url: RESTfulUrl,
|
|
data: JSON.stringify(resource),
|
|
}).success((data,header,config,status) => {
|
|
if(angular.isFunction(fn))
|
|
fn(data, header);
|
|
}).error((data,header,config,status) => {
|
|
if(angular.isFunction(fn))
|
|
fn(data, header);
|
|
});
|
|
}
|
|
|
|
export function createConfigHelperNavBar($scope, $location, $routeParams){
|
|
return Developer.activateCurrent([
|
|
{
|
|
href: UrlHelpers.join(context, "regionalism-code/searching"),
|
|
label: "行政区划检索",
|
|
title: "检索行政区划代码"
|
|
},
|
|
{
|
|
href: UrlHelpers.join(context,"system-code/searching"),
|
|
label: "系统编码检索",
|
|
title: "检索系统编码"
|
|
}
|
|
]);
|
|
}
|
|
|
|
export function formatVolume(volume: volume): formatedVolume{
|
|
var brick:Array<Brick> = [];
|
|
angular.forEach(volume.brick, (block:Block) => {
|
|
brick.push({
|
|
ip: block.ip.split("."),
|
|
status: block.status,
|
|
path: block.path
|
|
});
|
|
});
|
|
return {
|
|
name: volume.name,
|
|
path: volume.path,
|
|
brick: brick,
|
|
status: volume.status
|
|
}
|
|
}
|
|
|
|
export function formatVolumes(volumes: Array<volume>): Array<formatedVolume>{
|
|
var result:Array<formatedVolume> = [];
|
|
angular.forEach(volumes, (volume) => {
|
|
result.push(formatVolume(volume));
|
|
});
|
|
return result;
|
|
}
|
|
|
|
export interface formatedVolume{
|
|
name: string
|
|
path: string
|
|
brick: Array<Brick>;
|
|
status: string;
|
|
}
|
|
|
|
export interface Brick{
|
|
ip: Array<string>;
|
|
status: boolean;
|
|
path: string;
|
|
}
|
|
|
|
}
|