{preview.text ?? ''}
- hi
, diff --git a/public/app/features/alerting/unified/rule-editor/RuleEditorRecordingRule.test.tsx b/public/app/features/alerting/unified/rule-editor/RuleEditorRecordingRule.test.tsx index 8e979828aa9..29c1f926dbe 100644 --- a/public/app/features/alerting/unified/rule-editor/RuleEditorRecordingRule.test.tsx +++ b/public/app/features/alerting/unified/rule-editor/RuleEditorRecordingRule.test.tsx @@ -39,8 +39,6 @@ jest.mock('app/core/components/AppChrome/AppChromeUpdate', () => ({ AppChromeUpdate: ({ actions }: { actions: React.ReactNode }) =>hi
, diff --git a/public/app/features/alerting/unified/utils/k8s/utils.ts b/public/app/features/alerting/unified/utils/k8s/utils.ts index 69444f02b2c..1a99f52b522 100644 --- a/public/app/features/alerting/unified/utils/k8s/utils.ts +++ b/public/app/features/alerting/unified/utils/k8s/utils.ts @@ -1,4 +1,3 @@ -import { config } from '@grafana/runtime'; import { IoK8SApimachineryPkgApisMetaV1ObjectMeta } from 'app/features/alerting/unified/openapi/receiversApi.gen'; import { GRAFANA_RULES_SOURCE_NAME } from 'app/features/alerting/unified/utils/datasource'; import { K8sAnnotations, PROVENANCE_NONE } from 'app/features/alerting/unified/utils/k8s/constants'; @@ -10,8 +9,7 @@ import { K8sAnnotations, PROVENANCE_NONE } from 'app/features/alerting/unified/u * and the `alertingApiServer` feature toggle being enabled */ export const shouldUseK8sApi = (alertmanager?: string) => { - const featureToggleEnabled = config.featureToggles.alertingApiServer; - return featureToggleEnabled && alertmanager === GRAFANA_RULES_SOURCE_NAME; + return alertmanager === GRAFANA_RULES_SOURCE_NAME; }; type EntityToCheck = { diff --git a/public/app/features/alerting/unified/utils/rules.ts b/public/app/features/alerting/unified/utils/rules.ts index 88bc70a2cb8..13aa9982983 100644 --- a/public/app/features/alerting/unified/utils/rules.ts +++ b/public/app/features/alerting/unified/utils/rules.ts @@ -293,7 +293,13 @@ export const flattenCombinedRules = (rules: CombinedRuleNamespace[]) => { groups.forEach(({ name: groupName, rules }) => { rules.forEach((rule) => { if (rule.promRule && isAlertingRule(rule.promRule)) { - acc.push({ dataSourceName: getRulesSourceName(rulesSource), namespaceName, groupName, ...rule }); + acc.push({ + dataSourceName: getRulesSourceName(rulesSource), + namespaceName, + groupName, + ...rule, + namespace: { ...rule.namespace, uid: rule.promRule.folderUid }, + }); } }); }); diff --git a/public/app/features/canvas/runtime/element.tsx b/public/app/features/canvas/runtime/element.tsx index f61e9d94742..f71ce0f1b9e 100644 --- a/public/app/features/canvas/runtime/element.tsx +++ b/public/app/features/canvas/runtime/element.tsx @@ -334,8 +334,8 @@ export class ElementState implements LayerElement { placement.height = height; break; case VerticalConstraint.Scale: - placement.top = (relativeTop / (parentContainer?.height ?? height)) * 100; - placement.bottom = (relativeBottom / (parentContainer?.height ?? height)) * 100; + placement.top = (relativeTop / (parentContainer?.height ?? height)) * 100 * transformScale; + placement.bottom = (relativeBottom / (parentContainer?.height ?? height)) * 100 * transformScale; break; } @@ -360,8 +360,8 @@ export class ElementState implements LayerElement { placement.width = width; break; case HorizontalConstraint.Scale: - placement.left = (relativeLeft / (parentContainer?.width ?? width)) * 100; - placement.right = (relativeRight / (parentContainer?.width ?? width)) * 100; + placement.left = (relativeLeft / (parentContainer?.width ?? width)) * 100 * transformScale; + placement.right = (relativeRight / (parentContainer?.width ?? width)) * 100 * transformScale; break; } diff --git a/public/app/features/commandPalette/actions/staticActions.ts b/public/app/features/commandPalette/actions/staticActions.ts index ca70c8f7c1f..5dd1415a822 100644 --- a/public/app/features/commandPalette/actions/staticActions.ts +++ b/public/app/features/commandPalette/actions/staticActions.ts @@ -1,5 +1,6 @@ import { NavModelItem } from '@grafana/data'; import { enrichHelpItem } from 'app/core/components/AppChrome/MegaMenu/utils'; +import { performInviteUserClick, shouldRenderInviteUserButton } from 'app/core/components/InviteUserButton/utils'; import { t } from 'app/core/internationalization'; import { changeTheme } from 'app/core/services/theme'; @@ -99,5 +100,17 @@ export default (navBarTree: NavModelItem[], extensionActions: CommandPaletteActi const navBarActions = navTreeToActions(navBarTree); + if (shouldRenderInviteUserButton) { + navBarActions.push({ + id: 'invite-user', + name: t('navigation.invite-user.invite-new-member-button', 'Invite new member'), + section: t('command-palette.section.actions', 'Actions'), + priority: ACTIONS_PRIORITY, + perform: () => { + performInviteUserClick('command_palette_actions', 'invite-user-command-palette'); + }, + }); + } + return [...globalActions, ...extensionActions, ...navBarActions]; }; diff --git a/public/app/features/connections/components/AdvisorRedirectNotice/AdvisorRedirectNotice.test.tsx b/public/app/features/connections/components/AdvisorRedirectNotice/AdvisorRedirectNotice.test.tsx new file mode 100644 index 00000000000..f6b530d54c8 --- /dev/null +++ b/public/app/features/connections/components/AdvisorRedirectNotice/AdvisorRedirectNotice.test.tsx @@ -0,0 +1,74 @@ +import { render, screen, waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; + +import { config } from '@grafana/runtime'; +import { contextSrv } from 'app/core/core'; + +import { AdvisorRedirectNotice } from './AdvisorRedirectNotice'; + +const originalFeatureToggleValue = config.featureToggles.grafanaAdvisor; +jest.mock('@grafana/runtime/internal', () => ({ + UserStorage: jest.fn().mockImplementation(() => ({ + getItem: jest.fn().mockResolvedValue('true'), + setItem: jest.fn().mockResolvedValue(undefined), + })), +})); + +describe('AdvisorRedirectNotice', () => { + beforeEach(() => { + config.featureToggles.grafanaAdvisor = true; + contextSrv.isGrafanaAdmin = true; + }); + + afterEach(() => { + jest.clearAllMocks(); + config.featureToggles.grafanaAdvisor = originalFeatureToggleValue; + }); + + it('should not render when user is not admin', async () => { + contextSrv.isGrafanaAdmin = false; + render(
+