Expand check
This commit is contained in:
@@ -29,6 +29,5 @@ export async function initOpenFeature() {
|
||||
}
|
||||
|
||||
export function evaluateBooleanFlag(flagName: FeatureFlagName, defaultValue: boolean): boolean {
|
||||
console.log('deets', OpenFeature.getClient().getBooleanDetails('recentlyViewedDashboards', false));
|
||||
return OpenFeature.getClient().getBooleanValue(flagName, defaultValue);
|
||||
}
|
||||
|
||||
@@ -55,6 +55,13 @@ jest.mock('@grafana/runtime', () => {
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('@grafana/runtime/internal', () => {
|
||||
return {
|
||||
...jest.requireActual('@grafana/runtime/internal'),
|
||||
evaluateBooleanFlag: jest.fn().mockReturnValue(false),
|
||||
};
|
||||
});
|
||||
|
||||
function render(ui: Parameters<typeof testRender>[0], options: Parameters<typeof testRender>[1] = {}) {
|
||||
return testRender(ui, {
|
||||
preloadedState: {
|
||||
@@ -128,6 +135,7 @@ describe('browse-dashboards BrowseDashboardsPage', () => {
|
||||
const previousFlag = config.featureToggles.restoreDashboards;
|
||||
config.featureToggles.restoreDashboards = true;
|
||||
mockPermissions.canDeleteDashboards = false;
|
||||
jest.spyOn(contextSrv, 'hasPermission').mockReturnValue(false);
|
||||
|
||||
render(<BrowseDashboardsPage queryParams={{}} />);
|
||||
await screen.findByPlaceholderText('Search for dashboards and folders');
|
||||
|
||||
@@ -10,9 +10,11 @@ import { LinkButton, FilterInput, useStyles2, Text, Stack } from '@grafana/ui';
|
||||
import { useGetFolderQueryFacade, useUpdateFolder } from 'app/api/clients/folder/v1beta1/hooks';
|
||||
import { Page } from 'app/core/components/Page/Page';
|
||||
import { getConfig } from 'app/core/config';
|
||||
import { AccessControlAction } from 'app/types/accessControl';
|
||||
import { useDispatch } from 'app/types/store';
|
||||
|
||||
import { FolderRepo } from '../../core/components/NestedFolderPicker/FolderRepo';
|
||||
import { contextSrv } from '../../core/services/context_srv';
|
||||
import { ManagerKind } from '../apiserver/types';
|
||||
import { TemplateDashboardModal } from '../dashboard/dashgrid/DashboardLibrary/TemplateDashboardModal';
|
||||
import { buildNavModel, getDashboardsTabID } from '../folders/state/navModel';
|
||||
@@ -153,15 +155,16 @@ const BrowseDashboardsPage = memo(({ queryParams }: { queryParams: Record<string
|
||||
renderTitle={renderTitle}
|
||||
actions={
|
||||
<>
|
||||
{config.featureToggles.restoreDashboards && canDeleteDashboards && (
|
||||
<LinkButton
|
||||
variant="secondary"
|
||||
href={getConfig().appSubUrl + '/dashboard/recently-deleted'}
|
||||
onClick={handleButtonClickToRecentlyDeleted}
|
||||
>
|
||||
<Trans i18nKey="browse-dashboards.actions.button-to-recently-deleted">Recently deleted</Trans>
|
||||
</LinkButton>
|
||||
)}
|
||||
{config.featureToggles.restoreDashboards &&
|
||||
(canDeleteDashboards || contextSrv.hasPermission(AccessControlAction.DashboardsDelete)) && (
|
||||
<LinkButton
|
||||
variant="secondary"
|
||||
href={getConfig().appSubUrl + '/dashboard/recently-deleted'}
|
||||
onClick={handleButtonClickToRecentlyDeleted}
|
||||
>
|
||||
<Trans i18nKey="browse-dashboards.actions.button-to-recently-deleted">Recently deleted</Trans>
|
||||
</LinkButton>
|
||||
)}
|
||||
{folderDTO && <FolderActionsButton folder={folderDTO} repoType={repoType} isReadOnlyRepo={isReadOnlyRepo} />}
|
||||
{(canCreateDashboards || canCreateFolders) && (
|
||||
<CreateNewButton
|
||||
|
||||
Reference in New Issue
Block a user