修正服务集群信息显示中服务名,标签与实际不符合的Bug

This commit is contained in:
wu ming 2016-10-12 11:22:52 +08:00
parent 48e8136c50
commit 0a82e8674f
8 changed files with 83 additions and 40 deletions

View File

@ -86,6 +86,17 @@ declare module Kubernetes {
* Returns the labels text string using the <code>key1=value1,key2=value2,....</code> format * Returns the labels text string using the <code>key1=value1,key2=value2,....</code> format
*/ */
function labelsToString(labels: any, seperatorText?: string): string; function labelsToString(labels: any, seperatorText?: string): string;
function labelsFormat(replicas: any): {
isExtract: any;
isTarget: any;
status: any;
style: any;
cityName: any;
districtName: any;
systemName: any;
year: any;
version: string;
};
function initShared($scope: any, $location: any, $http: any, $timeout: any, $routeParams: any, KubernetesModel: any, KubernetesState: any, KubernetesApiURL: any): void; function initShared($scope: any, $location: any, $http: any, $timeout: any, $routeParams: any, KubernetesModel: any, KubernetesState: any, KubernetesApiURL: any): void;
/** /**
* Returns the number of pods that are ready * Returns the number of pods that are ready
@ -211,7 +222,7 @@ declare module Kubernetes {
function connectOracle($http: any, $timeout: any, url: any, operation: any, replicas: any, delayTime: any): void; function connectOracle($http: any, $timeout: any, url: any, operation: any, replicas: any, delayTime: any): void;
function getOracleStatus(labels: any): number; function getOracleStatus(labels: any): number;
function getExtractStatus(labels: any): number; function getExtractStatus(labels: any): number;
function getOracleName(name: string): string; function getOracleName(replicas: any): string;
function extractDataToOracle($http: any, selectedReplicationControllers: any, targetOracle: Configs.oracleParam, fn?: (data, status) => void): void; function extractDataToOracle($http: 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;

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.191.8", hostname: "192.168.0.110",
path: '/java/console/api', path: '/java/console/api',
targetPath: "/" targetPath: "/"
}]; }];

View File

@ -53,11 +53,17 @@ module Developer {
}, },
{ {
field: "name", field: "name",
displayName: '市-区/县' displayName: '市-区/县',
customSortField: (field) => {
return field;
}
}, },
{ {
field: "systemName", field: "systemName",
displayName: '系统名称' displayName: '系统名称',
customSortField: (field) => {
return field;
}
}, },
{ {
field: "labels", field: "labels",

View File

@ -371,6 +371,23 @@ module Kubernetes {
return answer; return answer;
} }
export function labelsFormat(replicas){
console.log(replicas);
var annotion = getAnnotations(replicas);
var lables = getLabels(replicas);
return{
isExtract: lables["isExtract"],
isTarget: lables["isTarget"],
status: lables["status"],
style: lables["style"],
cityName: annotion["cityName"],
districtName: annotion["districtName"],
systemName: annotion["systemName"],
year: annotion["year"],
version: "版本" + lables["version"]
}
}
export function initShared($scope, $location, $http, $timeout, $routeParams, KubernetesModel, KubernetesState, KubernetesApiURL) { export function initShared($scope, $location, $http, $timeout, $routeParams, KubernetesModel, KubernetesState, KubernetesApiURL) {
$scope.baseUri = Core.trimTrailing(Core.url("/") || "", "/") || ""; $scope.baseUri = Core.trimTrailing(Core.url("/") || "", "/") || "";
@ -1794,15 +1811,9 @@ module Kubernetes {
} }
} }
export function getOracleName(name:string):string { export function getOracleName(replicas):string {
var results = name.split("-"); var annotation = getAnnotations(replicas);
if(results.length === 2){ return annotation["cityName"] + "-" + annotation["districtName"] + "-" + annotation["systemName"];
return "汇总数据库" + "(" +results[1] + ")";
}else if(results.length === 3){
return Kubernetes.getCountyByCode(results[0]) + "_" + Kubernetes.getSystemNameById(results[1]);
}else{
return name;
}
} }
export function extractDataToOracle($http, selectedReplicationControllers, targetOracle: Configs.oracleParam, fn?:(data, status) => void){ export function extractDataToOracle($http, selectedReplicationControllers, targetOracle: Configs.oracleParam, fn?:(data, status) => void){

View File

@ -354,7 +354,7 @@ module Kubernetes {
replicationController.$podCount = replicationController.$pods.length; replicationController.$podCount = replicationController.$pods.length;
replicationController.$replicas = (replicationController.spec || {}).replicas; replicationController.$replicas = (replicationController.spec || {}).replicas;
replicationController.$oracleName = getOracleName(getName(replicationController)); replicationController.$oracleName = getOracleName(replicationController);
//console.log(getName(replicationController)); //console.log(getName(replicationController));
replicationController.$oracleStatus = getOracleStatus(getLabels(replicationController)); replicationController.$oracleStatus = getOracleStatus(getLabels(replicationController));
replicationController.$extractStatus = getExtractStatus(getLabels(replicationController)); replicationController.$extractStatus = getExtractStatus(getLabels(replicationController));
@ -364,8 +364,9 @@ module Kubernetes {
replicationController.connectTo = selectedPods.map((pod) => { replicationController.connectTo = selectedPods.map((pod) => {
return pod._key; return pod._key;
}).join(','); }).join(',');
//console.log(getLabels(replicationController));
replicationController.$labelsText = Kubernetes.labelsToString(getLabels(replicationController)); replicationController.$labelsText = Kubernetes.labelsToString(getLabels(replicationController));
replicationController.metadata.labels = Kubernetes.labelToChinese(getLabels(replicationController)); replicationController.metadata.labels = labelsFormat(replicationController);
this.updateIconUrlAndAppInfo(replicationController, "replicationControllerNames"); this.updateIconUrlAndAppInfo(replicationController, "replicationControllerNames");
var iconUrl = replicationController.$iconUrl; var iconUrl = replicationController.$iconUrl;
if (iconUrl && selectedPods) { if (iconUrl && selectedPods) {

View File

@ -335,4 +335,3 @@ legend {
top: 48%; top: 48%;
} }

View File

@ -105,8 +105,7 @@ module Navigation {
<div class="nav-pf-vertical nav-pf-vertical-with-secondary-nav" ng-controller="Developer.NavBarController" ng-class="getClass()"> <div class="nav-pf-vertical nav-pf-vertical-with-secondary-nav" ng-controller="Developer.NavBarController" ng-class="getClass()">
<div class="list-group"> <div class="list-group">
<div ng-repeat="subTab in subTabConfig" ng-show="true" <div ng-repeat="subTab in subTabConfig" ng-show="true"
class="list-group-item {{subTab.active ? 'active' : ''}}" class="list-group-item {{subTab.active ? 'active' : ''}}" >
title="{{subTab.title}}">
<a ng-hide="subTab.template" href="{{subTab.href}}"> <a ng-hide="subTab.template" href="{{subTab.href}}">
<span ng-show="subTab.class" ng-class="subTab.class"></span> <span ng-show="subTab.class" ng-class="subTab.class"></span>
<img ng-show="subTab.icon" ng-src="{{subTab.icon}}"> <img ng-show="subTab.icon" ng-src="{{subTab.icon}}">
@ -160,7 +159,7 @@ module Navigation {
<li ng-repeat="breadcrumb in breadcrumbConfig" ng-show="isValid(breadcrumb) && label(breadcrumb)" <li ng-repeat="breadcrumb in breadcrumbConfig" ng-show="isValid(breadcrumb) && label(breadcrumb)"
class="{{breadcrumb.active ? 'active' : ''}}" class="{{breadcrumb.active ? 'active' : ''}}"
ng-class="$last ? 'dropdown' : ''" ng-class="$last ? 'dropdown' : ''"
title="{{breadcrumb.title}}"> >
<a ng-show="breadcrumb.href" href="{{breadcrumb.href}}">{{label(breadcrumb)}}</a> <a ng-show="breadcrumb.href" href="{{breadcrumb.href}}">{{label(breadcrumb)}}</a>
<span ng-hide="breadcrumb.href">{{label(breadcrumb)}}</span> <span ng-hide="breadcrumb.href">{{label(breadcrumb)}}</span>
</li> </li>
@ -198,7 +197,7 @@ module Navigation {
<ul class="navbar-lf-menu " > <ul class="navbar-lf-menu " >
<li ng-repeat="subTab in subTabConfig " > <li ng-repeat="subTab in subTabConfig " >
<div class="expandable closed " ng-show="subTab.items.length" style=" padding:0;"> <div class="expandable closed " ng-show="subTab.items.length" style=" padding:0;">
<div title="The title" class="title sj_menu_nav" > <div class="title sj_menu_nav" >
<i class=" sj_menu_01" >{{subTab.label}}</i> <i class=" sj_menu_01" >{{subTab.label}}</i>
</div> </div>
<ul class="expandable-body sj_menu_ul" > <ul class="expandable-body sj_menu_ul" >