Web_Manager_Develope
Linda 8 years ago
commit 50163a76ac

@ -1,6 +1,7 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="configPlugin.d.ts" />
/// <reference path="../../developer/ts/developerNavigation.d.ts" />
/// <reference path="../../developer/ts/dataManagerHelper.d.ts" />
declare module Configs {
class OperateType {
static DELETE: string;

@ -2,6 +2,7 @@
/// <reference path="developerPlugin.d.ts" />
/// <reference path="dataManagerModel.d.ts" />
/// <reference path="dataManagerHelper.d.ts" />
/// <reference path="../../configs/ts/ConfigsHelper.d.ts" />
declare module Developer {
var KubeTaskController: ng.IModule;
}

@ -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;

Binary file not shown.

6
defs.d.ts vendored

@ -1,14 +1,14 @@
/// <reference path="d.ts/includes.d.ts"/>
/// <reference path="d.ts/configs/ts/configPlugin.d.ts"/>
/// <reference path="d.ts/developer/ts/developerNavigation.d.ts"/>
/// <reference path="d.ts/developer/ts/developerHelpers.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerHelper.d.ts"/>
/// <reference path="d.ts/configs/ts/ConfigsHelper.d.ts"/>
/// <reference path="d.ts/configs/ts/configsDataService.d.ts"/>
/// <reference path="d.ts/configs/ts/configsUtils.d.ts"/>
/// <reference path="d.ts/configs/ts/glusterfsSetting.d.ts"/>
/// <reference path="d.ts/configs/ts/kubeClusterSetting.d.ts"/>
/// <reference path="d.ts/configs/ts/shareController.d.ts"/>
/// <reference path="d.ts/developer/ts/developerHelpers.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerHelper.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesInterfaces.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/utilHelpers.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/readPlacedivision.d.ts"/>
@ -34,6 +34,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"/>
@ -76,4 +77,3 @@
/// <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"/>

@ -1,6 +1,7 @@
/// <reference path="../../includes.ts"/>
/// <reference path="configPlugin.ts"/>
/// <reference path="../../developer/ts/developerNavigation.ts"/>
/// <reference path="../../developer/ts/dataManagerHelper.ts"/>
module Configs{
export class OperateType{
public static get DELETE():string {return "delete"}
@ -57,8 +58,7 @@ module Configs{
}
export function shareInit($scope, $location, $routeParams){
$scope.subTabConfig = createConfigBreadcrumbs($scope, $location, $routeParams);
$scope.model.updateAllData();
$scope. subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams);
}
export function createNewObejct(array:Array<any>, obj){
@ -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))

@ -2,12 +2,12 @@
/// <reference path="configPlugin.ts"/>
/// <reference path="configsHelper.ts"/>
/// <reference path="configsUtils.ts"/>
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, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel) => {
$scope.model= ConfigsModel;
$scope.tableConfig={
data: 'model.oracleParam',
selectedItems: [],
@ -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{

@ -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=" 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=" 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=" 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,17 +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>

@ -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;
}]);
}

@ -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"
}
} */
]);
}

@ -2,8 +2,9 @@
/// <reference path="developerPlugin.ts"/>
/// <reference path="dataManagerModel.ts"/>
/// <reference path="dataManagerHelper.ts"/>
/// <reference path="../../configs/ts/ConfigsHelper.ts"/>
module Developer {
export var KubeTaskController = controller("KubeTaskController", ["$scope", "$location", "$routeParams", "DataModel", "$templateCache", ($scope, $location, $routeParams, DataModel, $templateCache) => {
export var KubeTaskController = controller("KubeTaskController", ["$scope", "$http", "$location", "$routeParams", "DataModel", "$templateCache", ($scope, $http, $location, $routeParams, DataModel, $templateCache) => {
$scope.model = DataModel;
$scope.subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams);
$scope.model.data = [{_key: 2, name: "南京市-玄武区", labels:{system: 34, batch: 2}, status: 1, process:75},
@ -39,7 +40,15 @@ module Developer {
field: "labels",
displayName: '数据标签',
cellTemplate: $templateCache.get("dataLabelsTemplate.html")
},
},
{
field: "from",
displayName: '源集群',
},
{
field: "to",
displayName: '目的集群',
},
{
field: "status",
displayName: '迁移状态',
@ -59,7 +68,14 @@ module Developer {
$scope.$on("deleteRow", (event, data) =>{
console.log("删除任务");
if(data.status === 1)
console.log("无法删除");
else{
Configs.oracleInfoOperate($http, "/java/console/api/task", Configs.OperateType.DELETE, data, (data, status) =>{
if(status === 200)
console.log("删除成功");
});
}
});
}]);
}

@ -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);

@ -210,20 +210,18 @@
<script type="text/ng-template" id="taskEdit.html">
<div class="ngCellText" ng-init="entity=row.entity" ng-controller="Kubernetes.TaskEdit">
<button class="btn sj_btn" ng-click="deleteRow(entity)">
<span class="glyphicon glyphicon-pencil"></span>&nbsp;&nbsp;删除
<span class="glyphicon glyphicon-trash"></span>&nbsp;&nbsp;删除
</button>
</div>
</script>
<!-- 迁移进度条 -->
<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 sj_progress_bar " role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
<span class="sr-only">{{entity.process}}</span>
<span class="sj_progress_font">20%</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 sj_progress_bar" role="progressbar" aria-valuenow="{{entity.process}}" aria-valuemin="0" aria-valuemax="100" style="width: {{entity.process}}%">
<span class="sr-only">{{entity.process}}</span>
<span class="sj_progress_font">20%</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>

@ -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()">

@ -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){

@ -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 = {

Loading…
Cancel
Save