Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Link from "next/link";
import Image from "next/image";
import Link from "next/link";

export default function NavBar() {
return (
Expand Down
2 changes: 1 addition & 1 deletion app/components/Block.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import { IfcBlock } from "@/app/types";
import { useState } from "react";
import { IfcBlock } from "@/app/types";

const grafana_stub =
"https://shadow.nd.rl.ac.uk/grafana/d/wMlwwaHMk/block-history?viewPanel=2&orgId=1&var-block=";
Expand Down
2 changes: 1 addition & 1 deletion app/components/CheckToggle.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CheckToggle from "@/app/components/CheckToggle";
import { fireEvent, render } from "@testing-library/react";
import CheckToggle from "@/app/components/CheckToggle";

it.each([true, false])(
"CheckToggle acts on checked variable on a toggle when the initial state is %s",
Expand Down
3 changes: 1 addition & 2 deletions app/components/CheckToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Dispatch, SetStateAction, useCallback } from "react";
import { memo } from "react";
import { Dispatch, memo, SetStateAction, useCallback } from "react";

const CheckToggle = memo(function CheckToggle({
checked,
Expand Down
5 changes: 2 additions & 3 deletions app/components/Group.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { memo } from "react";
import { tBlockMapping } from "@/app/types";
import Block from "./Block";
import { checkIfAllBlocksInGroupAreHidden } from "./GroupUtils";

import { tBlockMapping } from "@/app/types";
import { memo } from "react";

const Group = memo(function Group({
group,
blocks,
Expand Down
3 changes: 1 addition & 2 deletions app/components/GroupUtils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { checkIfAllBlocksInGroupAreHidden } from "./GroupUtils";

import { tBlockMapping } from "@/app/types";
import { checkIfAllBlocksInGroupAreHidden } from "./GroupUtils";

test("group with all hidden blocks returns true", () => {
let blocks: tBlockMapping = new Map();
Expand Down
2 changes: 1 addition & 1 deletion app/components/Groups.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Group from "./Group";
import { tGroups } from "@/app/types";
import Group from "./Group";

export default function Groups({
groupsMap,
Expand Down
4 changes: 2 additions & 2 deletions app/components/Instrument.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
CSSB,
findPVInGroups,
getExtraPVsForBlock,
getGroupsWithBlocksFromConfigOutput,
Instrument,
RC_ENABLE,
RC_INRANGE,
SP_RBV,
storePrecision,
getExtraPVsForBlock,
toPrecision,
yesToBoolean,
Instrument,
} from "@/app/components/Instrument";
import {
ConfigOutput,
Expand Down
2 changes: 1 addition & 1 deletion app/components/Instrument.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ExponentialOnThresholdFormat } from "@/app/components/PVutils";
import {
ConfigOutput,
ConfigOutputBlock,
Expand All @@ -7,7 +8,6 @@ import {
tBlockMapping,
tGroups,
} from "@/app/types";
import { ExponentialOnThresholdFormat } from "@/app/components/PVutils";

export const DASHBOARD = "CS:DASHBOARD:TAB:";

Expand Down
28 changes: 14 additions & 14 deletions app/components/InstrumentData.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
"use client";
import { RefObject, useEffect, useRef, useState } from "react";
import { IfcPVWSMessage, IfcPVWSRequest, PVWSRequestType } from "@/app/types";
import {
findPVInGroups,
getGroupsWithBlocksFromConfigOutput,
Instrument,
RC_ENABLE,
RC_INRANGE,
SP_RBV,
storePrecision,
toPrecision,
yesToBoolean,
} from "@/app/components/Instrument";
import useWebSocket from "react-use-websocket";
import {
instListPV,
Expand All @@ -20,14 +8,26 @@ import {
webSocketReconnectAttempts,
webSocketReconnectInterval,
} from "@/app/commonVars";
import CheckToggle from "@/app/components/CheckToggle";
import {
dehex_and_decompress,
instListFromBytes,
} from "@/app/components/dehex_and_decompress";
import Groups from "@/app/components/Groups";
import {
findPVInGroups,
getGroupsWithBlocksFromConfigOutput,
Instrument,
RC_ENABLE,
RC_INRANGE,
SP_RBV,
storePrecision,
toPrecision,
yesToBoolean,
} from "@/app/components/Instrument";
import { getPrefix, getPvValue } from "@/app/components/PVutils";
import TopBar from "@/app/components/TopBar";
import CheckToggle from "@/app/components/CheckToggle";
import Groups from "@/app/components/Groups";
import { IfcPVWSMessage, IfcPVWSRequest, PVWSRequestType } from "@/app/types";

export function InstrumentData({ instrumentName }: { instrumentName: string }) {
const [showHiddenBlocks, setShowHiddenBlocks] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion app/components/InstrumentWallCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { instListEntryWithRunstatePVandValue } from "@/app/types";
import { render } from "@testing-library/react";
import InstrumentWallCard from "@/app/components/InstrumentWallCard";
import { instListEntryWithRunstatePVandValue } from "@/app/types";

it("renders instrumentwallcard unchanged", () => {
const instrument: instListEntryWithRunstatePVandValue = {
Expand Down
2 changes: 1 addition & 1 deletion app/components/InstrumentWallCard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Link from "next/link";
import { instListEntryWithRunstatePVandValue } from "@/app/types";
import {
getForegroundColour,
getStatusColour,
UNREACHABLE,
} from "./getRunstateColours";
import { instListEntryWithRunstatePVandValue } from "@/app/types";

export default function InstrumentWallCard({
instrument,
Expand Down
14 changes: 7 additions & 7 deletions app/components/InstrumentsDisplay.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
"use client";
import { useState } from "react";
import {
IfcPVWSMessage,
IfcPVWSRequest,
instList,
PVWSRequestType,
} from "@/app/types";
import useWebSocket from "react-use-websocket";
import {
instListPV,
Expand All @@ -15,8 +9,14 @@ import {
webSocketReconnectInterval,
} from "@/app/commonVars";
import { instListFromBytes } from "@/app/components/dehex_and_decompress";
import TargetStation from "@/app/components/TargetStation";
import ScienceGroup from "@/app/components/ScienceGroup";
import TargetStation from "@/app/components/TargetStation";
import {
IfcPVWSMessage,
IfcPVWSRequest,
instList,
PVWSRequestType,
} from "@/app/types";

// Ignore support machines for the instruments page.
const instrumentsExcludeList = ["SUPPORT"];
Expand Down
2 changes: 1 addition & 1 deletion app/components/PVutils.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { IfcPVWSMessage, instListEntry } from "@/app/types";
import {
ExponentialOnThresholdFormat,
getPrefix,
getPvValue,
} from "@/app/components/PVutils";
import { IfcPVWSMessage, instListEntry } from "@/app/types";

// Test of ExponentialOnThresholdFormat ported from ibex_gui Java code
test("GIVEN value 0.1 which is above lower threshold WHEN formatting with precision 3 THEN no exponential notation used", () => {
Expand Down
2 changes: 1 addition & 1 deletion app/components/ScienceGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { instList, instListEntryWithRunstatePVandValue } from "@/app/types";
import InstrumentWallCard from "@/app/components/InstrumentWallCard";
import { instList, instListEntryWithRunstatePVandValue } from "@/app/types";

export default function ScienceGroup({
name,
Expand Down
3 changes: 1 addition & 2 deletions app/components/TargetStation.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import InstrumentWallCard from "./InstrumentWallCard";

import { instListEntryWithRunstatePVandValue } from "@/app/types";
import InstrumentWallCard from "./InstrumentWallCard";

export default function TargetStation({
name,
Expand Down
4 changes: 2 additions & 2 deletions app/components/TopBar.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { exportedForTesting, getRunstate } from "@/app/components/TopBar";
import { tBlockMapping } from "@/app/types";
import { render } from "@testing-library/react";
import { Instrument } from "@/app/components/Instrument";
import { exportedForTesting, getRunstate } from "@/app/components/TopBar";
import { tBlockMapping } from "@/app/types";

test("GetRunstate returns the runstate when it exists and is of string type", () => {
const prefix = "TESTING:";
Expand Down
7 changes: 3 additions & 4 deletions app/components/TopBar.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { memo } from "react";
import { DASHBOARD } from "@/app/components/Instrument";
import { tBlockMapping } from "@/app/types";
import {
getForegroundColour,
getStatusColour,
UNREACHABLE,
} from "./getRunstateColours";

import { tBlockMapping } from "@/app/types";
import { DASHBOARD } from "@/app/components/Instrument";
import { memo } from "react";

export function getRunstate(prefix: string, runInfoPVs: tBlockMapping): string {
const runStatePV = runInfoPVs.get(`${prefix}DAE:RUNSTATE_STR`);
if (runStatePV && runStatePV.value && typeof runStatePV.value === "string") {
Expand Down
2 changes: 1 addition & 1 deletion app/components/dehex_and_decompress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { instList } from "@/app/types";
import { unzipSync } from "zlib";
import { instList } from "@/app/types";
/**
* dehex_and_decompress
* - synonymous to dehex_and_decompress in inst_servers
Expand Down
2 changes: 1 addition & 1 deletion app/globals.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'tailwindcss';
@import "tailwindcss";

@custom-variant dark (&:is(.dark *));

Expand Down
4 changes: 3 additions & 1 deletion app/instrument/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"use client";
import { Inter } from "next/font/google";

const inter = Inter({ subsets: ["latin"] });

import { useSearchParams } from "next/navigation";
import { Suspense } from "react";
import { InstrumentData } from "@/app/components/InstrumentData";
import { useSearchParams } from "next/navigation";

function GetInstrumentData() {
const searchParams = useSearchParams();
Expand Down
4 changes: 2 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "./globals.css";
import NavBar from "./NavBar";
import Footer from "./Footer";
import type { ReactNode } from "react";
import Footer from "./Footer";
import NavBar from "./NavBar";

export const metadata = {
title: "Home | IBEX Web Dashboard",
Expand Down
4 changes: 2 additions & 2 deletions app/wall/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import JenkinsJobs from "../components/JenkinsJobs";
import InstrumentsDisplay from "@/app/components/InstrumentsDisplay";
import GithubActionsScheduledJobs from "@/app/components/GithubActionsScheduledJobs";
import InstrumentsDisplay from "@/app/components/InstrumentsDisplay";
import JenkinsJobs from "../components/JenkinsJobs";

export default function WallDisplay() {
return (
Expand Down
21 changes: 21 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.1/schema.json",
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
"files": { "ignoreUnknown": false },
"formatter": { "enabled": true, "indentStyle": "space", "indentWidth": 2 },
"linter": {
"enabled": true,
"rules": { "recommended": false },
"includes": ["**", "!./node_modules", "!./out", "!./coverage"]
},
"javascript": { "formatter": { "quoteStyle": "double" } },
"assist": {
"enabled": true,
"actions": { "source": { "organizeImports": "on" } }
},
"css": {
"parser": {
"tailwindDirectives": true
}
}
}
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference path="./.next/types/routes.d.ts" />
import "./.next/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
Loading