--抽取功能

This commit is contained in:
wu ming 2016-11-18 10:38:59 +08:00
parent aff4037514
commit 9768e31db1
11 changed files with 436 additions and 250 deletions

2
defs.d.ts vendored
View File

@ -37,7 +37,6 @@
/// <reference path="d.ts/developer/ts/projects.d.ts"/> /// <reference path="d.ts/developer/ts/projects.d.ts"/>
/// <reference path="d.ts/developer/ts/workspace.d.ts"/> /// <reference path="d.ts/developer/ts/workspace.d.ts"/>
/// <reference path="d.ts/developer/ts/workspaces.d.ts"/> /// <reference path="d.ts/developer/ts/workspaces.d.ts"/>
/// <reference path="d.ts/navigation/ts/navigationPlugin.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/apps.d.ts"/> /// <reference path="d.ts/kubernetes/ts/apps.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/breadcrumbs.d.ts"/> /// <reference path="d.ts/kubernetes/ts/breadcrumbs.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/build.d.ts"/> /// <reference path="d.ts/kubernetes/ts/build.d.ts"/>
@ -78,6 +77,7 @@
/// <reference path="d.ts/kubernetes/ts/sharedControllers.d.ts"/> /// <reference path="d.ts/kubernetes/ts/sharedControllers.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/tabs.d.ts"/> /// <reference path="d.ts/kubernetes/ts/tabs.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/templates.d.ts"/> /// <reference path="d.ts/kubernetes/ts/templates.d.ts"/>
/// <reference path="d.ts/navigation/ts/navigationPlugin.d.ts"/>
/// <reference path="d.ts/system/ts/systemHelpers.d.ts"/> /// <reference path="d.ts/system/ts/systemHelpers.d.ts"/>
/// <reference path="d.ts/system/ts/systemPlugin.d.ts"/> /// <reference path="d.ts/system/ts/systemPlugin.d.ts"/>
/// <reference path="d.ts/system/ts/regionalismCodeSearch.d.ts"/> /// <reference path="d.ts/system/ts/regionalismCodeSearch.d.ts"/>

File diff suppressed because one or more lines are too long

View File

@ -248,8 +248,8 @@ gulp.task('connect', ['watch'], function() {
targetPath: '/hawtio/git' targetPath: '/hawtio/git'
}, { }, {
proto: "http", proto: "http",
port: "8080", port: "8088",
hostname: "192.168.0.181", hostname: "192.168.0.110",
path: '/java/console/api', path: '/java/console/api',
targetPath: "/" targetPath: "/"
}]; }];

View File

@ -49,6 +49,9 @@ module Developer{
year: year year: year
} }
} }
function createAlias(cityName:string, districtName:string, systemName:string, version:string, year:string){
return cityName + "_" + districtName + "_" + systemName + "_" + year + "_版本" + version;
}
function createKey(regionalismCode, systemId, version){ function createKey(regionalismCode, systemId, version){
return regionalismCode + "-" + systemId + "-" + version; return regionalismCode + "-" + systemId + "-" + version;
} }
@ -59,6 +62,15 @@ module Developer{
return result; return result;
} }
function createItemsAlias(items: Array<any>){
var result = [];
angular.forEach(items, (item) => {
item.alias = createAlias(item.cityName, item.districtName, item.systemName, item.dataVersion, item.year);
result.push(item);
});
return result;
}
function populateLabel(item){ function populateLabel(item){
var result = item var result = item
result["labels"] = createLabel(item.cityName, item.districtName, item.systemName, item.dataVersion, item.year); result["labels"] = createLabel(item.cityName, item.districtName, item.systemName, item.dataVersion, item.year);
@ -166,6 +178,7 @@ module Developer{
this.data = populateKeys(this.data); this.data = populateKeys(this.data);
this.data = populateNames(this.data); this.data = populateNames(this.data);
this.data = populateLabels(this.data); this.data = populateLabels(this.data);
this.data = createItemsAlias(this.data);
} }
//更新用户选择参数 //更新用户选择参数

View File

@ -65,6 +65,10 @@ module Developer {
return field.systemCode; return field.systemCode;
} }
}, },
{
field: "dataBaseType",
displayName: '数据库类型',
},
{ {
field: "labels", field: "labels",
displayName: '数据标签', displayName: '数据标签',
@ -82,7 +86,7 @@ module Developer {
field: "extractStatus", field: "extractStatus",
displayName: '汇总状态', displayName: '汇总状态',
cellTemplate: $templateCache.get("dataExtractTemplate.html") cellTemplate: $templateCache.get("dataExtractTemplate.html")
} }
], ],
sortInfo: { sortInfo: {
sortBy: "_key", sortBy: "_key",
@ -183,7 +187,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) {
@ -269,10 +273,18 @@ 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({
@ -288,7 +300,7 @@ module Developer {
systemName: item.systemName, systemName: item.systemName,
id: item.id+"", id: item.id+"",
year: item.year, year: item.year,
checkStatus: item.check checkoutFlag: item.checkoutFlag
}, },
path: item.dataPath+"app/", path: item.dataPath+"app/",
isTarget: "false", isTarget: "false",

View File

@ -275,7 +275,10 @@
</script> </script>
<script type="text/ng-template" id="dataCheckStatus.html"> <script type="text/ng-template" id="dataCheckStatus.html">
<div class="ngCellText" ng-init="entity=row.entity"> <div class="ngCellText" ng-init="entity=row.entity">
<span ng-show="entity.metadata.annotations.checkoutFlag == 0">未校验</span>
<span ng-show="entity.metadata.annotations.checkoutFlag == 1">已校验</span>
<span ng-show="entity.metadata.annotations.checkoutFlag == 2">校验中</span>
</div> </div>
</script> </script>

View File

@ -359,6 +359,10 @@ module Kubernetes {
replicationController.$oracleStatus = getOracleStatus(getLabels(replicationController)); replicationController.$oracleStatus = getOracleStatus(getLabels(replicationController));
replicationController.$extractStatus = getExtractStatus(getLabels(replicationController)); replicationController.$extractStatus = getExtractStatus(getLabels(replicationController));
//
var annotation = getAnnotations(replicationController);
var label = getLabels(replicationController);
replicationController.$alias = annotation.cityName + "_" + annotation.districtName + "_" + annotation.systemName + "_" + annotation.year + "_" + label.version;
var selectedPods = replicationController.$pods; var selectedPods = replicationController.$pods;
replicationController.connectTo = selectedPods.map((pod) => { replicationController.connectTo = selectedPods.map((pod) => {

View File

@ -91,7 +91,7 @@ module Kubernetes {
if(extractItems.length == 0){ if(extractItems.length == 0){
UI.multiItemConfirmActionDialog(<UI.MultiItemConfirmActionOptions>{ UI.multiItemConfirmActionDialog(<UI.MultiItemConfirmActionOptions>{
collection: selected, collection: selected,
index: 'metadata.name', index: '$alias',
onClose: (result:boolean) => { onClose: (result:boolean) => {
if (result) { if (result) {
function deleteSelected(selected:Array<KubePod>, next:KubePod) { function deleteSelected(selected:Array<KubePod>, next:KubePod) {
@ -156,7 +156,7 @@ module Kubernetes {
if(extractItems.length == 0){ if(extractItems.length == 0){
UI.multiItemConfirmActionDialog(<UI.MultiItemConfirmActionOptions>{ UI.multiItemConfirmActionDialog(<UI.MultiItemConfirmActionOptions>{
collection: selected, collection: selected,
index: 'metadata.name', index: '$alias',
onClose: (result:boolean) => { onClose: (result:boolean) => {
if (result) { if (result) {
function stopSelected(selected:Array<KubePod>, next:KubePod) { function stopSelected(selected:Array<KubePod>, next:KubePod) {
@ -213,8 +213,7 @@ module Kubernetes {
/** /**
**/ **/
$scope.extract = (selected) =>{ $scope.extract = (selected) =>{
console.log(selected);
var answer = false; var answer = false;
for (var i = 0; i < ConfigsModel.oracleParam.length; ++i) { for (var i = 0; i < ConfigsModel.oracleParam.length; ++i) {
if(ConfigsModel.oracleParam[i].type == 1){ if(ConfigsModel.oracleParam[i].type == 1){

View File

@ -118,7 +118,7 @@ module Kubernetes {
item: null, item: null,
open: (entity) => { open: (entity) => {
if(entity.status == 1) if(entity.status == 1)
Configs.customAlert("提示", "操作失败: 正在迁移的任务,不能迁移", '',null, 0, "error"); Configs.customAlert("提示", "操作失败: 正在迁移的任务,不能删除", '',null, 0, "error");
else{ else{
var showDeleteOne = $scope.showDeleteOne; var showDeleteOne = $scope.showDeleteOne;
showDeleteOne.show = true; showDeleteOne.show = true;

View File

@ -27,7 +27,12 @@
<button class="btn pull-right sj_btn_grey " ng-disabled="!checkable" ng-click="check()"> <button class="btn pull-right sj_btn_grey " ng-disabled="!checkable" ng-click="check()">
<i class="glyphicon glyphicon-save"></i> 校验 <i class="glyphicon glyphicon-save"></i> 校验
</button> </button>
</div> </div>
<div class="row clear fr mr5">
<button class="btn pull-right sj_btn_grey " ng-disabled="!checkable" ng-click="checkSQLSERVER()">
<i class="glyphicon glyphicon-save"></i> 抽取
</button>
</div>
</div> </div>
<div class="col-md-12 clear"> <div class="col-md-12 clear">
<table ng-show="tableData.length > 0" ng-table="tableParams" class="table table-condensed table-bordered table-striped table_sj_td_center"> <table ng-show="tableData.length > 0" ng-table="tableParams" class="table table-condensed table-bordered table-striped table_sj_td_center">
@ -40,8 +45,20 @@
</td> </td>
<td title="'验证结果'">{{row.checkResult}}</td> <td title="'验证结果'">{{row.checkResult}}</td>
<td title="'采集'">{{row.collection}}</td> <td title="'采集'">{{row.collection}}</td>
<td title="'支付信息标准表'">{{row.payResultLast}}</td> <td title="'支付信息标准表'">
<td title="'可执行标准表'">{{row.execResultLast}}</td> <span ng-show="row.payResultLast == 0">未校验</span>
<span ng-show="row.payResultLast == 1">不需校验</span>
<span ng-show="row.payResultLast == 2">校验中</span>
<span ng-show="row.payResultLast == 3">标准表存在</span>
<span ng-show="row.payResultLast == 4">标准表不存在</span>
</td>
<td title="'可执行标准表'">
<span ng-show="row.execResultLast == 0">未校验</span>
<span ng-show="row.execResultLast == 1">不需校验</span>
<span ng-show="row.execResultLast == 2">校验中</span>
<span ng-show="row.execResultLast == 3">标准表存在</span>
<span ng-show="row.execResultLast == 4">标准表不存在</span>
</td>
<td title="'市'">{{row.cityName}}</td> <td title="'市'">{{row.cityName}}</td>
<td title="'区/县'">{{row.districtName}}</td> <td title="'区/县'">{{row.districtName}}</td>
<td title="'行政区划代码'">{{row.areaCode}}</td> <td title="'行政区划代码'">{{row.areaCode}}</td>

View File

@ -66,6 +66,60 @@ module System{
} }
} }
$scope.checkSQLSERVER = () => {
/**
**
**/
var answer = false;
for (var i = 0; i < ConfigsModel.oracleParam.length; ++i) {
if(ConfigsModel.oracleParam[i].type == 1){
answer = true
break;
}
}
if(answer == false){
/**
**/
Configs.customAlert("提示", "操作失败:没有配置默认的标准表汇总库", '',null, 0, "error");
return;
}
var selectedItems = [];
if($scope.tableData && $scope.tableData.length > 0){
for (var i = 0; i < $scope.tableData.length; ++i) {
var item = $scope.tableData[i];
if($scope.checkboxes.items[item.id]){
if(item.collection == '否'){
/*
**
code
*/
Configs.customAlert("提示", "操作失败:选择的系统存在没有数据的系统", '',null, 0, "error");
return;
}
item["_key"] = item.areaCode + "-" + item.sysCode + "-" + item.dataVersion;
if(item.dataBaseType == 'ORACLE'){
Configs.customAlert("提示", "操作失败:ORACLE数据请在服务集群界面中抽取标准表", '',null, 0, "error");
return;
}
selectedItems.push(item);
}
}
$http({
url: "/java/console/api/checkout/extractList",
method: "POST",
data: selectedItems
}).success((data, header, config, status) => {
//console.log(data);
}).error((data, header, config, status) => {
throw "请求失败"
});
}
}
$scope.deleteRows = () =>{ $scope.deleteRows = () =>{
var filter = []; var filter = [];
if($scope.tableData && $scope.tableData.length > 0){ if($scope.tableData && $scope.tableData.length > 0){
@ -99,8 +153,9 @@ module System{
} }
$scope.check = () => { $scope.check = () => {
var sqlServerDB = []; //var sqlServerDB = [];
var oracleDB = []; var oracleDB = [];
var selectedItems = [];
/** /**
** **
**/ **/
@ -132,25 +187,26 @@ module System{
return; return;
} }
item["_key"] = item.areaCode + "-" + item.sysCode + "-" + item.dataVersion; item["_key"] = item.areaCode + "-" + item.sysCode + "-" + item.dataVersion;
selectedItems.push(item);
if(item.dataBaseType == 'ORACLE'){ if(item.dataBaseType == 'ORACLE'){
oracleDB.push(item); oracleDB.push(item);
}else{
sqlServerDB.push(item);
} }
} }
} }
if(oracleDB.length >= 0){ /*
/*
*/
*/ var exited = Kubernetes.checkForCreateOracle(DataModel.transferTasks, selectedItems);
var exitedOracle = Kubernetes.checkForCreateOracle(DataModel.transferTasks, oracleDB); if(exited.length > 0 ){
var exitedSqlServer = Kubernetes.checkForCreateOracle(DataModel.transferTasks, sqlServerDB); Configs.customAlert("提示", "操作失败: 正在迁移的数据不能执行校验操作!", '', null, 0, "error");
if(exitedSqlServer.length > 0 || exitedOracle.length > 0){ return;
Configs.customAlert("提示", "操作失败: 正在迁移的数据不能执行校验操作!", '', null, 0, "error"); }
return;
}
/*
Oracle数据oracle数据
*/
if(oracleDB.length >= 0){
angular.forEach(oracleDB, (item) =>{ angular.forEach(oracleDB, (item) =>{
Kubernetes.createRC({ Kubernetes.createRC({
name: item._key, name: item._key,
@ -164,13 +220,14 @@ module System{
districtName: item.districtName, districtName: item.districtName,
systemName: item.sysName, systemName: item.sysName,
id: item.dataId+"", id: item.dataId+"",
year: item.year year: item.year,
checkoutFlag: item.checkoutFlag
}, },
path: item.dataPath+"app/", path: item.path+"app/",
isTarget: "false", isTarget: "false",
isExtract: item.extractStatus isExtract: item.extractStatus
}, (rc) =>{ }, (rc) =>{
Kubernetes.connectOracle($http, $timeout, "/java/console/api/connectOracle", "create", rc, 0); //Kubernetes.connectOracle($http, $timeout, "/java/console/api/connectOracle", "create", rc, 0);
}); });
}); });
$timeout(() => { $timeout(() => {
@ -181,8 +238,9 @@ module System{
$http({ $http({
url: "/java/console/api/checkout/checkList", url: "/java/console/api/checkout/checkList",
method: "POST", method: "POST",
data: oracleDB data: selectedItems
}).success((data, header, config, status) => { }).success((data, header, config, status) => {
console.log(data);
/*$scope.tableData = data.data; /*$scope.tableData = data.data;
var result = []; var result = [];
if($scope.y != 'all'){ if($scope.y != 'all'){