--增加标准表抽取功能

This commit is contained in:
wu ming 2016-11-18 17:15:19 +08:00
parent 9768e31db1
commit df66493679
12 changed files with 287 additions and 223 deletions

View File

@ -223,7 +223,7 @@ declare module Kubernetes {
function getOracleStatus(labels: any): number; function getOracleStatus(labels: any): number;
function getExtractStatus(labels: any): number; function getExtractStatus(labels: any): number;
function getOracleName(replicas: any): string; function getOracleName(replicas: any): string;
function extractDataToOracle($http: any, selectedReplicationControllers: any, targetOracle: Configs.oracleParam, fn?: (data, status) => void): void; function extractDataToOracle($http: any, url: any, selectedReplicationControllers: any, targetOracle: Configs.oracleParam, fn?: (data, status) => void): void;
function checkoutOracleIsRunning(rc: any): boolean; function checkoutOracleIsRunning(rc: any): boolean;
function replicasIsCreated(replicationcontrollers: Array<any>, name: string): boolean; function replicasIsCreated(replicationcontrollers: Array<any>, name: string): boolean;
function loadConfigs(): { function loadConfigs(): {

View File

@ -6,6 +6,7 @@
/// <reference path="../../kubernetes/ts/kubernetesHelpers.d.ts" /> /// <reference path="../../kubernetes/ts/kubernetesHelpers.d.ts" />
/// <reference path="../../configs/ts/customAlert.d.ts" /> /// <reference path="../../configs/ts/customAlert.d.ts" />
/// <reference path="../../configs/ts/configsDataService.d.ts" /> /// <reference path="../../configs/ts/configsDataService.d.ts" />
/// <reference path="../../kubernetes/ts/term.d.ts" />
declare module System { declare module System {
var SystemVerificationController: ng.IModule; var SystemVerificationController: ng.IModule;
} }

2
defs.d.ts vendored
View File

@ -37,6 +37,7 @@
/// <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"/>
@ -77,7 +78,6 @@
/// <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: "8088", port: "8080",
hostname: "192.168.0.110", hostname: "192.168.0.181",
path: '/java/console/api', path: '/java/console/api',
targetPath: "/" targetPath: "/"
}]; }];

View File

@ -66,7 +66,7 @@
<button ng-show="model.fetched" <button ng-show="model.fetched"
ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-disabled="!id && tableConfig.selectedItems.length == 0"
class="btn btn-success pull-right sj_btn_grey" class="btn btn-success pull-right sj_btn_grey"
ng-click="extract(id || tableConfig.selectedItems)"> ng-click="extractOracle(id || tableConfig.selectedItems)">
<i class="glyphicon glyphicon-cloud-download"></i> 抽取 <i class="glyphicon glyphicon-cloud-download"></i> 抽取
</button> </button>
</div> </div>

View File

@ -1816,7 +1816,7 @@ module Kubernetes {
return annotation["cityName"] + "-" + annotation["districtName"] + "-" + annotation["systemName"]; return annotation["cityName"] + "-" + annotation["districtName"] + "-" + annotation["systemName"];
} }
export function extractDataToOracle($http, selectedReplicationControllers, targetOracle: Configs.oracleParam, fn?:(data, status) => void){ export function extractDataToOracle($http, url, selectedReplicationControllers, targetOracle: Configs.oracleParam, fn?:(data, status) => void){
//console.log(targetReplicationController.length); //console.log(targetReplicationController.length);
var answer = targetOracle && true; var answer = targetOracle && true;
var inneedOracle = []; var inneedOracle = [];
@ -1836,7 +1836,7 @@ module Kubernetes {
var spinner; var spinner;
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: UrlHelpers.join("/java/console/api/oracle", targetOracle.id+"", "extract"), url: UrlHelpers.join(url, targetOracle.id+"", "extract"),
timeout: 8000, timeout: 8000,
dataType: 'json', dataType: 'json',
//async: false, //async: false,
@ -1851,7 +1851,7 @@ module Kubernetes {
complete: (XMLHttpRequest, textStatus) => { complete: (XMLHttpRequest, textStatus) => {
if(XMLHttpRequest.status == 200){ if(XMLHttpRequest.status == 200){
//spinner.spin(); //spinner.spin();
Kubernetes.createSuccessInfo("success", "连接汇总库成功,即将执行汇总操作!"); Kubernetes.createSuccessInfo("success", "连接汇总库成功,即将执行汇总或抽取操作!");
setTimeout("Kubernetes.removeMask()", 1500); setTimeout("Kubernetes.removeMask()", 1500);
} }
else{ else{

View File

@ -49,7 +49,7 @@ module Kubernetes {
$scope.openLogs = (entity) => { $scope.openLogs = (entity) => {
log.debug("Open logs: ", entity); log.debug("Open logs: ", entity);
TerminalService.newTerminal($interval, entity.metadata.selfLink, entity.$oracleName, entity,$templateCache.get(UrlHelpers.join(templatePath, 'logShell.html'))); TerminalService.newTerminal($interval, entity.metadata.selfLink, entity.$oracleName, entity, "/java/console/api/oracle/extract/log?rcName=" + getName(entity), $templateCache.get(UrlHelpers.join(templatePath, 'logShell.html')));
} }
}); });

View File

@ -213,7 +213,7 @@ module Kubernetes {
/** /**
**/ **/
$scope.extract = (selected) =>{ $scope.extractOracle = (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){
@ -234,7 +234,24 @@ module Kubernetes {
Configs.customAlert("提示", "操作失败:选择服务中存在未启动的数据库,请先启动服务", '',null, 0, "error"); Configs.customAlert("提示", "操作失败:选择服务中存在未启动的数据库,请先启动服务", '',null, 0, "error");
return; return;
} }
//执行标准表抽取操作 var answer = false;
var selectedItem = null;
for (var i = 0; i < ConfigsModel.oracleParam.length; ++i) {
if(ConfigsModel.oracleParam[i].type == 1){
selectedItem = ConfigsModel.oracleParam[i];
answer = true
break;
}
}
if(answer == false){
/**
**/
Configs.customAlert("提示", "操作失败:没有配置默认的标准表汇总库", '',null, 0, "error");
return;
}
Kubernetes.extractDataToOracle($http, "/java/console/api/oracle/standardextract", selected, selectedItem);
} }
$scope.extractClick = { $scope.extractClick = {
@ -244,7 +261,7 @@ module Kubernetes {
onOk: () => { onOk: () => {
var extractClick = $scope.extractClick; var extractClick = $scope.extractClick;
extractClick.items = $scope.tableConfig.selectedItems; extractClick.items = $scope.tableConfig.selectedItems;
Kubernetes.extractDataToOracle($http, extractClick.items, extractClick.selectedItem); Kubernetes.extractDataToOracle($http, "/java/console/api/oracle", extractClick.items, extractClick.selectedItem);
//extractClick.selectedItem = $scope.filterReplicationControllers[0] || ""; //extractClick.selectedItem = $scope.filterReplicationControllers[0] || "";
extractClick.dialog.close(); extractClick.dialog.close();
}, },

View File

@ -43,7 +43,7 @@ module Kubernetes {
}, },
terminals: {}, terminals: {},
httpTask: {}, httpTask: {},
newTerminal: ($interval, podLink, containerName, entity, template = defaultTemplate) => { newTerminal: ($interval, podLink, containerName, entity, url ,template = defaultTemplate) => {
var terminalId = UrlHelpers.join(podLink, containerName); var terminalId = UrlHelpers.join(podLink, containerName);
if (terminalId in self.terminals) { if (terminalId in self.terminals) {
log.debug("Already a terminal with id: ", terminalId); log.debug("Already a terminal with id: ", terminalId);
@ -51,7 +51,7 @@ module Kubernetes {
return terminalId; return terminalId;
} }
var scope = $rootScope.$new(); var scope = $rootScope.$new();
getLogs(entity, scope); getLogs(entity, scope, url);
scope.podLink = podLink; scope.podLink = podLink;
scope.containerName = containerName; scope.containerName = containerName;
scope.id = terminalId; scope.id = terminalId;
@ -61,7 +61,7 @@ module Kubernetes {
return terminalId; return terminalId;
}else{ }else{
self.httpTask[terminalId] = $interval(() =>{ self.httpTask[terminalId] = $interval(() =>{
getLogs(entity, scope); getLogs(entity, scope, url);
},2000); },2000);
} }
var el = $($compile(template)(scope)); var el = $($compile(template)(scope));
@ -300,7 +300,7 @@ module Kubernetes {
}; };
}); });
function getLogs(rc, scope){ function getLogs(rc, scope, url){
var xhr= new XMLHttpRequest(); var xhr= new XMLHttpRequest();
xhr.onreadystatechange = () => { xhr.onreadystatechange = () => {
if(xhr.readyState == 4){ if(xhr.readyState == 4){
@ -319,7 +319,8 @@ module Kubernetes {
} }
} }
} }
xhr.open("POST", "/java/console/api/oracle/extract/log?rcName=" + getName(rc),false); xhr.open("POST", url, false);
//xhr.open("POST", "/java/console/api/oracle/extract/log?rcName=" + getName(rc),false);
xhr.send(null); xhr.send(null);
} }
} }

View File

@ -51,6 +51,9 @@
<span ng-show="row.payResultLast == 2">校验中</span> <span ng-show="row.payResultLast == 2">校验中</span>
<span ng-show="row.payResultLast == 3">标准表存在</span> <span ng-show="row.payResultLast == 3">标准表存在</span>
<span ng-show="row.payResultLast == 4">标准表不存在</span> <span ng-show="row.payResultLast == 4">标准表不存在</span>
<span ng-show="row.payResultLast == 5">待抽取</span>
<span ng-show="row.payResultLast == 6">正在抽取</span>
<span ng-show="row.payResultLast == 7">抽取完成</span>
</td> </td>
<td title="'可执行标准表'"> <td title="'可执行标准表'">
<span ng-show="row.execResultLast == 0">未校验</span> <span ng-show="row.execResultLast == 0">未校验</span>
@ -58,6 +61,9 @@
<span ng-show="row.execResultLast == 2">校验中</span> <span ng-show="row.execResultLast == 2">校验中</span>
<span ng-show="row.execResultLast == 3">标准表存在</span> <span ng-show="row.execResultLast == 3">标准表存在</span>
<span ng-show="row.execResultLast == 4">标准表不存在</span> <span ng-show="row.execResultLast == 4">标准表不存在</span>
<span ng-show="row.execResultLast == 5">待抽取</span>
<span ng-show="row.execResultLast == 6">正在抽取</span>
<span ng-show="row.execResultLast == 7">抽取完成</span>
</td> </td>
<td title="'市'">{{row.cityName}}</td> <td title="'市'">{{row.cityName}}</td>
<td title="'区/县'">{{row.districtName}}</td> <td title="'区/县'">{{row.districtName}}</td>
@ -71,6 +77,11 @@
<td title="'联系人'">{{row.departmentManager}}</td> <td title="'联系人'">{{row.departmentManager}}</td>
<td title="'联系方式'">{{row.managerContacts}}</td> <td title="'联系方式'">{{row.managerContacts}}</td>
<td title="'数据库类型'">{{row.dataBaseType}}</td> <td title="'数据库类型'">{{row.dataBaseType}}</td>
<td title="'抽取日志'">
<button class="btn sj_btn" ng-click="openLog(row)">
<span>查看日志</span>
</button>
</td>
</tr> </tr>
</table> </table>
<div ng-hide="tableData.length > 0" class="col-sm-12 alert alert-warning sj_alert-warning"> <div ng-hide="tableData.length > 0" class="col-sm-12 alert alert-warning sj_alert-warning">

View File

@ -6,9 +6,10 @@
/// <reference path="../../kubernetes/ts/kubernetesHelpers.ts"/> /// <reference path="../../kubernetes/ts/kubernetesHelpers.ts"/>
/// <reference path="../../configs/ts/customAlert.ts"/> /// <reference path="../../configs/ts/customAlert.ts"/>
/// <reference path="../../configs/ts/configsDataService.ts"/> /// <reference path="../../configs/ts/configsDataService.ts"/>
/// <reference path="../../kubernetes/ts/term.ts"/>
module System{ module System{
export var SystemVerificationController = controller('SystemVerificationController', ['$scope', '$location', '$http', '$templateCache', 'Upload', 'NgTableParams', 'ngDialog', 'SystemModel', '$element', '$timeout', 'ConfigsModel', 'DataModel', ($scope, $location, $http, $templateCache, Upload, NgTableParams, ngDialog, SystemModel, $element, $timeout, ConfigsModel, DataModel) => { export var SystemVerificationController = controller('SystemVerificationController', ['$scope', '$interval', '$location', '$http', '$templateCache', 'Upload', 'NgTableParams', 'ngDialog', 'SystemModel', '$element', '$timeout', 'ConfigsModel', 'DataModel', 'TerminalService', ($scope, $interval, $location, $http, $templateCache, Upload, NgTableParams, ngDialog, SystemModel, $element, $timeout, ConfigsModel, DataModel, TerminalService) => {
shareInit($scope); shareInit($scope);
$scope.cities = classifyCity(SystemModel.regionalismInfo); $scope.cities = classifyCity(SystemModel.regionalismInfo);
$scope.model = SystemModel; $scope.model = SystemModel;
@ -334,5 +335,13 @@ module System{
Configs.customAlert("提示", "操作失败:发生请求失败,不能删除!", '',null, 0, "error"); Configs.customAlert("提示", "操作失败:发生请求失败,不能删除!", '',null, 0, "error");
}); });
}); });
$scope.openLog = (entity) => {
console.log(entity);
var name = entity.areaCode + "_" + entity.sysCode + "_" + entity.dataVersion
var containerName = entity.cityName + "-" + entity.districtName + "-" + entity.sysName + "-版本" + entity.dataVersion;
entity["name"] = name;
TerminalService.newTerminal($interval, entity.id+"", containerName, entity, "/java/console/api/standardextract/log?rcName=" + name, $templateCache.get(UrlHelpers.join(Kubernetes.templatePath, 'logShell.html')));
}
}]); }]);
} }