@cccsaurora/howler-ui 2.18.0-dev.841 → 2.19.0-cases.1040
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/api/action/index.d.ts +5 -4
- package/api/action/index.js +8 -8
- package/api/analytic/index.d.ts +3 -2
- package/api/analytic/index.js +4 -4
- package/api/analytic/owner.d.ts +2 -1
- package/api/analytic/owner.js +2 -2
- package/api/analytic/rules.d.ts +2 -1
- package/api/analytic/rules.js +2 -2
- package/api/dossier/index.d.ts +4 -3
- package/api/dossier/index.js +6 -6
- package/api/hit/index.d.ts +3 -2
- package/api/hit/index.js +4 -4
- package/api/hit/labels.d.ts +3 -2
- package/api/hit/labels.js +4 -4
- package/api/hit/overwrite.d.ts +2 -1
- package/api/hit/overwrite.js +2 -2
- package/api/hit/transition.d.ts +2 -1
- package/api/hit/transition.js +2 -2
- package/api/index.d.ts +5 -4
- package/api/index.js +8 -8
- package/api/overview/index.d.ts +4 -3
- package/api/overview/index.js +6 -6
- package/api/search/overview.d.ts +2 -2
- package/api/template/index.d.ts +4 -3
- package/api/template/index.js +6 -6
- package/api/user/index.d.ts +2 -1
- package/api/user/index.js +2 -2
- package/api/view/index.d.ts +4 -3
- package/api/view/index.js +6 -6
- package/components/app/App.d.ts +1 -0
- package/components/app/App.js +24 -6
- package/components/app/providers/FavouritesProvider.js +0 -4
- package/components/app/providers/ModalProvider.d.ts +1 -0
- package/components/app/providers/ModalProvider.js +5 -1
- package/components/app/providers/RecordProvider.d.ts +1 -1
- package/components/app/providers/RecordProvider.js +1 -1
- package/components/app/providers/SearchResponseProvider.d.ts +21 -0
- package/components/app/providers/SearchResponseProvider.js +81 -0
- package/components/app/providers/SearchResponseProvider.test.d.ts +1 -0
- package/components/app/providers/SearchResponseProvider.test.js +406 -0
- package/components/app/providers/ViewProvider.test.js +4 -1
- package/components/elements/addons/buttons/CustomButton.test.d.ts +1 -0
- package/components/elements/addons/buttons/CustomButton.test.js +106 -0
- package/components/elements/addons/layout/FlexOne.test.d.ts +1 -0
- package/components/elements/addons/layout/FlexOne.test.js +30 -0
- package/components/elements/addons/lists/TuiListBase.js +4 -0
- package/components/elements/addons/lists/TuiListElement.js +6 -3
- package/components/elements/addons/lists/index.d.ts +1 -0
- package/components/elements/addons/search/SearchPagination.d.ts +2 -1
- package/components/elements/addons/search/SearchPagination.js +4 -4
- package/components/elements/addons/search/SearchPagination.test.d.ts +1 -0
- package/components/elements/addons/search/SearchPagination.test.js +80 -0
- package/components/elements/addons/search/SearchTotal.test.d.ts +1 -0
- package/components/elements/addons/search/SearchTotal.test.js +47 -0
- package/components/elements/display/DocumentationButton.test.d.ts +1 -0
- package/components/elements/display/DocumentationButton.test.js +84 -0
- package/components/elements/display/DynamicTabs.test.d.ts +1 -0
- package/components/elements/display/DynamicTabs.test.js +93 -0
- package/components/elements/display/HowlerAvatar.js +2 -1
- package/components/elements/display/HowlerCard.test.d.ts +1 -0
- package/components/elements/display/HowlerCard.test.js +51 -0
- package/components/elements/display/Image.test.d.ts +1 -0
- package/components/elements/display/Image.test.js +79 -0
- package/components/elements/display/ItemManager.d.ts +2 -2
- package/components/elements/display/ItemManager.js +1 -1
- package/components/elements/display/Markdown.js +9 -2
- package/components/elements/display/QueryResultText.test.d.ts +1 -0
- package/components/elements/display/QueryResultText.test.js +48 -0
- package/components/elements/display/TextDivider.test.d.ts +1 -0
- package/components/elements/display/TextDivider.test.js +43 -0
- package/components/elements/display/TypingIndicator.test.d.ts +1 -0
- package/components/elements/display/TypingIndicator.test.js +33 -0
- package/components/elements/display/modals/ConfirmDeleteModal.d.ts +4 -0
- package/components/elements/display/modals/ConfirmDeleteModal.js +4 -2
- package/components/elements/hit/HitBanner.js +6 -3
- package/components/elements/hit/HitLinks.js +1 -1
- package/components/elements/hit/HitSummary.js +3 -2
- package/components/elements/hit/elements/AnalyticLink.js +1 -1
- package/components/elements/hit/elements/Assigned.d.ts +2 -0
- package/components/elements/hit/elements/Assigned.js +15 -13
- package/components/elements/record/RecordContextMenu.js +15 -3
- package/components/elements/record/RecordContextMenu.test.js +96 -0
- package/components/hooks/useMyApi.d.ts +1 -1
- package/components/hooks/useMyPreferences.js +2 -1
- package/components/routes/403.d.ts +3 -0
- package/components/routes/403.js +10 -0
- package/components/routes/403.test.d.ts +1 -0
- package/components/routes/403.test.js +27 -0
- package/components/routes/404.test.d.ts +1 -0
- package/components/routes/404.test.js +26 -0
- package/components/routes/ErrorBoundary.test.d.ts +1 -0
- package/components/routes/ErrorBoundary.test.js +43 -0
- package/components/routes/ErrorOccured.test.d.ts +1 -0
- package/components/routes/ErrorOccured.test.js +35 -0
- package/components/routes/Logout.test.d.ts +1 -0
- package/components/routes/Logout.test.js +59 -0
- package/components/routes/action/edit/ActionEditor.js +1 -1
- package/components/routes/action/useMyActionFunctions.js +30 -6
- package/components/routes/action/view/ActionDetails.js +15 -2
- package/components/routes/action/view/ActionSearch.js +32 -20
- package/components/routes/action/view/markdown/integrations.en.md.js +1 -1
- package/components/routes/action/view/markdown/integrations.fr.md.js +1 -1
- package/components/routes/analytics/AnalyticDetails.js +10 -6
- package/components/routes/analytics/AnalyticSearch.js +6 -6
- package/components/routes/cases/Cases.js +5 -6
- package/components/routes/cases/modals/ResolveModal.js +14 -13
- package/components/routes/cases/modals/ResolveModal.test.js +85 -25
- package/components/routes/dossiers/Dossiers.js +25 -19
- package/components/routes/help/ActionIntroductionDocumentation.js +1 -1
- package/components/routes/help/markdown/en/client.md.js +1 -1
- package/components/routes/help/markdown/en/retention.md.js +1 -1
- package/components/routes/help/markdown/fr/client.md.js +1 -1
- package/components/routes/help/markdown/fr/retention.md.js +1 -1
- package/components/routes/hits/search/shared/CustomSpan.js +7 -7
- package/components/routes/hits/search/shared/CustomSpan.test.d.ts +1 -0
- package/components/routes/hits/search/shared/CustomSpan.test.js +170 -0
- package/components/routes/home/AddNewCard.js +1 -1
- package/components/routes/home/AddNewCard.test.d.ts +1 -0
- package/components/routes/home/AddNewCard.test.js +86 -0
- package/components/routes/home/ViewCard.js +1 -1
- package/components/routes/home/ViewRefresh.test.d.ts +1 -0
- package/components/routes/home/ViewRefresh.test.js +79 -0
- package/components/routes/overviews/OverviewCard.test.d.ts +1 -0
- package/components/routes/overviews/OverviewCard.test.js +108 -0
- package/components/routes/overviews/OverviewViewer.js +16 -8
- package/components/routes/overviews/Overviews.js +25 -19
- package/components/routes/overviews/template/en.md.js +1 -1
- package/components/routes/overviews/template/fr.md.js +1 -1
- package/components/routes/settings/LocalSection.js +2 -1
- package/components/routes/settings/SettingsSection.test.d.ts +1 -0
- package/components/routes/settings/SettingsSection.test.js +19 -0
- package/components/routes/templates/TemplateCard.d.ts +3 -1
- package/components/routes/templates/TemplateCard.js +8 -4
- package/components/routes/templates/TemplateCard.test.d.ts +1 -0
- package/components/routes/templates/TemplateCard.test.js +115 -0
- package/components/routes/templates/TemplateViewer.js +62 -16
- package/components/routes/templates/Templates.js +35 -13
- package/components/routes/views/Views.js +21 -14
- package/locales/en/translation.json +25 -4
- package/locales/fr/translation.json +25 -4
- package/models/entities/generated/ApiType.d.ts +1 -1
- package/models/entities/generated/Hit.d.ts +1 -0
- package/models/entities/generated/Howler.d.ts +1 -0
- package/models/entities/generated/UserUser.d.ts +2 -0
- package/package.json +143 -148
- package/rest/FetchClient.test.d.ts +1 -0
- package/rest/FetchClient.test.js +81 -0
- package/setupTests.js +5 -0
- package/utils/Throttler.test.d.ts +1 -0
- package/utils/Throttler.test.js +135 -0
- package/utils/actionUtils.test.d.ts +1 -0
- package/utils/actionUtils.test.js +140 -0
- package/utils/constants.d.ts +1 -0
- package/utils/constants.js +1 -0
- package/utils/hitFunctions.test.d.ts +1 -0
- package/utils/hitFunctions.test.js +52 -0
- package/utils/localStorage.test.d.ts +1 -0
- package/utils/localStorage.test.js +96 -0
- package/utils/menuUtils.js +1 -1
- package/utils/menuUtils.test.d.ts +1 -0
- package/utils/menuUtils.test.js +198 -0
- package/utils/sessionStorage.test.d.ts +1 -0
- package/utils/sessionStorage.test.js +81 -0
- package/utils/stringUtils.test.d.ts +1 -0
- package/utils/stringUtils.test.js +159 -0
- package/utils/utils.test.d.ts +1 -0
- package/utils/utils.test.js +292 -0
- package/utils/viewUtils.test.d.ts +1 -0
- package/utils/viewUtils.test.js +45 -0
- package/utils/xsrf.test.d.ts +1 -0
- package/utils/xsrf.test.js +41 -0
package/api/action/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import * as execute from '@cccsaurora/howler-ui/api/action/execute';
|
|
2
3
|
import * as operations from '@cccsaurora/howler-ui/api/action/operations';
|
|
3
4
|
import type { Action } from '@cccsaurora/howler-ui/models/entities/generated/Action';
|
|
4
5
|
export declare const uri: (id?: string) => string;
|
|
5
6
|
export declare const get: (id: string) => Promise<Action>;
|
|
6
|
-
export declare const post: (data: Action) => Promise<Action>;
|
|
7
|
-
export declare const put: (id: string, data: Action) => Promise<Action>;
|
|
8
|
-
export declare const patch: (id: string, data: Action) => Promise<Action>;
|
|
9
|
-
export declare const del: (id: string) => Promise<void>;
|
|
7
|
+
export declare const post: (data: Action, refresh?: HowlerRefreshParam) => Promise<Action>;
|
|
8
|
+
export declare const put: (id: string, data: Action, refresh?: HowlerRefreshParam) => Promise<Action>;
|
|
9
|
+
export declare const patch: (id: string, data: Action, refresh?: HowlerRefreshParam) => Promise<Action>;
|
|
10
|
+
export declare const del: (id: string, refresh?: HowlerRefreshParam) => Promise<void>;
|
|
10
11
|
export { execute, operations };
|
package/api/action/index.js
CHANGED
|
@@ -13,16 +13,16 @@ export const get = (id) => {
|
|
|
13
13
|
})
|
|
14
14
|
.then(res => res.items[0]);
|
|
15
15
|
};
|
|
16
|
-
export const post = (data) => {
|
|
17
|
-
return hpost(uri(), data);
|
|
16
|
+
export const post = (data, refresh) => {
|
|
17
|
+
return hpost(uri(), data, {}, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
18
18
|
};
|
|
19
|
-
export const put = (id, data) => {
|
|
20
|
-
return hput(uri(id), data);
|
|
19
|
+
export const put = (id, data, refresh) => {
|
|
20
|
+
return hput(uri(id), data, {}, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
21
21
|
};
|
|
22
|
-
export const patch = (id, data) => {
|
|
23
|
-
return hpatch(uri(id), data);
|
|
22
|
+
export const patch = (id, data, refresh) => {
|
|
23
|
+
return hpatch(uri(id), data, {}, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
24
24
|
};
|
|
25
|
-
export const del = (id) => {
|
|
26
|
-
return hdelete(uri(id));
|
|
25
|
+
export const del = (id, refresh) => {
|
|
26
|
+
return hdelete(uri(id), undefined, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
27
27
|
};
|
|
28
28
|
export { execute, operations };
|
package/api/analytic/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import * as comments from '@cccsaurora/howler-ui/api/analytic/comments';
|
|
2
3
|
import * as favourite from '@cccsaurora/howler-ui/api/analytic/favourite';
|
|
3
4
|
import * as notebooks from '@cccsaurora/howler-ui/api/analytic/notebooks';
|
|
@@ -7,6 +8,6 @@ import type { Analytic } from '@cccsaurora/howler-ui/models/entities/generated/A
|
|
|
7
8
|
export type EditOptions = Pick<Analytic, 'description' | 'rule' | 'rule_crontab' | 'triage_settings'>;
|
|
8
9
|
export declare const uri: (id?: string) => string;
|
|
9
10
|
export declare const get: (id?: string) => Promise<Analytic> | Promise<Analytic[]>;
|
|
10
|
-
export declare const put: (id: string, editData: EditOptions) => Promise<Analytic>;
|
|
11
|
-
export declare const del: (id: string) => Promise<
|
|
11
|
+
export declare const put: (id: string, editData: EditOptions, refresh?: HowlerRefreshParam) => Promise<Analytic>;
|
|
12
|
+
export declare const del: (id: string, refresh?: HowlerRefreshParam) => Promise<void>;
|
|
12
13
|
export { comments, favourite, notebooks, owner, rules };
|
package/api/analytic/index.js
CHANGED
|
@@ -10,10 +10,10 @@ export const uri = (id) => {
|
|
|
10
10
|
export const get = (id) => {
|
|
11
11
|
return id ? hget(uri(id)) : hget(uri());
|
|
12
12
|
};
|
|
13
|
-
export const put = (id, editData) => {
|
|
14
|
-
return hput(uri(id), editData);
|
|
13
|
+
export const put = (id, editData, refresh) => {
|
|
14
|
+
return hput(uri(id), editData, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
15
15
|
};
|
|
16
|
-
export const del = (id) => {
|
|
17
|
-
return hdelete(uri(id));
|
|
16
|
+
export const del = (id, refresh) => {
|
|
17
|
+
return hdelete(uri(id), undefined, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
18
18
|
};
|
|
19
19
|
export { comments, favourite, notebooks, owner, rules };
|
package/api/analytic/owner.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import type { Analytic } from '@cccsaurora/howler-ui/models/entities/generated/Analytic';
|
|
2
3
|
export declare const uri: (id: string) => string;
|
|
3
4
|
export declare const post: (id: string, body: {
|
|
4
5
|
username: string;
|
|
5
|
-
}) => Promise<Analytic>;
|
|
6
|
+
}, refresh?: HowlerRefreshParam) => Promise<Analytic>;
|
package/api/analytic/owner.js
CHANGED
|
@@ -3,6 +3,6 @@ import { uri as parentUri } from '@cccsaurora/howler-ui/api/analytic';
|
|
|
3
3
|
export const uri = (id) => {
|
|
4
4
|
return joinAllUri(parentUri(), id, 'owner');
|
|
5
5
|
};
|
|
6
|
-
export const post = (id, body) => {
|
|
7
|
-
return hpost(uri(id), body);
|
|
6
|
+
export const post = (id, body, refresh) => {
|
|
7
|
+
return hpost(uri(id), body, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
8
8
|
};
|
package/api/analytic/rules.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import type { Analytic } from '@cccsaurora/howler-ui/models/entities/generated/Analytic';
|
|
2
3
|
export declare const uri: () => string;
|
|
3
|
-
export declare const post: (body: Pick<Analytic, "description" | "name" | "rule" | "rule_type" | "rule_crontab"
|
|
4
|
+
export declare const post: (body: Pick<Analytic, "description" | "name" | "rule" | "rule_type" | "rule_crontab">, refresh?: HowlerRefreshParam) => Promise<Analytic>;
|
package/api/analytic/rules.js
CHANGED
|
@@ -3,6 +3,6 @@ import { uri as parentUri } from '@cccsaurora/howler-ui/api/analytic';
|
|
|
3
3
|
export const uri = () => {
|
|
4
4
|
return joinUri(parentUri(), 'rules');
|
|
5
5
|
};
|
|
6
|
-
export const post = (body) => {
|
|
7
|
-
return hpost(uri(), body);
|
|
6
|
+
export const post = (body, refresh) => {
|
|
7
|
+
return hpost(uri(), body, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
8
8
|
};
|
package/api/dossier/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import type { Dossier } from '@cccsaurora/howler-ui/models/entities/generated/Dossier';
|
|
2
3
|
import * as hit from './hit';
|
|
3
4
|
export declare const uri: (id?: string) => string;
|
|
4
5
|
export declare const get: (id?: string) => Promise<Dossier | Dossier[]>;
|
|
5
|
-
export declare const post: (newData: Partial<Dossier
|
|
6
|
-
export declare const put: (id: string, dossier: Partial<Dossier
|
|
7
|
-
export declare const del: (id: string) => Promise<void>;
|
|
6
|
+
export declare const post: (newData: Partial<Dossier>, refresh?: HowlerRefreshParam) => Promise<Dossier>;
|
|
7
|
+
export declare const put: (id: string, dossier: Partial<Dossier>, refresh?: HowlerRefreshParam) => Promise<Dossier>;
|
|
8
|
+
export declare const del: (id: string, refresh?: HowlerRefreshParam) => Promise<void>;
|
|
8
9
|
export { hit };
|
package/api/dossier/index.js
CHANGED
|
@@ -7,13 +7,13 @@ export const uri = (id) => {
|
|
|
7
7
|
export const get = (id) => {
|
|
8
8
|
return hget(uri(id));
|
|
9
9
|
};
|
|
10
|
-
export const post = (newData) => {
|
|
11
|
-
return hpost(uri(), newData);
|
|
10
|
+
export const post = (newData, refresh) => {
|
|
11
|
+
return hpost(uri(), newData, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
12
12
|
};
|
|
13
|
-
export const put = (id, dossier) => {
|
|
14
|
-
return hput(uri(id), dossier);
|
|
13
|
+
export const put = (id, dossier, refresh) => {
|
|
14
|
+
return hput(uri(id), dossier, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
15
15
|
};
|
|
16
|
-
export const del = (id) => {
|
|
17
|
-
return hdelete(uri(id));
|
|
16
|
+
export const del = (id, refresh) => {
|
|
17
|
+
return hdelete(uri(id), undefined, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
18
18
|
};
|
|
19
19
|
export { hit };
|
package/api/hit/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import * as assign from '@cccsaurora/howler-ui/api/hit/assign';
|
|
2
3
|
import * as comments from '@cccsaurora/howler-ui/api/hit/comments';
|
|
3
4
|
import * as labels from '@cccsaurora/howler-ui/api/hit/labels';
|
|
@@ -28,8 +29,8 @@ interface PostResponse {
|
|
|
28
29
|
error: string;
|
|
29
30
|
}[];
|
|
30
31
|
}
|
|
31
|
-
export declare const post: (hits: Hit[]) => Promise<PostResponse>;
|
|
32
|
-
export declare const del: (ids: string[]) => Promise<{
|
|
32
|
+
export declare const post: (hits: Hit[], refresh?: HowlerRefreshParam) => Promise<PostResponse>;
|
|
33
|
+
export declare const del: (ids: string[], refresh?: HowlerRefreshParam) => Promise<{
|
|
33
34
|
success: boolean;
|
|
34
35
|
}>;
|
|
35
36
|
export { assign, comments, labels, overwrite, transition };
|
package/api/hit/index.js
CHANGED
|
@@ -14,10 +14,10 @@ export const get = (id, metadata) => {
|
|
|
14
14
|
}
|
|
15
15
|
return hget(uri(id), params);
|
|
16
16
|
};
|
|
17
|
-
export const post = (hits) => {
|
|
18
|
-
return hpost(uri(), hits);
|
|
17
|
+
export const post = (hits, refresh) => {
|
|
18
|
+
return hpost(uri(), hits, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
19
19
|
};
|
|
20
|
-
export const del = (ids) => {
|
|
21
|
-
return hdelete(uri(), ids);
|
|
20
|
+
export const del = (ids, refresh) => {
|
|
21
|
+
return hdelete(uri(), ids, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
22
22
|
};
|
|
23
23
|
export { assign, comments, labels, overwrite, transition };
|
package/api/hit/labels.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import type { LabelActionBody } from '@cccsaurora/howler-ui/api/hit';
|
|
2
3
|
import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
|
|
3
4
|
export declare const uri: (id: string, category: string) => string;
|
|
4
|
-
export declare const put: (id: string, category: string, body: LabelActionBody) => Promise<Hit>;
|
|
5
|
-
export declare const del: (id: string, category: string, body: LabelActionBody) => Promise<Hit>;
|
|
5
|
+
export declare const put: (id: string, category: string, body: LabelActionBody, refresh?: HowlerRefreshParam) => Promise<Hit>;
|
|
6
|
+
export declare const del: (id: string, category: string, body: LabelActionBody, refresh?: HowlerRefreshParam) => Promise<Hit>;
|
package/api/hit/labels.js
CHANGED
|
@@ -3,9 +3,9 @@ import { uri as parentUri } from '@cccsaurora/howler-ui/api/hit';
|
|
|
3
3
|
export const uri = (id, category) => {
|
|
4
4
|
return joinAllUri(parentUri(), id, 'labels', category);
|
|
5
5
|
};
|
|
6
|
-
export const put = (id, category, body) => {
|
|
7
|
-
return hput(uri(id, category), body);
|
|
6
|
+
export const put = (id, category, body, refresh) => {
|
|
7
|
+
return hput(uri(id, category), body, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
8
8
|
};
|
|
9
|
-
export const del = (id, category, body) => {
|
|
10
|
-
return hdelete(uri(id, category), body);
|
|
9
|
+
export const del = (id, category, body, refresh) => {
|
|
10
|
+
return hdelete(uri(id, category), body, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
11
11
|
};
|
package/api/hit/overwrite.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
|
|
2
3
|
export declare const uri: (id: string) => string;
|
|
3
|
-
export declare const put: <T extends Hit = Hit>(id: string, body: Partial<T
|
|
4
|
+
export declare const put: <T extends Hit = Hit>(id: string, body: Partial<T>, refresh?: HowlerRefreshParam) => Promise<T>;
|
package/api/hit/overwrite.js
CHANGED
|
@@ -3,6 +3,6 @@ import { uri as parentUri } from '@cccsaurora/howler-ui/api/hit';
|
|
|
3
3
|
export const uri = (id) => {
|
|
4
4
|
return joinAllUri(parentUri(), id, 'overwrite');
|
|
5
5
|
};
|
|
6
|
-
export const put = (id, body) => {
|
|
7
|
-
return hput(uri(id), body);
|
|
6
|
+
export const put = (id, body, refresh) => {
|
|
7
|
+
return hput(uri(id), body, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
8
8
|
};
|
package/api/hit/transition.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import type { HitTransitionBody } from '@cccsaurora/howler-ui/api/hit';
|
|
2
3
|
import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
|
|
3
4
|
export declare const uri: (id: string) => string;
|
|
4
|
-
export declare const post: (id: string, body: HitTransitionBody) => Promise<Hit>;
|
|
5
|
+
export declare const post: (id: string, body: HitTransitionBody, refresh?: HowlerRefreshParam) => Promise<Hit>;
|
package/api/hit/transition.js
CHANGED
|
@@ -3,6 +3,6 @@ import { uri as parentUri } from '@cccsaurora/howler-ui/api/hit';
|
|
|
3
3
|
export const uri = (id) => {
|
|
4
4
|
return joinAllUri(parentUri(), id, 'transition');
|
|
5
5
|
};
|
|
6
|
-
export const post = (id, body) => {
|
|
7
|
-
return hpost(uri(id), body);
|
|
6
|
+
export const post = (id, body, refresh) => {
|
|
7
|
+
return hpost(uri(id), body, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
8
8
|
};
|
package/api/index.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export type HowlerResponse<R> = {
|
|
|
42
42
|
api_server_version: string;
|
|
43
43
|
api_status_code: number;
|
|
44
44
|
};
|
|
45
|
+
export type HowlerRefreshParam = 'true' | 'false' | 'wait_for';
|
|
45
46
|
/**
|
|
46
47
|
* The base section of the Howler API uri.
|
|
47
48
|
*
|
|
@@ -110,7 +111,7 @@ export declare const hget: <R = any>(_uri: string, searchParams?: URLSearchParam
|
|
|
110
111
|
* @param body - the body of the request.
|
|
111
112
|
* @returns the `api_response` object of the returned {@link HowlerResponse}.
|
|
112
113
|
*/
|
|
113
|
-
export declare const hpost: <R = any>(_uri: string, body: any, headers?: HeadersInit) => Promise<R>;
|
|
114
|
+
export declare const hpost: <R = any>(_uri: string, body: any, headers?: HeadersInit, searchParams?: URLSearchParams) => Promise<R>;
|
|
114
115
|
/**
|
|
115
116
|
* Peform an HTTP PUT for the specified uri and body data.
|
|
116
117
|
*
|
|
@@ -120,7 +121,7 @@ export declare const hpost: <R = any>(_uri: string, body: any, headers?: Headers
|
|
|
120
121
|
* @param body - the body of the request.
|
|
121
122
|
* @returns the `api_response` object of the returned {@link HowlerResponse}.
|
|
122
123
|
*/
|
|
123
|
-
export declare const hput: <R = any>(_uri: string, body: any, headers?: HeadersInit) => Promise<R>;
|
|
124
|
+
export declare const hput: <R = any>(_uri: string, body: any, headers?: HeadersInit, searchParams?: URLSearchParams) => Promise<R>;
|
|
124
125
|
/**
|
|
125
126
|
* Peform an HTTP PATCH for the specified uri and body data.
|
|
126
127
|
*
|
|
@@ -130,7 +131,7 @@ export declare const hput: <R = any>(_uri: string, body: any, headers?: HeadersI
|
|
|
130
131
|
* @param body - the body of the request.
|
|
131
132
|
* @returns the `api_response` object of the returned {@link HowlerResponse}.
|
|
132
133
|
*/
|
|
133
|
-
export declare const hpatch: <R = any>(_uri: string, body: any, headers?: HeadersInit) => Promise<R>;
|
|
134
|
+
export declare const hpatch: <R = any>(_uri: string, body: any, headers?: HeadersInit, searchParams?: URLSearchParams) => Promise<R>;
|
|
134
135
|
/**
|
|
135
136
|
* Performa an HTTP DELETE for the specified uri.
|
|
136
137
|
*
|
|
@@ -139,7 +140,7 @@ export declare const hpatch: <R = any>(_uri: string, body: any, headers?: Header
|
|
|
139
140
|
* @param _uri - the uri to fetch.
|
|
140
141
|
* @returns the `api_response` object of the returned {@link HowlerResponse}.
|
|
141
142
|
*/
|
|
142
|
-
export declare const hdelete: <R = any>(_uri: string, body?: any, headers?: HeadersInit) => Promise<R>;
|
|
143
|
+
export declare const hdelete: <R = any>(_uri: string, body?: any, headers?: HeadersInit, searchParams?: URLSearchParams) => Promise<R>;
|
|
143
144
|
/**
|
|
144
145
|
* Default export exposing the howler rest api
|
|
145
146
|
*/
|
package/api/index.js
CHANGED
|
@@ -204,8 +204,8 @@ export const hget = (_uri, searchParams, headers = {}) => {
|
|
|
204
204
|
* @param body - the body of the request.
|
|
205
205
|
* @returns the `api_response` object of the returned {@link HowlerResponse}.
|
|
206
206
|
*/
|
|
207
|
-
export const hpost = (_uri, body, headers = {}) => {
|
|
208
|
-
return hfetch(_uri, 'post', body,
|
|
207
|
+
export const hpost = (_uri, body, headers = {}, searchParams) => {
|
|
208
|
+
return hfetch(_uri, 'post', body, searchParams, headers);
|
|
209
209
|
};
|
|
210
210
|
/**
|
|
211
211
|
* Peform an HTTP PUT for the specified uri and body data.
|
|
@@ -216,8 +216,8 @@ export const hpost = (_uri, body, headers = {}) => {
|
|
|
216
216
|
* @param body - the body of the request.
|
|
217
217
|
* @returns the `api_response` object of the returned {@link HowlerResponse}.
|
|
218
218
|
*/
|
|
219
|
-
export const hput = (_uri, body, headers = {}) => {
|
|
220
|
-
return hfetch(_uri, 'put', body,
|
|
219
|
+
export const hput = (_uri, body, headers = {}, searchParams) => {
|
|
220
|
+
return hfetch(_uri, 'put', body, searchParams, headers);
|
|
221
221
|
};
|
|
222
222
|
/**
|
|
223
223
|
* Peform an HTTP PATCH for the specified uri and body data.
|
|
@@ -228,8 +228,8 @@ export const hput = (_uri, body, headers = {}) => {
|
|
|
228
228
|
* @param body - the body of the request.
|
|
229
229
|
* @returns the `api_response` object of the returned {@link HowlerResponse}.
|
|
230
230
|
*/
|
|
231
|
-
export const hpatch = (_uri, body, headers = {}) => {
|
|
232
|
-
return hfetch(_uri, 'patch', body,
|
|
231
|
+
export const hpatch = (_uri, body, headers = {}, searchParams) => {
|
|
232
|
+
return hfetch(_uri, 'patch', body, searchParams, headers);
|
|
233
233
|
};
|
|
234
234
|
/**
|
|
235
235
|
* Performa an HTTP DELETE for the specified uri.
|
|
@@ -239,8 +239,8 @@ export const hpatch = (_uri, body, headers = {}) => {
|
|
|
239
239
|
* @param _uri - the uri to fetch.
|
|
240
240
|
* @returns the `api_response` object of the returned {@link HowlerResponse}.
|
|
241
241
|
*/
|
|
242
|
-
export const hdelete = (_uri, body = null, headers = {}) => {
|
|
243
|
-
return hfetch(_uri, 'delete', body,
|
|
242
|
+
export const hdelete = (_uri, body = null, headers = {}, searchParams) => {
|
|
243
|
+
return hfetch(_uri, 'delete', body, searchParams, headers);
|
|
244
244
|
};
|
|
245
245
|
/**
|
|
246
246
|
* Default export exposing the howler rest api
|
package/api/overview/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import type { Overview } from '@cccsaurora/howler-ui/models/entities/generated/Overview';
|
|
2
3
|
export declare const uri: (id?: string) => string;
|
|
3
4
|
export declare const get: () => Promise<Overview[]>;
|
|
4
|
-
export declare const post: (newData: Partial<Overview
|
|
5
|
-
export declare const put: (id: string, content: string) => Promise<Overview>;
|
|
6
|
-
export declare const del: (id: string) => Promise<void>;
|
|
5
|
+
export declare const post: (newData: Partial<Overview>, refresh?: HowlerRefreshParam) => Promise<Overview>;
|
|
6
|
+
export declare const put: (id: string, content: string, refresh?: HowlerRefreshParam) => Promise<Overview>;
|
|
7
|
+
export declare const del: (id: string, refresh?: HowlerRefreshParam) => Promise<void>;
|
package/api/overview/index.js
CHANGED
|
@@ -5,12 +5,12 @@ export const uri = (id) => {
|
|
|
5
5
|
export const get = () => {
|
|
6
6
|
return hget(uri());
|
|
7
7
|
};
|
|
8
|
-
export const post = (newData) => {
|
|
9
|
-
return hpost(uri(), newData);
|
|
8
|
+
export const post = (newData, refresh) => {
|
|
9
|
+
return hpost(uri(), newData, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
10
10
|
};
|
|
11
|
-
export const put = (id, content) => {
|
|
12
|
-
return hput(uri(id), { content });
|
|
11
|
+
export const put = (id, content, refresh) => {
|
|
12
|
+
return hput(uri(id), { content }, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
13
13
|
};
|
|
14
|
-
export const del = (id) => {
|
|
15
|
-
return hdelete(uri(id));
|
|
14
|
+
export const del = (id, refresh) => {
|
|
15
|
+
return hdelete(uri(id), undefined, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
16
16
|
};
|
package/api/search/overview.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { HowlerSearchRequest, HowlerSearchResponse } from '@cccsaurora/howler-ui/api/search';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Overview } from '@cccsaurora/howler-ui/models/entities/generated/Overview';
|
|
3
3
|
export declare const uri: () => string;
|
|
4
|
-
export declare const post: (request?: HowlerSearchRequest) => Promise<HowlerSearchResponse<
|
|
4
|
+
export declare const post: (request?: HowlerSearchRequest) => Promise<HowlerSearchResponse<Overview>>;
|
package/api/template/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import type { Template } from '@cccsaurora/howler-ui/models/entities/generated/Template';
|
|
2
3
|
export declare const uri: (id?: string) => string;
|
|
3
4
|
export declare const get: () => Promise<Template[]>;
|
|
4
|
-
export declare const post: (newData: Partial<Template
|
|
5
|
-
export declare const put: (id: string, newFields: string[]) => Promise<Template>;
|
|
6
|
-
export declare const del: (id: string) => Promise<void>;
|
|
5
|
+
export declare const post: (newData: Partial<Template>, refresh?: HowlerRefreshParam) => Promise<Template>;
|
|
6
|
+
export declare const put: (id: string, newFields: string[], refresh?: HowlerRefreshParam) => Promise<Template>;
|
|
7
|
+
export declare const del: (id: string, refresh?: HowlerRefreshParam) => Promise<void>;
|
package/api/template/index.js
CHANGED
|
@@ -5,12 +5,12 @@ export const uri = (id) => {
|
|
|
5
5
|
export const get = () => {
|
|
6
6
|
return hget(uri());
|
|
7
7
|
};
|
|
8
|
-
export const post = (newData) => {
|
|
9
|
-
return hpost(uri(), newData);
|
|
8
|
+
export const post = (newData, refresh) => {
|
|
9
|
+
return hpost(uri(), newData, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
10
10
|
};
|
|
11
|
-
export const put = (id, newFields) => {
|
|
12
|
-
return hput(uri(id), newFields);
|
|
11
|
+
export const put = (id, newFields, refresh) => {
|
|
12
|
+
return hput(uri(id), newFields, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
13
13
|
};
|
|
14
|
-
export const del = (id) => {
|
|
15
|
-
return hdelete(uri(id));
|
|
14
|
+
export const del = (id, refresh) => {
|
|
15
|
+
return hdelete(uri(id), undefined, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
16
16
|
};
|
package/api/user/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import * as avatar from '@cccsaurora/howler-ui/api/user/avatar';
|
|
2
3
|
import * as groups from '@cccsaurora/howler-ui/api/user/groups';
|
|
3
4
|
import * as whoami from '@cccsaurora/howler-ui/api/user/whoami';
|
|
@@ -6,5 +7,5 @@ export declare const uri: (username?: string) => string;
|
|
|
6
7
|
export declare const get: (username: string) => Promise<HowlerUser>;
|
|
7
8
|
export declare const put: (username: string, newData: Partial<HowlerUser> | {
|
|
8
9
|
new_pass: string;
|
|
9
|
-
}) => Promise<any>;
|
|
10
|
+
}, refresh?: HowlerRefreshParam) => Promise<any>;
|
|
10
11
|
export { avatar, groups, whoami };
|
package/api/user/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export const uri = (username) => {
|
|
|
9
9
|
export const get = (username) => {
|
|
10
10
|
return hget(uri(username));
|
|
11
11
|
};
|
|
12
|
-
export const put = (username, newData) => {
|
|
13
|
-
return hput(uri(username), newData);
|
|
12
|
+
export const put = (username, newData, refresh) => {
|
|
13
|
+
return hput(uri(username), newData, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
14
14
|
};
|
|
15
15
|
export { avatar, groups, whoami };
|
package/api/view/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type HowlerRefreshParam } from '@cccsaurora/howler-ui/api';
|
|
1
2
|
import * as favourite from '@cccsaurora/howler-ui/api/view/favourite';
|
|
2
3
|
import type { View } from '@cccsaurora/howler-ui/models/entities/generated/View';
|
|
3
4
|
export declare const uri: (id?: string) => string;
|
|
4
5
|
export declare const get: () => Promise<View[]>;
|
|
5
|
-
export declare const post: (newData: Partial<View
|
|
6
|
-
export declare const put: (id: string, partialView: Partial<Omit<View, "view_id"
|
|
7
|
-
export declare const del: (id: string) => Promise<void>;
|
|
6
|
+
export declare const post: (newData: Partial<View>, refresh?: HowlerRefreshParam) => Promise<View>;
|
|
7
|
+
export declare const put: (id: string, partialView: Partial<Omit<View, "view_id">>, refresh?: HowlerRefreshParam) => Promise<View>;
|
|
8
|
+
export declare const del: (id: string, refresh?: HowlerRefreshParam) => Promise<void>;
|
|
8
9
|
export { favourite };
|
package/api/view/index.js
CHANGED
|
@@ -6,13 +6,13 @@ export const uri = (id) => {
|
|
|
6
6
|
export const get = () => {
|
|
7
7
|
return hget(uri());
|
|
8
8
|
};
|
|
9
|
-
export const post = (newData) => {
|
|
10
|
-
return hpost(uri(), newData);
|
|
9
|
+
export const post = (newData, refresh) => {
|
|
10
|
+
return hpost(uri(), newData, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
11
11
|
};
|
|
12
|
-
export const put = (id, partialView) => {
|
|
13
|
-
return hput(uri(id), partialView);
|
|
12
|
+
export const put = (id, partialView, refresh) => {
|
|
13
|
+
return hput(uri(id), partialView, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
14
14
|
};
|
|
15
|
-
export const del = (id) => {
|
|
16
|
-
return hdelete(uri(id));
|
|
15
|
+
export const del = (id, refresh) => {
|
|
16
|
+
return hdelete(uri(id), undefined, undefined, refresh ? new URLSearchParams({ refresh }) : undefined);
|
|
17
17
|
};
|
|
18
18
|
export { favourite };
|
package/components/app/App.d.ts
CHANGED
package/components/app/App.js
CHANGED
|
@@ -13,6 +13,7 @@ import useMyTheme from '@cccsaurora/howler-ui/components/hooks/useMyTheme';
|
|
|
13
13
|
import useMyUser from '@cccsaurora/howler-ui/components/hooks/useMyUser';
|
|
14
14
|
import LoginScreen from '@cccsaurora/howler-ui/components/logins/Login';
|
|
15
15
|
import useLogin from '@cccsaurora/howler-ui/components/logins/hooks/useLogin';
|
|
16
|
+
import PermissionDeniedPage from '@cccsaurora/howler-ui/components/routes/403';
|
|
16
17
|
import NotFoundPage from '@cccsaurora/howler-ui/components/routes/404';
|
|
17
18
|
import ErrorBoundary from '@cccsaurora/howler-ui/components/routes/ErrorBoundary';
|
|
18
19
|
import Logout from '@cccsaurora/howler-ui/components/routes/Logout';
|
|
@@ -57,14 +58,16 @@ import Templates from '@cccsaurora/howler-ui/components/routes/templates/Templat
|
|
|
57
58
|
import ViewComposer from '@cccsaurora/howler-ui/components/routes/views/ViewComposer';
|
|
58
59
|
import Views from '@cccsaurora/howler-ui/components/routes/views/Views';
|
|
59
60
|
import dayjs from 'dayjs';
|
|
61
|
+
import 'dayjs/locale/fr-ca';
|
|
60
62
|
import duration from 'dayjs/plugin/duration';
|
|
61
63
|
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
64
|
+
import minMax from 'dayjs/plugin/minMax';
|
|
62
65
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
63
66
|
import utc from 'dayjs/plugin/utc';
|
|
64
67
|
import i18n from '@cccsaurora/howler-ui/i18n';
|
|
65
68
|
import * as monaco from 'monaco-editor';
|
|
66
69
|
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
67
|
-
import { useContext, useEffect, useMemo } from 'react';
|
|
70
|
+
import { useCallback, useContext, useEffect, useMemo } from 'react';
|
|
68
71
|
import { I18nextProvider } from 'react-i18next';
|
|
69
72
|
import { PluginProvider, usePluginStore } from 'react-pluggable';
|
|
70
73
|
import { createBrowserRouter, Outlet, RouterProvider, useLocation, useNavigate } from 'react-router-dom';
|
|
@@ -90,13 +93,15 @@ dayjs.extend(utc);
|
|
|
90
93
|
dayjs.extend(duration);
|
|
91
94
|
dayjs.extend(relativeTime);
|
|
92
95
|
dayjs.extend(localizedFormat);
|
|
96
|
+
dayjs.extend(minMax);
|
|
97
|
+
dayjs.locale(i18n.language === 'en' ? 'en' : 'fr-ca');
|
|
93
98
|
loader.config({ monaco });
|
|
94
|
-
const RoleRoute = ({
|
|
99
|
+
const RoleRoute = ({ roles }) => {
|
|
95
100
|
const appUser = useAppUser();
|
|
96
|
-
if (appUser.user?.roles?.includes(role)) {
|
|
101
|
+
if (roles.some((role) => appUser.user?.roles?.includes(role))) {
|
|
97
102
|
return _jsx(Outlet, {});
|
|
98
103
|
}
|
|
99
|
-
return _jsx(
|
|
104
|
+
return _jsx(PermissionDeniedPage, {});
|
|
100
105
|
};
|
|
101
106
|
// Your application's initialization flow.
|
|
102
107
|
const MyApp = () => {
|
|
@@ -111,6 +116,13 @@ const MyApp = () => {
|
|
|
111
116
|
const { setItems } = useAppSwitcher();
|
|
112
117
|
const { get, set, remove } = useMyLocalStorage();
|
|
113
118
|
const pluginStore = usePluginStore();
|
|
119
|
+
const onLanguageChange = useCallback((language) => dayjs.locale(language === 'en' ? 'en' : 'fr-ca'), []);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
i18n.on('languageChanged', onLanguageChange);
|
|
122
|
+
return () => {
|
|
123
|
+
i18n.off('languageChanged', onLanguageChange);
|
|
124
|
+
};
|
|
125
|
+
}, [onLanguageChange]);
|
|
114
126
|
// Simulate app loading time...
|
|
115
127
|
// e.g. fetching initial app data, etc.
|
|
116
128
|
useEffect(() => {
|
|
@@ -195,7 +207,7 @@ const createRouter = () => createBrowserRouter([
|
|
|
195
207
|
},
|
|
196
208
|
{
|
|
197
209
|
path: 'cases/:id',
|
|
198
|
-
element: _jsx(CaseViewer, {}),
|
|
210
|
+
element: (_jsx(ParameterProvider, { children: _jsx(CaseViewer, {}) })),
|
|
199
211
|
children: [
|
|
200
212
|
{
|
|
201
213
|
index: true,
|
|
@@ -337,7 +349,13 @@ const createRouter = () => createBrowserRouter([
|
|
|
337
349
|
},
|
|
338
350
|
{
|
|
339
351
|
path: 'action',
|
|
340
|
-
element: _jsx(RoleRoute, {
|
|
352
|
+
element: (_jsx(RoleRoute, { roles: [
|
|
353
|
+
'admin',
|
|
354
|
+
'automation_basic',
|
|
355
|
+
'automation_advanced',
|
|
356
|
+
'actionrunner_basic',
|
|
357
|
+
'actionrunner_advanced'
|
|
358
|
+
] })),
|
|
341
359
|
children: [
|
|
342
360
|
{
|
|
343
361
|
index: true,
|
|
@@ -26,10 +26,6 @@ const FavouriteProvider = ({ children }) => {
|
|
|
26
26
|
if (favourites.length < 1) {
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
|
-
// The favourite list is fully represented, skip
|
|
30
|
-
if (favourites.length === viewElement?.element?.items?.length) {
|
|
31
|
-
return viewElement;
|
|
32
|
-
}
|
|
33
29
|
const savedViews = await fetchViews(favourites);
|
|
34
30
|
const items = sortBy(savedViews, 'title')
|
|
35
31
|
.filter(view => !!view)
|
|
@@ -7,6 +7,7 @@ export interface ModalOptions {
|
|
|
7
7
|
}
|
|
8
8
|
interface ModalContextType {
|
|
9
9
|
showModal: (children: ReactNode, options?: ModalOptions) => () => void;
|
|
10
|
+
withConfirmDeleteModal: (onConfirm: () => void, preferDelete?: boolean, preferCancel?: boolean) => () => void;
|
|
10
11
|
content?: ReactNode;
|
|
11
12
|
setContent: (children: ReactNode) => void;
|
|
12
13
|
options?: ModalOptions;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ConfirmDeleteModal from '@cccsaurora/howler-ui/components/elements/display/modals/ConfirmDeleteModal';
|
|
2
3
|
import { createContext, useCallback, useEffect, useState } from 'react';
|
|
3
4
|
const defaultOptions = {
|
|
4
5
|
disableClose: false
|
|
@@ -23,6 +24,9 @@ const ModalProvider = ({ children }) => {
|
|
|
23
24
|
return () => setContent(null);
|
|
24
25
|
}, [options]);
|
|
25
26
|
const close = useCallback(() => setContent(null), []);
|
|
26
|
-
|
|
27
|
+
const withConfirmDeleteModal = useCallback((onConfirm, preferDelete, preferCancel) => {
|
|
28
|
+
return showModal(_jsx(ConfirmDeleteModal, { onConfirm: onConfirm, preferDelete: preferDelete, preferCancel: preferCancel }));
|
|
29
|
+
}, [showModal]);
|
|
30
|
+
return (_jsx(ModalContext.Provider, { value: { showModal, withConfirmDeleteModal, content, setContent, options, close }, children: children }));
|
|
27
31
|
};
|
|
28
32
|
export default ModalProvider;
|
|
@@ -19,5 +19,5 @@ export declare const RecordContext: import("use-context-selector").Context<Recor
|
|
|
19
19
|
* Central repository for storing individual hit data across the application. Allows efficient retrieval of hits across componenents.
|
|
20
20
|
*/
|
|
21
21
|
declare const RecordProvider: FC<PropsWithChildren>;
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const useRecordContextSelector: <Selected>(selector: (value: RecordContextType) => Selected) => Selected;
|
|
23
23
|
export default RecordProvider;
|
|
@@ -107,7 +107,7 @@ const RecordProvider = ({ children }) => {
|
|
|
107
107
|
loadRecords
|
|
108
108
|
}, children: children }));
|
|
109
109
|
};
|
|
110
|
-
export const
|
|
110
|
+
export const useRecordContextSelector = (selector) => {
|
|
111
111
|
return useContextSelector(RecordContext, selector);
|
|
112
112
|
};
|
|
113
113
|
export default RecordProvider;
|