aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/nav/global
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-08-24 13:50:18 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-08-26 10:12:03 +0200
commit223bcb955ba554be354f6b4b1ca0c1acb9431d66 (patch)
treec055f39d1cf688974d275877c5ff07490c32295f /server/sonar-web/src/main/js/apps/nav/global
parent4fa812ee4cb69d00e761b7887fdd30820d6748a9 (diff)
downloadsonarqube-223bcb955ba554be354f6b4b1ca0c1acb9431d66.tar.gz
sonarqube-223bcb955ba554be354f6b4b1ca0c1acb9431d66.zip
use the single web app
Diffstat (limited to 'server/sonar-web/src/main/js/apps/nav/global')
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx2
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx5
-rw-r--r--server/sonar-web/src/main/js/apps/nav/global/search-view.js39
3 files changed, 24 insertions, 22 deletions
diff --git a/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx b/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx
index 6249b8b11fb..1b945c62fcd 100644
--- a/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx
+++ b/server/sonar-web/src/main/js/apps/nav/global/global-nav-menu.jsx
@@ -91,7 +91,7 @@ export default React.createClass({
},
renderAdministrationLink() {
- if (!window.SS.isUserAdmin) {
+ if (!this.props.user.isAdmin) {
return null;
}
const url = `${window.baseUrl}/settings`;
diff --git a/server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx b/server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx
index d07c9a4d201..64c913461f1 100644
--- a/server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx
+++ b/server/sonar-web/src/main/js/apps/nav/global/global-nav-user.jsx
@@ -1,5 +1,6 @@
import React from 'react';
import Avatar from 'components/shared/avatar';
+import RecentHistory from '../../../libs/recent-history';
export default React.createClass({
renderAuthenticated() {
@@ -38,9 +39,7 @@ export default React.createClass({
handleLogout(e) {
e.preventDefault();
- if (window.sonarRecentHistory) {
- window.sonarRecentHistory.clear();
- }
+ RecentHistory.clear();
const logoutUrl = `${window.baseUrl}/sessions/logout`;
window.location = logoutUrl;
},
diff --git a/server/sonar-web/src/main/js/apps/nav/global/search-view.js b/server/sonar-web/src/main/js/apps/nav/global/search-view.js
index 233a1dc5f29..ccfe575526b 100644
--- a/server/sonar-web/src/main/js/apps/nav/global/search-view.js
+++ b/server/sonar-web/src/main/js/apps/nav/global/search-view.js
@@ -1,7 +1,9 @@
define([
+ 'backbone',
+ 'backbone.marionette',
'components/common/selectable-collection-view',
'../templates'
-], function (SelectableCollectionView) {
+], function (Backbone, Marionette, SelectableCollectionView) {
var $ = jQuery,
@@ -120,7 +122,7 @@ define([
that.favorite = r.map(function (f) {
var isFile = ['FIL', 'UTS'].indexOf(f.qualifier) !== -1;
return {
- url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + dashboardParameters(true),
+ url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + window.dashboardParameters(true),
name: isFile ? window.collapsedDirFromPath(f.lname) + window.fileFromPath(f.lname) : f.name,
icon: 'favorite'
};
@@ -133,19 +135,20 @@ define([
var recentHistory = JSON.parse(localStorage.getItem('sonar_recent_history')),
history = (recentHistory || []).map(function (historyItem, index) {
return {
- url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) + dashboardParameters(true),
+ url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) +
+ window.dashboardParameters(true),
name: historyItem.name,
q: historyItem.icon,
- extra: index === 0 ? t('browsed_recently') : null
+ extra: index === 0 ? window.t('browsed_recently') : null
};
}),
favorite = _.first(this.favorite, 6).map(function (f, index) {
- return _.extend(f, { extra: index === 0 ? t('favorite') : null });
+ return _.extend(f, { extra: index === 0 ? window.t('favorite') : null });
}),
qualifiers = this.model.get('qualifiers').map(function (q, index) {
return {
url: baseUrl + '/all_projects?qualifier=' + encodeURIComponent(q),
- name: t('qualifiers.all', q),
+ name: window.t('qualifiers.all', q),
extra: index === 0 ? '' : null
};
});
@@ -155,7 +158,7 @@ define([
search: function (q) {
if (q.length < 2) {
this.resetResultsToDefault();
- return;
+ return $.Deferred().resolve().promise();
}
var that = this,
url = baseUrl + '/api/components/suggestions',
@@ -167,7 +170,7 @@ define([
collection.push(_.extend(item, {
q: domain.q,
extra: index === 0 ? domain.name : null,
- url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + dashboardParameters(true)
+ url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + window.dashboardParameters(true)
}));
});
});
@@ -182,22 +185,22 @@ define([
getNavigationFindings: function (q) {
var DEFAULT_ITEMS = [
- { name: t('issues.page'), url: baseUrl + '/issues/search' },
- { name: t('layout.measures'), url: baseUrl + '/measures/search?qualifiers[]=TRK' },
- { name: t('coding_rules.page'), url: baseUrl + '/coding_rules' },
- { name: t('quality_profiles.page'), url: baseUrl + '/profiles' },
- { name: t('quality_gates.page'), url: baseUrl + '/quality_gates' },
- { name: t('comparison_global.page'), url: baseUrl + '/comparison' }
+ { name: window.t('issues.page'), url: baseUrl + '/issues/search' },
+ { name: window.t('layout.measures'), url: baseUrl + '/measures/search?qualifiers[]=TRK' },
+ { name: window.t('coding_rules.page'), url: baseUrl + '/coding_rules' },
+ { name: window.t('quality_profiles.page'), url: baseUrl + '/profiles' },
+ { name: window.t('quality_gates.page'), url: baseUrl + '/quality_gates' },
+ { name: window.t('comparison_global.page'), url: baseUrl + '/comparison' }
],
customItems = [];
if (window.SS.isUserAdmin) {
- customItems.push({ name: t('layout.settings'), url: baseUrl + '/settings' });
+ customItems.push({ name: window.t('layout.settings'), url: baseUrl + '/settings' });
}
var findings = [].concat(DEFAULT_ITEMS, customItems).filter(function (f) {
return f.name.match(new RegExp(q, 'i'));
});
if (findings.length > 0) {
- findings[0].extra = t('navigation');
+ findings[0].extra = window.t('navigation');
}
return _.first(findings, 6);
},
@@ -211,7 +214,7 @@ define([
return f.name.match(new RegExp(q, 'i'));
});
if (findings.length > 0) {
- findings[0].extra = t('dashboard.global_dashboards');
+ findings[0].extra = window.t('dashboard.global_dashboards');
}
return _.first(findings, 6);
},
@@ -221,7 +224,7 @@ define([
return f.name.match(new RegExp(q, 'i'));
});
if (findings.length > 0) {
- findings[0].extra = t('favorite');
+ findings[0].extra = window.t('favorite');
}
return _.first(findings, 6);
}