Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
a11c505
added owners
Ahalya-ni Aug 27, 2025
58f1768
added skeleton
Ahalya-ni Aug 27, 2025
361ef6f
formatted
Ahalya-ni Aug 28, 2025
90825d8
rephrase test description
Ahalya-ni Aug 28, 2025
1616aa3
resolve comments
Ahalya-ni Aug 28, 2025
f0cd161
remove alarms from example yaml
Ahalya-ni Aug 28, 2025
9f8d99d
add line breaks and format
Ahalya-ni Aug 29, 2025
4091b26
added semi-colon
Ahalya-ni Sep 2, 2025
34972ae
initial commit
Ahalya-ni Aug 29, 2025
412e3e6
renamed folder
Ahalya-ni Aug 29, 2025
f5fdc49
added test for editor
Ahalya-ni Aug 29, 2025
8de3e89
added test for datasource
Ahalya-ni Aug 29, 2025
b056598
removed query type
Ahalya-ni Aug 29, 2025
2d5dcee
updated test block and renamed from base to core
Ahalya-ni Sep 2, 2025
38eb037
added default query
Ahalya-ni Sep 2, 2025
aa993fa
add switch case intead of if
Ahalya-ni Sep 2, 2025
585e6e6
update type for default
Ahalya-ni Sep 2, 2025
e77d43c
added check in editor
Ahalya-ni Sep 2, 2025
e985f5f
updated todo comment
Ahalya-ni Sep 2, 2025
d3ab776
organized datasource test file
Ahalya-ni Sep 3, 2025
5adb6ca
updated assertion
Ahalya-ni Sep 3, 2025
18a467d
added type
Ahalya-ni Sep 3, 2025
dfc3d3e
Merge branch 'main' into users/ahalya/feat/alarms/base-class
Sep 4, 2025
b64dbed
fix import
Sep 4, 2025
62ec322
initial commit
Ahalya-ni Sep 5, 2025
9ea012b
added constant
Ahalya-ni Sep 5, 2025
d6c962b
Merge branch 'main' of https://github.com/ni/systemlink-grafana-plugi…
Ahalya-ni Sep 6, 2025
4edf226
resolve conflicts
Ahalya-ni Sep 6, 2025
c644e88
removed unwanted file change
Ahalya-ni Sep 6, 2025
402c2a5
added tests for count datasource
Ahalya-ni Sep 8, 2025
9bd8a51
undo test plan changes
Ahalya-ni Sep 8, 2025
4d074a8
add test for editor
Ahalya-ni Sep 8, 2025
1865afa
added nit comments
Ahalya-ni Sep 8, 2025
d8273a9
added test for query editor
Ahalya-ni Sep 8, 2025
1a1541c
resolve conditional qpp events
Ahalya-ni Sep 8, 2025
99ecb88
added separate test file for core file
Ahalya-ni Sep 11, 2025
7ab0ed9
address other comments
Ahalya-ni Sep 11, 2025
bad35aa
undo file change
Ahalya-ni Sep 11, 2025
d24f006
added access modifier for alarmsdatasource file urls
Ahalya-ni Sep 11, 2025
6a78320
add public access modifier
Ahalya-ni Sep 11, 2025
111e18f
move buildquery to the top
Ahalya-ni Sep 12, 2025
a890c17
Merge branch 'main' of https://github.com/ni/systemlink-grafana-plugi…
Ahalya-ni Sep 12, 2025
9441d4d
added query alarms url into a constant file and updated files
Ahalya-ni Sep 16, 2025
ee5e813
renamed QueryAlarmsRequestBody to QueryAlarmsRequest
Ahalya-ni Sep 16, 2025
1b3d9de
added type and updated test
Ahalya-ni Sep 16, 2025
2aa64e9
initial commit
Ahalya-ni Sep 10, 2025
dc46c1f
add test
Ahalya-ni Sep 11, 2025
0acc77a
remove the transformation logic
Ahalya-ni Sep 12, 2025
d79669b
added test
Ahalya-ni Sep 12, 2025
537e803
added test for core file
Ahalya-ni Sep 12, 2025
1155149
added test for alarmsqueryeditor
Ahalya-ni Sep 12, 2025
5578c2d
created constant file for constants
Ahalya-ni Sep 12, 2025
2031b22
undo root types file
Ahalya-ni Sep 12, 2025
8efe976
add test for count datasource
Ahalya-ni Sep 12, 2025
cff7beb
rephrased description
Ahalya-ni Sep 12, 2025
48b48dc
undo global variable changes and remove root types file
Ahalya-ni Sep 15, 2025
a4fe725
addressed comments
Ahalya-ni Sep 16, 2025
54c729d
added query alarms url into a constant file and updated files
Ahalya-ni Sep 16, 2025
c112cbd
renamed QueryAlarmsRequestBody to QueryAlarmsRequest
Ahalya-ni Sep 16, 2025
d218c72
updated test for query builder change in count editor
Ahalya-ni Sep 17, 2025
741e19d
Merge branch 'main' of https://github.com/ni/systemlink-grafana-plugi…
Ahalya-ni Sep 17, 2025
8430a43
undo quotes changes
Ahalya-ni Sep 17, 2025
73e10d7
undo types file
Ahalya-ni Sep 17, 2025
42a3959
updated quotes
Ahalya-ni Sep 17, 2025
70237f4
moved core file into query-type-handlers folder
Ahalya-ni Sep 17, 2025
cf15151
remove the added eslint rule
Ahalya-ni Sep 17, 2025
3a0a335
delete root types file
Ahalya-ni Sep 17, 2025
277c90d
rename the core file
Ahalya-ni Sep 17, 2025
f064a89
moved core file
Ahalya-ni Sep 18, 2025
43eef93
remove semicolon
Ahalya-ni Sep 18, 2025
511802b
Merge branch 'main' of https://github.com/ni/systemlink-grafana-plugi…
Ahalya-ni Oct 8, 2025
4f0f5cf
undo unwanted changes
Ahalya-ni Oct 8, 2025
f8debab
delete const file
Ahalya-ni Oct 8, 2025
d1406da
change casing for default queries constant file
Ahalya-ni Oct 8, 2025
95145c0
Merge branch 'main' of https://github.com/ni/systemlink-grafana-plugi…
Ahalya-ni Oct 16, 2025
e45fa23
fix conflicts
Ahalya-ni Oct 16, 2025
a15c211
removed duplicate mock from the alarms
Ahalya-ni Oct 16, 2025
8f08009
use single quotes
Ahalya-ni Oct 16, 2025
be8192b
fix single quotes in import
Ahalya-ni Oct 16, 2025
a592e34
remove eslint rule
Ahalya-ni Oct 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { AlarmsCountQuery } from "datasources/alarms/types/AlarmsCount.types";
import React, { useEffect, useState } from "react";
import { InlineField } from "core/components/InlineField";
import { AlarmsQueryBuilder } from "../../query-builder/AlarmsQueryBuilder";
import { ERROR_SEVERITY_WARNING, LABEL_WIDTH, labels, tooltips } from "datasources/alarms/constants/AlarmsQueryEditor.constants";
import { AlarmsCountDataSource } from "datasources/alarms/query-type-handlers/alarms-count/AlarmsCountDataSource";
import { Workspace } from "core/types";
import { FloatingError } from "core/errors";
import { AlarmsCountQuery } from 'datasources/alarms/types/AlarmsCount.types';
import React, { useEffect, useState } from 'react';
import { InlineField } from 'core/components/InlineField';
import { AlarmsQueryBuilder } from '../../query-builder/AlarmsQueryBuilder';
import { ERROR_SEVERITY_WARNING, LABEL_WIDTH, labels, tooltips } from 'datasources/alarms/constants/AlarmsQueryEditor.constants';
import { AlarmsCountDataSource } from 'datasources/alarms/query-type-handlers/alarms-count/AlarmsCountDataSource';
import { Workspace } from 'core/types';
import { FloatingError } from 'core/errors';

type Props = {
query: AlarmsCountQuery;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AlertVariant } from "@grafana/ui";
import { AlertVariant } from '@grafana/ui';

export const LABEL_WIDTH = 26;
export const ERROR_SEVERITY_WARNING: AlertVariant = 'warning';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AlarmsCountQuery } from "../types/AlarmsCount.types";
import { QueryType } from "../types/types";
import { AlarmsCountQuery } from '../types/AlarmsCount.types';
import { QueryType } from '../types/types';

export const defaultAlarmsCountQuery: Omit<AlarmsCountQuery, 'refId'> = {
queryType: QueryType.AlarmsCount,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { AlarmsDataSourceCore } from './AlarmsDataSourceCore';
import { AlarmsQueryHandlersCore } from './AlarmsQueryHandlersCore';
import { DataFrameDTO, DataQueryRequest, ScopedVars } from '@grafana/data';
import { AlarmsQuery, QueryAlarmsRequest, QueryType } from './types/types';
import { AlarmsQuery, QueryAlarmsRequest, QueryType } from '../types/types';
import { MockProxy } from 'jest-mock-extended';
import { BackendSrv } from '@grafana/runtime';
import { createFetchError, createFetchResponse, requestMatching, setupDataSource } from 'test/fixtures';
import { QUERY_ALARMS_RELATIVE_PATH } from './constants/QueryAlarms.constants';
import { QUERY_ALARMS_RELATIVE_PATH } from '../constants/QueryAlarms.constants';
import { Workspace } from 'core/types';
import { getVariableOptions } from 'core/utils';

jest.mock('core/utils', () => ({
getVariableOptions: jest.fn(),
Expand All @@ -23,13 +24,8 @@ jest.mock('shared/workspace.utils', () => {
}))
};
});
import { getVariableOptions } from 'core/utils';

jest.mock('core/utils', () => ({
getVariableOptions: jest.fn(),
}));

class TestAlarmsDataSource extends AlarmsDataSourceCore {
class TestAlarmsDataSource extends AlarmsQueryHandlersCore {
async runQuery(query: AlarmsQuery, _: DataQueryRequest): Promise<DataFrameDTO> {

return {
Expand All @@ -51,7 +47,7 @@ class TestAlarmsDataSource extends AlarmsDataSourceCore {
};
}

describe('AlarmsDataSourceCore', () => {
describe('AlarmsQueryHandlersCore', () => {
let datastore: TestAlarmsDataSource, backendServer: MockProxy<BackendSrv>;

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { DataSourceBase } from "core/DataSourceBase";
import { DataQueryRequest, DataFrameDTO, TestDataSourceResponse, AppEvents, ScopedVars, DataSourceInstanceSettings } from "@grafana/data";
import { AlarmsQuery, QueryAlarmsRequest, QueryAlarmsResponse } from "./types/types";
import { extractErrorInfo } from "core/errors";
import { QUERY_ALARMS_RELATIVE_PATH } from "./constants/QueryAlarms.constants";
import { ExpressionTransformFunction, getConcatOperatorForMultiExpression, multipleValuesQuery, timeFieldsQuery, transformComputedFieldsQuery } from "core/query-builder.utils";
import { ALARMS_TIME_FIELDS, AlarmsQueryBuilderFields } from "./constants/AlarmsQueryBuilder.constants";
import { QueryBuilderOption, Workspace } from "core/types";
import { WorkspaceUtils } from "shared/workspace.utils";
import { getVariableOptions } from "core/utils";
import { BackendSrv, getBackendSrv, getTemplateSrv, TemplateSrv } from "@grafana/runtime";
import { MINION_ID_CUSTOM_PROPERTY, SYSTEM_CUSTOM_PROPERTY } from "./constants/SourceProperties.constants";

export abstract class AlarmsDataSourceCore extends DataSourceBase<AlarmsQuery> {
import { DataSourceBase } from 'core/DataSourceBase';
import { DataQueryRequest, DataFrameDTO, TestDataSourceResponse, AppEvents, ScopedVars, DataSourceInstanceSettings } from '@grafana/data';
import { AlarmsQuery, QueryAlarmsRequest, QueryAlarmsResponse } from '../types/types';
import { extractErrorInfo } from 'core/errors';
import { QUERY_ALARMS_RELATIVE_PATH } from '../constants/QueryAlarms.constants';
import { ExpressionTransformFunction, getConcatOperatorForMultiExpression, multipleValuesQuery, timeFieldsQuery, transformComputedFieldsQuery } from 'core/query-builder.utils';
import { ALARMS_TIME_FIELDS, AlarmsQueryBuilderFields } from '../constants/AlarmsQueryBuilder.constants';
import { QueryBuilderOption, Workspace } from 'core/types';
import { WorkspaceUtils } from 'shared/workspace.utils';
import { getVariableOptions } from 'core/utils';
import { BackendSrv, getBackendSrv, getTemplateSrv, TemplateSrv } from '@grafana/runtime';
import { MINION_ID_CUSTOM_PROPERTY, SYSTEM_CUSTOM_PROPERTY } from '../constants/SourceProperties.constants';

export abstract class AlarmsQueryHandlersCore extends DataSourceBase<AlarmsQuery> {
public errorTitle?: string;
public errorDescription?: string;

Expand Down Expand Up @@ -147,6 +147,6 @@ export abstract class AlarmsDataSourceCore extends DataSourceBase<AlarmsQuery> {
}

public testDatasource(): Promise<TestDataSourceResponse> {
throw new Error("Method not implemented.");
throw new Error('Method not implemented.');
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { DataFrameDTO, DataQueryRequest, FieldType } from '@grafana/data';
import { AlarmsDataSourceCore } from 'datasources/alarms/AlarmsDataSourceCore';
import { defaultAlarmsCountQuery } from 'datasources/alarms/constants/defaultQueries';
import { AlarmsQueryHandlersCore } from 'datasources/alarms/query-type-handlers/AlarmsQueryHandlersCore';
import { MINIMUM_TAKE } from 'datasources/alarms/constants/QueryAlarms.constants';
import { AlarmsCountQuery } from 'datasources/alarms/types/AlarmsCount.types';
import { defaultAlarmsCountQuery } from 'datasources/alarms/constants/DefaultQueries.constants';

export class AlarmsCountDataSource extends AlarmsDataSourceCore {
export class AlarmsCountDataSource extends AlarmsQueryHandlersCore {
public readonly defaultQuery = defaultAlarmsCountQuery;

public async runQuery(query: AlarmsCountQuery, options: DataQueryRequest): Promise<DataFrameDTO> {
Expand Down
3 changes: 0 additions & 3 deletions src/datasources/alarms/types.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/datasources/alarms/types/AlarmsCount.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AlarmsQuery } from "./types";
import { AlarmsQuery } from './types';

export interface AlarmsCountQuery extends AlarmsQuery {
filter?: string;
Expand Down