@cccsaurora/howler-ui 3.1.0-dev.1627 → 3.1.0-dev.1632
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/components/routes/analytics/widgets/Escalation.js +1 -1
- package/package.json +2 -2
- package/plugins/clue/Provider.js +4 -4
- package/plugins/clue/Provider.test.js +2 -2
- package/plugins/clue/index.d.ts +1 -0
- package/plugins/clue/index.js +3 -2
- package/plugins/clue/index.test.d.ts +1 -0
- package/plugins/clue/index.test.js +8 -0
|
@@ -11,7 +11,7 @@ const Escalation = forwardRef(({ analytic, maxWidth = '45%' }, ref) => {
|
|
|
11
11
|
const { doughnut } = useMyChart();
|
|
12
12
|
const [loading, setLoading] = useState(false);
|
|
13
13
|
const [escalationData, setEscalationData] = useState({});
|
|
14
|
-
const escalationColors = useMemo(() => Object.keys(escalationData).map(escalation => getEscalationColor(escalation, 'rgba(255, 255, 255, 0.16)', theme)), [theme]);
|
|
14
|
+
const escalationColors = useMemo(() => Object.keys(escalationData).map(escalation => getEscalationColor(escalation, 'rgba(255, 255, 255, 0.16)', theme)), [escalationData, theme]);
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
if (!analytic) {
|
|
17
17
|
return;
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@cccsaurora/clue-ui": "1.4.
|
|
15
|
+
"@cccsaurora/clue-ui": "1.4.4",
|
|
16
16
|
"@dnd-kit/core": "^6.3.1",
|
|
17
17
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
18
18
|
"@dnd-kit/sortable": "^8.0.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"url": "https://github.com/CybercentreCanada/howler"
|
|
98
98
|
},
|
|
99
99
|
"type": "module",
|
|
100
|
-
"version": "3.1.0-dev.
|
|
100
|
+
"version": "3.1.0-dev.1632",
|
|
101
101
|
"exports": {
|
|
102
102
|
"./i18n": "./i18n.js",
|
|
103
103
|
"./index.css": "./index.css",
|
package/plugins/clue/Provider.js
CHANGED
|
@@ -9,17 +9,17 @@ import { getStored } from '@cccsaurora/howler-ui/utils/localStorage';
|
|
|
9
9
|
const Provider = ({ children, options = {} }) => {
|
|
10
10
|
const { config } = useContext(ApiConfigContext);
|
|
11
11
|
const features = config?.configuration?.features ?? {};
|
|
12
|
-
const [database, setDatabase] = useState();
|
|
12
|
+
const [database, setDatabase] = useState(null);
|
|
13
13
|
const defaultGetToken = useCallback(() => getStored(StorageKey.APP_TOKEN) ?? '', []);
|
|
14
14
|
const baseURL = options.baseURL ?? `${location.origin}/api/v1/clue`;
|
|
15
15
|
const getToken = options.getToken ?? defaultGetToken;
|
|
16
16
|
const publicIconify = options.publicIconify ?? location.origin.includes('localhost');
|
|
17
17
|
const customIconify = options.customIconify ?? location.origin.replace('howler', 'icons');
|
|
18
18
|
useEffect(() => {
|
|
19
|
-
|
|
20
|
-
if (!features.clue) {
|
|
19
|
+
if (!features.clue || database) {
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
22
|
+
let cancelled = false;
|
|
23
23
|
void buildDatabase({
|
|
24
24
|
storageType: options.storageType ?? 'memory',
|
|
25
25
|
replicate: !!options.replicate,
|
|
@@ -33,7 +33,7 @@ const Provider = ({ children, options = {} }) => {
|
|
|
33
33
|
return () => {
|
|
34
34
|
cancelled = true;
|
|
35
35
|
};
|
|
36
|
-
}, [baseURL, features.clue, getToken, options.storageType, options.replicate]);
|
|
36
|
+
}, [baseURL, features.clue, getToken, options.storageType, options.replicate, database]);
|
|
37
37
|
return (_jsx(ClueProvider, { baseURL: baseURL, getToken: getToken, enabled: features.clue, publicIconify: publicIconify, customIconify: customIconify, defaultTimeout: options.defaultTimeout ?? 5, i18next: useTranslation('clue'), chunkSize: options.chunkSize ?? 50, database: database, includeContext: options.includeContext, children: children }));
|
|
38
38
|
};
|
|
39
39
|
export default Provider;
|
|
@@ -51,7 +51,7 @@ describe('Clue Provider', () => {
|
|
|
51
51
|
renderProvider({ configuration: { features: { clue: false } } });
|
|
52
52
|
expect(mocks.buildDatabase).not.toHaveBeenCalled();
|
|
53
53
|
expect(getProviderProps().enabled).toBe(false);
|
|
54
|
-
expect(getProviderProps().database).
|
|
54
|
+
expect(getProviderProps().database).toBeNull();
|
|
55
55
|
expect(getProviderProps().getToken?.()).toBe('');
|
|
56
56
|
});
|
|
57
57
|
it('returns the current stored application token by default', () => {
|
|
@@ -114,6 +114,6 @@ describe('Clue Provider', () => {
|
|
|
114
114
|
await act(async () => {
|
|
115
115
|
resolveDatabase({ name: 'late' });
|
|
116
116
|
});
|
|
117
|
-
expect(getProviderProps().database).
|
|
117
|
+
expect(getProviderProps().database).toBeNull();
|
|
118
118
|
});
|
|
119
119
|
});
|
package/plugins/clue/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import useSetup from './setup';
|
|
|
9
9
|
export type { CluePluginOptions } from './Provider';
|
|
10
10
|
declare class CluePlugin extends HowlerPlugin {
|
|
11
11
|
private readonly options;
|
|
12
|
+
private readonly providerComponent;
|
|
12
13
|
constructor(options?: CluePluginOptions);
|
|
13
14
|
name: string;
|
|
14
15
|
version: string;
|
package/plugins/clue/index.js
CHANGED
|
@@ -17,9 +17,11 @@ import Provider, {} from './Provider';
|
|
|
17
17
|
import useSetup from './setup';
|
|
18
18
|
class CluePlugin extends HowlerPlugin {
|
|
19
19
|
options;
|
|
20
|
+
providerComponent;
|
|
20
21
|
constructor(options = {}) {
|
|
21
22
|
super();
|
|
22
23
|
this.options = options;
|
|
24
|
+
this.providerComponent = ({ children }) => _jsx(Provider, { options: this.options, children: children });
|
|
23
25
|
}
|
|
24
26
|
name = 'CluePlugin';
|
|
25
27
|
version = '0.0.1';
|
|
@@ -46,8 +48,7 @@ class CluePlugin extends HowlerPlugin {
|
|
|
46
48
|
super.addPivot('clue', pivotForm, pivotRenderer);
|
|
47
49
|
}
|
|
48
50
|
provider() {
|
|
49
|
-
|
|
50
|
-
return ({ children }) => _jsx(Provider, { options: options, children: children });
|
|
51
|
+
return this.providerComponent;
|
|
51
52
|
}
|
|
52
53
|
setup() {
|
|
53
54
|
return useSetup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import CluePlugin from './index';
|
|
3
|
+
describe('Clue plugin', () => {
|
|
4
|
+
it('keeps its provider component identity stable', () => {
|
|
5
|
+
const plugin = new CluePlugin();
|
|
6
|
+
expect(plugin.provider()).toBe(plugin.provider());
|
|
7
|
+
});
|
|
8
|
+
});
|