功能调整和完善--9.20

This commit is contained in:
wu ming 2016-09-20 19:00:09 +08:00
parent e76717783e
commit 25d67ad44e
16 changed files with 136 additions and 138 deletions

View File

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

File diff suppressed because one or more lines are too long

View File

@ -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 li{ float:left;}
.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;}
.table{ margin-bottom: 10px;}
.sj_nav_taps{ border-bottom: none;}

View File

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

View File

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

View File

@ -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>
</ul>
<div class="fr sj_searchbox">
<input type="text" class="sj_search_input" />
<a href="#" class="sj_search_btn"></a>
<input type="text" class="sj_search_input" ng-model="keyQuery" placeholder="请选择或输入关键字,多关键字请用空格隔开"/>
<a href="#" class="sj_search_btn" ng-click="search()"></a>
</div>
</div>
<div ng-hide="model.data.length" class="align-center">

View File

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

View File

@ -79,15 +79,17 @@ module Developer {
]
};
$scope.$on("dataLabelFilterUpdate", ($event, text, key) => {
$scope.keyQuery += " " + text;
})
$scope.selectBatchItem = (item)=> {
$scope.navbarItems.forEach((nav) =>{
nav.class="";
});
item.class="active";
if(item.label === "全部")
$scope.model.updateParamOption("dataBatch", null);
else
$scope.model.updateParamOption("dataBatch", item.alias);
$scope.model.updateParamOption("keyQuery", $scope.keyQuery);
$scope.model.updateParamOption("dataBatch", item.alias);
}
$scope.isEmptyOrFirst = () => {
@ -130,17 +132,21 @@ module Developer {
}
$scope.$watch('options', (newValue, oldValue) => {
if(newValue && newValue !== oldValue){
if(newValue){
if(newValue.currentTableSize !== oldValue.currentTableSize)
$scope.options.priorTableSize = oldValue.currentTableSize;
else
$scope.options.priorTableSize = newValue.currentTableSize;
DataModel.updateModel();
}
}, true);
$scope.search = () => {
$scope.model.updateParamOption("keyQuery", $scope.keyQuery);
}
$scope.deletePrompt = (selected) => {
if (angular.isString(selected)) {
selected = [{
@ -155,7 +161,6 @@ module Developer {
if (result) {
angular.forEach(selected, (select) => {
idColl.push(select.id);
console.log(select.id);
});
$http({
method: "POST",
@ -186,8 +191,6 @@ module Developer {
dialog: new UI.Dialog(),
onOk: () => {
var migrationClick = $scope.migrationClick;
console.log($scope.tableConfig.selectedItems);
console.log($scope.selectNode);
Configs.oracleInfoOperate($http, "/java/console/api/volume", Configs.OperateType.MOVE,
{
"name": migrationClick.selectedItem.name,
@ -229,7 +232,8 @@ module Developer {
systemName: item.systemName
},
path: item.dataPath+"app/",
isTarget: "false"
isTarget: "false",
isExtract: item.extractStatus
}, (rc) =>{
Kubernetes.connectOracle($http, $timeout, "/java/console/api/connectOracle", "create", rc, 0);
});
@ -241,7 +245,9 @@ module Developer {
}
function init($scope,$location,$routeParams){
$scope.model.updateModel();
//$scope.model.updateModel();
$scope.keyQuery = "";
$scope.model.updateParamOption("keyQuery", $scope.keyQuery);
if(ConfigsModel.cluster!=null)
$scope.volumes = ConfigsModel.cluster;
@ -276,10 +282,10 @@ module Developer {
var subPath = path.split("/");
switch (subPath[subPath.length -1]) {
case "financial":
result = "财政"
result = "财政";
break;
case "social-security":
result = "社保"
result = "社保";
break;
default:
result = null;

View File

@ -22,22 +22,23 @@
<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===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.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>
</div>
</script>
<script type="text/ng-template" id="dataSummaryTemplate.html">
<div class="ngCellText" ng-init="entity=row.entity">
<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 === 1" class="badge badge-success" href=""> 正在汇总</span>
<span ng-show="row.entity.$extractStatus === 2" class="badge" href=""> 已完成</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-show="row.entity.$extractStatus === 0" class="badge badge-info"> 待汇总</span>
<div ng-show="row.entity.$extractStatus === 1">
<span class="badge badge-success" > 汇总中</span>
<span ng-include="'oracleLogTemplate.html'"></span>
</div>
<div ng-show="row.entity.$extractStatus === 2">
<span class="badge" > 已完成</span>
<span ng-include="'oracleLogTemplate.html'"></span>
</div>
</a>
@ -46,7 +47,7 @@
<script type="text/ng-template" id="labelTemplate.html">
<div class="ngCellText" ng-init="entity=row.entity" ng-controller="Kubernetes.Labels">
<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>
</script>
<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>
</div>
</script>
<script type="text/ng-template" id="dataLabelsTemplate.html" ng-controller="Kubernetes.DataLabels">
<div class="ngCellText" ng-init="labels=row.entity.labels">
<script type="text/ng-template" id="dataLabelsTemplate.html">
<div class="ngCellText" ng-init="labels=row.entity.labels" ng-controller="Kubernetes.DataLabels">
<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>
</script>
<script type="text/ng-template" id="hostTemplate.html">
@ -141,7 +142,10 @@
</script>
<script type="text/ng-template" id="connectParamTemplate.html">
<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>
</script>
<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 class="dialog-body">
<p>
Are you sure you want to delete all the stuff?
是否删除:{{entity.name}}-{{entity.systemName}} 任务?
</p>
</div>
</div>

View File

@ -1551,11 +1551,9 @@ module Kubernetes {
var labelColors = {
'batch': 'k8s-badge-batch',
'region': 'k8s-badge-region',
'type': 'k8s-badge-type',
'system': 'k8s-badge-system',
'isTarget': 'k8s-badge-target'
'isTarget': 'k8s-badge-target',
};
export function containerLabelClass(labelType:string) {

View File

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

View File

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

View File

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

View File

@ -301,14 +301,17 @@ module Kubernetes {
});
function getLogs(rc, scope){
console.log(scope);
var xhr= new XMLHttpRequest();
xhr.onreadystatechange = () => {
if(xhr.readyState == 4){
if (xhr.status == 200){
var obj=JSON.parse(xhr.responseText);
var text = obj.logContent.replace(/\\n/gmi, '\r\n');
scope.logs = text;
if(xhr.responseText !="" && xhr.responseText !=null){
var logObject = JSON.parse(xhr.responseText);
scope.logs = logObject[getName(rc)];
}else{
scope.logs = "当前没有可以查看的日志信息";
}
//return ({text: "aaaaaa"});
}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);
}
}

View File

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