Commit aaf4e760 by Patrick O'Carroll Committed by Torkel Ödegaard

new dashboard is now hidden from viewer, fixes #10815 (#10854)

* new dashboard is now hidden from viewer, fixes #10815

* changed orgRole to isEditor

* removed unused import

* added contextSrv mock to search.jest
parent 42af87b7
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</tag-filter> </tag-filter>
</div> </div>
<div class="search-filter-box"> <div class="search-filter-box" ng-if="ctrl.isEditor">
<a href="dashboard/new" class="search-filter-box-link"> <a href="dashboard/new" class="search-filter-box-link">
<i class="gicon gicon-dashboard-new"></i> New dashboard <i class="gicon gicon-dashboard-new"></i> New dashboard
</a> </a>
......
import _ from 'lodash'; import _ from 'lodash';
import coreModule from '../../core_module'; import coreModule from '../../core_module';
import { SearchSrv } from 'app/core/services/search_srv'; import { SearchSrv } from 'app/core/services/search_srv';
import { contextSrv } from 'app/core/services/context_srv';
import appEvents from 'app/core/app_events'; import appEvents from 'app/core/app_events';
export class SearchCtrl { export class SearchCtrl {
...@@ -15,6 +16,7 @@ export class SearchCtrl { ...@@ -15,6 +16,7 @@ export class SearchCtrl {
ignoreClose: any; ignoreClose: any;
isLoading: boolean; isLoading: boolean;
initialFolderFilterTitle: string; initialFolderFilterTitle: string;
isEditor: string;
/** @ngInject */ /** @ngInject */
constructor($scope, private $location, private $timeout, private searchSrv: SearchSrv) { constructor($scope, private $location, private $timeout, private searchSrv: SearchSrv) {
...@@ -24,6 +26,7 @@ export class SearchCtrl { ...@@ -24,6 +26,7 @@ export class SearchCtrl {
this.initialFolderFilterTitle = 'All'; this.initialFolderFilterTitle = 'All';
this.getTags = this.getTags.bind(this); this.getTags = this.getTags.bind(this);
this.onTagSelect = this.onTagSelect.bind(this); this.onTagSelect = this.onTagSelect.bind(this);
this.isEditor = contextSrv.isEditor;
} }
closeSearch() { closeSearch() {
......
import { SearchCtrl } from '../components/search/search'; import { SearchCtrl } from '../components/search/search';
import { SearchSrv } from '../services/search_srv'; import { SearchSrv } from '../services/search_srv';
jest.mock('app/core/services/context_srv', () => ({
contextSrv: {
user: { orgId: 1 },
},
}));
describe('SearchCtrl', () => { describe('SearchCtrl', () => {
const searchSrvStub = { const searchSrvStub = {
search: (options: any) => {}, search: (options: any) => {},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment