修改连接oracle服务

This commit is contained in:
wu ming 2016-09-14 16:31:58 +08:00
commit 11d9143db2
16 changed files with 214 additions and 140 deletions

View File

@ -206,7 +206,7 @@ declare module Kubernetes {
function currentUserName(): any;
function createNamespace(ns: any, client?: any): void;
function createRC(obj: any, onCompleteFn?: any): void;
function connectOracle($http: any, $timeout: any, url: any, operation: any, rcName: 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 getExtractStatus(labels: any): number;
function getOracleName(name: string): string;

File diff suppressed because one or more lines are too long

View File

@ -98,7 +98,7 @@ treecontrol.tree-classic li.tree-leaf i.tree-leaf-head { padding: 1px 15px; padd
treecontrol.tree-classic li .tree-selected{background-color: #e5f0fb; color: #333; }
treecontrol li{ line-height: 30px; padding-left: 25px;}
treecontrol li:hover{}
.sj_modal_body{ height: 210px; overflow: auto;padding-left: 0; padding-right: 0;}
.sj_modal_body{ height: 210px; overflow: auto;}
.modal{ width: 500px;}
.sj_modal-header{ height:42px; line-height: 42px; border-bottom: 1px solid #ddd; }
.sj_modal-header h4{ margin-top: 5px; font-weight: bold;}
@ -128,4 +128,13 @@ treecontrol li:hover{}
.alert{ padding:10px 15px; margin-bottom:0;}
.sj_control-label{ padding:0; line-height:30px; }
.modal-footer{ margin-top: 0;}
.badge-info{ background-color: #3498db;}
.badge-info{ background-color: #3498db;}
.btn:focus {outline: none;outline-offset: 0; }
td > .progress:first-child:last-child{ margin-top:9px;}
.progress-bar-success{ background-color: #5cb85c;}
.progress-bar-danger { background-color: #d9534f;
.sj_progress_bar{ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); position: relative; }
.sj_progress_font{ position: absolute; right: 20px; top:0; }
.sj_table_border{ border: 1px solid #ccc; }
.sj_content_table .table-header{background-image:-webkit-linear-gradient(top, #f7f7f7,#dfdfdf);background-image:linear-gradient(top, #f7f7f7,#dfdfdf); border-bottom:1px solid #a6a6a6;}
.sj_c_green{ color: #58b358;}

View File

@ -7,26 +7,26 @@
</div>
<div class="container-content sj_content">
<div class="row">
<div class="col-md-1">
<button class="btn pull-right sj_btn_blue" ng-click="create()">
<span class="glyphicon glyphicon-plus"></span> 添加
<div class="mb10">
<button class="btn sj_btn_green" style="color:#fff;" ng-click="create()">
<span class="glyphicon glyphicon-plus "></span> 添加
</button>
</div>
</div>
<div class="row" ng-repeat="volume in volumes">
<table class="table table-hover">
<table class="table table-bordered sj_content_table " >
<thead class="no-scope">
<tr>
<th class="sj_c_green simple-table-checkbox" style="padding:0 10px;color: #58b358;">已启用</th>
<th class="no-fade table-header">
<span class="">{{volume.name}}</span>
</th>
<th class="no-fade table-header">
<th class="no-fade table-header" colspan="2">
<span class="">云路径:{{volume.path}}</span>
</th>
<th class="no-fade table-header">
<span class="">状态</span>
</th>
<th class="no-fade table-header">
<span class="">已用{{volume.usedSize}}/共{{allSize}}</span>
<span class="">已用&nbsp;{{volume.usedSize}}&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;{{allSize}}</span>
</th>
<th class="no-fade table-header">
<button class="btn sj_btn" ng-click="editRow(volume)">
@ -34,7 +34,12 @@
</button>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in volume.brick track by $index" class="row.class">
<td>
<span class="glyphicon glyphicon-ok sj_c_green" style="padding:0 10px; color: #58b358;"></span>
</td>
<td >
<span class="">服务器{{$index+1}}</span>
</td>
@ -45,9 +50,11 @@
<span class="">存储路径:{{row.path}}</span>
</td>
<td >
<span class="">已用{{row.usedSize}}/共{{row.availableSize}}</span>
<span class="">已用&nbsp;{{row.usedSize}}&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;{{row.availableSize}}</span>
</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -98,7 +98,14 @@ module Configs{
$http({
method: "POST",
url: RESTfulUrl,
params: resource
params: resource,
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
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))

View File

@ -81,7 +81,7 @@ module Configs{
$scope.onSubmit = () => {
$scope.edit = false;
$scope.add = false;
oracleInfoOperate($http, "/java/console/api/oracle", OperateType.UPDATE, createOracleInfo($scope.tableForm, $scope.rowId), (result, status) => {
oracleInfoOperate($http, "/java/console/api/oracle", OperateType.UPDATE, createOracleInfo($scope.tableForm, $scope.rowId), (result, status) => {
if(status===200){
$scope.model.updateOracleParam();
}else{

View File

@ -10,7 +10,7 @@
<p class="alert alert-info">当前没有可以查看的任务列表!</p>
</div>
<div class="row mb10" ng-show="model.data.length">
<table class="table table-bordered table-striped sj_content_table" hawtio-simple-table="tableConfig" />
<table class="table table-bordered table-striped sj_content_table" hawtio-simple-table="tableConfig" />
</div>
</div>
</div>

View File

@ -1,15 +1,14 @@
<div ng-controller="Developer.WorkspacesController" hawtio-card-bg >
<div ng-controller="Developer.WorkspacesController" hawtio-card-bg>
<div hawtio-breadcrumbs></div>
<div hawtio-tabs></div>
<div class="container-content ">
<div class="container-fluid sj_fluid">
<div class="row nav-content mb10 clear " >
<div class="row nav-content mb10 clear ">
<ul class="nav nav-tabs sj_nav_taps fl" ng-show="navbarItems.length">
<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"/>
<input type="text" class="sj_search_input" />
<a href="#" class="sj_search_btn"></a>
</div>
</div>
@ -22,33 +21,28 @@
<div class=" fl">
<input type="checkbox" class="fl mr5 " style="margin-top: 8px;" />
<label class="fl mr5 " style="margin-top: 5px; font-style:nomal;">全选</label>
<button ng-disabled="!id && tableConfig.selectedItems.length == 0"
class="btn btn-success pull-right sj_btn_grey"
ng-click="deletePrompt(id || tableConfig.selectedItems)">
<i class="glyphicon glyphicon-trash"></i> 删除数据
<span class="pull-right">&nbsp;</span>
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="deletePrompt(id || tableConfig.selectedItems)">
<i class="glyphicon glyphicon-trash"></i> 删除
</button>
<span class="pull-right">&nbsp;</span>
<button ng-disabled="!id && tableConfig.selectedItems.length == 0"
class="btn btn-success pull-right sj_btn_grey"
ng-click="migrationClick.open(id || tableConfig.selectedItems)">
<i class="glyphicon glyphicon-export"></i> 迁移数据
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="migrationClick.open(id || tableConfig.selectedItems)">
<i class="glyphicon glyphicon-export"></i> 迁移
</button>
<span class="pull-right">&nbsp;</span>
<button ng-disabled="!id && tableConfig.selectedItems.length == 0"
class="btn btn-success pull-right sj_btn_grey"
ng-click="createOracleService(id || tableConfig.selectedItems)">
<i class="glyphicon glyphicon-play-circle"></i> 启动服务
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="createOracleService(id || tableConfig.selectedItems)">
<i class="glyphicon glyphicon-play-circle"></i> 启动
</button>
</div>
<ul class="fr sj_table_bottom">
<li class="mr5 " >当前显示1~7行共7行。</li>
<li class="mr5 ">当前显示1~7行共7行。</li>
<li class="mr5 ">每页显示
<select ng-options="value for value in pageSizeChoses" ng-change="selectAction()" ng-model="options.currentTableSize"></select>
</li>
<li class="mr5 ">当前页码</li>
<li>
<div class="hawtio-pager clearfix">
<label >{{options.currentPageNum}} / {{options.getPageSizeNum()}}</label>
<label>{{options.currentPageNum}} / {{options.getPageSizeNum()}}</label>
<div class=btn-group>
<button class="btn sj_btn_grey" ng-disabled="isEmptyOrFirst()" ng-click="first()"><i class="fa fa-fast-backward"></i></button>
<button class="btn sj_btn_grey" ng-disabled="isEmptyOrFirst()" ng-click="previous()"><i class="fa fa-step-backward"></i></button>
@ -62,10 +56,10 @@
</div>
</div>
</div>
<div modal="migrationClick.dialog.show " >
<div modal="migrationClick.dialog.show ">
<form name="selectFolder " class=" " ng-submit="migrationClick.onOk() ">
<div class="modal-header sj_modal-header" >
<h4 >数据迁移</h4></div>
<div class="modal-header sj_modal-header">
<h4>数据迁移</h4></div>
<div class="modal-body sj_modal_body">
<div class="row sj_model_row">
<label class="col-sm-3 control-label sj_contro_label" for="selectedItem ">
@ -73,15 +67,15 @@
</label>
<select ng-model="migrationClick.selectedItem " class="col-sm-3 sj_modal_select" title="name of the new namespace " id="selectedItem " ng-options="x.name for x in volumes " />
</div>
<div class="form-group">
<div class="col-sm-12 alert alert-warning" ng-show="!volumes || volumes.length == 0">
<span class="help-block" >
<div class="col-sm-12 alert alert-warning" ng-show="!volumes || volumes.length == 0">
<span class="help-block">
当前没有可以迁移的集群,请在数据集群配置页面进行配置!
</span>
</div>
</div>
<div ng-hide= "!volumes || volumes.length == 0">
<div ng-hide="!volumes || volumes.length == 0">
<treecontrol class="tree-classic" tree-model="migrationClick.selectedItem.folder" options="treeOptions" on-selection="showSelected(node)" selected-node="selectNode">
{{node.name}}
</treecontrol>

View File

@ -180,7 +180,7 @@ module Developer{
//创建数据模型服务
_module.factory("DataModel", ['$rootScope', '$http', '$interval', '$location', '$resource', ($rootScope, $http, $interval, $location, $resource) => {
var $scope = new DataModelService();
$scope.startIntervalTask($interval, $http);
$scope.startIntervalTask($interval, $http);
return $scope;
}]);
}

View File

@ -581,7 +581,7 @@ module Developer {
class: "fa fa-clone",
title: "View the Replicas for this project"
},
{
/*{
href: UrlHelpers.join(namespacesLink, ns, "events"),
label: "日志信息",
class: "fa fa-newspaper-o",
@ -593,7 +593,7 @@ module Developer {
label: "集群节点",
class: "fa fa-server",
title: "View the nodes for this project"
}
} */
]);
}

View File

@ -40,7 +40,15 @@ module Developer {
field: "labels",
displayName: '数据标签',
cellTemplate: $templateCache.get("dataLabelsTemplate.html")
},
},
{
field: "from",
displayName: '源集群',
},
{
field: "to",
displayName: '目的集群',
},
{
field: "status",
displayName: '迁移状态',

View File

@ -62,7 +62,11 @@ module Developer {
field: "labels",
displayName: '数据标签',
cellTemplate: $templateCache.get("dataLabelsTemplate.html")
},
},
{
field: "year",
displayName: '年度',
},
{
field: "collectingTime",
displayName: '采集时间'
@ -136,22 +140,43 @@ module Developer {
}, true);
$scope.deletePrompt = (items) =>{
var idColl = [];
angular.forEach(items,(item) => {
idColl.push(item.id);
console.log(item.id);
});
$http({
method: "POST",
url: "/java/console/api/delete/data",
params: {"data": idColl}
}).success(function(data, status, headers, config) {
//成功之后做一些事情
DataModel.updateModel();
}).error(function(data, status, headers, config) {
});
$scope.deletePrompt = (selected) => {
if (angular.isString(selected)) {
selected = [{
id: selected
}];
}
UI.multiItemConfirmActionDialog(<UI.MultiItemConfirmActionOptions>{
collection: selected,
index: 'id',
onClose: (result:boolean) => {
var idColl = [];
if (result) {
angular.forEach(selected, (select) => {
idColl.push(select.id);
console.log(select.id);
});
$http({
method: "POST",
url: "/java/console/api/delete/data",
params: {"data": idColl}
}).success(function(data, status, headers, config) {
//成功之后做一些事情
DataModel.updateModel();
}).error(function(data, status, headers, config) {
});
}
},
title: '是否需要删除采集数据?',
action: '以下采集数据文件将会被删除:',
okText: '删除',
okClass: 'btn-danger sj_btn_cir',
custom: "该删除操作将会彻底删除数据文件,是否删除,请确认!",
customClass: "alert alert-warning sj_alert-warning",
cancelText: "取消",
cancelClass: 'sj_btn_grey'
}).open();
}
$scope.migrationClick = {
@ -177,9 +202,7 @@ module Developer {
open: (selected) =>{
var migrationClick = $scope.migrationClick;
if($scope.volumes && $scope.volumes instanceof Array && $scope.volumes.length >0)
migrationClick.selectedItem = $scope.volumes[0];
console.log(migrationClick.selectedItem.folder.childNodes);
migrationClick.selectedItem = $scope.volumes[0];
migrationClick.dialog.open();
},
close: () => {
@ -204,10 +227,11 @@ module Developer {
},
path: item.dataPath+"app/",
isTarget: "false"
}, (rc) =>{
Kubernetes.connectOracle($http, $timeout, "/java/console/api/connectOracle", "create", Kubernetes.getName(rc), 0);
}, (rc) =>{
Kubernetes.connectOracle($http, $timeout, "/java/console/api/connectOracle", "create", rc, 0);
});
});
});
$timeout(() => {
$location.path('/kubernetes/namespace/default/replicationControllers');
}, 200);

View File

@ -217,11 +217,11 @@
<!-- 迁移进度条 -->
<script type="text/ng-template" id="taskProcess.html">
<div class="ngCellText progress" ng-init="entity=row.entity">
<div ng-show="entity.status!==3" class="progress-bar progress-bar-success active" role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
<span class="sr-only">{{entity.process}}</span>
<div ng-show="entity.status!==3" class="progress-bar progress-bar-success active sj_progress_bar " role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
<span class="sj_progress_font">{{entity.process}}%</span>
</div>
<div ng-show="entity.status ===3" class="progress-bar progress-bar-danger active" role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
<span class="sr-only">{{entity.process}}</span>
<div ng-show="entity.status ===3" class="progress-bar progress-bar-danger active sj_progress_bar" role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
<span class="sj_progress_font">{{entity.process}}%</span>
</div>
</div>
</script>

View File

@ -81,8 +81,7 @@
</div>
</div>
</div>
</div>
<ng-include src="'resizeDialog.html'"/>
</div>
<div modal="extractClick.dialog.show">
<form name="selectOracle" class="" ng-submit="extractClick.onOk()">

View File

@ -1749,18 +1749,18 @@ module Kubernetes {
});
}
export function connectOracle($http, $timeout, url, operation, rcName, delayTime){
$timeout(() => {
$http({
url: url,
method:'POST',
params:{oracleName: rcName, operation: operation}
}).success(function(data,header,config,status){
console.log("success");
}).error(function(data,header,config,status){
//log.warn("Failed to connect " + connectParam + " " + data + " " + status);
});
}, delayTime);
export function connectOracle($http, $timeout, url, operation, replicas, delayTime){
$timeout(() => {
$http({
url: url,
method:'POST',
params:{oracleName: getName(replicas), operation: operation},
}).success(function(data,header,config,status){
console.log("success");
}).error(function(data,header,config,status){
//log.warn("Failed to connect " + connectParam + " " + data + " " + status);
});
}, delayTime);
}
export function getOracleStatus(labels){

View File

@ -72,7 +72,7 @@ module Kubernetes {
Kubernetes.initShared($scope, $location, $http, $timeout, $routeParams, KubernetesModel, KubernetesState, KubernetesApiURL);
$scope.deletePrompt = (selected) => {
$scope.deletePrompt = (selected) => {
if (angular.isString(selected)) {
selected = [{
id: selected
@ -89,8 +89,8 @@ module Kubernetes {
KubernetesReplicationControllers.delete({
id: getName(next)
}, undefined, () => {
if(next.metadata.labels.style === "oracle"){
Kubernetes.connectOracle($http, $timeout, "/java/console/api/cancelOracleConection", "delete", getName(next), 0);
if(next.metadata.labels.style === "oracle"){
Kubernetes.connectOracle($http, $timeout, "/java/console/api/cancelOracleConection", "delete", next, 0);
}
deleteSelected(selected, selected.shift());
}, (error) => {
@ -100,7 +100,7 @@ module Kubernetes {
});
}
}
deleteSelected(selected, selected.shift());
deleteSelected(selected, selected.shift());
}
},
title: '是否需要删除oracle服务',
@ -127,7 +127,7 @@ module Kubernetes {
});
}
$scope.stopPrompt = (selected) =>{
$scope.stopPrompt = (selected) =>{
if (angular.isString(selected)) {
selected = [{
id: selected
@ -142,14 +142,14 @@ module Kubernetes {
function stopSelected(selected:Array<KubePod>, next:KubePod) {
if (next) {
Kubernetes.resizeController($http, KubernetesApiURL, next, 0, () => {
if(next.metadata.labels.style === "oracle"){
Kubernetes.connectOracle($http, $timeout, "/java/console/api/cancelOracleConection", "stop", getName(next), 0);
if(next.metadata.labels.style === "oracle"){
Kubernetes.connectOracle($http, $timeout, "/java/console/api/cancelOracleConection", "stop", next, 0);
}
stopSelected(selected, selected.shift());
});
}
}
stopSelected(selected, selected.shift());
stopSelected(selected, selected.shift());
}
},
title: '是否需要停止oracle服务',
@ -163,18 +163,18 @@ module Kubernetes {
}).open();
};
$scope.reStartPrompt = (selected) => {
$scope.reStartPrompt = (selected) => {
function startSelected(selected:Array<KubePod>, next:KubePod){
if(next){
if(next.$replicas === 0)
Kubernetes.resizeController($http, KubernetesApiURL, next, 1, () => {
console.log("restart " + next.metadata.name);
Kubernetes.connectOracle($http, $timeout, "/java/console/api/connectOracle", "reStart", getName(next), 0);
startSelected(selected, selected.shift());
Kubernetes.connectOracle($http, $timeout, "/java/console/api/connectOracle", "reStart", next, 200);
startSelected(selected, selected.shift());
});
}
}
startSelected(selected, selected.shift());
};
$scope.extractClick = {