mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* new dashboard is now hidden from viewer, fixes #10815 * changed orgRole to isEditor * removed unused import * added contextSrv mock to search.jest
This commit is contained in:
parent
42af87b7c9
commit
aaf4e760c6
@ -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>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
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 {
|
|||||||
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 {
|
|||||||
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() {
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
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) => {},
|
||||||
|
Loading…
Reference in New Issue
Block a user