功能调整和完善--9.20

Web_Manager_Develope
wu ming 8 years ago
parent e76717783e
commit 25d67ad44e

@ -10,12 +10,14 @@ declare module Developer {
currentPageNum: number; currentPageNum: number;
totalSize: any; totalSize: any;
priorTableSize: number; priorTableSize: number;
keyQuery: any;
createParamData(): { createParamData(): {
currentPageNum: number; currentPageNum: number;
dataType: any; dataType: any;
submittedBatch: any; submittedBatch: any;
limit: number; limit: number;
priorTableSize: number; priorTableSize: number;
keyQuery: any;
}; };
getPageSizeNum(): number; getPageSizeNum(): number;
} }

File diff suppressed because one or more lines are too long

@ -82,7 +82,7 @@ a:hover.sj_btn_grey{ background-image:-webkit-linear-gradient(top, #eeeeee,#d3d3
.sj_table_bottom{ height:30px; line-height:30px; } .sj_table_bottom{ height:30px; line-height:30px; }
.sj_table_bottom li{ float:left;} .sj_table_bottom li{ float:left;}
.sj_table_select{ background:#fff; border:1px solid #b1b1b1; height:25px; margin:0 5px;} .sj_table_select{ background:#fff; border:1px solid #b1b1b1; height:25px; margin:0 5px;}
.badge{ font-weight: normal; text-shadow:none; background-color: #a1a1a1;} .badge{ font-weight: normal; text-shadow:none; /*background-color: #a1a1a1*/;}
.simple-table-checkbox{ text-align: center;} .simple-table-checkbox{ text-align: center;}
.table{ margin-bottom: 10px;} .table{ margin-bottom: 10px;}
.sj_nav_taps{ border-bottom: none;} .sj_nav_taps{ border-bottom: none;}

@ -59,7 +59,7 @@ module Configs{
} }
export function shareInit($scope, $location, $routeParams){ export function shareInit($scope, $location, $routeParams){
$scope. subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams); $scope. subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams);
} }
export function createNewObejct(array:Array<any>, obj){ export function createNewObejct(array:Array<any>, obj){
@ -86,35 +86,27 @@ module Configs{
export function oracleInfoOperate($http, url:string, operate:string, resource, fn?: (data, status)=>void ){ export function oracleInfoOperate($http, url:string, operate:string, resource, fn?: (data, status)=>void ){
if(resource === null) if(resource === null)
throw "不能操作空资源对象"; throw "不能操作空资源对象";
var id = resource["id"] || resource["name"] || resource["_id"] || resource["_key"];
var id = resource["id"] || resource["name"] || resource["_id"] || resource["_key"];
var RESTfulUrl=url; var RESTfulUrl=url;
if(id===undefined){ if(id == "undefined"){
RESTfulUrl = UrlHelpers.join(url, operate); RESTfulUrl = UrlHelpers.join(url, operate);
}else{ }else{
RESTfulUrl = UrlHelpers.join(url, resource.id+"", operate); RESTfulUrl = UrlHelpers.join(url, id+"", operate);
} }
$http({ $http({
method: "POST", method: "POST",
url: RESTfulUrl, dataType: 'json',
params: resource, url: RESTfulUrl,
transformRequest: function(obj) { data: resource,
var str = []; }).success((data,header,config,status) => {
for(var p in obj) if(angular.isFunction(fn))
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); fn(data, header);
return str.join("&"); }).error((data,header,config,status) => {
}, if(angular.isFunction(fn))
}).success(function(data, status, headers, config) { fn(data, header);
//成功之后做一些事情 });
if(angular.isFunction(fn))
fn(data, status);
}).error(function(data, status, headers, config) {
if(angular.isFunction(fn))
fn(data, status);
});
} }
export function createConfigHelperNavBar($scope, $location, $routeParams){ export function createConfigHelperNavBar($scope, $location, $routeParams){

@ -7,7 +7,10 @@ module Configs{
export var KubeController = controller('KubeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout","ConfigsModel", export var KubeController = controller('KubeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout","ConfigsModel",
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel) => { ($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel) => {
$scope.model= ConfigsModel; $scope.model= ConfigsModel;
$scope.model.updateOracleParam();
$scope.tableConfig={ $scope.tableConfig={
data: 'model.oracleParam', data: 'model.oracleParam',
selectedItems: [], selectedItems: [],
@ -101,6 +104,7 @@ module Configs{
$scope.$on("deleteRow", (event, data) =>{ $scope.$on("deleteRow", (event, data) =>{
oracleInfoOperate($http, "/java/console/api/oracle", OperateType.DELETE, data, (result, status) => { oracleInfoOperate($http, "/java/console/api/oracle", OperateType.DELETE, data, (result, status) => {
if(status===200){ if(status===200){
console.log("准备更新");
$scope.model.updateOracleParam(); $scope.model.updateOracleParam();
}else{ }else{
throw "资源请求失败"; throw "资源请求失败";

@ -8,8 +8,8 @@
<li role="presentation" ng-repeat="item in navbarItems" class="{{item.class}}"><a href="#" ng-click="selectBatchItem(item)">{{item.label}}</a></li> <li role="presentation" ng-repeat="item in navbarItems" class="{{item.class}}"><a href="#" ng-click="selectBatchItem(item)">{{item.label}}</a></li>
</ul> </ul>
<div class="fr sj_searchbox"> <div class="fr sj_searchbox">
<input type="text" class="sj_search_input" /> <input type="text" class="sj_search_input" ng-model="keyQuery" placeholder="请选择或输入关键字,多关键字请用空格隔开"/>
<a href="#" class="sj_search_btn"></a> <a href="#" class="sj_search_btn" ng-click="search()"></a>
</div> </div>
</div> </div>
<div ng-hide="model.data.length" class="align-center"> <div ng-hide="model.data.length" class="align-center">

@ -51,5 +51,5 @@ module Developer{
title: "任务查看" title: "任务查看"
} }
]); ]);
} }
} }

@ -9,7 +9,8 @@ module Developer{
public labels={}; public labels={};
public currentPageNum=1; public currentPageNum=1;
public totalSize=null; public totalSize=null;
public priorTableSize = 20; public priorTableSize = 20;
public keyQuery=null;
public createParamData(){ public createParamData(){
var extendValue =["cityName", "districtName", "dataVersion", "systemName", "dataYear"]; var extendValue =["cityName", "districtName", "dataVersion", "systemName", "dataYear"];
@ -18,7 +19,8 @@ module Developer{
dataType: this.dataType, dataType: this.dataType,
submittedBatch: this.dataBatch, submittedBatch: this.dataBatch,
limit: this.currentTableSize, limit: this.currentTableSize,
priorTableSize: this.priorTableSize priorTableSize: this.priorTableSize,
keyQuery: this.keyQuery
} }
angular.forEach(this.labels,(value, key) =>{ angular.forEach(this.labels,(value, key) =>{

@ -15,7 +15,7 @@ module Developer {
init($scope, $location, $routeParams); init($scope, $location, $routeParams);
$scope.options = DataModel.paramOptions; $scope.options = DataModel.paramOptions;
$scope.pageSizeChoses = DataModel.paramOptions.pagerSizeOption; $scope.pageSizeChoses = DataModel.paramOptions.pagerSizeOption;
$scope.options.dataType = getDataType($location); $scope.options.dataType = getDataType($location);
$scope.treeOptions = { $scope.treeOptions = {
nodeChildren: "childNodes", nodeChildren: "childNodes",
@ -79,15 +79,17 @@ module Developer {
] ]
}; };
$scope.$on("dataLabelFilterUpdate", ($event, text, key) => {
$scope.keyQuery += " " + text;
})
$scope.selectBatchItem = (item)=> { $scope.selectBatchItem = (item)=> {
$scope.navbarItems.forEach((nav) =>{ $scope.navbarItems.forEach((nav) =>{
nav.class=""; nav.class="";
}); });
item.class="active"; item.class="active";
if(item.label === "全部") $scope.model.updateParamOption("keyQuery", $scope.keyQuery);
$scope.model.updateParamOption("dataBatch", null); $scope.model.updateParamOption("dataBatch", item.alias);
else
$scope.model.updateParamOption("dataBatch", item.alias);
} }
$scope.isEmptyOrFirst = () => { $scope.isEmptyOrFirst = () => {
@ -129,18 +131,22 @@ module Developer {
$scope.model.updateParamOption("currentPageNum", idx+1); $scope.model.updateParamOption("currentPageNum", idx+1);
} }
$scope.$watch('options', (newValue, oldValue) => { $scope.$watch('options', (newValue, oldValue) => {
if(newValue && newValue !== oldValue){ if(newValue){
if(newValue.currentTableSize !== oldValue.currentTableSize) if(newValue.currentTableSize !== oldValue.currentTableSize)
$scope.options.priorTableSize = oldValue.currentTableSize; $scope.options.priorTableSize = oldValue.currentTableSize;
else else
$scope.options.priorTableSize = newValue.currentTableSize; $scope.options.priorTableSize = newValue.currentTableSize;
DataModel.updateModel(); DataModel.updateModel();
} }
}, true); }, true);
$scope.search = () => {
$scope.model.updateParamOption("keyQuery", $scope.keyQuery);
}
$scope.deletePrompt = (selected) => { $scope.deletePrompt = (selected) => {
if (angular.isString(selected)) { if (angular.isString(selected)) {
selected = [{ selected = [{
@ -154,8 +160,7 @@ module Developer {
var idColl = []; var idColl = [];
if (result) { if (result) {
angular.forEach(selected, (select) => { angular.forEach(selected, (select) => {
idColl.push(select.id); idColl.push(select.id);
console.log(select.id);
}); });
$http({ $http({
method: "POST", method: "POST",
@ -185,9 +190,7 @@ module Developer {
selectedItem: {"name": "当前没有可以迁移的集群"}, selectedItem: {"name": "当前没有可以迁移的集群"},
dialog: new UI.Dialog(), dialog: new UI.Dialog(),
onOk: () => { onOk: () => {
var migrationClick = $scope.migrationClick; var migrationClick = $scope.migrationClick;
console.log($scope.tableConfig.selectedItems);
console.log($scope.selectNode);
Configs.oracleInfoOperate($http, "/java/console/api/volume", Configs.OperateType.MOVE, Configs.oracleInfoOperate($http, "/java/console/api/volume", Configs.OperateType.MOVE,
{ {
"name": migrationClick.selectedItem.name, "name": migrationClick.selectedItem.name,
@ -214,8 +217,8 @@ module Developer {
} }
}; };
$scope.createOracleService = (items) =>{ $scope.createOracleService = (items) =>{
angular.forEach(items,(item)=>{ angular.forEach(items,(item)=>{
Kubernetes.createRC({ Kubernetes.createRC({
name: item._key, name: item._key,
labels: { labels: {
@ -229,7 +232,8 @@ module Developer {
systemName: item.systemName systemName: item.systemName
}, },
path: item.dataPath+"app/", path: item.dataPath+"app/",
isTarget: "false" isTarget: "false",
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);
}); });
@ -241,7 +245,9 @@ module Developer {
} }
function init($scope,$location,$routeParams){ function init($scope,$location,$routeParams){
$scope.model.updateModel(); //$scope.model.updateModel();
$scope.keyQuery = "";
$scope.model.updateParamOption("keyQuery", $scope.keyQuery);
if(ConfigsModel.cluster!=null) if(ConfigsModel.cluster!=null)
$scope.volumes = ConfigsModel.cluster; $scope.volumes = ConfigsModel.cluster;
@ -276,10 +282,10 @@ module Developer {
var subPath = path.split("/"); var subPath = path.split("/");
switch (subPath[subPath.length -1]) { switch (subPath[subPath.length -1]) {
case "financial": case "financial":
result = "财政" result = "财政";
break; break;
case "social-security": case "social-security":
result = "社保" result = "社保";
break; break;
default: default:
result = null; result = null;

@ -22,31 +22,32 @@
<a ng-show="row.entity.$podCounters.podsLink" title="pods status"> <a ng-show="row.entity.$podCounters.podsLink" title="pods status">
<span ng-show="row.entity.$podCounters.ready && (row.entity.$oracleStatus===2)" class="badge badge-success"> 启动</span> <span ng-show="row.entity.$podCounters.ready && (row.entity.$oracleStatus===2)" class="badge badge-success"> 启动</span>
<span ng-show="row.entity.$podCounters.ready && (row.entity.$oracleStatus===0)" class="badge badge-info"> 等待</span> <span ng-show="row.entity.$podCounters.ready && (row.entity.$oracleStatus===0)" class="badge badge-info"> 等待</span>
<span ng-show="row.entity.$podCounters.ready && (row.entity.$oracleStatus===1)" class="badge badge-warning "> 失败</span> <span ng-show="row.entity.$podCounters.ready && (row.entity.$oracleStatus===1)" class="badge badge-important "> 失败</span>
<span ng-show="row.entity.$podCounters.valid || row.entity.$podCounters.waiting" class="badge badge-info"> 等待</span> <span ng-show="row.entity.$podCounters.valid || row.entity.$podCounters.waiting" class="badge badge-info"> 等待</span>
<span ng-show="!(row.entity.$podCounters.waiting || row.entity.$podCounters.ready || row.entity.$podCounters.valid || row.entity.$podCounters.error)" class="badge"> 停止</span> <span ng-show="!(row.entity.$podCounters.waiting || row.entity.$podCounters.ready || row.entity.$podCounters.valid || row.entity.$podCounters.error)" class="badge"> 停止</span>
<span ng-show="row.entity.$podCounters.error" class="badge badge-warning"> 失败</span> <span ng-show="row.entity.$podCounters.error" class="badge badge-important"> 失败</span>
</a> </a>
</div> </div>
</script> </script>
<script type="text/ng-template" id="dataSummaryTemplate.html"> <script type="text/ng-template" id="dataSummaryTemplate.html">
<div class="ngCellText" ng-init="entity=row.entity"> <div class="ngCellText" ng-init="entity=row.entity">
<a ng-show="row.entity.$podCounters.podsLink" title="pods status"> <a ng-show="row.entity.$podCounters.podsLink" title="pods status">
<span ng-show="row.entity.$extractStatus === 0" class="badge badge-info" href=""> 未汇总</span> <span ng-show="row.entity.$extractStatus === 0" class="badge badge-info"> 待汇总</span>
<span ng-show="row.entity.$extractStatus === 1" class="badge badge-success" href=""> 正在汇总</span> <div ng-show="row.entity.$extractStatus === 1">
<span ng-show="row.entity.$extractStatus === 2" class="badge" href=""> 已完成</span> <span class="badge badge-success" > 汇总中</span>
<span ng-show="row.entity.$extractStatus === 3" class="badge badge-warning" href=""> 失败</span>
<div ng-show="row.entity.$extractStatus === 10">
<span class="badge badge-remind"> 汇总数据库</span>
<span ng-include="'oracleLogTemplate.html'"></span> <span ng-include="'oracleLogTemplate.html'"></span>
</div> </div>
<div ng-show="row.entity.$extractStatus === 2">
<span class="badge" > 已完成</span>
<span ng-include="'oracleLogTemplate.html'"></span>
</div>
</a> </a>
</div> </div>
</script> </script>
<script type="text/ng-template" id="labelTemplate.html"> <script type="text/ng-template" id="labelTemplate.html">
<div class="ngCellText" ng-init="entity=row.entity" ng-controller="Kubernetes.Labels"> <div class="ngCellText" ng-init="entity=row.entity" ng-controller="Kubernetes.Labels">
<p ng-show="data"><strong>Labels</strong></p> <p ng-show="data"><strong>Labels</strong></p>
<span ng-repeat="label in labels track by $index" class="pod-label badge" ng-class="labelClass(label.key)" ng-click="handleClick(entity, label.key, label)" title="{{label.key}}">{{label.title}}</span> <span ng-repeat="label in labels track by $index" class="pod-label badge" ng-class="labelClass(label.key)" ng-click="handleClick(entity, label.key, label)" title="{{label.key}}"><span class="glyphicon glyphicon-tag"/> {{label.title}}</span>
</div> </div>
</script> </script>
<script type="text/ng-template" id="eventSourceTemplate.html"> <script type="text/ng-template" id="eventSourceTemplate.html">
@ -55,10 +56,10 @@
<span ng-repeat="(key, value) in labels track by $index" class="pod-label badge" class="background-light-grey mouse-pointer" title="{{key}}" ng-click="$emit('labelFilterUpdate', key + '=' + value)">{{value}}</span> <span ng-repeat="(key, value) in labels track by $index" class="pod-label badge" class="background-light-grey mouse-pointer" title="{{key}}" ng-click="$emit('labelFilterUpdate', key + '=' + value)">{{value}}</span>
</div> </div>
</script> </script>
<script type="text/ng-template" id="dataLabelsTemplate.html" ng-controller="Kubernetes.DataLabels"> <script type="text/ng-template" id="dataLabelsTemplate.html">
<div class="ngCellText" ng-init="labels=row.entity.labels"> <div class="ngCellText" ng-init="labels=row.entity.labels" ng-controller="Kubernetes.DataLabels">
<p ng-show="data"><strong>Labels</strong></p> <p ng-show="data"><strong>Labels</strong></p>
<span ng-repeat="(key, value) in labels track by $index" class="pod-label badge" ng-class="labelClass(label.key)" ng-click="labelClick(entity, label.key, label.value)" title="{{label.key}}">{{value}}</span> <span ng-repeat="(key, value) in labels track by $index" class="pod-label badge" ng-class="labelClass(key)" ng-click="labelClick(entity, key, value)" title="{{key}}"><span class="glyphicon glyphicon-tag"/> {{value}}</span>
</div> </div>
</script> </script>
<script type="text/ng-template" id="hostTemplate.html"> <script type="text/ng-template" id="hostTemplate.html">
@ -141,7 +142,10 @@
</script> </script>
<script type="text/ng-template" id="connectParamTemplate.html"> <script type="text/ng-template" id="connectParamTemplate.html">
<div class="ngCellText" ng-init="entity=row.entity"> <div class="ngCellText" ng-init="entity=row.entity">
<p ng-show="row.entity.$pods.length"><strong>{{row.entity.$pods[0].$host}}:{{row.entity.$pods[0].spec.containers[0].ports[0].hostPort}}/orcl</strong></p> <div ng-show="row.entity.$pods.length && row.entity.$pods[0].$host && row.entity.$pods[0].spec.containers[0].ports[0].hostPort"><strong>{{row.entity.$pods[0].$host}}:{{row.entity.$pods[0].spec.containers[0].ports[0].hostPort}}/orcl</strong>
<button class="btn" zero-clipboard data-clipboard-text="{{row.entity.$pods[0].$host}}:{{row.entity.$pods[0].spec.containers[0].ports[0].hostPort}}/orcl" title="点击复制">
<i class="fa fa-copy"></i></button>
</div>
</div> </div>
</script> </script>
<script type="text/ng-template" id="statusTemplate.html"> <script type="text/ng-template" id="statusTemplate.html">
@ -215,7 +219,7 @@
<div hawtio-confirm-dialog="showDeleteOne.show" title="是否删除任务?" ok-button-text="确认" cancel-button-text="取消" on-cancel="showDeleteOne.onCancelled()" on-ok="showDeleteOne.onOk()"> <div hawtio-confirm-dialog="showDeleteOne.show" title="是否删除任务?" ok-button-text="确认" cancel-button-text="取消" on-cancel="showDeleteOne.onCancelled()" on-ok="showDeleteOne.onOk()">
<div class="dialog-body"> <div class="dialog-body">
<p> <p>
Are you sure you want to delete all the stuff? 是否删除:{{entity.name}}-{{entity.systemName}} 任务?
</p> </p>
</div> </div>
</div> </div>

@ -1550,15 +1550,13 @@ module Kubernetes {
} }
var labelColors = { var labelColors = {
'batch': 'k8s-badge-batch', 'region': 'k8s-badge-region',
'region': 'k8s-badge-region',
'type': 'k8s-badge-type',
'system': 'k8s-badge-system', 'system': 'k8s-badge-system',
'isTarget': 'k8s-badge-target' 'isTarget': 'k8s-badge-target',
}; };
export function containerLabelClass(labelType:string) { export function containerLabelClass(labelType:string) {
if (!(labelType in labelColors)) { if (!(labelType in labelColors)) {
return 'mouse-pointer'; return 'mouse-pointer';
} }

@ -154,8 +154,7 @@ module Kubernetes {
link: (scope:any, element, attr) => { link: (scope:any, element, attr) => {
addWindowActions(scope, element, TerminalService); addWindowActions(scope, element, TerminalService);
scope.atBottom = true; scope.atBottom = true;
scope.$watch('atBottom', (val) => { scope.$watch('atBottom', (val) => {
console.log("atBottom: ", val);
}); });
} }
}; };

@ -43,11 +43,7 @@ module Kubernetes {
{ field: '$pods', { field: '$pods',
displayName: '连接参数', displayName: '连接参数',
cellTemplate: $templateCache.get("connectParamTemplate.html") cellTemplate: $templateCache.get("connectParamTemplate.html")
}, },
{ field: '$pods[0].$eventCount',
displayName: '服务启动日志',
cellTemplate: $templateCache.get("eventSummaryTemplate.html")
},
{ field: '$podCounters', { field: '$podCounters',
displayName: '服务状态', displayName: '服务状态',
cellTemplate: $templateCache.get("podCountsAndLinkTemplate.html"), cellTemplate: $templateCache.get("podCountsAndLinkTemplate.html"),

@ -24,12 +24,9 @@ module Kubernetes {
} }
}); });
export var DataLabels = controller("DataLabels",['$scope','$location', ($scope, $location) =>{ export var DataLabels = controller("DataLabels",['$scope','$location', ($scope, $location) =>{
console.log($scope.labels); $scope.labelClick = (entity, key:string, value:string) => {
$scope.labelClick = (entity, key:string, value:string) => { $scope.$emit('dataLabelFilterUpdate', value, key)
// log.debug("handleClick, entity: ", entity, " key: ", labelType, " value: ", value);
console.log("cacacacac");
$scope.$emit('dataLabelFilterUpdate', value)
} }
$scope.labelClass = containerLabelClass; $scope.labelClass = containerLabelClass;
}]); }]);

@ -300,15 +300,18 @@ module Kubernetes {
}; };
}); });
function getLogs(rc, scope){ function getLogs(rc, scope){
console.log(scope);
var xhr= new XMLHttpRequest(); var xhr= new XMLHttpRequest();
xhr.onreadystatechange = () => { xhr.onreadystatechange = () => {
if(xhr.readyState == 4){ if(xhr.readyState == 4){
if (xhr.status == 200){ if (xhr.status == 200){
var obj=JSON.parse(xhr.responseText); if(xhr.responseText !="" && xhr.responseText !=null){
var text = obj.logContent.replace(/\\n/gmi, '\r\n'); var logObject = JSON.parse(xhr.responseText);
scope.logs = text; scope.logs = logObject[getName(rc)];
}else{
scope.logs = "当前没有可以查看的日志信息";
}
//return ({text: "aaaaaa"}); //return ({text: "aaaaaa"});
}else{ }else{
@ -316,7 +319,7 @@ module Kubernetes {
} }
} }
} }
xhr.open("POST", "/oracleExtractLog?rcName=" + getName(rc),false); xhr.open("POST", "/java/console/api/oracle/extract/log?rcName=" + getName(rc),false);
xhr.send(null); xhr.send(null);
} }
} }

@ -53,7 +53,7 @@ module Kubernetes {
var labels = { var labels = {
"style": "oracle", "style": "oracle",
"status": "0", "status": "0",
"isExtract": "0", "isExtract": Obj.isExtract+"" || "0",
"isTarget": Obj.isTarget "isTarget": Obj.isTarget
}; };
for(var item in Obj.labels) for(var item in Obj.labels)

Loading…
Cancel
Save