Skip to content

Commit

Permalink
Chore: undo rollback to get main back on track (#1035)
Browse files Browse the repository at this point in the history
* Revert "chore(main): release 1.16.11 (#1022)"

This reverts commit b9d63f5.

* Revert "Fix: Revert to v1.16.9 (#1027)"

This reverts commit 51e4d55.

* fix: set correct versions
  • Loading branch information
VikaCep authored Jan 6, 2025
1 parent b9d63f5 commit e287f10
Show file tree
Hide file tree
Showing 96 changed files with 1,396 additions and 1,215 deletions.
21 changes: 0 additions & 21 deletions .release-it.js

This file was deleted.

1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

## [1.16.11](https://github.com/grafana/synthetic-monitoring-app/compare/v1.16.10...v1.16.11) (2024-12-19)


### Fixes

* Revert to v1.16.9 ([#1027](https://github.com/grafana/synthetic-monitoring-app/issues/1027)) ([51e4d55](https://github.com/grafana/synthetic-monitoring-app/commit/51e4d5573d771f8aecd356a4dcb9a536b4c6f782))
Expand Down
730 changes: 0 additions & 730 deletions CHANGELOG_DEPRECATED.md

This file was deleted.

9 changes: 9 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@
# https://git-scm.com/docs/gitignore#_pattern_format

* @grafana/synthetic-monitoring-fe

# These files are updated by release-please and we need any member of the
# larger team to be able to approve them.
#
# The docs seem to suggest that the last matching pattern is the one that is
# used, so we need to keep the * pattern above this one.
/CHANGELOG.md @grafana/synthetic-monitoring-fe @grafana/synthetic-monitoring-dev
/package.json @grafana/synthetic-monitoring-fe @grafana/synthetic-monitoring-dev
/.github/release-please/release-please-config.json @grafana/synthetic-monitoring-fe @grafana/synthetic-monitoring-dev
11 changes: 0 additions & 11 deletions __mocks__/@grafana/faro-web-sdk.ts

This file was deleted.

42 changes: 0 additions & 42 deletions __mocks__/@grafana/ui.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions __mocks__/components/SimpleMap/index.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions __mocks__/grafana/app/core/app_events.ts

This file was deleted.

5 changes: 0 additions & 5 deletions cspell.config.json

This file was deleted.

1 change: 0 additions & 1 deletion dummy.scss

This file was deleted.

9 changes: 5 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ module.exports = {
...config.moduleNameMapper,
'^lodash-es$': 'lodash',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|md)$':
'<rootDir>/src/test/fileMock.js',
'^!raw-loader!*': '<rootDir>/src/test/rawLoaderMock.js',
'^(.+)\\?raw$': '<rootDir>/src/test/rawLoaderMock.js',
'<rootDir>/src/test/mocks/unsupported_file.js',
'^!raw-loader!*': '<rootDir>/src/test/mocks/rawLoader.js',
'^(.+)\\?raw$': '<rootDir>/src/test/mocks/rawLoader.js',
'^grafana/app/core/core$': '<rootDir>/src/test/mocks/grafana/app/core/core.js',
'^grafana/app/core/app_events$': '<rootDir>/src/test/mocks/grafana/app/core/app_events.js',
},
testTimeout: 30000,
// Inform jest to only transform specific node_module packages.
transform: {
...config.transform,
'^.+\\.mjs$': ['@swc/jest'],
'assets/snippets/.+\\.js$': '<rootDir>/src/test/rawLoaderMock.js',
'assets/snippets/.+\\.js$': '<rootDir>/src/test/mocks/rawLoader.js',
},
transformIgnorePatterns: [
nodeModulesToTransform([
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"release:test": "release-it --dry-run --ci --no-git.requireCleanWorkingDir",
"server": "docker compose up --build",
"sign": "npx --yes @grafana/sign-plugin@latest",
"spellcheck": "cspell -c cspell.config.json \"**/*.{ts,tsx,js,go,md,mdx,yml,yaml,json,scss,css}\"",
"test": "jest --all",
"test:changed": "jest --watch --onlyChanged",
"typecheck": "tsc --noEmit",
Expand Down
15 changes: 8 additions & 7 deletions src/components/AddNewCheckButton/AddNewCheckButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ import React from 'react';
import { Button } from '@grafana/ui';

import { ROUTES } from 'routing/types';
import { useCanWriteSM } from 'hooks/useDSPermission';
import { getUserPermissions } from 'data/permissions';
import { useNavigation } from 'hooks/useNavigation';

export function AddNewCheckButton() {
const navigate = useNavigation();
const canEdit = useCanWriteSM();

if (!canEdit) {
return null;
}
const { canWriteChecks } = getUserPermissions();

return (
<Button variant="primary" onClick={() => navigate(ROUTES.ChooseCheckGroup)} type="button">
<Button
variant="primary"
onClick={() => navigate(ROUTES.ChooseCheckGroup)}
type="button"
disabled={!canWriteChecks}
>
Add new check
</Button>
);
Expand Down
15 changes: 11 additions & 4 deletions src/components/AppInitializer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import { DataTestIds } from 'test/dataTestIds';

import { hasGlobalPermission } from 'utils';
import { ROUTES } from 'routing/types';
import { getUserPermissions } from 'data/permissions';
import { useAppInitializer } from 'hooks/useAppInitializer';
import { useMeta } from 'hooks/useMeta';
import { MismatchedDatasourceModal } from 'components/MismatchedDatasourceModal';
import { ContactAdminAlert } from 'page/ContactAdminAlert';

interface Props {
redirectTo?: ROUTES;
Expand All @@ -19,7 +21,10 @@ interface Props {
export const AppInitializer = ({ redirectTo, buttonText }: PropsWithChildren<Props>) => {
const { jsonData } = useMeta();
const styles = useStyles2(getStyles);
const canInitialize = hasGlobalPermission(`datasources:create`);
const { canWritePlugin } = getUserPermissions();

const canReadDs = hasGlobalPermission(`datasources:read`);
const canInitialize = canWritePlugin && hasGlobalPermission(`datasources:create`);

const {
error,
Expand All @@ -35,11 +40,13 @@ export const AppInitializer = ({ redirectTo, buttonText }: PropsWithChildren<Pro
setDataSouceModalOpen,
} = useAppInitializer(redirectTo);

if (!canReadDs) {
return <ContactAdminAlert missingPermissions={['datasources:read']} />;
}

if (!canInitialize) {
return (
<Alert title="" severity="info">
Contact your administrator to get you started.
</Alert>
<ContactAdminAlert missingPermissions={['grafana-synthetic-monitoring-app.plugin:write', 'datasources:create']} />
);
}

Expand Down
43 changes: 0 additions & 43 deletions src/components/Autosizer.tsx

This file was deleted.

8 changes: 3 additions & 5 deletions src/components/CheckEditor/CheckProbes/CheckProbes.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef, useMemo, useState } from 'react';
import React, { useMemo, useState } from 'react';
import { Field, Stack } from '@grafana/ui';

import { Probe } from 'types';
Expand All @@ -16,7 +16,7 @@ interface CheckProbesProps {
invalid?: boolean;
error?: string;
}
export const CheckProbes = forwardRef(({ probes, availableProbes, onChange, error }: CheckProbesProps) => {
export function CheckProbes({ probes, availableProbes, onChange, error }: CheckProbesProps) {
const [filteredProbes, setFilteredProbes] = useState<Probe[]>(availableProbes);

const publicProbes = useMemo(() => filteredProbes.filter((probe) => probe.public), [filteredProbes]);
Expand Down Expand Up @@ -73,6 +73,4 @@ export const CheckProbes = forwardRef(({ probes, availableProbes, onChange, erro
{showPrivateProbesDiscovery && <PrivateProbesAlert />}
</div>
);
});

CheckProbes.displayName = 'CheckProbes';
}
24 changes: 14 additions & 10 deletions src/components/CheckEditor/ProbeOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@ export const ProbeOptions = ({ checkType, disabled }: ProbeOptionsProps) => {
<Controller
control={control}
name="probes"
render={({ field }) => (
<CheckProbes
{...field}
probes={field.value}
availableProbes={getAvailableProbes(probes, checkType)}
disabled={disabled}
invalid={Boolean(errors.probes)}
error={errors.probes?.message}
/>
)}
render={({ field }) => {
const { ref, ...fieldProps } = field; // ref is unused, this is to silence warnings

return (
<CheckProbes
{...fieldProps}
probes={field.value}
availableProbes={getAvailableProbes(probes, checkType)}
disabled={disabled}
invalid={Boolean(errors.probes)}
error={errors.probes?.message}
/>
);
}}
/>
<Field
label="Frequency"
Expand Down
27 changes: 27 additions & 0 deletions src/components/CheckForm/CheckForm.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import { screen } from '@testing-library/react';
import { render } from 'test/render';

import { Check } from '../../types';

import { DataTestIds } from '../../test/dataTestIds';
import { CheckForm } from './CheckForm';

interface RenderCheckFormProps {
check?: Check;
disabled?: boolean;
}

async function renderCheckForm(props?: RenderCheckFormProps) {
const result = render(<CheckForm {...props} />);
await screen.findByTestId(DataTestIds.CHECK_FORM_SUBMIT_BUTTON); // Wait for the form to be rendered

return result;
}

describe(`<CheckForm />`, () => {
it(`should render without props`, async () => {
await renderCheckForm();
expect(screen.getByTestId(DataTestIds.CHECK_FORM_SUBMIT_BUTTON)).not.toBeEnabled();
});
});
Loading

0 comments on commit e287f10

Please sign in to comment.