Skip to content

Commit 1e95e5e

Browse files
committed
Update dependencies II
Update dependencies to the same version as the Grafana plugin creation boilerplate
1 parent 91d9b90 commit 1e95e5e

File tree

9 files changed

+914
-1396
lines changed

9 files changed

+914
-1396
lines changed

.config/jest-setup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Object.assign(global, { TextDecoder, TextEncoder });
1313
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
1414
Object.defineProperty(global, 'matchMedia', {
1515
writable: true,
16-
value: jest.fn().mockImplementation((query) => ({
16+
value: (query) => ({
1717
matches: false,
1818
media: query,
1919
onchange: null,
@@ -22,7 +22,7 @@ Object.defineProperty(global, 'matchMedia', {
2222
addEventListener: jest.fn(),
2323
removeEventListener: jest.fn(),
2424
dispatchEvent: jest.fn(),
25-
})),
25+
}),
2626
});
2727

2828
HTMLCanvasElement.prototype.getContext = () => {};

.config/jest/utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ const nodeModulesToTransform = (moduleNames) => `node_modules\/(?!.*(${moduleNam
1414
const grafanaESModules = [
1515
'.pnpm', // Support using pnpm symlinked packages
1616
'@grafana/schema',
17+
'@wojtekmaj/date-utils',
1718
'd3',
1819
'd3-color',
1920
'd3-force',
2021
'd3-interpolate',
2122
'd3-scale-chromatic',
23+
'get-user-locale',
24+
'marked',
25+
'memoize',
26+
'mimic-function',
2227
'ol',
28+
'react-calendar',
2329
'react-colorful',
2430
'rxjs',
2531
'uuid',

jest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ process.env.TZ = 'UTC';
66
module.exports = {
77
// Jest configuration provided by Grafana scaffolding
88
...require('./.config/jest.config'),
9-
//testMatch: ['<rootDir>/test/unit/**/*.{spec,test,jest}.{js,jsx,ts,tsx}'],
109
testMatch: ['**/tests/unit/**/*.{spec,test,jest}.{js,jsx,ts,tsx}'],
1110
};

package-lock.json

Lines changed: 855 additions & 1369 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"devDependencies": {
2929
"@babel/core": "^7.28.5",
3030
"@grafana/eslint-config": "^7.0.0",
31-
"@grafana/plugin-e2e": "^1.19.4",
31+
"@grafana/plugin-e2e": "^2.2.0",
3232
"@grafana/tsconfig": "^2.0.1",
3333
"@playwright/test": "^1.56.1",
34-
"@swc/core": "^1.13.5",
34+
"@swc/core": "^1.13.20",
3535
"@swc/helpers": "^0.5.17",
3636
"@swc/jest": "^0.2.39",
3737
"@testing-library/jest-dom": "6.9.1",
@@ -45,7 +45,7 @@
4545
"css-loader": "^7.1.2",
4646
"dotenv": "^17.2.3",
4747
"eslint-plugin-deprecation": "^3.0.0",
48-
"eslint-webpack-plugin": "^4.2.0",
48+
"eslint-webpack-plugin": "^5.0.0",
4949
"fork-ts-checker-webpack-plugin": "^9.1.0",
5050
"glob": "^11.0.3",
5151
"identity-obj-proxy": "3.0.0",
@@ -73,9 +73,10 @@
7373
"dependencies": {
7474
"@emotion/css": "^11.13.5",
7575
"@grafana/data": "^12.0.2",
76-
"@grafana/runtime": "^11.6.2",
77-
"@grafana/schema": "^11.6.2",
78-
"@grafana/ui": "^11.6.2",
76+
"@grafana/i18n": "^12.2.0",
77+
"@grafana/runtime": "^12.2.0",
78+
"@grafana/schema": "^12.2.0",
79+
"@grafana/ui": "^12.2.0",
7980
"process": "^0.11.10",
8081
"react": "18.3.1",
8182
"react-dom": "18.3.1",

src/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"updated": "%TODAY%"
4040
},
4141
"dependencies": {
42-
"grafanaDependency": ">=10.4.18",
42+
"grafanaDependency": ">=11.6.7",
4343
"plugins": []
4444
},
4545
"routes": [

src/ui/components.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ export const OnlyActiveChildren = (props: OnlyActiveChildrenProps): React.JSX.El
573573
icon="minus"
574574
data-test-id={'cmk-oac-minus-button-' + getLabel(elem)}
575575
variant="secondary"
576+
aria-label={getLabel(elem)}
576577
onClick={() =>
577578
setActiveComponents((c) => {
578579
if (!React.isValidElement(elem)) {

tests/checkmk-docker-hooks/post-start/post-configure-checkmk.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,10 @@ def parse() -> tuple[argparse.ArgumentParser, argparse.Namespace]:
462462
default=[0],
463463
help="more verbose",
464464
)
465+
466+
parser.add_argument ("--skip-initial-setup", action="store_true")
467+
parser.add_argument ("--skip-automation-user-creation", action="store_true")
468+
465469
subparsers = parser.add_subparsers()
466470

467471
args = parser.parse_args()
@@ -499,23 +503,34 @@ def main() -> None:
499503
site = Site(CMK_SITE, True)
500504
api = API(site)
501505

502-
create_config = CreateConfig(
503-
folder_name="grafana",
504-
folder_title="grafana",
505-
rule_name="datasource_programs",
506-
rule_value="'cat ~/var/check_mk/agent_output/$HOSTNAME$'",
507-
source_folder="agent_output",
508-
host_attributes={
509-
"tag_agent": "cmk-agent",
510-
},
511-
source_destination="~/var/check_mk/agent_output/{host_name}",
512-
)
506+
if args.skip_initial_setup:
507+
printer.info ("Skipping creating folder, hosts, rules and discovering services")
508+
509+
else:
510+
create_config = CreateConfig(
511+
folder_name="grafana",
512+
folder_title="grafana",
513+
rule_name="datasource_programs",
514+
rule_value="'cat ~/var/check_mk/agent_output/$HOSTNAME$'",
515+
source_folder="agent_output",
516+
host_attributes={
517+
"tag_agent": "cmk-agent",
518+
},
519+
source_destination="~/var/check_mk/agent_output/{host_name}",
520+
)
521+
522+
api.delete_folder(create_config.folder_name)
523+
524+
create_from(create_config, source_files, api, site, printer)
513525

514-
api.delete_folder(create_config.folder_name)
526+
if args.skip_automation_user_creation:
527+
api.activate_changes(printer)
515528

516-
create_from(create_config, source_files, api, site, printer)
529+
if args.skip_automation_user_creation:
530+
printer.info ("Skipping automation user creation")
517531

518-
create_automation_user(CMK_AUITOMATION_USER, CMK_PASS, api, printer)
532+
else:
533+
create_automation_user(CMK_AUITOMATION_USER, CMK_PASS, api, printer)
519534

520535

521536
if __name__ == "__main__":

tests/checkmk-docker-hooks/post-start/post-configure-checkmk.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,27 @@
44
su - cmk -c "/usr/bin/env bash" << __EOF__
55
66
# Watch for new rrd files and fill them with random data
7+
# WARNING:
8+
# If the host OS reaches max inode watcher counter, the whole
9+
# setup will fail and so the tests
10+
#
711
python3 -m pip install watchdog
812
export GRRD_FORK=1
913
python3 -u /docker-entrypoint.d/post-start/generate_random_rrd_data.py
1014
15+
# Create hosts and discover services
16+
echo "Setting up hosts and services"
17+
python3 -u /docker-entrypoint.d/post-start/post-configure-checkmk.py --skip-automation-user-creation
18+
1119
# Wait until Checkmk API responds our requests
12-
until curl -f -s -u cmkadmin:abskjfdalkdhjbld http://127.0.0.1:5000/cmk/check_mk/api/1.0/version
20+
until curl -f -s -o /dev/null -u cmkadmin:abskjfdalkdhjbld http://127.0.0.1:5000/cmk/check_mk/api/1.0/version
1321
do
1422
echo Wait until Checkmk API is ready...
1523
sleep 5
1624
done
1725
18-
# Create hosts, discover services, and create automation user
19-
python3 -u /docker-entrypoint.d/post-start/post-configure-checkmk.py
26+
# Create automation user
27+
echo "Setting up automation user"
28+
python3 -u /docker-entrypoint.d/post-start/post-configure-checkmk.py --skip-initial-setup
29+
2030
__EOF__

0 commit comments

Comments
 (0)