@atlar-widgets/rasor-components-status 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import type { Component } from '../types';
2
2
  interface Props {
3
3
  component: Component;
4
+ now: number;
4
5
  }
5
- export declare function ComponentCard({ component }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export declare function ComponentCard({ component, now }: Props): import("react/jsx-runtime").JSX.Element;
6
7
  export {};
@@ -0,0 +1,14 @@
1
+ /** Shared status mapping, severity ordering and time helpers. */
2
+ export type StatusKey = 'idle' | 'running' | 'error' | 'warning' | 'init' | 'waiting' | 'offline' | 'stale' | 'unknown';
3
+ /** A component whose heartbeat is older than this is considered stale. */
4
+ export declare const STALE_MS = 120000;
5
+ export declare function getStatusKey(status: string | undefined | null): StatusKey;
6
+ /** Effective key: staleness overrides whatever the component last reported. */
7
+ export declare function getEffectiveStatusKey(status: string | undefined | null, lastSeen: string | undefined, now: number): StatusKey;
8
+ export declare function isStale(lastSeen: string | undefined, now: number): boolean;
9
+ export declare function severityRank(key: StatusKey): number;
10
+ export declare const STATUS_LABELS: Record<StatusKey, string>;
11
+ export declare function formatRelativeTime(iso: string | undefined, now: number): string;
12
+ /** Compact uptime from an ISO start timestamp, e.g. "42d 3h" or "3h 12m". */
13
+ export declare function formatUptime(iso: string | undefined, now: number): string;
14
+ export declare function formatExactTime(iso: string | undefined): string;
@@ -11,7 +11,7 @@ export interface Component {
11
11
  name: string;
12
12
  lastStatus: string;
13
13
  lastSeen: string;
14
- state: ComponentState;
14
+ state: ComponentState | null;
15
15
  }
16
16
  export interface ComponentHeartbeat {
17
17
  componentName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlar-widgets/rasor-components-status",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Components status widget — shows live heartbeat and status for all RASOR components",
5
5
  "main": "dist/index.iife.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "peerDependencies": {
22
22
  "@apollo/client": "^3",
23
23
  "@reduxjs/toolkit": "^2",
24
- "@ska-octopus-widget-sdk/widget-sdk": "^0.5.0",
24
+ "@ska-octopus-widget-sdk/widget-sdk": "^0.7.10",
25
25
  "graphql": "^16",
26
26
  "react": "^19",
27
27
  "react-dom": "^19",
@@ -32,7 +32,7 @@
32
32
  "@apollo/client": "^3",
33
33
  "@eslint/js": "^9.34.0",
34
34
  "@reduxjs/toolkit": "^2",
35
- "@ska-octopus-widget-sdk/widget-sdk": "^0.5.0",
35
+ "@ska-octopus-widget-sdk/widget-sdk": "^0.7.10",
36
36
  "@testing-library/jest-dom": "^6.0.0",
37
37
  "@testing-library/react": "^16.0.0",
38
38
  "@types/node": "^20",
@@ -81,7 +81,8 @@
81
81
  "@testing-library/react": {
82
82
  "react": "^19",
83
83
  "react-dom": "^19"
84
- }
84
+ },
85
+ "esbuild": "0.28.1"
85
86
  },
86
87
  "type": "module",
87
88
  "lint-staged": {