diff --git a/pkg/api/index.go b/pkg/api/index.go
index 23ba7aedc23..aef0bc98fb1 100644
--- a/pkg/api/index.go
+++ b/pkg/api/index.go
@@ -133,14 +133,6 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
}
data.NavTree = append(data.NavTree, profileNode)
- } else {
- data.NavTree = append(data.NavTree, &dtos.NavLink{
- Text: "Sign in",
- Id: "sign-in",
- Icon: "fa fa-fw fa-sign-in",
- Url: setting.AppSubUrl + "/login",
- HideFromMenu: true,
- })
}
if setting.AlertingEnabled && (c.OrgRole == m.ROLE_ADMIN || c.OrgRole == m.ROLE_EDITOR) {
diff --git a/public/app/core/components/help/help.html b/public/app/core/components/help/help.html
index c07d57a0ffc..45faa560e40 100644
--- a/public/app/core/components/help/help.html
+++ b/public/app/core/components/help/help.html
@@ -4,15 +4,6 @@
Shortcuts
-
-
-
-
-
-
-
-
-
diff --git a/public/app/core/components/org_switcher.ts b/public/app/core/components/org_switcher.ts
new file mode 100644
index 00000000000..fe8a7a3412c
--- /dev/null
+++ b/public/app/core/components/org_switcher.ts
@@ -0,0 +1,82 @@
+///
+
+import coreModule from 'app/core/core_module';
+import config from 'app/core/config';
+import {contextSrv} from 'app/core/services/context_srv';
+
+const template = `
+
+
+
+
`;
+
+export class OrgSwitchCtrl {
+ orgs: any[];
+ currentOrgId: any;
+
+ /** @ngInject */
+ constructor(private backendSrv) {
+ this.currentOrgId = contextSrv.user.orgId;
+ this.getUserOrgs();
+ }
+
+ getUserOrgs() {
+ this.backendSrv.get('/api/user/orgs').then(orgs => {
+ this.orgs = orgs;
+ });
+ }
+
+ setUsingOrg(org) {
+ this.backendSrv.post('/api/user/using/' + org.orgId).then(() => {
+ window.location.href = window.location.href;
+ });
+ }
+}
+
+export function orgSwitcher() {
+ return {
+ restrict: 'E',
+ template: template,
+ controller: OrgSwitchCtrl,
+ bindToController: true,
+ controllerAs: 'ctrl',
+ scope: {dismiss: "&"},
+ };
+}
+
+coreModule.directive('orgSwitcher', orgSwitcher);
diff --git a/public/app/core/components/sidemenu/sidemenu.html b/public/app/core/components/sidemenu/sidemenu.html
index 6dd08687743..1bbba2a2124 100644
--- a/public/app/core/components/sidemenu/sidemenu.html
+++ b/public/app/core/components/sidemenu/sidemenu.html
@@ -28,6 +28,16 @@
diff --git a/public/app/core/components/sidemenu/sidemenu.ts b/public/app/core/components/sidemenu/sidemenu.ts
index 2172723763a..0c4bb881279 100644
--- a/public/app/core/components/sidemenu/sidemenu.ts
+++ b/public/app/core/components/sidemenu/sidemenu.ts
@@ -9,18 +9,13 @@ export class SideMenuCtrl {
user: any;
mainLinks: any;
bottomNav: any;
- appSubUrl: string;
loginUrl: string;
- orgFilter: string;
- orgItems: any;
- orgs: any;
- maxShownOrgs: number;
+ isSignedIn: boolean;
/** @ngInject */
constructor(private $scope, private $rootScope, private $location, private contextSrv, private backendSrv, private $element) {
+ this.isSignedIn = contextSrv.isSignedIn;
this.user = contextSrv.user;
- this.appSubUrl = config.appSubUrl;
- this.maxShownOrgs = 10;
this.mainLinks = _.filter(config.bootData.navTree, item => !item.hideFromMenu);
this.bottomNav = _.filter(config.bootData.navTree, item => item.hideFromMenu);
this.loginUrl = 'login?redirect=' + encodeURIComponent(this.$location.path());
@@ -38,17 +33,13 @@ export class SideMenuCtrl {
}
this.loginUrl = 'login?redirect=' + encodeURIComponent(this.$location.path());
});
-
- this.orgFilter = '';
}
- getUrl(url) {
- return config.appSubUrl + url;
- }
-
- search() {
- this.$rootScope.appEvent('show-dash-search');
- }
+ switchOrg() {
+ this.$rootScope.appEvent('show-modal', {
+ templateHtml: '