修复数据分页显示bug

Web_Manager_Develope
wu ming 10 years ago
parent 92e5814d5c
commit 7efdc5d699

@ -1,14 +1,45 @@
/// <reference path="../../includes.d.ts" />
declare module Developer {
type LabelResolver = () => string;
interface BreadcrumbConfig {
href?: string;
label?: string | LabelResolver;
title?: string;
class?: string;
isValid?: () => boolean;
isActive?: (subTab, path) => boolean;
}
function workspaceLink(): string;
function projectLink(projectId: any): string;
function createWorkspacesBreadcrumbs(developPerspective: any): any[];
function createWorkspacesBreadcrumbs(developPerspective?: any): BreadcrumbConfig[];
function createWorkspacesSubNavBars(developPerspective: any): any;
function createWorkspaceBreadcrumbs(children?: any, workspaceName?: any): any;
function createEnvironmentBreadcrumbs($scope: any, $location: any, $routeParams: any): any;
function createProjectBreadcrumbs(projectName?: any, children?: any, workspaceName?: any): any;
function createProjectBreadcrumbs(projectName?: any, children?: Array<BreadcrumbConfig>, workspaceName?: any): any;
function createProjectSettingsBreadcrumbs(projectName: any, workspaceName?: any): any;
function createWorkspaceSubNavBars(): any;
function namespaceRuntimeLink(workspaceName?: any): string;
/**
* Creates a routing function that loads a template and inject the needed directives to properly
* display/update the Developer module managed tabs and bread crumbs for when the route is active.
*
* Example Usage:
*
* var route = Developer.createTabRoutingFunction("/app/somedir");
* $routeProvider.when('/profiles', route('view.html', false, [{
* label: "Profiles",
* title: "Browse the profiles of this project"
* }]
* ));
*
* @param baseURL
* @returns {function(string, boolean=, Array<Developer.BreadcrumbConfig>=): {template: string, reloadOnSearch: boolean, controller: string|string|(function(any, ng.route.IRouteParamsService): undefined)[]}}
*/
function createTabRoutingFunction(baseURL: string): (templateName: string, reloadOnSearch?: boolean, children?: BreadcrumbConfig[]) => {
template: string;
reloadOnSearch: boolean;
controller: (string | (($scope: any, $routeParams: ng.route.IRouteParamsService) => void))[];
};
function createProjectSubNavBars(projectName: any, jenkinsJobId?: any, $scope?: any): any;
function createProjectSettingsSubNavBars(projectName: any, jenkinsJobId?: any): any;
function forgeProjectHasBuilder(name: any): any;
@ -20,9 +51,13 @@ declare module Developer {
function projectSecretsLink(workspaceName: any, projectName: any): string;
function secretsNamespaceLink(workspaceName: any, projectName: any, secretsNamespace: any): string;
function projectWorkspaceLink(workspaceName: any, projectName: any, path: any, ignoreBlankProject?: boolean): string;
function environmentsLink(workspaceName?: any): string;
function environmentLink(workspaceName: any, environmentNamespace: any, path?: string, ignoreBlankProject?: boolean): string;
var customProjectSubTabFactories: any[];
function createJenkinsBreadcrumbs(projectName: any, jobId: any, buildId: any): any;
function createJenkinsSubNavBars(projectName: any, jenkinsJobId: any, buildId: any, extraOption?: any): any;
function createEnvironmentSubNavBars($scope: any, $location: any, $routeParams: any): any;
function environmentInstanceLink(env: any, projectName?: any): string;
function namespaceLink($scope: any, $routeParams: any, path?: any): string;
function normalizeHref(href: string): string;
}

@ -2,7 +2,8 @@
/// <reference path="../../kubernetes/ts/kubernetesHelpers.d.ts" />
/// <reference path="developerEnrichers.d.ts" />
/// <reference path="developerHelpers.d.ts" />
/// <reference path="developerNavigation.d.ts" />
/// <reference path="dataManagerHelper.d.ts" />
/// <reference path="dataManagerModel.d.ts" />
declare module Developer {
var WorkspacesController: ng.IModule;
}

@ -209,4 +209,5 @@ declare module Kubernetes {
function getOracleName(name: string): string;
function extractDataToOracle($http: any, selectedReplicationControllers: any, targetReplicationController: any): void;
function checkoutOracleRCIsRunning(rc: any): boolean;
function replicasIsCreated(replicationcontrollers: Array<any>, name: string): boolean;
}

@ -24,6 +24,7 @@ declare module Kubernetes {
"isExtract": string;
"isTarget": any;
};
"annotations": any;
};
"spec": {
replicas: any;

2
defs.d.ts vendored

@ -5,7 +5,9 @@
/// <reference path="d.ts/developer/ts/developerHelpers.d.ts"/>
/// <reference path="d.ts/developer/ts/developerNavigation.d.ts"/>
/// <reference path="d.ts/developer/ts/FileMode.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerHelper.d.ts"/>
/// <reference path="d.ts/developer/ts/developerPlugin.d.ts"/>
/// <reference path="d.ts/developer/ts/dataManagerModel.d.ts"/>
/// <reference path="d.ts/developer/ts/environmentPanel.d.ts"/>
/// <reference path="d.ts/developer/ts/home.d.ts"/>
/// <reference path="d.ts/developer/ts/jenkinsJob.d.ts"/>

@ -686,6 +686,73 @@ a:hover.data_file_btn {
background: url(../img/icons2.gif) -6px 9px no-repeat;
}
.layout-pf.layout-pf-fixed .container-pf-nav-pf-vertical {
margin-left: 170px;
}
.nav-pf-vertical {
width: auto;
min-width: 170px;
}
.nav-pf-vertical .list-group > .list-group-item > a {
width: auto;
}
.nav-pf-vertical > .list-group > .list-group-item > a .fa,
.nav-pf-vertical > .list-group > .list-group-item > a .glyphicon,
.nav-pf-vertical > .list-group > .list-group-item > a .pficon {
line-height: 25px;
margin-right: 3px;
}
.nav-pf-vertical > .list-group > .list-group-item > a img {
max-height: 16px;
max-width: 16px;
margin-right: 10px;
}
.navbar-tab-vertical {
height: 70px;
width: 100%;
display: block;
background: #1d1d1d;
border-color: #1d1d1d;
}
.navbar-tab-horizontal {
height: 100%;
width: 100px;
display: block;
background: #1d1d1d;
border-color: #1d1d1d;
}
.gesture {
cursor: pointer;
}
.navbar-lf {
width: 200px;
min-height: 800px;
background: #1d1d1d;
position: absolute;
left: 0;
top: 0px;
}
.navbar-lf-menu {
display: block;
text-decoration: none;
}
.log-img {
width: "66";
height: "21";
alt: "logo";
}
.fl {
float: left;
}
a.logo {
display: block;
width: 130px;
padding: 20px 0 0 40px;
}
.content-margin {
margin-left: 170px;
}
/* This is for the 'Overview' page with all the rows of boxes */
.service-view-rectangle {
position: relative;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -14,7 +14,6 @@
<link rel="stylesheet" href="libs/nvd3/build/nv.d3.css" />
<link rel="stylesheet" href="libs/codemirror/lib/codemirror.css" />
<link rel="stylesheet" href="libs/toastr/toastr.css" />
<link rel="stylesheet" href="libs/angular-patternfly/dist/styles/angular-patternfly.css" />
<link rel="stylesheet" href="libs/hawtio-ui/dist/OpenSans.css" />
<link rel="stylesheet" href="libs/hawtio-ui/dist/DroidSansMono.css" />
<link rel="stylesheet" href="libs/hawtio-ui/dist/ui.dynatree.css" />
@ -54,7 +53,6 @@
<script src="libs/dagre/dist/dagre.core.min.js"></script>
<script src="libs/zeroclipboard/dist/ZeroClipboard.js"></script>
<script src="libs/toastr/toastr.js"></script>
<script src="libs/angular-patternfly/dist/angular-patternfly.js"></script>
<script src="libs/hawtio-ui/dist/jquery-ui.custom.js"></script>
<script src="libs/hawtio-ui/dist/ui-bootstrap.js"></script>
<script src="libs/hawtio-ui/dist/ui-bootstrap-tpls.js"></script>
@ -67,12 +65,13 @@
<script src="libs/hawtio-ui/dist/d3.js"></script>
<script src="libs/hawtio-ui/dist/tabbable.js"></script>
<script src="libs/hawtio-ui/dist/hawtio-ui.js"></script>
<script src="libs/hawtio-forms/dist/jsdiff.js"></script>
<script src="libs/hawtio-forms/dist/hawtio-forms.js"></script>
<script src="libs/hawtio-forms/dist/bootstrap-combobox.js"></script>
<script src="libs/hawtio-template-cache/dist/hawtio-template-cache.js"></script>
<script src="libs/keycloak/dist/keycloak.js"></script>
<script src="libs/ng-idle/angular-idle.js"></script>
<script src="libs/hawtio-oauth/dist/hawtio-oauth.js"></script>
<script src="libs/hawtio-template-cache/dist/hawtio-template-cache.js"></script>
<script src="libs/term.js/src/term.js"></script>
<script src="libs/kubernetes-container-terminal/dist/container-terminal.js"></script>
<script src="libs/hawtio-kubernetes-api/dist/smokesignals.unminified.js"></script>
@ -135,34 +134,17 @@
</head>
<body style="padding-top: 75px;">
<nav class="navbar navbar-default navbar-fixed-top navbar-pf" role="navigation">
<div class="navbar-header" hawtio-extension name="hawtio-header">
<div class="navbar-brand" href="/"><img /></div>
</div>
<!--<ul class="nav navbar-nav navbar-utility">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="pficon pficon-user"></span>
User <b class="caret"></b>
</a>
<ul class="dropdown-menu" hawtio-extension name="hawtio-user">
</ul>
</li>
</ul>-->
<ul class="nav navbar-nav navbar-primary" hawtio-main-nav></ul>
<ul class="nav navbar-nav navbar-persistent" hawtio-sub-tabs></ul>
<nav class="navbar navbar-fixed-top navbar-pf" role="navigation">
<a href="/" class="log fl"><img src="/" class="log-img"></a>
<ul class="nav navbar-nav navbar-primary" hawtio-main-nav></ul>
</nav>
<div id="main" class="container-fluid ng-cloak" ng-controller="HawtioNav.ViewController">
<div class="row" style="margin-left: -20px; margin-right: -20px">
<div hawtio-main-outlet ng-class="getClass()"><br><br>
<!-- <hawtio-breadcrumbs-outlet></hawtio-breadcrumbs-outlet> -->
<div ng-include src="viewPartial"></div>
<platform-sub-tabs-outlet></platform-sub-tabs-outlet>
<div id="main" class="container-fluid container-pf-nav-pf-vertical container-pf-nav-pf-vertical-with-secondary content-margin" ng-controller="HawtioNav.ViewController" hawtio-main-outlet>
<div class="row" ng-class="getClass()">
<hawtio-breadcrumbs-outlet></hawtio-breadcrumbs-outlet>
<div ng-include src="viewPartial"></div>
</div>
<!-- <hawtio-tabs-outlet></hawtio-tabs-outlet> -->
</div>
</div>
<script src="dist/hawtio-kubernetes.js"></script>
</body>
</body>
</html>

Binary file not shown.

@ -1,75 +1,46 @@
<div ng-controller="Developer.WorkspacesController"><div class="row">
<div ng-controller="Developer.WorkspacesController" hawtio-card-bg>
<div hawtio-breadcrumbs></div>
</div>
<div class="row">
<div hawtio-tabs></div>
</div>
<header class="data_heaer">
<h2 >江苏省审计厅数据汇总平台</h2>
</header>
<div class="data_content">
<div class="data_leftside fl">
<h3 class="data_h3">本地文件列表</h3>
<ul class="fl data_leftside_files">
<li class=" data_title data_title_w">文件名</li>
<div treecontrol class="tree-classic"
tree-model="dataForTheTreeLocal"
options="treeOptionss"
on-selection="showSelectedLocal(node,selected)"
selected-nodes="selectedNodes">
{{node.name}}
<div class="container-content">
<div class="container-fluid">
<div class="row nav-content">
<ul class="nav nav-tabs" 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>
</ul>
<ul class="fl data_leftside_files ">
<li class=" data_title data_title_w">已选数据文件</li>
<li ng-repeat="node in model.selectednodes" >{{node.name}}</li>
</ul>
<ul class="fl data_leftside_files " style="border-right:none;">
<li class=" data_title data_title_w">采集时间</li>
<li ng-repeat="node in model.selectednodes" >{{node.date}}&nbsp&nbsp
<span ng-show="model.uploadprocess[node.id]" style="font-size:larger; font-weight:bold; font-family:serif; color:red;">{{model.uploadprocess[node.id]}}%</span></li>
</ul>
<div class="cl"></div>
<div class="date_btns">
<a class="data_file_btn fl" >导入到服务器</a><input type="file" name="file-upload[]" id="file-uploads" onchange="angular.element(this).scope().upLoadXMLFile(this.files)" multiple webkitdirectory="" />
<a ng-click="upLoadFiles()" class="data_file_btn fl" >导入到服务器</a>
</div>
<div class="cl"></div>
</div><!--data_leftside end-->
<div class="data_rightside fr">
<h3 class="data_h3">服务器文件列表</h3>
<div style="width: 259px; overflow-x:scroll; overflow-y:auto;" class="data_rightside_tree fl" >
<div treecontrol class="tree-classic" style="width: 459px; overflow-x:visible;"
tree-model="dataForTheTree"
options="treeOptions"
on-selection="showSelected(node,selected)"
selected-node="node1">
{{node.name}}
<div ng-hide="model.data.length" class="align-center">
<p class="alert alert-info">当前没有可以查看的数据.</p>
</div>
<div ng-show="model.data.length">
<table class="table table-striped table-bordered" hawtio-simple-table="tableConfig"></table>
<div class="row">
<div class="col-xs-6 col-sm-2">
<button ng-show="true" class="btn btn-danger pull-right" ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="deletePrompt(id || tableConfig.selectedItems)">
<i class="fa fa-remove"></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 class="pull-right">&nbsp;</span>
<a class="btn btn-default pull-right" title="启动oracle服务" href="/kubernetes/replicationControllers" ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="createOracleService(id || tableConfig.selectedItems)"><i class="fa fa-plus"></i> 启动服务</a>
<span class="pull-right">&nbsp;</span>
</div>
<div class="col-md-6 col-md-offset-9">
每页显示&nbsp
<select ng-options="value for value in pageSizeChoses" ng-change="selectAction()" ng-model="options.currentTableSize"></select>
&nbsp&nbsp当前页码
<div class="hawtio-pager clearfix">
<label>{{options.currentPageNum}} / {{options.getPageSizeNum()}}</label>
<div class=btn-group>
<button class="btn" ng-disabled="isEmptyOrFirst()" ng-click="first()"><i class="fa fa-fast-backward"></i></button>
<button class="btn" ng-disabled="isEmptyOrFirst()" ng-click="previous()"><i class="fa fa-step-backward"></i></button>
<button class="btn" ng-disabled="isEmptyOrLast()" ng-click="next()"><i class="fa fa-step-forward"></i></button>
<button class="btn" ng-disabled="isEmptyOrLast()" ng-click="last()"><i class="fa fa-fast-forward"></i></button>
</div>
</div>
</div>
</div>
</div>
</div><!--data_rightside_tree end-->
<div class="data_leftside fl data_rightside_w" style="width: 407px; border-right:none;">
<ul class="fl data_leftside_files" style="width: 250px; border-right:1;">
<li class=" data_title data_title_w" style="width: 250px; border-right:1;" >文件名</li>
<li ng-repeat="item in model.serveritems" style="width: 235px; overflow-x:visible;" >{{item.name}}<input type="checkbox" ng-click="isSelected(item)" class="fr"/></li>
</ul>
<ul class="fl data_leftside_files " style="width: 150px; border-right:none;" >
<li class=" data_title data_title_w" style="width: 130px; border-right:none;" >采集时间</li>
<li ng-repeat="item in model.serveritems" style="width: 158px;">{{item.time}}</li>
</ul>
</div><!--data_leftside end-->
<div class="cl"></div>
<div class="date_btns date_btns_w">
<!--<a ng-click="getServerXML()" class="data_file_btn fl">查看服务数据</a>-->
<a ng-click="downLoadFiles()" class="data_file_btn fl" >下载服务数据</a>
<!--<input type="file" name="file-upload[]" id="file-uploads" onchange="angular.element(this).scope().downLoadFiles(this.files)" multiple webkitdirectory="" />-->
<a ng-click="startOracle()" class="data_file_btn fl" >启动oracle服务</a>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<div class="prettify"></div>
</div>

File diff suppressed because it is too large Load Diff

@ -3,66 +3,37 @@
module Developer {
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'nvd3', 'treeControl']);
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'nvd3']);
export var controller = PluginHelpers.createControllerFunction(_module, pluginName);
export var route = PluginHelpers.createRoutingFunction(templatePath);
_module.config(['$routeProvider', ($routeProvider:ng.route.IRouteProvider) => {
_module.config(['$routeProvider', ($routeProvider:ng.route.IRouteProvider) => {
$routeProvider.when(context, route('workspaces.html', false))
.when("/namespaces", route('workspaces.html', false))
//.when("/home", route('home.html', false))
.when(UrlHelpers.join(context, '/:namespace'), route('projects.html', false))
.when(UrlHelpers.join(context, '/:namespace/detail'), route('workspace.html', false))
.when(UrlHelpers.join(context, '/:namespace/jenkinsJob'), route('jenkinsJobs.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects'), route('projects.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id'), route('environments.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/detail'), Kubernetes.route('buildConfig.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/builds'), Kubernetes.route('builds.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/environments'), route('environments.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsJob/:job'), route('jenkinsJob.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsJob/:job/log/:build'), route('jenkinsLog.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsJob/:job/pipelines'), route('pipelines.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsJob/:job/pipeline/:build'), route('pipeline.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsJob/:job/metrics'), route('jenkinsMetrics.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/jenkinsMetrics'), route('jenkinsMetrics.html', false))
.when(UrlHelpers.join(context, '/:namespace/projects/:id/tools'), route('tools.html', false))
.when(UrlHelpers.join(context, '/:workspace/projects/:project/environments/:namespace'), route('environment.html', false))
.when(UrlHelpers.join(context, '/:workspace/projects/:project/environments/:namespace'), route('environment.html', false))
.when(UrlHelpers.join(context, '/Aggregate/overview'), route('addDataFile.html', false))
.otherwise("/workspaces");
.when("/data-manager", route('workspaces.html', false))
.when(UrlHelpers.join(context, 'Overview/data-type/all'), route('workspaces.html', false))
.when(UrlHelpers.join(context, 'Overview/data-type/financial'), route('workspaces.html', false))
.when(UrlHelpers.join(context, 'Overview/data-type/social-security'), route('workspaces.html', false))
.when(UrlHelpers.join(context, 'task'), route('apps.html', false))
.otherwise(context);
}]);
_module.run(['viewRegistry', 'ServiceRegistry', 'HawtioNav', 'KubernetesModel', '$templateCache', 'DataInfoModel',(viewRegistry, ServiceRegistry, HawtioNav, KubernetesModel, $templateCache, DataInfoModel) => {
_module.run(['viewRegistry', 'ServiceRegistry', 'HawtioNav', 'KubernetesModel', '$templateCache', (viewRegistry, ServiceRegistry, HawtioNav, KubernetesModel, $templateCache) => {
log.debug("Running");
viewRegistry['workspaces'] = Kubernetes.templatePath + 'layoutKubernetes.html';
viewRegistry['namespaces'] = Kubernetes.templatePath + 'layoutKubernetes.html';
var builder = HawtioNav.builder();
var workspaces = builder.id('workspaces')
.href(() => context)
.title(() => '查看')
.build();
/*
var workspaceOverview = builder.id('workspaces')
.href(() => UrlHelpers.join(context, 'overview'))
.title(() => 'Workspace')
.build();
*/
/* var dataadd = builder.id('dataadd')
.href(() => context)
.title(() => '汇总')
.build();
*/
var Aggregate = builder.id('Aggregate;')
var dmanagerTab = builder.id('dmanager')
.rank(200)
.href(() => context)
.title(() => '数据汇总')
//.isValid(() => !Core.isRemoteConnection())
.tabs(workspaces)
.title(() => '数据管理')
//.isValid(() => !Core.isRemoteConnection())
.build();
HawtioNav.add(Aggregate);
HawtioNav.add(dmanagerTab);
}]);
_module.filter('asTrustedHtml', ['$sce', function ($sce) {

File diff suppressed because it is too large Load Diff

@ -942,7 +942,7 @@ module Kubernetes {
var url = kubernetesUrlForKind(KubernetesApiURL, "ReplicationController", namespace, id);
$http.get(url).
success(function (data, status, headers, config) {
if (data) {
if (data) {
var desiredState = data.spec;
if (!desiredState) {
desiredState = {};
@ -1737,16 +1737,16 @@ module Kubernetes {
var client = Kubernetes.createKubernetesClient('replicationcontrollers','default');
var RCTemplate = new resourceRCTemplate();
var rcTemplate = RCTemplate.createRC(obj);
//console.log(rcTemplate);
console.log(JSON.stringify(rcTemplate));
client.put(rcTemplate, function(obj) {
//console.log("Created: ", obj);
console.log("Created: ", obj);
if (angular.isFunction(onCompleteFn)) {
onCompleteFn(obj);
}
});
}
export function connectOracle($http, $timeout, url, operation, rcName, delayTime){
export function connectOracle($http, $timeout, url, operation, rcName, delayTime){
$timeout(() => {
$http({
url: url,
@ -1847,4 +1847,17 @@ module Kubernetes {
return false;
}
}
export function replicasIsCreated (replicationcontrollers:Array<any>, name:string){
var result = false;
if( replicationcontrollers !=null || replicationcontrollers.length<=0){
for(var i=0; i<replicationcontrollers.length;i++){
if(getName(replicationcontrollers[i]) === name){
result = true;
break;
}
}
}
return result;
}
}

@ -26,9 +26,10 @@ module Kubernetes {
.when(UrlHelpers.join(context, 'pipelines'), route('pipelines.html', false))
.when(UrlHelpers.join(context, 'overview'), route('overview.html', true))
.when(context, {redirectTo: UrlHelpers.join(context, 'replicationControllers')});
console.log("===================");
console.log(context);
angular.forEach([context, "/workspaces/:workspace/projects/:project"], (context) => {
angular.forEach([context, "/workspaces/:workspace/projects/:project"], (context) => {
$routeProvider
.when(UrlHelpers.join(context, '/namespace/:namespace/podCreate'), route('podCreate.html', false))
.when(UrlHelpers.join(context, '/namespace/:namespace/podEdit/:id'), route('podEdit.html', false))

@ -83,34 +83,20 @@ module Kubernetes {
onClose: (result:boolean) => {
if (result) {
function deleteSelected(selected:Array<KubePod>, next:KubePod) {
if (next) {
log.debug("deleting: ", getName(next));
Kubernetes.resizeController($http, KubernetesApiURL, next, 0, () => {
log.debug("updated number of replicas");
if (next) {
Kubernetes.resizeController($http, KubernetesApiURL, next, 0, () => {
KubernetesReplicationControllers.delete({
id: getName(next)
}, undefined, () => {
log.debug("deleted: ", getName(next));
if(next.metadata.labels.style === "oracle"){
console.log("delete " + next.metadata.name);
Kubernetes.connectOracle($http, $timeout, "/cancelOracleConection", "delete", getName(next), 0);
}
}, undefined, () => {
if(next.metadata.labels.style === "oracle"){
Kubernetes.connectOracle($http, $timeout, "/java/console/api/cancelOracleConection", "delete", getName(next), 0);
}
deleteSelected(selected, selected.shift());
}, (error) => {
log.debug("Error deleting: ", error);
deleteSelected(selected, selected.shift());
});
});
/*KubernetesReplicationControllers.delete({
id: getName(next)
}, undefined, () => {
log.debug("deleted: ", getName(next));
deleteSelected(selected, selected.shift());
}, (error) => {
log.debug("Error deleting: ", error);
deleteSelected(selected, selected.shift());
});*/
}
}
deleteSelected(selected, selected.shift());
@ -126,45 +112,17 @@ module Kubernetes {
}).open();
}
$scope.createRCs= () => {
var xhr= new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState == 4) {//4表示数据已经调用完成
if (xhr.status == 200) {//HTTP的状态码
var obj=JSON.parse(xhr.responseText);
//console.log(obj.path);
var name = obj.name;
//console.log(name + "=====" +port);
var object = {
"name": name,
"labels": {
"name" : name
},
"path": obj.path,
"isTarget": "true"
}
console.log(object);
Kubernetes.createRC(object, (rc) =>{
$http({
url:'/xmlformserver',
method:'Post'
}).success(function(data,header,config,status){
if(data){
DataInfoModel.serverdata = data;
}
}).error(function(data,header,config,status){
console.log("error");
});
Kubernetes.connectOracle($http, $timeout, "/connectToOracle", "create", getName(rc), 0);
});
}else if(xhr.status == 403){
alert("两次创建oracle服务时间间隔需要超过2分钟!");
}else{
}
}
};
xhr.open("POST", "/oracleAppPath", false);//与服务器连接并发送
xhr.send(null);
$scope.createRCs= () => {
$http({
url: '/java/console/api/cancelOracleConection',
dataType: 'json',
method:'POST',
params:{param: "data"}
}).success(function(data,header,config,status){
console.log("success");
}).error(function(data,header,config,status){
//log.warn("Failed to connect " + connectParam + " " + data + " " + status);
});
}
$scope.stopPrompt = (selected) =>{
@ -182,9 +140,8 @@ module Kubernetes {
function stopSelected(selected:Array<KubePod>, next:KubePod) {
if (next) {
Kubernetes.resizeController($http, KubernetesApiURL, next, 0, () => {
if(next.metadata.labels.style === "oracle"){
console.log("stop " + next.metadata.name);
Kubernetes.connectOracle($http, $timeout, "/cancelOracleConection", "stop", getName(next), 0);
if(next.metadata.labels.style === "oracle"){
Kubernetes.connectOracle($http, $timeout, "/java/console/api/cancelOracleConection", "stop", getName(next), 0);
}
stopSelected(selected, selected.shift());
});
@ -209,7 +166,7 @@ module Kubernetes {
if(next.$replicas === 0)
Kubernetes.resizeController($http, KubernetesApiURL, next, 1, () => {
console.log("restart " + next.metadata.name);
Kubernetes.connectOracle($http, $timeout, "/connectToOracle", "reStart", getName(next), 0);
Kubernetes.connectOracle($http, $timeout, "/java/console/api/connectOracle", "reStart", getName(next), 0);
startSelected(selected, selected.shift());
});
}

@ -46,7 +46,7 @@ module Kubernetes {
export class resourceRCTemplate{
public image="s1:latest";
public image="oracle:utf8";
public names = ["admin","cfgtoollogs","checkpoints","diag","flash-recovery-area","oradata"];
public createRC(Obj){
@ -64,7 +64,8 @@ module Kubernetes {
"kind" : "ReplicationController",
"metadata" : {
"name" : Obj.name,
"labels" : labels
"labels" : labels,
"annotations": Obj.annotations
},
"spec" : {
replicas : Obj.replicas || 1,

@ -40,6 +40,18 @@ module Navigation {
return self;
});
_module.directive('hawtioRelativeHref', ['$location', ($location) => {
return {
restrict: 'A',
link: (scope, element, attr) => {
var targetPath = attr['hawtioRelativeHref'];
var targetHref = new URI($location.url());
targetHref.segment(targetPath);
element.attr('href', targetHref.toString());
}
}
}]);
_module.directive('viewportHeight', ['$window', '$document', ($window, $document) => {
return {
restrict: 'A',
@ -68,15 +80,15 @@ module Navigation {
return {
restrict: 'A',
link: (scope, element, attrs) => {
scope.HawtioSubTabs = HawtioSubTabs;
scope.$watchCollection('HawtioSubTabs.get()', (subTabConfig) => {
scope.tabs = HawtioSubTabs;
scope.$watchCollection('tabs.get()', (tabs) => {
// log.debug("subTabConfig: ", subTabConfig);
if (subTabConfig && subTabConfig.length > 0) {
if (tabs && tabs.length > 0) {
element.removeClass('hidden-nav');
//element.css({ 'margin-left': '' });
element.css({ 'margin-left': '' });
} else {
element.addClass('hidden-nav');
//element.css({ 'margin-left': 'auto' });
element.css({ 'margin-left': 'auto' });
}
});
}
@ -91,30 +103,31 @@ module Navigation {
replace: true,
template: `
<div class="nav-pf-vertical nav-pf-vertical-with-secondary-nav" ng-controller="Developer.NavBarController" ng-class="getClass()">
<ul class="list-group">
<li ng-repeat="subTab in subTabConfig" ng-show="isValid(subTab)"
<div class="list-group">
<div ng-repeat="subTab in subTabConfig" ng-show="true"
class="list-group-item {{subTab.active ? 'active' : ''}}"
title="{{subTab.title}}">
<a ng-hide="subTab.template" href="{{subTab.href}}">
<span ng-show="subTab.class" ng-class="subTab.class"></span>
<img ng-show="subTab.icon" ng-src="{{subTab.icon}}" style="max-width: 16px; margin-right: 13px;">
<img ng-show="subTab.icon" ng-src="{{subTab.icon}}">
{{subTab.label}}
</a>
<div ng-show="subTab.template" compile="subTab.template"></div>
</li>
</ul>
</div>
</>
</div>
`,
link: (scope, element, attrs) => {
if (!initialized) {
try {
(<any>$)().setupVerticalNavigation(false);
//(<any>$)().setupVerticalNavigation(false);
} catch (err) {
// ignore if we haven't loaded patternfly
}
initialized = true;
}
scope.HawtioSubTabs = HawtioSubTabs;
var collapsed = false;
scope.getClass = () => {
//log.debug("My class: ", element.attr('class'));
@ -131,31 +144,104 @@ module Navigation {
});
scope.$watch('HawtioSubTabs.get()', (subTabConfig) => {
scope.subTabConfig = subTabConfig;
});
}
};
}]);
_module.directive('hawtioBreadcrumbsOutlet', ['HawtioBreadcrumbs', (HawtioBreadcrumbs) => {
_module.directive('hawtioBreadcrumbsOutlet', ['HawtioBreadcrumbs', 'HawtioSubTabs', (HawtioBreadcrumbs, HawtioSubTabs) => {
return {
restrict: 'E',
scope: {},
template: `
<div ng-show="breadcrumbConfig" ng-controller="Developer.NavBarController">
<div class="nav navbar-nav nav-breadcrumb nav-breadcrumbs" ng-show="breadcrumbConfig" ng-controller="Developer.NavBarController">
<ol class="breadcrumb">
<div class = 'br'><br></div>
<li ng-repeat="breadcrumb in breadcrumbConfig" ng-show="isValid(breadcrumb)"
<li ng-repeat="breadcrumb in breadcrumbConfig" ng-show="isValid(breadcrumb) && label(breadcrumb)"
class="{{breadcrumb.active ? 'active' : ''}}"
ng-class="$last ? 'dropdown' : ''"
title="{{breadcrumb.title}}">
<a ng-show="breadcrumb.href && !breadcrumb.active" href="{{breadcrumb.href}}">{{breadcrumb.label}}</a>
<span ng-hide="breadcrumb.href && !breadcrumb.active">{{breadcrumb.label}}</span>
<a ng-show="breadcrumb.href" href="{{breadcrumb.href}}">{{label(breadcrumb)}}</a>
<span ng-hide="breadcrumb.href">{{label(breadcrumb)}}</span>
</li>
<li ng-show="pageTitle">
<span ng-bind="pageTitle"></span>
</li>
</ol>
</div>
`,
link: (scope, element, attrs) => {
link: (scope, element, attrs) => {
scope.breadcrumbs = HawtioBreadcrumbs;
scope.tabs = HawtioSubTabs;
scope.$watchCollection('breadcrumbs.get()', (breadcrumbConfig) => {
scope.breadcrumbConfig = breadcrumbConfig;
scope.breadcrumbConfig = breadcrumbConfig;
});
scope.$watchCollection('tabs.get()', (tabs) => {
var active = _.find(tabs, (tab:any) => tab.active);
if (active) {
scope.pageTitle = active.label;
} else {
scope.pageTitle = undefined;
}
});
}
};
}]);
_module.directive('platformSubTabsOutlet', ['HawtioSubTabs', (HawtioSubTabs) => {
var initialized = false;
return {
restrict: 'AE',
replace: true,
template: `
<div class="nav-pf-vertical nav-pf-vertical-with-secondary-nav" ng-controller="Developer.NavBarController" ng-class="getClass()">
<ul class="navbar-lf-menu">
<li ng-repeat="subTab in subTabConfig">
<div class="expandable closed" ng-show="subTab.items.length">
<div title="The title" class="title">
<i class="expandable-indicator"><span style="font-size:12px;color:red">{{subTab.label}}</i>
</div>
<ul class="expandable-body well">
<li ng-repeat="item in subTab.items">
<a href="{{item.href}}">{{item.label}}</a>
</li>
</ul>
</div>
<div ng-hide="subTab.items.length">
<a href="{{subTab.href}}">{{subTab.label}}</a>
</div>
</li>
</ul>
</div>
`,
link: (scope, element, attrs) => {
if (!initialized) {
try {
//(<any>$)().setupVerticalNavigation(false);
} catch (err) {
// ignore if we haven't loaded patternfly
}
initialized = true;
}
scope.HawtioSubTabs = HawtioSubTabs;
var collapsed = false;
scope.getClass = () => {
//log.debug("My class: ", element.attr('class'));
if (!scope.subTabConfig || !scope.subTabConfig.length) {
return 'hidden';
}
if (collapsed) {
return 'collapsed';
}
return '';
}
scope.$on('hawtioCollapseNav', () => {
collapsed = !collapsed;
});
scope.$watch('HawtioSubTabs.get()', (subTabConfig) => {
scope.subTabConfig = subTabConfig;
});
}
};

Loading…
Cancel
Save