添加gfs配置页面

This commit is contained in:
wu ming 2016-09-10 21:06:48 +08:00
commit ce4b567081
27 changed files with 1287 additions and 944 deletions

View File

@ -2,6 +2,16 @@
/// <reference path="configPlugin.d.ts" />
/// <reference path="../../developer/ts/developerNavigation.d.ts" />
declare module Configs {
class OperateType {
static DELETE: string;
static UPDATE: string;
static PUT: string;
static MOVE: string;
}
function createOracleInfo(array: Array<any>, id: number): {
"id": number;
};
function shareInit($scope: any, $location: any, $routeParams: any): void;
function createNewObejct(array: Array<any>, obj: any): any[];
function oracleInfoOperate($http: any, url: string, operate: string, resource: any, fn?: (data, status) => void): void;
}

View File

@ -24,7 +24,9 @@ declare module Configs {
cluster: Array<volume>;
oracleParam: Array<oracleParam>;
constructor();
updateVolumeData(): any[];
updateAllData(): void;
updateVolumeData(): void;
updateOracleParam(): void;
getFolderByVolumeName(name: string): any[];
}
}

View File

@ -1,6 +1,8 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="configPlugin.d.ts" />
/// <reference path="configsHelper.d.ts" />
/// <reference path="configsUtils.d.ts" />
/// <reference path="configsDataService.d.ts" />
declare module Configs {
var GfsController: ng.IModule;
}

View File

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

View File

@ -1,5 +1,7 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="kubernetesInterfaces.d.ts" />
/// <reference path="utilHelpers.d.ts" />
/// <reference path="readPlacedivision.d.ts" />
declare module Kubernetes {
var context: string;
var hash: string;

View File

@ -1,6 +1,7 @@
/// <reference path="../../includes.d.ts" />
/// <reference path="kubernetesHelpers.d.ts" />
/// <reference path="kubernetesPlugin.d.ts" />
/// <reference path="kubernetesModel.d.ts" />
declare module Kubernetes {
var ReplicationControllers: ng.IModule;
}

5
defs.d.ts vendored
View File

@ -4,11 +4,14 @@
/// <reference path="d.ts/developer/ts/developerNavigation.d.ts"/>
/// <reference path="d.ts/configs/ts/configsHelper.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/dataManagerHelper.d.ts"/>
/// <reference path="d.ts/developer/ts/developerHelpers.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"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesHelpers.d.ts"/>
/// <reference path="d.ts/developer/ts/developerPlugin.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerModel.d.ts"/>
@ -43,7 +46,6 @@
/// <reference path="d.ts/kubernetes/ts/deploymentConfigs.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/events.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/host.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/utilHelpers.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/hosts.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/imageRepositories.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/kubernetesNavigation.d.ts"/>
@ -60,7 +62,6 @@
/// <reference path="d.ts/kubernetes/ts/term.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/podLogs.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/pods.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/readPlacedivision.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/replicationController.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/replicationControllerEdit.d.ts"/>
/// <reference path="d.ts/kubernetes/ts/replicationControllers.d.ts"/>

File diff suppressed because one or more lines are too long

View File

@ -133,12 +133,12 @@
<nav class="navbar navbar-fixed-top navbar-pf sj_header " role="navigation">
<a href="/" class="log fl sj_logo"><img src="new/images/logo.png" class="log-img"></a>
<ul class="nav navbar-nav navbar-primary sj_topnav " hawtio-main-nav></ul>
<ul class="nav navbar-nav navbar-utility">
<ul class="nav navbar-nav navbar-utility sj_setting">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="glyphicon glyphicon-cog"></span> 配置<b class="caret"></b>
</a>
<div class="dropdown-menu" hawtio-extension name="config-setting">
<div class="dropdown-menu sj_drop_menu" hawtio-extension name="config-setting">
</div>
</li>
</ul>

View File

@ -34,7 +34,7 @@ a:hover.sj_btn_grey{ background-image:-webkit-linear-gradient(top, #eeeeee,#d3d3
.sj_topnav li a:hover,.sj_topnav li a.sj_topnav_active{ background-image:-webkit-linear-gradient(top, #424242,#323232);background-image:linear-gradient(top,#424242,#323232); }
/* sj_content */
.sj_content{ margin-top: 56px;}
.sj_leftnav{ width:170px; min-height:800px; max-height:985px; background:#1d1d1d; position:absolute; left:0; top:0px;}
.sj_leftnav{ width:170px; min-height:800px; max-height:985px; background:#1d1d1d; }
.sj_leftnav_i{ background:#717171; padding:0 5px;;-webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px; margin-left:80px; }
.sj_menu {margin-top:12px;background:#1d1d1d; }
.sj_menu_nav { background-image:-webkit-linear-gradient(top, #404040,#353535);background-image:linear-gradient(top,#404040,#353535); color: #fff; height:40px; line-height:38px; padding-left:15px; border: none; border-top: 2px solid #4d4d4d; border-bottom: 2px solid #1d1d1d;}
@ -103,4 +103,19 @@ treecontrol li:hover{}
.sj_modal_select{ width: 350px; height: 30px; line-height: 30px; border: 1px solid #ccc; }
.sj_contro_label{ height: 30px; line-height: 30px;}
.sj_contro_label{ padding-right:10px; }
.sj_fluid{ padding-right: 0px; padding-left: 0px;}
.sj_fluid{ padding-right: 0px; padding-left: 0px; margin-top:0px;}
.sj_setting {height:70px; }
.sj_setting li a { background-image:none; border: none;}
.navbar-pf .sj_setting > li > a{ height:70px; line-height:70px; font-size:14px; color:#fff; padding:0px 20px;}
.navbar-pf .navbar-utility > li > a{ border: none;}
.sj_drop_menu{min-width: 120px; border: 1px solid #ccc; margin-right: 30px;}
.nav-pills > li + li{ margin-left: 0px;}
.sj_server{ }
.sj_txt_box{-webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px; border:1px solid #d3d3d3; background:#f5f5f5; padding-left:5px; color:#888; height:32px; width:310px;box-shadow: inset 0px 0px 5px #dcdcdc; }
.search-query{ margin-top:0; margin-bottom: 0;}
.filter-header .btn, .filter-header form { margin-bottom: 0; margin-top:0;}
.kubernetes-view .filter-header{ margin-bottom: 0;}
.sj_btn{box-shadow:none;-webkit-box-shadow:none; font-weight: normal; background:none; color: #0088cc;}
.sj_btn:hover{ color: #005580;}

View File

@ -1,8 +1,45 @@
<div>
<div ng-controller="Configs.GfsController">
<div class="row">
<div hawtio-breadcrumbs></div>
</div>
<div class="row">
<div hawtio-tabs></div>
</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> 添加
</button>
</div>
</div>
<div class="row" ng-repeat="volume in volumes">
<table class="table table-hover">
<tr>
<th class="no-fade table-header">
<span class="">{{volume.name}}</span>
</th>
<th class="no-fade table-header">
<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>
</th>
<th class="no-fade table-header">
<button class="btn sj_btn" ng-click="editRow(volume)">
<span class="glyphicon glyphicon-pencil"></span>&nbsp;&nbsp;编辑
</button>
</th>
</tr>
<tr ng-repeat="row in volume.brick track by $index" class="row.class">
<td ng-repeat="col in row" class="col.class">
<span class="col.class">{{col.title}}</span>
</td>
</tr>
</table>
</div>
</div>
</div>

View File

@ -5,13 +5,25 @@
<div class="row">
<div hawtio-tabs></div>
</div>
<div class="container-content container-fluid sj_content">
<div class="row">
<table class="table" hawtio-simple-table="tableConfig" />
<div class="container-content sj_content" >
<div class="sj_content_position clear" >
<ul >
<li class="sj_icons_home"></li>
<li>当前位置:</li>
<li><a href="#">服务集群</a> <span>&gt;</span></li>
<li><a href="#">服务管理</a> <span>&gt;</span></li>
<li><a href="#">配置</a> </li>
</ul>
</div>
<div class="row align-center" ng-hide="model.oracleParam.length">
<p class="alert alert-info">当前没有配置汇总库信息,请配置,否则汇总操作将不可用!</p>
</div>
<div class="row" ng-show="model.oracleParam.length">
<table class="table table-bordered table-striped sj_content_table" hawtio-simple-table="tableConfig" />
</div>
<div class="row">
<div class="col-md-1">
<button class="btn pull-right" ng-click="create()">
<button class="btn pull-right sj_btn_blue" ng-click="create()">
<span class="glyphicon glyphicon-plus"></span> 添加
</button>
</div>

View File

@ -1,15 +1,23 @@
<script type="text/ng-template" id="tableEdit.html" >
<div class="ngCellText" ng-init="entity=row.entity" ng-controller="Configs.EableEdit">
<button class="btn" ng-click="editRow(entity)">
<button class="btn sj_btn" ng-click="editRow(entity)">
<span class="glyphicon glyphicon-pencil"></span>&nbsp;&nbsp;编辑
</button>
<span class="pull-right">&nbsp;</span>
<button class="btn" ng-click="deleteRow(entity)">
<button class="btn sj_btn" ng-click="deleteRow(entity)">
<span class="glyphicon glyphicon-trash"></span>&nbsp;&nbsp;删除
</button>
</div>
</script>
<script type="text/ng-template" id="connectStatus.html">
<div class="ngCellText" ng-init="entity=row.entity">
<div ng-show="true" title="汇总库的连接状态">
<span ng-show="entity.status== 0" class="glyphicon glyphicon-minus">&nbsp;未连接</span>
<span ng-show="entity.status== 1" class="glyphicon glyphicon-ok">&nbsp;连接成功</span>
<span ng-show="entity.status== 2" class="glyphicon glyphicon-import">&nbsp;使用中</span>
<span ng-show="entity.status== 3" class="glyphicon glyphicon-remove">&nbsp;连接失败</span>
</div>
</div>
</script>
<div ng-controller="Kubernetes.TopLevel">
<div class="wiki-icon-view" ng-controller="Kubernetes.FileDropController" nv-file-drop nv-file-over uploader="uploader" over-class="ready-drop">

View File

@ -2,6 +2,13 @@
/// <reference path="configPlugin.ts"/>
/// <reference path="../../developer/ts/developerNavigation.ts"/>
module Configs{
export class OperateType{
public static get DELETE():string {return "delete"}
public static get UPDATE():string {return "update"}
public static get PUT():string{return "put"}
public static get MOVE():string{return "move"}
}
_module.controller('Configs.MenuItemController',['$scope', '$location', ($scope, $location) => {
$scope.menuItem=[{
icon: "glyphicon glyphicon-cloud-upload",
@ -40,8 +47,17 @@ module Configs{
}]);
}
export function createOracleInfo(array:Array<any>, id:number){
var result ={"id": id};
angular.forEach(array, (arr) => {
result[arr.field] = arr.value;
});
return result;
}
export function shareInit($scope, $location, $routeParams){
$scope.subTabConfig = createConfigBreadcrumbs($scope, $location, $routeParams);
$scope.model.updateAllData();
}
export function createNewObejct(array:Array<any>, obj){
@ -66,4 +82,28 @@ module Configs{
return result;
}
export function oracleInfoOperate($http, url:string, operate:string, resource, fn?: (data, status)=>void ){
var id = resource.id+"", RESTfulUrl;
if(id !="")
RESTfulUrl = UrlHelpers.join(url, resource.id, operate);
else
RESTfulUrl = UrlHelpers.join(url, operate);
if(resource === null)
throw "不能操作空资源对象";
$http({
method: "POST",
url: RESTfulUrl,
params: resource
}).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);
});
}
}

View File

@ -24,5 +24,31 @@ module Configs {
viewRegistry['config'] = templatePath + "shareLayout.html";
}]);
_module.directive('gfsConfigTable', [() =>{
return{
restrict: 'AE',
replace : true,
scope: {
tableTitle: '=',
tableContent: '='
},
template: `<table class="table table-hover">
<tr>
<th ng-repeat="column in tableTitle.column" class="no-fade table-header">
<span class="{{column.class}}">{{column.title}}</span>
</th>
</tr>
<tr ng-repeat = "row in tableContent" class="row.class">
<td ng-repeat="col in row" class="col.class">
<span class="col.class">{{col.title}}</span>
</td>
</tr>
</table>
`,
link: (scope, element, attr) =>{
}
}
}]);
hawtioPluginLoader.addModule(pluginName);
}

View File

@ -39,23 +39,46 @@ module Configs{
export class ConfigsModelService{
public cluster: Array<volume>=[];
public oracleParam: Array<oracleParam>;
public oracleParam: Array<oracleParam>=[];
public constructor(){
this.cluster = this.updateVolumeData();
this.updateAllData();
}
public updateAllData(){
this.updateVolumeData();
this.updateOracleParam();
}
public updateVolumeData(){
var result=[];
var result=null;
$.ajax({
async: false,
type : "POST",
url : "/java/console/api/volume/list",
success : function(data) {
result.push(data);
console.log(data);
if(data){
result = data;
}
}
});
return result;
console.log(result);
this.cluster = result;
}
public updateOracleParam(){
var result=null;
$.ajax({
async: false,
type : "POST",
url : "/java/console/api/oracle/list",
success : function(data) {
if(data){
result = data;
}
}
});
this.oracleParam = result;
}
public getFolderByVolumeName(name: string){
@ -70,7 +93,6 @@ module Configs{
_module.factory('ConfigsModel', ['$rootScope', '$http', '$location', '$resource', ($rootScope, $http, $location, $resource) =>{
var $scope = new ConfigsModelService();
console.log($scope.cluster);
return $scope;
}]);
}

View File

@ -0,0 +1,16 @@
/// <reference path="../../includes.ts"/>
/// <reference path="configPlugin.ts"/>
/// <reference path="configsHelper.ts"/>
/// <reference path="configsUtils.ts"/>
/// <reference path="configsDataService.ts"/>
module Configs{
export var GfsController = controller('GfsController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", 'ConfigsModel',
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel) =>{
$scope.model = ConfigsModel;
$scope.volumes = ConfigsModel.cluster;
shareInit($scope, $location, $routeParams);
}]);
}

View File

@ -4,41 +4,14 @@
/// <reference path="configsUtils.ts"/>
module Configs{
export var KubeController = controller('KubeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout",
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout) => {
$scope.model= [{
"name": "",
"status": "OK",
"ip": "10.188.2.3",
"_id": 1
},
{
"name": "camel-041",
"status": "OK",
"ip": "10.188.2.20",
"_id": 2
},
{
"name": "activemq-004",
"status": "failed",
"ip": "10.188.2.111",
"_id": 3
}];
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.tableConfig={
data: "model",
selectedItems: [{
name: "activemq-004",
status: "failed",
ip: "10.188.2.111",
_id: 2
}],
data: 'model.oracleParam',
selectedItems: [],
columnDefs: [{
field: "_id",
displayName: "序号"
},
{
field: "name",
displayName: "名称"
},
@ -51,7 +24,7 @@ module Configs{
displayName: "端口号"
},
{
field: "userName",
field: "user",
displayName: "用户名"
},
{
@ -59,23 +32,32 @@ module Configs{
displayName: "密码"
},
{
field: "serviceName",
field: "database",
displayName: "服务名"
},
{
field: "tableName",
displayName: "表空间名"
},
{
field: "suffix",
displayName: "表后缀"
},
{
field: "status",
displayName: "连接状态"
displayName: "连接状态",
cellTemplate: $templateCache.get("connectStatus.html")
},
{
field: "entity",
displayName: "操作",
cellTemplate: $templateCache.get("tableEdit.html")
}],
enableRowClickSelection: true,
enableRowClickSelection: false,
showSelectionCheckbox: false,
multiSelect: false,
sortInfo: {
sortBy: "_id",
sortBy: "name",
ascending: true
}
}
@ -86,24 +68,39 @@ module Configs{
$scope.add= true;
$scope.edit = false;
$scope.tableForm = createNewObejct($scope.tableConfig.columnDefs, null);
$scope.rowId=0;
removeElementsByValue($scope.tableForm, [{key: "name", value: "序号"},{key: "name", value: "连接状态"},{key: "name", value: "操作"}]);
}
$scope.onSubmit = () => {
$scope.edit = false;
$scope.add = false;
console.log($scope.tableForm);
oracleInfoOperate($http, "/java/console/api/oracle", OperateType.UPDATE, createOracleInfo($scope.tableForm, $scope.rowId), (result, status) => {
if(status===200){
$scope.model.updateOracleParam();
}else{
throw "资源请求失败";
}
});
}
$scope.$on("editRow", (event, data) =>{
$scope.edit = true;
$scope.add = false;
$scope.rowId = data.id
$scope.tableForm = createNewObejct($scope.tableConfig.columnDefs, data);
removeElementsByValue($scope.tableForm, [{key: "name", value: "序号"},{key: "name", value: "连接状态"},{key: "name", value: "操作"}]);
}) ;
$scope.$on("deleteRow", (event, data) =>{
removeElementByValue($scope.model, data._id, "_id");
oracleInfoOperate($http, "/java/console/api/oracle", OperateType.DELETE, data, (result, status) => {
if(status===200){
$scope.model.updateOracleParam();
}else{
throw "资源请求失败";
}
});
//removeElementByValue($scope.model, data._id, "_id");
}) ;
}]);
}

View File

@ -3,6 +3,7 @@
module Configs{
export var EableEdit = controller('EableEdit', ['$scope', ($scope) => {
$scope.editRow = (entity)=>{
console.log(entity);
$scope.$emit('editRow', entity);
}

View File

@ -30,9 +30,20 @@
<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>
<a class="sj_btn_grey pull-left mr5" title="启动oracle服务" href="/kubernetes/replicationControllers" ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="createOracleService(id || tableConfig.selectedItems)">启动oracle服务</a>
<button class="btn btn-danger pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="stopPrompt(id || tableConfig.selectedItems)">
<i class="glyphicon glyphicon-trash"></i> 删除数据
</button>
<span class="pull-right">&nbsp;</span>
<button class="btn btn-info 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 class="btn btn-success 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>
<!--<a class="sj_btn_grey pull-left mr5" title="启动oracle服务" href="/kubernetes/replicationControllers" ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="createOracleService(id || tableConfig.selectedItems)">启动服务</a>
<a class="sj_btn_grey pull-left mr5" title="迁移数据" href="#" ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="migrationClick.open(id || tableConfig.selectedItems)">迁移数据</a>
<a class="sj_btn_grey pull-left mr5" title="删除数据" href="#" ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="deletePrompt(id || tableConfig.selectedItems)">删除数据</a>
<a class="sj_btn_grey pull-left mr5" title="删除数据" href="#" ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="deletePrompt(id || tableConfig.selectedItems)">删除数据</a> -->
</div>
<ul class="fr sj_table_bottom">
<li class="mr5 ">当前显示1~7行共7行。</li>
@ -65,16 +76,16 @@
<label class="col-sm-3 control-label sj_contro_label" for="selectedItem ">
请选择迁移集群
</label>
<select ng-model="migrationClick.selectedItem " class="col-sm-3 sj_modal_select" title="name of the new namespace " id="selectedItem " ng-options="x.volume for x in volumes " />
<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>
<treecontrol class="tree-classic" tree-model="dataForTheTree" options="treeOptions" on-selection="showSelected(node)" selected-node="selectNode">
<treecontrol class="tree-classic" tree-model="migrationClick.selectedItem.folder" options="treeOptions" on-selection="showSelected(node)" selected-node="selectNode">
{{node.name}}
</treecontrol>
</div>
</div>
<div class="modal-footer ">
<input class="btn btn-primary sj_btn_blue" type="submit" ng-disabled="!selectNode || selectNode.children.length <= 0" value="确定">
<input class="btn btn-primary sj_btn_blue" type="submit" ng-disabled="!selectNode || selectNode.childNodes.length <= 0" value="确定">
<button class="btn btn-warning cancel sj_btn_grey" type="button" ng-click="migrationClick.close()">取消</button>
</div>
</form>

View File

@ -6,6 +6,7 @@
/// <reference path="developerHelpers.ts"/>
/// <reference path="dataManagerHelper.ts"/>
/// <reference path="dataManagerModel.ts"/>
/// <reference path="../../configs/ts/configsHelper.ts"/>
module Developer {
export var WorkspacesController = controller("WorkspacesController", ["$scope", "KubernetesModel", "DataModel", "ConfigsModel", "KubernetesState", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL", "$element",
@ -16,10 +17,10 @@ module Developer {
$scope.options = DataModel.paramOptions;
$scope.pageSizeChoses = DataModel.paramOptions.pagerSizeOption;
$scope.options.dataType = getDataType($location);
$scope.volumes = ConfigsModel.cluster;
console.log(JSON.stringify($scope.volumes[0].folderNode));
$scope.model.updateModel();
//console.log(JSON.stringify($scope.volumes[0].folderNode));
$scope.treeOptions = {
nodeChildren: "childNodes",
@ -35,7 +36,6 @@ module Developer {
labelSelected: "a8"
}
}
//配置数据表格需要显示的内容及显示格式
$scope.tableConfig = {
data: 'model.data',
@ -160,15 +160,28 @@ module Developer {
$scope.migrationClick = {
items:null,
selectedItem: $scope.volumes[0],
selectedItem: $scope.volumes[0] || "当前没有可以迁移的集群",
dialog: new UI.Dialog(),
onOk: () => {
var migrationClick = $scope.migrationClick;
var volumeName = migrationClick.selectedItem.name;
var selectItems = $scope.tableConfig.selectedItems;
var selectNode = $scope.selectNode;
console.log(migrationClick);
console.log(selectItems);
console.log(selectNode);
/*Configs.oracleInfoOperate($http, "/java/console/api/volume", Configs.OperateType.MOVE, {"id":selectedItem.name}, (result, status) => {
if(status===200){
//$scope.model.updateOracleParam();
}else{
throw "资源请求失败";
}
});*/
migrationClick.close();
},
open: (selected) =>{
var migrationClick = $scope.migrationClick;
migrationClick.dialog.open();
console.log("===================");
console.log(migrationClick.selectedItem);
},
close: () => {
$scope.migrationClick.dialog.close();
@ -176,9 +189,7 @@ module Developer {
};
$scope.createOracleService = (items) =>{
console.log(items);
angular.forEach(items,(item)=>{
console.log(item);
Kubernetes.createRC({
name: item._key,
labels: {
@ -195,11 +206,16 @@ module Developer {
isTarget: "false"
}, (rc) =>{
Kubernetes.connectOracle($http, $timeout, "/java/console/api/connectOracle", "create", Kubernetes.getName(rc), 0);
$location.path('/kubernetes/namespace/default/replicationControllers');
});
});
}
function init($scope,$location,$routeParams){
$scope.model.updateModel();
if(ConfigsModel.cluster!=null)
$scope.volumes = ConfigsModel.cluster;
//创建二级菜单
$scope.subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams);
$scope.navbarItems =[{

View File

@ -24,56 +24,56 @@
</div>
<div class="row filter-header">
<div class="col-md-12" >
<div class="sj_content_position clear" style="margin-top:25px;">
<ul >
<li class="sj_icons_home"></li>
<li>当前位置:</li>
<li><a href="#">服务集群</a> <span>&gt;</span></li>
<li><a href="#">服务管理</a> </li>
</ul>
</div>
<div class="col-md-12 sj_fluid" >
<span ng-show="!id">
<hawtio-filter ng-model="tableConfig.filterOptions.filterText"
css-class="input-xxlarge"
css-class="input-xxlarge sj_txt_box"
placeholder="通过数据标签筛选相应的oracle服务..."
save-as="kubernetes-replication-controllers-text-filter"></hawtio-filter>
</span>
<button ng-show="model.fetched"
class="btn btn-danger pull-right"
class="btn btn-danger pull-right sj_btn_grey "
ng-disabled="!id && tableConfig.selectedItems.length == 0"
ng-click="deletePrompt(id || tableConfig.selectedItems)">
<i class="fa fa-remove"></i> 删除
<i class="glyphicon glyphicon-trash"></i> 删除
</button>
<span class="pull-right">&nbsp;</span>
<button ng-show="model.fetched"
class="btn btn-danger pull-right"
class="btn btn-warning pull-right sj_btn_grey "
ng-disabled="!id && tableConfig.selectedItems.length == 0"
ng-click="stopPrompt(id || tableConfig.selectedItems)">
<i class="fa fa-remove"></i> 停止
<i class="glyphicon glyphicon-off"></i> 停止
</button>
<span class="pull-right">&nbsp;</span>
<button ng-show="model.fetched"
class="btn btn-primary pull-right"
class="btn btn-info pull-right sj_btn_grey"
ng-disabled="!id && tableConfig.selectedItems.length == 0"
ng-click="reStartPrompt(id || tableConfig.selectedItems)">
<i class="fa fa-plus"></i> 启动
<i class="glyphicon glyphicon-play"></i> 启动
</button>
<span class="pull-right">&nbsp;</span>
<!--<button ng-show="id"
class="btn btn-primary pull-right"
ng-click="id = undefined"><i class="fa fa-list"></i></button>
<span ng-show="id" class="pull-right">&nbsp;</span>
<a class="btn btn-default pull-right"
title="Create a new replication controller"
ng-click="createRCs()"><i class="fa fa-plus"></i> 创建汇总数据库</a>
<span class="pull-right">&nbsp;</span>-->
<button ng-show="model.fetched"
ng-disabled="!id && tableConfig.selectedItems.length == 0"
class="btn btn-success pull-right"
class="btn btn-success pull-right sj_btn_grey"
ng-click="extractData.open(id || tableConfig.selectedItems)">
<i class="fa fa-play-circle"></i> 汇总
<i class="glyphicon glyphicon-cloud-download"></i> 汇总
</button>
<!--<span ng-include="'runButton.html'"></span>-->
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-12 sj_fluid">
<div ng-hide="model.fetched">
<div class="align-center">
<i class="fa fa-spinner fa-spin"></i>
@ -84,7 +84,7 @@
<p class="alert alert-info">当前没有正在运行的oracle服务.</p>
</div>
<div ng-show="model.replicationControllers.length">
<table class="table table-bordered table-striped"
<table class="table table-bordered table-striped sj_content_table"
hawtio-simple-table="tableConfig" ></table>
</div>
</div>
@ -110,11 +110,10 @@
<select ng-model="extractData.selectedItem" class="form-control"
title="name of the new namespace"
id ="selectedItem"
ng-options="x.$oracleName for x in filterReplicationControllers">
ng-options="x.name for x in oracleParam">
</select>
<span class="help-block" ng-show="filterReplicationControllers.length == 0">
<span class="help-block" ng-show="oracleParam.length == 0">
当前没有汇总数据库可以选择,请先创建,可以点击创建汇总数据库按钮进行创建或从汇总页面中的服务器数据列表中启动已创建的汇总数据库!
</span>
</div>
@ -127,14 +126,14 @@
<span class="help-block" ng-show="extractData.selectedItem">
<br>
您所选择的数据库数据将会被抽取到汇总数据库:
<font color="Red"><strong>{{extractData.selectedItem.$oracleName}}</strong></font> 中,是否继续请确认!
<font color="Red"><strong>{{extractData.selectedItem.name}}</strong></font> 中,是否继续请确认!
</span>
</div>
</div>
</div>
<div class="modal-footer">
<input class="btn btn-primary" type="submit"
ng-disabled="filterReplicationControllers.length == 0"
ng-disabled="oracleParam.length == 0"
value="确定">
<button class="btn btn-warning cancel" type="button" ng-click="extractData.close()">取消</button>

View File

@ -1,5 +1,7 @@
/// <reference path="../../includes.ts"/>
/// <reference path="kubernetesInterfaces.ts"/>
/// <reference path="utilHelpers.ts"/>
/// <reference path="readPlacedivision.ts"/>
module Kubernetes {
export var context = '/kubernetes';

View File

@ -180,7 +180,7 @@ module Kubernetes {
yes();
}
})
.href(() => context)
.href(() => UrlHelpers.join(context, "/namespace/default/replicationControllers"))
.title(() => '服务集群')
.tabs(controllers, pods, events)
.build();

View File

@ -9,7 +9,6 @@ module Kubernetes {
export var FileDropController = controller("FileDropController", ["$scope", "KubernetesModel", "FileUploader", '$http', ($scope, model:KubernetesModelService, FileUploader, $http:ng.IHttpService) => {
var log = Logger.get('kubernetes-file-uploader');
console.log("---------------------------");
var uploader = $scope.uploader = <FileUpload.FileUploader> new FileUploader(<FileUpload.IOptions>{
autoUpload: false,

View File

@ -1,17 +1,18 @@
/// <reference path="../../includes.ts"/>
/// <reference path="kubernetesHelpers.ts"/>
/// <reference path="kubernetesPlugin.ts"/>
/// <reference path="kubernetesModel.ts"/>
module Kubernetes {
export var ReplicationControllers = controller("ReplicationControllers",
["$scope", "KubernetesModel", "KubernetesReplicationControllers", "KubernetesPods", "KubernetesState", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL",
($scope, KubernetesModel: Kubernetes.KubernetesModelService, KubernetesReplicationControllers:ng.resource.IResourceClass<any>, KubernetesPods:ng.resource.IResourceClass<any>, KubernetesState,
["$scope", "KubernetesModel", "KubernetesReplicationControllers", "KubernetesPods", "ConfigsModel", "KubernetesState", "$templateCache", "$location", "$routeParams", "$http", "$timeout", "KubernetesApiURL",
($scope, KubernetesModel: Kubernetes.KubernetesModelService, KubernetesReplicationControllers:ng.resource.IResourceClass<any>, KubernetesPods:ng.resource.IResourceClass<any>, ConfigsModel, KubernetesState,
$templateCache, $location:ng.ILocationService, $routeParams, $http, $timeout, KubernetesApiURL) => {
$scope.kubernetes = KubernetesState;
$scope.configs = ConfigsModel;
$scope.model = KubernetesModel;
$scope.filterReplicationControllers = $scope.model.filterReplicationcontrollers;
$scope.tableConfig = {
data: 'model.replicationControllers',
@ -176,7 +177,7 @@ module Kubernetes {
$scope.extractData = {
items: null,
selectedItem: $scope.filterReplicationControllers[0] || "",
selectedItem: $scope.oracleParam[0].name || "当前可用的汇总库",
dialog: new UI.Dialog(),
onOk: () => {
var extractData = $scope.extractData;