@adcops/autocore-react 3.3.73 → 3.3.77
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.
- package/dist/assets/HomeMotor.d.ts +4 -0
- package/dist/assets/HomeMotor.d.ts.map +1 -0
- package/dist/assets/HomeMotor.js +1 -0
- package/dist/assets/svg/home_motor.svg +57 -0
- package/dist/components/Indicator.d.ts +29 -52
- package/dist/components/Indicator.d.ts.map +1 -1
- package/dist/components/Indicator.js +1 -1
- package/dist/components/ValueInput.d.ts +1 -1
- package/dist/components/ValueInput.d.ts.map +1 -1
- package/dist/components/ams/AmsProvider.d.ts +7 -0
- package/dist/components/ams/AmsProvider.d.ts.map +1 -1
- package/dist/components/ams/AssetDetailView.d.ts.map +1 -1
- package/dist/components/ams/AssetDetailView.js +1 -1
- package/dist/components/ams/AssetRegistryTable.d.ts.map +1 -1
- package/dist/components/ams/AssetRegistryTable.js +1 -1
- package/dist/components/ams/CalibrationEntryDialog.d.ts.map +1 -1
- package/dist/components/ams/CalibrationEntryDialog.js +1 -1
- package/dist/components/ams/MissingAssetsBanner.d.ts +11 -0
- package/dist/components/ams/MissingAssetsBanner.d.ts.map +1 -0
- package/dist/components/ams/MissingAssetsBanner.js +1 -0
- package/dist/components/ams/PlaceholderHealthPanel.d.ts +3 -0
- package/dist/components/ams/PlaceholderHealthPanel.d.ts.map +1 -0
- package/dist/components/ams/PlaceholderHealthPanel.js +1 -0
- package/dist/components/ams/index.d.ts +2 -0
- package/dist/components/ams/index.d.ts.map +1 -1
- package/dist/components/ams/index.js +1 -1
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/network/NetworkPanel.d.ts +8 -0
- package/dist/components/network/NetworkPanel.d.ts.map +1 -0
- package/dist/components/network/NetworkPanel.js +1 -0
- package/dist/components/network/NetworkProvider.d.ts +72 -0
- package/dist/components/network/NetworkProvider.d.ts.map +1 -0
- package/dist/components/network/NetworkProvider.js +1 -0
- package/dist/components/network/StagedChangeBanner.d.ts +8 -0
- package/dist/components/network/StagedChangeBanner.d.ts.map +1 -0
- package/dist/components/network/StagedChangeBanner.js +1 -0
- package/dist/components/network/index.d.ts +7 -0
- package/dist/components/network/index.d.ts.map +1 -0
- package/dist/components/network/index.js +1 -0
- package/dist/components/tis/ProjectManager.d.ts +7 -0
- package/dist/components/tis/ProjectManager.d.ts.map +1 -0
- package/dist/components/tis/ProjectManager.js +1 -0
- package/dist/components/tis/ResultHistoryTable.d.ts.map +1 -1
- package/dist/components/tis/ResultHistoryTable.js +1 -1
- package/dist/components/tis/TestDataView.d.ts.map +1 -1
- package/dist/components/tis/TestDataView.js +1 -1
- package/dist/components/tis/TestRawDataView.d.ts.map +1 -1
- package/dist/components/tis/TestRawDataView.js +1 -1
- package/dist/components/tis/TestSetupForm.d.ts +7 -0
- package/dist/components/tis/TestSetupForm.d.ts.map +1 -1
- package/dist/components/tis/TestSetupForm.js +1 -1
- package/package.json +5 -1
- package/src/assets/HomeMotor.tsx +37 -0
- package/src/assets/svg/home_motor.svg +57 -0
- package/src/components/Indicator.tsx +166 -162
- package/src/components/ValueInput.tsx +2 -2
- package/src/components/ams/AmsProvider.tsx +7 -0
- package/src/components/ams/AssetDetailView.tsx +287 -4
- package/src/components/ams/AssetRegistryTable.tsx +325 -21
- package/src/components/ams/CalibrationEntryDialog.tsx +163 -30
- package/src/components/ams/MissingAssetsBanner.tsx +124 -0
- package/src/components/ams/PlaceholderHealthPanel.tsx +188 -0
- package/src/components/ams/index.ts +2 -0
- package/src/components/index.ts +26 -0
- package/src/components/network/NetworkPanel.tsx +363 -0
- package/src/components/network/NetworkProvider.tsx +349 -0
- package/src/components/network/StagedChangeBanner.tsx +101 -0
- package/src/components/network/index.ts +17 -0
- package/src/components/tis/ProjectManager.tsx +392 -0
- package/src/components/tis/ResultHistoryTable.tsx +125 -74
- package/src/components/tis/TestDataView.tsx +160 -14
- package/src/components/tis/TestRawDataView.tsx +118 -8
- package/src/components/tis/TestSetupForm.tsx +42 -1
|
@@ -1,194 +1,198 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* <Indicator> — non-interactive visual state lamp.
|
|
5
|
+
*
|
|
6
|
+
* Two usage shapes are supported:
|
|
7
|
+
*
|
|
8
|
+
* 1. Icon / children mode (matches <IndicatorButton>):
|
|
9
|
+
*
|
|
10
|
+
* <Indicator
|
|
11
|
+
* className="ac-toolbar-icon-btn"
|
|
12
|
+
* onColor={IndicatorColor.IndicatorGreen}
|
|
13
|
+
* offColor={IndicatorColor.IndicatorRed}
|
|
14
|
+
* value={controlPowerOk}
|
|
15
|
+
* >
|
|
16
|
+
* <i className="pi pi-power-off" />
|
|
17
|
+
* </Indicator>
|
|
18
|
+
*
|
|
19
|
+
* Renders a square (non-rounded) box whose background is driven by
|
|
20
|
+
* `value` (and `onColor` / `offColor`). The children are layered on
|
|
21
|
+
* top — typically an icon — and the box gets a subtle inset shadow
|
|
22
|
+
* so it visually reads as a passive indicator rather than a button.
|
|
23
|
+
*
|
|
24
|
+
* 2. Legacy label mode:
|
|
25
|
+
*
|
|
26
|
+
* <Indicator label="Pump Running" value={pumpOk} />
|
|
27
|
+
*
|
|
28
|
+
* A small color swatch followed by a text label. Kept for callers
|
|
29
|
+
* that pre-date the icon form.
|
|
30
|
+
*
|
|
31
|
+
* State source priority: explicit `value` prop > subscribed `topic` value.
|
|
32
|
+
* `undefined` displays as `invalidColor` (default black) — meaning "not
|
|
33
|
+
* available," not "off."
|
|
8
34
|
*/
|
|
9
35
|
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
//import clsx from 'clsx';
|
|
36
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
37
|
+
import clsx from 'clsx';
|
|
13
38
|
import { EventEmitterContext, type EventEmitterContextType } from '../core/EventEmitterContext';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export {IndicatorColor}
|
|
17
|
-
|
|
18
|
-
//import {Lamp} from "./Lamp";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
interface IndicatorProps {
|
|
24
|
-
|
|
39
|
+
import { IndicatorColor } from '../core/IndicatorColor';
|
|
40
|
+
export { IndicatorColor };
|
|
25
41
|
|
|
42
|
+
export interface IndicatorProps {
|
|
26
43
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* ## Examples
|
|
30
|
-
* ```
|
|
31
|
-
* <Indicator label="Simple Text" />
|
|
32
|
-
* <Indicator label={<span><i className="pi pi-check"></i> Icon and Text</span>} />
|
|
33
|
-
* <Indicator label={<YourCustomIconComponent />} />
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
label? : React.ReactNode;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* State to be displayed<br/>
|
|
41
|
-
*
|
|
42
|
-
* Available states: **on**, **off** and **not available**:
|
|
44
|
+
* State to be displayed.
|
|
43
45
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
value?: boolean | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* CSS color for **enabled** state
|
|
46
|
+
* * `true` → on
|
|
47
|
+
* * `false` → off
|
|
48
|
+
* * `undefined` → not available (invalid color)
|
|
51
49
|
*/
|
|
50
|
+
value?: boolean;
|
|
51
|
+
|
|
52
|
+
/** CSS color when value is true. Defaults to IndicatorColor.IndicatorGreen. */
|
|
52
53
|
onColor?: string;
|
|
53
|
-
/**
|
|
54
|
-
* CSS color for **disabled** state
|
|
55
|
-
*/
|
|
54
|
+
/** CSS color when value is false. Defaults to IndicatorColor.IndicatorOff (gray). */
|
|
56
55
|
offColor?: string;
|
|
57
|
-
/**
|
|
58
|
-
* CSS color for **not available** state
|
|
59
|
-
*/
|
|
56
|
+
/** CSS color when value is undefined. Defaults to IndicatorColor.IndicatorInvalid (black). */
|
|
60
57
|
invalidColor?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Custom class name to be attached
|
|
63
|
-
*/
|
|
64
|
-
className?: string;
|
|
65
58
|
|
|
66
59
|
/**
|
|
67
|
-
*
|
|
60
|
+
* Optional broadcast topic to subscribe to. The latest broadcast value
|
|
61
|
+
* is used when `value` is left undefined; an explicit `value` always
|
|
62
|
+
* wins so callers can drive the indicator from React state instead.
|
|
68
63
|
*/
|
|
69
64
|
topic?: string;
|
|
70
65
|
|
|
66
|
+
/** Additional CSS class names applied to the outer box. */
|
|
67
|
+
className?: string;
|
|
71
68
|
|
|
72
|
-
|
|
69
|
+
/** Inline style overrides for the outer box. */
|
|
70
|
+
style?: React.CSSProperties;
|
|
73
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Legacy text label rendered next to a small color swatch. Mutually
|
|
74
|
+
* exclusive with `children` — pass one or the other. Plain strings or
|
|
75
|
+
* React nodes both work.
|
|
76
|
+
*/
|
|
77
|
+
label?: React.ReactNode;
|
|
74
78
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Icon (or any node) to display on top of the colored backdrop.
|
|
81
|
+
* Use this for the modern square-button-shaped indicator, e.g.
|
|
82
|
+
* `<Indicator ...><i className="pi pi-power-off" /></Indicator>`.
|
|
83
|
+
*/
|
|
84
|
+
children?: React.ReactNode;
|
|
78
85
|
}
|
|
79
86
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Pick the color to paint based on the displayed state. Kept outside the
|
|
89
|
+
* component so the rendering logic is trivial to read.
|
|
90
|
+
*/
|
|
91
|
+
const pickColor = (
|
|
92
|
+
displayValue: boolean | undefined,
|
|
93
|
+
onColor: string,
|
|
94
|
+
offColor: string,
|
|
95
|
+
invalidColor: string,
|
|
96
|
+
): string => {
|
|
97
|
+
if (displayValue === true) return onColor;
|
|
98
|
+
if (displayValue === false) return offColor;
|
|
99
|
+
return invalidColor;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const Indicator: React.FC<IndicatorProps> = ({
|
|
103
|
+
value,
|
|
104
|
+
onColor = IndicatorColor.IndicatorGreen,
|
|
105
|
+
offColor = IndicatorColor.IndicatorOff,
|
|
106
|
+
invalidColor = IndicatorColor.IndicatorInvalid,
|
|
107
|
+
topic,
|
|
108
|
+
className,
|
|
109
|
+
style,
|
|
110
|
+
label,
|
|
111
|
+
children,
|
|
112
|
+
}) => {
|
|
113
|
+
const { subscribe, unsubscribe } = useContext(EventEmitterContext) as EventEmitterContextType;
|
|
114
|
+
|
|
115
|
+
const [subscribedValue, setSubscribedValue] = useState<boolean | undefined>(undefined);
|
|
116
|
+
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (!topic || !subscribe) return;
|
|
119
|
+
const token = subscribe(topic, (v: any) => {
|
|
120
|
+
// The Hub publishes any payload; coerce to boolean for boolean
|
|
121
|
+
// indicators. Non-boolean topics should use IndicatorRect instead.
|
|
122
|
+
setSubscribedValue(v === undefined || v === null ? undefined : !!v);
|
|
123
|
+
});
|
|
124
|
+
return () => {
|
|
125
|
+
try {
|
|
126
|
+
if (unsubscribe && token !== undefined) unsubscribe(token);
|
|
127
|
+
} catch {
|
|
128
|
+
/* no-op */
|
|
129
|
+
}
|
|
97
130
|
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
componentDidMount() {
|
|
101
|
-
const { topic } = this.props;
|
|
102
|
-
if (topic && this.unsubscribeTopicId === null) {
|
|
103
|
-
const { subscribe } = this.context as EventEmitterContextType;
|
|
104
|
-
this.unsubscribeTopicId = subscribe(topic, (value: any) => {
|
|
105
|
-
this.setState({ subscribedValue: value });
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
componentDidUpdate(prevProps: IndicatorProps) {
|
|
111
|
-
if (prevProps.value !== this.props.value) {
|
|
112
|
-
this.setState({ subscribedValue: this.props.value });
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
componentWillUnmount() {
|
|
117
|
-
if (this.unsubscribeTopicId !== null) {
|
|
118
|
-
const { unsubscribe } = this.context as EventEmitterContextType;
|
|
119
|
-
unsubscribe(this.unsubscribeTopicId);
|
|
120
|
-
this.unsubscribeTopicId = null;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
131
|
+
}, [topic, subscribe, unsubscribe]);
|
|
123
132
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
//
|
|
129
|
-
// Load the value from the proper source.
|
|
130
|
-
// If the `value` property is undefined, that takes precedence.
|
|
131
|
-
//
|
|
132
|
-
let displayValue = subscribedValue;
|
|
133
|
-
if (value !== undefined) {
|
|
134
|
-
displayValue = value;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
let color;
|
|
138
|
-
switch (displayValue) {
|
|
139
|
-
case true:
|
|
140
|
-
color = onColor;
|
|
141
|
-
break;
|
|
142
|
-
case false:
|
|
143
|
-
color = offColor;
|
|
144
|
-
break;
|
|
145
|
-
default:
|
|
146
|
-
color = invalidColor;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// const style: React.CSSProperties = {
|
|
151
|
-
// position: useAbsolutePositioning ? 'absolute' : 'relative',
|
|
152
|
-
// display: useAbsolutePositioning ? "" : "inline-block",
|
|
153
|
-
// verticalAlign: 'middle',
|
|
154
|
-
// top: useAbsolutePositioning && y ? `${yOffset + adjScale * y}px` : undefined,
|
|
155
|
-
// left: useAbsolutePositioning && x ? `${xOffset + adjScale * x}px` : undefined,
|
|
156
|
-
// width: adjWidth ? `${adjWidth * adjScale}px` : undefined,
|
|
157
|
-
// height: adjHeight ? `${adjHeight * adjScale}px` : undefined,
|
|
158
|
-
// lineHeight: adjHeight ? `${adjHeight * adjScale}px` : undefined,
|
|
159
|
-
// backgroundColor: color,
|
|
160
|
-
// borderRadius: "20px"
|
|
161
|
-
// };
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const groupStyle : React.CSSProperties = {
|
|
165
|
-
alignItems: "center",
|
|
166
|
-
// PrimeReact injects `.p-inputgroup { width: 100% }`, which makes
|
|
167
|
-
// this Indicator hog its parent flex row and squeeze siblings
|
|
168
|
-
// (e.g. an adjacent ToggleGroup's buttons wrap vertically).
|
|
169
|
-
// Size to content instead.
|
|
170
|
-
width: "auto",
|
|
171
|
-
flex: "0 0 auto",
|
|
172
|
-
};
|
|
133
|
+
// Explicit value prop wins over the subscription.
|
|
134
|
+
const displayValue = value !== undefined ? value : subscribedValue;
|
|
135
|
+
const color = pickColor(displayValue, onColor, offColor, invalidColor);
|
|
173
136
|
|
|
174
|
-
|
|
137
|
+
// Children mode: square, filled, inset look. Sized by the caller's
|
|
138
|
+
// className (e.g. `ac-toolbar-icon-btn`) so it lines up with sibling
|
|
139
|
+
// IndicatorButtons in the same toolbar.
|
|
140
|
+
if (children !== undefined && children !== null) {
|
|
141
|
+
const boxStyle: React.CSSProperties = {
|
|
175
142
|
backgroundColor: color,
|
|
176
|
-
|
|
143
|
+
color: 'white',
|
|
144
|
+
display: 'inline-flex',
|
|
145
|
+
alignItems: 'center',
|
|
146
|
+
justifyContent: 'center',
|
|
147
|
+
// Square corners distinguish a passive indicator from an
|
|
148
|
+
// interactive button (PrimeReact buttons round to ~6px).
|
|
149
|
+
borderRadius: 0,
|
|
150
|
+
// Subtle inset shadow reinforces "this is a readout, not a
|
|
151
|
+
// control." Light enough to stay readable against any of the
|
|
152
|
+
// IndicatorColor palette.
|
|
153
|
+
boxShadow: 'inset 0 1px 3px rgba(0, 0, 0, 0.45)',
|
|
154
|
+
boxSizing: 'border-box',
|
|
155
|
+
...style,
|
|
177
156
|
};
|
|
178
|
-
|
|
179
157
|
return (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
</div>
|
|
189
|
-
|
|
158
|
+
<span
|
|
159
|
+
className={clsx('indicator', className)}
|
|
160
|
+
style={boxStyle}
|
|
161
|
+
role="status"
|
|
162
|
+
aria-label={typeof label === 'string' ? label : undefined}
|
|
163
|
+
>
|
|
164
|
+
{children}
|
|
165
|
+
</span>
|
|
190
166
|
);
|
|
191
167
|
}
|
|
192
|
-
|
|
168
|
+
|
|
169
|
+
// Legacy label mode: small color swatch + text. Kept so existing
|
|
170
|
+
// <Indicator label="..." /> callers don't have to migrate. The
|
|
171
|
+
// `p-inputgroup` width:auto guard prevents PrimeReact from stretching
|
|
172
|
+
// this to fill its parent flex row.
|
|
173
|
+
const groupStyle: React.CSSProperties = {
|
|
174
|
+
alignItems: 'center',
|
|
175
|
+
width: 'auto',
|
|
176
|
+
flex: '0 0 auto',
|
|
177
|
+
...style,
|
|
178
|
+
};
|
|
179
|
+
const lampStyle: React.CSSProperties = {
|
|
180
|
+
backgroundColor: color,
|
|
181
|
+
width: '22px',
|
|
182
|
+
borderRadius: 0,
|
|
183
|
+
boxShadow: 'inset 0 1px 2px rgba(0, 0, 0, 0.4)',
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<div className={clsx('p-inputgroup indicator', className)} style={groupStyle} role="status">
|
|
188
|
+
<span className="p-inputgroup-addon" style={lampStyle}>
|
|
189
|
+
|
|
190
|
+
</span>
|
|
191
|
+
{label !== undefined && (
|
|
192
|
+
<span className="p-inputgroup-addon">{label}</span>
|
|
193
|
+
)}
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
193
197
|
|
|
194
198
|
export default Indicator;
|
|
@@ -75,7 +75,7 @@ interface ValueInputProps extends Omit<InputNumberProps, 'value' | 'size'> {
|
|
|
75
75
|
/**
|
|
76
76
|
* The label for the ValueInput field.
|
|
77
77
|
*/
|
|
78
|
-
label: React.ReactNode | undefined;
|
|
78
|
+
label: React.ReactNode | undefined | null;
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
/**
|
|
@@ -205,7 +205,7 @@ interface ValueInputProps extends Omit<InputNumberProps, 'value' | 'size'> {
|
|
|
205
205
|
* accepting and rejecting values and keyboard management.
|
|
206
206
|
*/
|
|
207
207
|
export const ValueInput: React.FC<ValueInputProps> = ({
|
|
208
|
-
label,
|
|
208
|
+
label = undefined,
|
|
209
209
|
value = null,
|
|
210
210
|
min = undefined,
|
|
211
211
|
max = undefined,
|
|
@@ -48,6 +48,13 @@ export interface AmsRole {
|
|
|
48
48
|
description: string | null;
|
|
49
49
|
/** Test method IDs whose start_test will pick up an asset in this role. */
|
|
50
50
|
used_by: string[];
|
|
51
|
+
/** Module names whose configs reference this role via
|
|
52
|
+
* `${ams.by_location.<location>.*}` placeholders. Surfaces in the
|
|
53
|
+
* AIS Role dropdown so the operator can see *why* a role exists
|
|
54
|
+
* even when no test method directly resolves it (e.g., a load_cell
|
|
55
|
+
* feeding NI bridge channel calibration). Empty for purely
|
|
56
|
+
* test-method-driven roles. */
|
|
57
|
+
used_by_modules: string[];
|
|
51
58
|
}
|
|
52
59
|
export type AmsRoleRegistry = { [assetType: string]: AmsRole[] };
|
|
53
60
|
|