Skip to content

Commit f1ec8c5

Browse files
MB-12222: tab name specified by user
Change-Id: I13b4fed07e2c58457db854fe78b33d9bc746a3c0 Reviewed-on: http://review.couchbase.org/46886 Reviewed-by: Pavel Blagodov <[email protected]> Tested-by: Pavel Blagodov <[email protected]>
1 parent 18fbdb5 commit f1ec8c5

File tree

6 files changed

+35
-13
lines changed

6 files changed

+35
-13
lines changed

priv/public/angular/app/app.css

+6-2
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ a.dynamic_disabled{text-decoration:none;cursor:default;}
9090
#mainContainer {position:relative;width:1060px;left:12%;margin-top:15px;padding:0 0 220px;}
9191
.main_holder {position:relative; margin:auto; left:0px !important;}
9292
.cnt_holder {width:960px; position:relative; margin: 0 auto;}
93-
.log_wrap {overflow: hidden;}
93+
.log_wrap {float: left;}
9494
.log_wrap a {display: block; width: 109px; height: 60px; background: url(/images/couchbase_small_2.0.2.png) no-repeat 50% 50%;}
95-
95+
.tab_name {overflow: hidden; font-size: 30px; font-weight: normal; line-height: 60px; text-align: center;}
9696
.page-header {background:url('/images/header_bg.png') 0 bottom repeat-x;height:60px;}
9797

9898
#headerNav {clear:both;height:50px;background:url('/images/navigation_bg.png') repeat-x;}
@@ -1453,3 +1453,7 @@ input[type=number].size {width:4em;}
14531453
.global_alerts_container {width: 1060px; margin: 0 auto;}
14541454

14551455
#js_collect_information .controls {text-align: right; height: 30px; padding-right: 10px; margin-top: -40px; padding-bottom: 10px; margin-left: 300px;}
1456+
1457+
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
1458+
display: none !important;
1459+
}

priv/public/angular/app/app_controller.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
angular.module('app').controller('appController',
2-
function ($scope, $templateCache, $http, $modal, $rootScope, $location, pools) {
2+
function ($scope, $templateCache, $http, $modal, $rootScope, $location, pools, parseVersionFilter) {
33

44
_.each(angularTemplatesList, function (url) {
55
$http.get("/angular/" + url, {cache: $templateCache});
66
});
77

8-
$scope.implementationVersion = pools.implementationVersion;
8+
$rootScope.implementationVersion = pools.implementationVersion;
99

10+
$scope.$watchGroup(['implementationVersion', 'tabName'], function (values) {
11+
var version = parseVersionFilter(values[0]);
12+
var tabName = values[1];
13+
$rootScope.mnTitle = (version ? '(' + version[0] + ')' : '') + (tabName ? '-' + tabName : '');
14+
});
1015
$scope.showAboutDialog = function () {
1116
$modal.open({
1217
templateUrl: '/angular/app/mn_about_dialog.html',

priv/public/angular/app/components/mn_filters.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,11 @@ angular.module('mnFilters')
265265
};
266266
})
267267

268-
.filter('mnPrettyVersion', function () {
269-
function parseVersion(str) {
268+
.filter('parseVersion', function () {
269+
return function (str) {
270+
if (!str) {
271+
return;
272+
}
270273
// Expected string format:
271274
// {release version}-{build #}-{Release type or SHA}-{enterprise / community}
272275
// Example: "1.8.0-9-ga083a1e-enterprise"
@@ -281,12 +284,15 @@ angular.module('mnFilters')
281284
a[3] = (a[3] && (a[3].substr(0, 1).toUpperCase() + a[3].substr(1))) || "DEV";
282285
return a; // Example result: ["1.8.0-9", "9", "ga083a1e", "Enterprise"]
283286
}
287+
})
288+
289+
.filter('mnPrettyVersion', function (parseVersionFilter) {
284290

285291
return function (str, full) {
286292
if (!str) {
287293
return;
288294
}
289-
var a = parseVersion(str);
295+
var a = parseVersionFilter(str);
290296
// Example default result: "1.8.0-7 Enterprise Edition (build-7)"
291297
// Example full result: "1.8.0-7 Enterprise Edition (build-7-g35c9cdd)"
292298
var suffix = "";

priv/public/angular/app/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!doctype html>
22
<html data-ng-app="app">
33
<head>
4-
<title>Couhbase Console</title>
4+
<title>Couchbase Console {{mnTitle}}</title>
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
66
<link rel="stylesheet" type="text/css" href="app.css">
77
<link rel="stylesheet" type="text/css" href="template/modal/modal.css">

priv/public/angular/app/mn_admin/mn_admin.html

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<div class="log_wrap">
2525
<a href="/index.html"></a>
2626
</div>
27+
<div class="tab_name ellipsis" id="js_tab_name" title="{{tabName}}">{{tabName}}</div>
2728
<div id="global_progress" class="closed disable_toggle">
2829
<i class="toggle">i</i>
2930
<ul id="global_progress_container"></ul>

priv/public/angular/app/mn_admin/mn_admin_controller.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
angular.module('mnAdmin').controller('mnAdminController',
2-
function ($scope, mnHelper, mnAuthService, tasks, mnTasksDetails, mnAlertsService) {
3-
2+
function ($scope, $rootScope, $q, mnHelper, mnAuthService, tasks, mnTasksDetails, mnAlertsService, mnPoolDefault) {
43
$scope.alerts = mnAlertsService.alerts;
54
$scope.closeAlert = mnAlertsService.closeAlert;
65

6+
77
$scope.logout = function () {
88
mnAuthService.logout();
99
};
1010

11-
function applyTasks(tasks) {
12-
$scope.tasks = tasks;
11+
function applyTasks(resp) {
12+
$scope.tasks = resp[0];
13+
$rootScope.tabName = resp[1] && resp[1].clusterName;
1314
}
1415

1516
applyTasks(tasks);
1617

1718
mnHelper.setupLongPolling({
18-
methodToCall: mnTasksDetails.getFresh,
19+
methodToCall: function () {
20+
return $q.all([
21+
mnTasksDetails.getFresh(),
22+
mnPoolDefault.getFresh()
23+
]);
24+
},
1925
scope: $scope,
2026
onUpdate: applyTasks
2127
});

0 commit comments

Comments
 (0)