--增加标准表抽取功能

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 getExtractStatus(labels: any): number;
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 replicasIsCreated(replicationcontrollers: Array<any>, name: string): boolean;
function loadConfigs(): {

View File

@ -6,6 +6,7 @@
/// <reference path="../../kubernetes/ts/kubernetesHelpers.d.ts" />
/// <reference path="../../configs/ts/customAlert.d.ts" />
/// <reference path="../../configs/ts/configsDataService.d.ts" />
/// <reference path="../../kubernetes/ts/term.d.ts" />
declare module System {
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/workspace.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/breadcrumbs.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/tabs.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/systemPlugin.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'
}, {
proto: "http",
port: "8088",
hostname: "192.168.0.110",
port: "8080",
hostname: "192.168.0.181",
path: '/java/console/api',
targetPath: "/"
}];

View File

@ -66,7 +66,7 @@
<button ng-show="model.fetched"
ng-disabled="!id && tableConfig.selectedItems.length == 0"
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> 抽取
</button>
</div>

View File

@ -1816,7 +1816,7 @@ module Kubernetes {
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);
var answer = targetOracle && true;
var inneedOracle = [];
@ -1836,7 +1836,7 @@ module Kubernetes {
var spinner;
$.ajax({
type: "POST",
url: UrlHelpers.join("/java/console/api/oracle", targetOracle.id+"", "extract"),
url: UrlHelpers.join(url, targetOracle.id+"", "extract"),
timeout: 8000,
dataType: 'json',
//async: false,
@ -1851,7 +1851,7 @@ module Kubernetes {
complete: (XMLHttpRequest, textStatus) => {
if(XMLHttpRequest.status == 200){
//spinner.spin();
Kubernetes.createSuccessInfo("success", "连接汇总库成功,即将执行汇总操作!");
Kubernetes.createSuccessInfo("success", "连接汇总库成功,即将执行汇总或抽取操作!");
setTimeout("Kubernetes.removeMask()", 1500);
}
else{

View File

@ -49,7 +49,7 @@ module Kubernetes {
$scope.openLogs = (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;
for (var i = 0; i < ConfigsModel.oracleParam.length; ++i) {
if(ConfigsModel.oracleParam[i].type == 1){
@ -234,7 +234,24 @@ module Kubernetes {
Configs.customAlert("提示", "操作失败:选择服务中存在未启动的数据库,请先启动服务", '',null, 0, "error");
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 = {
@ -244,7 +261,7 @@ module Kubernetes {
onOk: () => {
var extractClick = $scope.extractClick;
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.dialog.close();
},

View File

@ -43,7 +43,7 @@ module Kubernetes {
},
terminals: {},
httpTask: {},
newTerminal: ($interval, podLink, containerName, entity, template = defaultTemplate) => {
newTerminal: ($interval, podLink, containerName, entity, url ,template = defaultTemplate) => {
var terminalId = UrlHelpers.join(podLink, containerName);
if (terminalId in self.terminals) {
log.debug("Already a terminal with id: ", terminalId);
@ -51,7 +51,7 @@ module Kubernetes {
return terminalId;
}
var scope = $rootScope.$new();
getLogs(entity, scope);
getLogs(entity, scope, url);
scope.podLink = podLink;
scope.containerName = containerName;
scope.id = terminalId;
@ -61,7 +61,7 @@ module Kubernetes {
return terminalId;
}else{
self.httpTask[terminalId] = $interval(() =>{
getLogs(entity, scope);
getLogs(entity, scope, url);
},2000);
}
var el = $($compile(template)(scope));
@ -300,13 +300,13 @@ module Kubernetes {
};
});
function getLogs(rc, scope){
function getLogs(rc, scope, url){
var xhr= new XMLHttpRequest();
xhr.onreadystatechange = () => {
if(xhr.readyState == 4){
if (xhr.status == 200){
if(xhr.responseText !="" && xhr.responseText !=null){
var logObject = JSON.parse(xhr.responseText);
var logObject = JSON.parse(xhr.responseText);
scope.logs = logObject[getName(rc)];
}else{
scope.logs = "当前没有可以查看的日志信息";
@ -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);
}
}

View File

@ -51,6 +51,9 @@
<span ng-show="row.payResultLast == 2">校验中</span>
<span ng-show="row.payResultLast == 3">标准表存在</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 title="'可执行标准表'">
<span ng-show="row.execResultLast == 0">未校验</span>
@ -58,6 +61,9 @@
<span ng-show="row.execResultLast == 2">校验中</span>
<span ng-show="row.execResultLast == 3">标准表存在</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 title="'市'">{{row.cityName}}</td>
<td title="'区/县'">{{row.districtName}}</td>
@ -71,6 +77,11 @@
<td title="'联系人'">{{row.departmentManager}}</td>
<td title="'联系方式'">{{row.managerContacts}}</td>
<td title="'数据库类型'">{{row.dataBaseType}}</td>
<td title="'抽取日志'">
<button class="btn sj_btn" ng-click="openLog(row)">
<span>查看日志</span>
</button>
</td>
</tr>
</table>
<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="../../configs/ts/customAlert.ts"/>
/// <reference path="../../configs/ts/configsDataService.ts"/>
/// <reference path="../../kubernetes/ts/term.ts"/>
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);
$scope.cities = classifyCity(SystemModel.regionalismInfo);
$scope.model = SystemModel;
@ -334,5 +335,13 @@ module System{
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')));
}
}]);
}