@ -14,12 +14,11 @@ module Developer {
( $scope , KubernetesModel : Kubernetes.KubernetesModelService , DataModel :Developer.DataModelService , ConfigsModel :Configs.ConfigsModelService , KubernetesState , $templateCache :ng.ITemplateCacheService , $location :ng.ILocationService , $routeParams , $http , $timeout , KubernetesApiURL , $element , ngDialog ) = > {
( $scope , KubernetesModel : Kubernetes.KubernetesModelService , DataModel :Developer.DataModelService , ConfigsModel :Configs.ConfigsModelService , KubernetesState , $templateCache :ng.ITemplateCacheService , $location :ng.ILocationService , $routeParams , $http , $timeout , KubernetesApiURL , $element , ngDialog ) = > {
$scope . model = DataModel ;
$scope . model = DataModel ;
$scope . replicasModel = KubernetesModel ;
$scope . replicasModel = KubernetesModel ;
init ( $scope , $location , $routeParams ) ;
$scope . options = DataModel . paramOptions ;
$scope . options = DataModel . paramOptions ;
$scope . pageSizeChoses = DataModel . paramOptions . pagerSizeOption ;
$scope . pageSizeChoses = DataModel . paramOptions . pagerSizeOption ;
var result = getDataType ( $location )
var result = getDataType ( $location ) ;
$scope . options . dataType = result [ "dataType" ] ;
$scope . options . volumeType = result [ "volumeType" ] ;
$scope . treeOptions = {
$scope . treeOptions = {
nodeChildren : "childNodes" ,
nodeChildren : "childNodes" ,
@ -65,6 +64,10 @@ module Developer {
return field . systemCode ;
return field . systemCode ;
}
}
} ,
} ,
{
field : "dataBaseType" ,
displayName : '数据库类型' ,
} ,
{
{
field : "labels" ,
field : "labels" ,
displayName : '数据标签' ,
displayName : '数据标签' ,
@ -90,6 +93,10 @@ module Developer {
}
}
} ;
} ;
init ( $scope , $location , $routeParams ) ;
$scope . model . paramOptions . dataType = result [ "dataType" ] ;
$scope . model . paramOptions . volumeType = result [ "volumeType" ] ;
$scope . $on ( "dataLabelFilterUpdate" , ( $event , text , key ) = > {
$scope . $on ( "dataLabelFilterUpdate" , ( $event , text , key ) = > {
$scope . keyQuery += " " + text ;
$scope . keyQuery += " " + text ;
} )
} )
@ -99,19 +106,20 @@ module Developer {
nav . class = "" ;
nav . class = "" ;
} ) ;
} ) ;
item . class = "active" ;
item . class = "active" ;
$scope . model . updateParamOption ( "currentPageNum" , 1 ) ;
$scope . model . updateParamOption ( "keyQuery" , $scope . keyQuery ) ;
$scope . model . updateParamOption ( "keyQuery" , $scope . keyQuery ) ;
$scope . model . updateParamOption ( "dataBatch" , item . alias ) ;
$scope . model . updateParamOption ( "dataBatch" , item . alias ) ;
}
}
$scope . isEmptyOrFirst = ( ) = > {
$scope . isEmptyOrFirst = ( ) = > {
var idx = $scope . model . getParamOption ( "currentPageNum" ) ;
var idx = $scope . model . getParamOption ( "currentPageNum" ) ;
var length = $scope . options. ge tPageSizeNum( ) ;
var length = $scope . m odel. paramO ptions. totle Page;
return length <= 0 || idx <= 1 ;
return length <= 0 || idx <= 1 ;
}
}
$scope . isEmptyOrLast = ( ) = > {
$scope . isEmptyOrLast = ( ) = > {
var idx = $scope . model . getParamOption ( "currentPageNum" ) ;
var idx = $scope . model . getParamOption ( "currentPageNum" ) ;
var length = $scope . options. ge tPageSizeNum( ) ;
var length = $scope . m odel. paramO ptions. totle Page;
return length < 1 || idx >= length ;
return length < 1 || idx >= length ;
}
}
@ -125,7 +133,7 @@ module Developer {
$scope . last = ( ) = > {
$scope . last = ( ) = > {
var idx = $scope . model . getParamOption ( "currentPageNum" ) ;
var idx = $scope . model . getParamOption ( "currentPageNum" ) ;
var length = $scope . options. ge tPageSizeNum( ) ;
var length = $scope . m odel. paramO ptions. totle Page;
if ( idx < length ) {
if ( idx < length ) {
Kubernetes . eliminateChechBoxClick ( ) ;
Kubernetes . eliminateChechBoxClick ( ) ;
$scope . model . updateParamOption ( "currentPageNum" , length ) ;
$scope . model . updateParamOption ( "currentPageNum" , length ) ;
@ -134,7 +142,7 @@ module Developer {
$scope . previous = ( ) = > {
$scope . previous = ( ) = > {
var idx = $scope . model . getParamOption ( "currentPageNum" ) ;
var idx = $scope . model . getParamOption ( "currentPageNum" ) ;
var length = $scope . options. ge tPageSizeNum( ) ;
var length = $scope . m odel. paramO ptions. totle Page;
if ( idx > 1 ) {
if ( idx > 1 ) {
Kubernetes . eliminateChechBoxClick ( ) ;
Kubernetes . eliminateChechBoxClick ( ) ;
$scope . model . updateParamOption ( "currentPageNum" , idx - 1 ) ;
$scope . model . updateParamOption ( "currentPageNum" , idx - 1 ) ;
@ -142,7 +150,7 @@ module Developer {
}
}
$scope . next = ( ) = > {
$scope . next = ( ) = > {
var length = $scope . options. ge tPageSizeNum( ) ;
var length = $scope . m odel. paramO ptions. totle Page;
var idx = $scope . model . getParamOption ( "currentPageNum" ) ;
var idx = $scope . model . getParamOption ( "currentPageNum" ) ;
if ( idx < length ) {
if ( idx < length ) {
Kubernetes . eliminateChechBoxClick ( ) ;
Kubernetes . eliminateChechBoxClick ( ) ;
@ -150,7 +158,7 @@ module Developer {
}
}
}
}
$scope . $watch ( ' options', ( newValue , oldValue ) = > {
$scope . $watch ( ' m odel.paramO ptions', ( newValue , oldValue ) = > {
if ( newValue ) {
if ( newValue ) {
if ( newValue . currentTableSize !== oldValue . currentTableSize )
if ( newValue . currentTableSize !== oldValue . currentTableSize )
$scope . options . priorTableSize = oldValue . currentTableSize ;
$scope . options . priorTableSize = oldValue . currentTableSize ;
@ -162,6 +170,8 @@ module Developer {
} , true ) ;
} , true ) ;
$scope . search = ( ) = > {
$scope . search = ( ) = > {
//$scope.model.initParamOptions();
$scope . model . paramOptions . currentPageNum = 1 ;
$scope . model . updateParamOption ( "keyQuery" , $scope . keyQuery ) ;
$scope . model . updateParamOption ( "keyQuery" , $scope . keyQuery ) ;
}
}
@ -175,7 +185,7 @@ module Developer {
/ *
/ *
判 断 数 据 是 否 已 挂 载 使 用 和 正 在 迁 移 。
判 断 数 据 是 否 已 挂 载 使 用 和 正 在 迁 移 。
* /
* /
var message = Kubernetes . checkForMigration ( $scope . replicasModel . replicationControllers , $scope . model . transferTasks , $scope . tableConfig . selectedItems );
var message = Kubernetes . checkForMigration ( $scope . replicasModel . replicationControllers , $scope . model . transferTasks , $scope . tableConfig . selectedItems , "manager" );
if ( message != "" ) {
if ( message != "" ) {
Configs . customAlert ( "提示" , "操作失败:" + message + ",不能删除!" , '' , null , 0 , "error" ) ;
Configs . customAlert ( "提示" , "操作失败:" + message + ",不能删除!" , '' , null , 0 , "error" ) ;
return ;
return ;
@ -183,7 +193,7 @@ module Developer {
UI . multiItemConfirmActionDialog ( < UI.MultiItemConfirmActionOptions > {
UI . multiItemConfirmActionDialog ( < UI.MultiItemConfirmActionOptions > {
collection : selected ,
collection : selected ,
index : ' id ',
index : ' alias ',
onClose : ( result :boolean ) = > {
onClose : ( result :boolean ) = > {
var idColl = [ ] ;
var idColl = [ ] ;
if ( result ) {
if ( result ) {
@ -223,6 +233,7 @@ module Developer {
向 后 台 发 生 数 据 迁 移 请 求 , $http : 发 生 http 异 步 请 求 ; 第 二 个 参 数 : 请 求 url ; 第 三 个 参 数 : 请 求 操 作 类 型 ; 第 四 个 参 数 : 请 求 携 带 的 数 据 ; 第 五 个 参 数 :
向 后 台 发 生 数 据 迁 移 请 求 , $http : 发 生 http 异 步 请 求 ; 第 二 个 参 数 : 请 求 url ; 第 三 个 参 数 : 请 求 操 作 类 型 ; 第 四 个 参 数 : 请 求 携 带 的 数 据 ; 第 五 个 参 数 :
一 个 回 调 函 数 , 请 求 响 应 后 的 回 调 函 数 。
一 个 回 调 函 数 , 请 求 响 应 后 的 回 调 函 数 。
* /
* /
if ( Kubernetes . alreadyExitInFolder ( $scope . tableConfig . selectedItems , $scope . selectNode ) ) {
if ( Kubernetes . alreadyExitInFolder ( $scope . tableConfig . selectedItems , $scope . selectNode ) ) {
migrationClick . close ( ) ;
migrationClick . close ( ) ;
Configs . customAlert ( "提示" , "操作失败:" + "数据已在当前目录!" , '' , null , 0 , "error" ) ;
Configs . customAlert ( "提示" , "操作失败:" + "数据已在当前目录!" , '' , null , 0 , "error" ) ;
@ -250,10 +261,16 @@ module Developer {
} ,
} ,
open : ( selected ) = > {
open : ( selected ) = > {
var migrationClick = $scope . migrationClick ;
var migrationClick = $scope . migrationClick ;
ConfigsModel . updateVolumeData ( ) ;
if ( ConfigsModel . cluster != null )
$scope . volumes = ConfigsModel . cluster ;
/ *
/ *
判 断 数 据 是 否 已 挂 载 使 用 和 正 在 迁 移 。
判 断 数 据 是 否 已 挂 载 使 用 和 正 在 迁 移 。
* /
* /
var message = Kubernetes . checkForMigration ( $scope . replicasModel . replicationControllers , $scope . model . transferTasks , $scope . tableConfig . selectedItems ) ;
var message = Kubernetes . checkForMigration ( $scope . replicasModel . replicationControllers , $scope . model . transferTasks , $scope . tableConfig . selectedItems , "manager" ) ;
if ( message == "" ) {
if ( message == "" ) {
if ( $scope . volumes && $scope . volumes instanceof Array && $scope . volumes . length > 0 )
if ( $scope . volumes && $scope . volumes instanceof Array && $scope . volumes . length > 0 )
@ -271,8 +288,16 @@ module Developer {
$scope . createOracleService = ( items ) = > {
$scope . createOracleService = ( items ) = > {
var exitedItems = Kubernetes . checkForCreateOracle ( $scope . model . transferTasks , items ) ;
var exitedItems = Kubernetes . checkForCreateOracle ( $scope . model . transferTasks , items ) ;
for ( var i = 0 ; i < items . length ; ++ i ) {
// code...
if ( items [ i ] . dataBaseType != 'ORACLE' ) {
Configs . customAlert ( "提示" , "操作失败: 非ORACLE数据不需要挂载启动! " , '' , null , 0 , "error" ) ;
return ;
}
}
if ( exitedItems . length == 0 ) {
if ( exitedItems . length == 0 ) {
angular . forEach ( items , ( item ) = > {
angular . forEach ( items , ( item ) = > {
console . log ( item ) ;
var isExited = Kubernetes . checkForExit ( $scope . replicasModel . replicationControllers , item ) ;
var isExited = Kubernetes . checkForExit ( $scope . replicasModel . replicationControllers , item ) ;
if ( ! isExited ) {
if ( ! isExited ) {
Kubernetes . createRC ( {
Kubernetes . createRC ( {
@ -287,7 +312,8 @@ module Developer {
districtName : item.districtName ,
districtName : item.districtName ,
systemName : item.systemName ,
systemName : item.systemName ,
id : item.id + "" ,
id : item.id + "" ,
year : item.year
year : item.year ,
checkoutFlag : item.checkoutFlag
} ,
} ,
path : item.dataPath + "app/" ,
path : item.dataPath + "app/" ,
isTarget : "false" ,
isTarget : "false" ,
@ -311,8 +337,8 @@ module Developer {
}
}
function init ( $scope , $location , $routeParams ) {
function init ( $scope , $location , $routeParams ) {
//$scope.model.updateModel();
$scope . keyQuery = "" ;
$scope . keyQuery = "" ;
$scope . model . initParamOptions ( ) ;
$scope . model . updateParamOption ( "keyQuery" , $scope . keyQuery ) ;
$scope . model . updateParamOption ( "keyQuery" , $scope . keyQuery ) ;
if ( ConfigsModel . cluster != null )
if ( ConfigsModel . cluster != null )
$scope . volumes = ConfigsModel . cluster ;
$scope . volumes = ConfigsModel . cluster ;
@ -339,7 +365,15 @@ module Developer {
title : "查看批次B的数据" ,
title : "查看批次B的数据" ,
class : "" ,
class : "" ,
alias : "B"
alias : "B"
} ]
} ] ;
if ( ! ( $location . path ( ) . indexOf ( "hot" ) > - 1 ) ) {
$scope . tableConfig . columnDefs . splice ( 7 , 0 , {
field : "existHotData" ,
displayName : '是否已在热区' ,
cellTemplate : $templateCache.get ( "isExistHot.html" )
} ) ;
}
}
}
function getDataType ( $location ) {
function getDataType ( $location ) {
@ -347,6 +381,11 @@ module Developer {
var dataType ;
var dataType ;
var volumeType ;
var volumeType ;
var subPath = path . split ( "/" ) ;
var subPath = path . split ( "/" ) ;
if ( path . indexOf ( "hot" ) > - 1 )
$scope . isShow = true ;
else
$scope . isShow = false ;
switch ( subPath [ subPath . length - 1 ] ) {
switch ( subPath [ subPath . length - 1 ] ) {
case "financial" :
case "financial" :
dataType = "财政" ;
dataType = "财政" ;