@danikokonn/yarik-frontend-lib 2.0.57-test → 2.0.57
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/components/ActionDialog/ActionDialog.d.ts +1 -2
- package/dist/components/ActionDialog/ActionDialog.d.ts.map +1 -1
- package/dist/components/ActionDialog/ActionDialog.js +7 -18
- package/dist/components/ActionDialog/ActionDialogProps.d.ts +1 -1
- package/dist/components/ActionDialog/ActionDialogProps.d.ts.map +1 -1
- package/dist/components/ActionDialog/index.d.ts +2 -2
- package/dist/components/ActionDialog/index.d.ts.map +1 -1
- package/dist/components/ActionDialog/index.js +1 -1
- package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts +1 -2
- package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts.map +1 -1
- package/dist/components/ColumnSearchInput/ColumnSearchInput.js +5 -5
- package/dist/components/ColumnSearchInput/index.d.ts +2 -2
- package/dist/components/ColumnSearchInput/index.d.ts.map +1 -1
- package/dist/components/ColumnSearchInput/index.js +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +2 -3
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js +39 -42
- package/dist/components/DateTimeRangePicker/index.d.ts +2 -2
- package/dist/components/DateTimeRangePicker/index.d.ts.map +1 -1
- package/dist/components/DateTimeRangePicker/index.js +1 -1
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts +1 -0
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts.map +1 -1
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.js +38 -44
- package/dist/components/DatetimeRangeInput/index.d.ts +2 -2
- package/dist/components/DatetimeRangeInput/index.d.ts.map +1 -1
- package/dist/components/DatetimeRangeInput/index.js +1 -1
- package/dist/components/Footer/Footer.d.ts +1 -2
- package/dist/components/Footer/Footer.d.ts.map +1 -1
- package/dist/components/Footer/Footer.js +5 -13
- package/dist/components/Footer/index.d.ts +1 -1
- package/dist/components/Footer/index.d.ts.map +1 -1
- package/dist/components/Footer/index.js +1 -1
- package/dist/components/IpAddressInput/IpAddressInput.d.ts +1 -2
- package/dist/components/IpAddressInput/IpAddressInput.d.ts.map +1 -1
- package/dist/components/IpAddressInput/IpAddressInput.js +5 -6
- package/dist/components/IpAddressInput/index.d.ts +2 -2
- package/dist/components/IpAddressInput/index.d.ts.map +1 -1
- package/dist/components/IpAddressInput/index.js +1 -1
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts +1 -2
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts.map +1 -1
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.js +3 -2
- package/dist/components/IpAddressSwitchableInput/index.d.ts +2 -2
- package/dist/components/IpAddressSwitchableInput/index.d.ts.map +1 -1
- package/dist/components/IpAddressSwitchableInput/index.js +1 -1
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.d.ts +1 -2
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.d.ts.map +1 -1
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.js +6 -6
- package/dist/components/LocalizedDatetimePicker/index.d.ts +2 -2
- package/dist/components/LocalizedDatetimePicker/index.d.ts.map +1 -1
- package/dist/components/LocalizedDatetimePicker/index.js +1 -1
- package/dist/components/Navigation/NavMenu.d.ts +4 -3
- package/dist/components/Navigation/NavMenu.d.ts.map +1 -1
- package/dist/components/Navigation/NavMenu.js +23 -27
- package/dist/components/Navigation/Navigation.d.ts +1 -2
- package/dist/components/Navigation/Navigation.d.ts.map +1 -1
- package/dist/components/Navigation/Navigation.js +122 -147
- package/dist/components/Navigation/NavigationProps.d.ts +2 -1
- package/dist/components/Navigation/NavigationProps.d.ts.map +1 -1
- package/dist/components/Navigation/index.d.ts +2 -2
- package/dist/components/Navigation/index.d.ts.map +1 -1
- package/dist/components/Navigation/index.js +1 -1
- package/dist/components/NumberRangeInput/NumberRangeInput.d.ts +1 -2
- package/dist/components/NumberRangeInput/NumberRangeInput.d.ts.map +1 -1
- package/dist/components/NumberRangeInput/NumberRangeInput.js +34 -39
- package/dist/components/NumberRangeInput/index.d.ts +2 -2
- package/dist/components/NumberRangeInput/index.d.ts.map +1 -1
- package/dist/components/NumberRangeInput/index.js +1 -1
- package/dist/components/PageWrapper/PageWrapper.d.ts +2 -2
- package/dist/components/PageWrapper/PageWrapper.d.ts.map +1 -1
- package/dist/components/PageWrapper/PageWrapper.js +11 -14
- package/dist/components/PageWrapper/index.d.ts +2 -2
- package/dist/components/PageWrapper/index.d.ts.map +1 -1
- package/dist/components/PageWrapper/index.js +1 -1
- package/dist/components/RichFilterTextField/FilterHistoryMenu.d.ts +1 -2
- package/dist/components/RichFilterTextField/FilterHistoryMenu.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/FilterHistoryMenu.js +17 -31
- package/dist/components/RichFilterTextField/HintOptionsMenu.d.ts +4 -4
- package/dist/components/RichFilterTextField/HintOptionsMenu.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/HintOptionsMenu.js +8 -10
- package/dist/components/RichFilterTextField/RichFilterTextField.d.ts +1 -2
- package/dist/components/RichFilterTextField/RichFilterTextField.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/RichFilterTextField.js +105 -86
- package/dist/components/RichFilterTextField/index.d.ts +2 -2
- package/dist/components/RichFilterTextField/index.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/index.js +1 -1
- package/dist/components/RichFilterTextField/utils.d.ts.map +1 -1
- package/dist/components/RichFilterTextField/utils.js +13 -5
- package/dist/components/SmartTable/RowContent.d.ts +29 -9
- package/dist/components/SmartTable/RowContent.d.ts.map +1 -1
- package/dist/components/SmartTable/RowContent.js +59 -20
- package/dist/components/SmartTable/SmartTable.d.ts +9 -2
- package/dist/components/SmartTable/SmartTable.d.ts.map +1 -1
- package/dist/components/SmartTable/SmartTable.js +97 -109
- package/dist/components/SmartTable/SmartTableProps.d.ts +20 -10
- package/dist/components/SmartTable/SmartTableProps.d.ts.map +1 -1
- package/dist/components/SmartTable/TableHeader.d.ts +1 -2
- package/dist/components/SmartTable/TableHeader.d.ts.map +1 -1
- package/dist/components/SmartTable/TableHeader.js +5 -4
- package/dist/components/SmartTable/index.d.ts +2 -2
- package/dist/components/SmartTable/index.d.ts.map +1 -1
- package/dist/components/SmartTable/index.js +1 -1
- package/dist/components/SortBtn/SortBtn.d.ts +1 -2
- package/dist/components/SortBtn/SortBtn.d.ts.map +1 -1
- package/dist/components/SortBtn/SortBtn.js +3 -2
- package/dist/components/SortBtn/index.d.ts +2 -2
- package/dist/components/SortBtn/index.d.ts.map +1 -1
- package/dist/components/SortBtn/index.js +1 -1
- package/dist/components/SubtaskItem/SubtaskItem.d.ts +1 -2
- package/dist/components/SubtaskItem/SubtaskItem.d.ts.map +1 -1
- package/dist/components/SubtaskItem/SubtaskItem.js +82 -43
- package/dist/components/SubtaskItem/SubtaskItemProps.d.ts +1 -1
- package/dist/components/SubtaskItem/SubtaskItemProps.d.ts.map +1 -1
- package/dist/components/SubtaskItem/index.d.ts +2 -2
- package/dist/components/SubtaskItem/index.d.ts.map +1 -1
- package/dist/components/SubtaskItem/index.js +1 -1
- package/dist/components/TaskLoader/TaskLoader.d.ts +2 -2
- package/dist/components/TaskLoader/TaskLoader.d.ts.map +1 -1
- package/dist/components/TaskLoader/TaskLoader.js +179 -194
- package/dist/components/TaskLoader/TaskLoaderProps.d.ts +1 -0
- package/dist/components/TaskLoader/TaskLoaderProps.d.ts.map +1 -1
- package/dist/components/TaskLoader/index.d.ts +2 -2
- package/dist/components/TaskLoader/index.d.ts.map +1 -1
- package/dist/components/TaskLoader/index.js +1 -1
- package/dist/components/TaskStateDialog/TaskStateDialog.d.ts +1 -2
- package/dist/components/TaskStateDialog/TaskStateDialog.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/TaskStateDialog.js +33 -47
- package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts +2 -1
- package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/index.d.ts +2 -2
- package/dist/components/TaskStateDialog/index.d.ts.map +1 -1
- package/dist/components/TaskStateDialog/index.js +1 -1
- package/dist/components/icons/GenerateAndRunIcon.d.ts +1 -2
- package/dist/components/icons/GenerateAndRunIcon.d.ts.map +1 -1
- package/dist/components/icons/GenerateAndRunIcon.js +6 -23
- package/dist/components/icons/GenerateIcon.d.ts +1 -2
- package/dist/components/icons/GenerateIcon.d.ts.map +1 -1
- package/dist/components/icons/GenerateIcon.js +6 -21
- package/dist/components/icons/IntegerIcon.d.ts +1 -2
- package/dist/components/icons/IntegerIcon.d.ts.map +1 -1
- package/dist/components/icons/IntegerIcon.js +6 -9
- package/dist/components/icons/ProcessingIcon.d.ts +1 -2
- package/dist/components/icons/ProcessingIcon.d.ts.map +1 -1
- package/dist/components/icons/ProcessingIcon.js +2 -12
- package/dist/components/icons/QueueIcon.d.ts +1 -2
- package/dist/components/icons/QueueIcon.d.ts.map +1 -1
- package/dist/components/icons/QueueIcon.js +6 -9
- package/dist/components/icons/RangeIcon.d.ts +1 -2
- package/dist/components/icons/RangeIcon.d.ts.map +1 -1
- package/dist/components/icons/RangeIcon.js +6 -9
- package/dist/components/icons/RunIcon.d.ts +1 -2
- package/dist/components/icons/RunIcon.d.ts.map +1 -1
- package/dist/components/icons/RunIcon.js +6 -12
- package/dist/components/icons/TextModeIcon.d.ts.map +1 -1
- package/dist/components/icons/TextModeIcon.js +2 -6
- package/dist/components/icons/TreeModeIcon.d.ts.map +1 -1
- package/dist/components/icons/TreeModeIcon.js +2 -6
- package/dist/components/icons/index.d.ts +1 -1
- package/dist/components/icons/index.js +1 -1
- package/dist/http.d.ts +2 -2
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +4 -29
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/providers/AirflowProvider.d.ts +5 -4
- package/dist/providers/AirflowProvider.d.ts.map +1 -1
- package/dist/providers/AirflowProvider.js +44 -58
- package/dist/providers/DagStateProvider.d.ts +7 -5
- package/dist/providers/DagStateProvider.d.ts.map +1 -1
- package/dist/providers/DagStateProvider.js +95 -84
- package/dist/providers/SessionProvider.d.ts +3 -1
- package/dist/providers/SessionProvider.d.ts.map +1 -1
- package/dist/providers/SessionProvider.js +14 -7
- package/dist/providers/SnackBarProvider.d.ts +2 -2
- package/dist/providers/SnackBarProvider.d.ts.map +1 -1
- package/dist/providers/SnackBarProvider.js +8 -9
- package/dist/providers/index.d.ts +4 -4
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +4 -4
- package/dist/types.d.ts +17 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -2
- package/package.json +30 -21
- package/dist/components/SmartTable/RuleRow.d.ts +0 -22
- package/dist/components/SmartTable/RuleRow.d.ts.map +0 -1
- package/dist/components/SmartTable/RuleRow.js +0 -35
package/dist/http.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ interface BaseCallParamsPOST extends BaseCallParams {
|
|
|
6
6
|
headers?: HeadersInit;
|
|
7
7
|
}
|
|
8
8
|
interface ExtraCallParams<T, P> {
|
|
9
|
-
successHandler?: (resp
|
|
10
|
-
errorHandler?: (resp
|
|
9
|
+
successHandler?: (resp: T) => void;
|
|
10
|
+
errorHandler?: (resp: P & {
|
|
11
11
|
status: number;
|
|
12
12
|
}) => void;
|
|
13
13
|
}
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,kBAAmB,SAAQ,cAAc;IACjD,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,UAAU,eAAe,CAAC,CAAC,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,kBAAmB,SAAQ,cAAc;IACjD,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,UAAU,eAAe,CAAC,CAAC,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACnC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACvD;AAED,KAAK,UAAU,CAAC,CAAC,EAAE,CAAC,IAAI,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/D,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,IAAI,kBAAkB,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AA2BvE,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,EAC5C,GAAG,EACH,IAAI,GACL,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAYxD;AAED,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,EAC7C,GAAG,EACH,IAAI,EACJ,OAAO,GACR,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAY5D;AAED,wBAAsB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,EACrC,GAAG,EACH,IAAI,EACJ,cAAc,EACd,YAAY,GACb,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBlC;AAED,wBAAsB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,EACtC,GAAG,EACH,IAAI,EACJ,OAAO,EACP,cAAc,EACd,YAAY,GACb,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,iBActB"}
|
package/dist/http.js
CHANGED
|
@@ -20,13 +20,7 @@ async function _postRequest({ url, data, headers }) {
|
|
|
20
20
|
}
|
|
21
21
|
export async function getRequestPromise({ url, data, }) {
|
|
22
22
|
const resp = await _getRequest({ url, data });
|
|
23
|
-
if (resp.
|
|
24
|
-
// #NOTE
|
|
25
|
-
// На данный момент редирект - признак просроченной сессии,
|
|
26
|
-
// так как на json запрос нет явного ответа редиректом, только через декоратор логина,
|
|
27
|
-
// если же в будущем будет добавлен какой-то иной редирект в ответ за json запрос,
|
|
28
|
-
// то нужно будет поменять код в данном блоке
|
|
29
|
-
// location.reload();
|
|
23
|
+
if (resp.status === 401) {
|
|
30
24
|
console.log("Session expired");
|
|
31
25
|
}
|
|
32
26
|
if (resp.ok) {
|
|
@@ -38,13 +32,7 @@ export async function getRequestPromise({ url, data, }) {
|
|
|
38
32
|
}
|
|
39
33
|
export async function postRequestPromise({ url, data, headers, }) {
|
|
40
34
|
const resp = await _postRequest({ url, data, headers });
|
|
41
|
-
if (resp.
|
|
42
|
-
// #NOTE
|
|
43
|
-
// На данный момент редирект - признак просроченной сессии,
|
|
44
|
-
// так как на json запрос нет явного ответа редиректом, только через декоратор логина,
|
|
45
|
-
// если же в будущем будет добавлен какой-то иной редирект в ответ за json запрос,
|
|
46
|
-
// то нужно будет поменять код в данном блоке
|
|
47
|
-
// location.reload();
|
|
35
|
+
if (resp.status === 401) {
|
|
48
36
|
console.log("Session expired");
|
|
49
37
|
}
|
|
50
38
|
if (resp.ok) {
|
|
@@ -56,13 +44,7 @@ export async function postRequestPromise({ url, data, headers, }) {
|
|
|
56
44
|
}
|
|
57
45
|
export async function getRequest({ url, data, successHandler, errorHandler, }) {
|
|
58
46
|
const resp = await _getRequest({ url, data });
|
|
59
|
-
if (resp.
|
|
60
|
-
// #NOTE
|
|
61
|
-
// На данный момент редирект - признак просроченной сессии,
|
|
62
|
-
// так как на json запрос нет явного ответа редиректом, только через декоратор логина,
|
|
63
|
-
// если же в будущем будет добавлен какой-то иной редирект в ответ за json запрос,
|
|
64
|
-
// то нужно будет поменять код в данном блоке
|
|
65
|
-
// location.reload();
|
|
47
|
+
if (resp.status === 401) {
|
|
66
48
|
console.log("Session expired");
|
|
67
49
|
}
|
|
68
50
|
if (resp.ok) {
|
|
@@ -78,14 +60,7 @@ export async function getRequest({ url, data, successHandler, errorHandler, }) {
|
|
|
78
60
|
}
|
|
79
61
|
export async function postRequest({ url, data, headers, successHandler, errorHandler, }) {
|
|
80
62
|
const resp = await _postRequest({ url, data, headers });
|
|
81
|
-
if (resp.
|
|
82
|
-
// #NOTE
|
|
83
|
-
// На данный момент редирект - признак просроченной сессии,
|
|
84
|
-
// так как на json запрос нет явного ответа редиректом, только через декоратор логина,
|
|
85
|
-
// если же в будущем будет добавлен какой-то иной редирект в ответ за json запрос,
|
|
86
|
-
// то нужно будет поменять код в данном блоке
|
|
87
|
-
// location.reload();
|
|
88
|
-
// Надо продумать этот вопрос получше
|
|
63
|
+
if (resp.status === 401) {
|
|
89
64
|
console.log("Session expired");
|
|
90
65
|
}
|
|
91
66
|
if (resp.ok) {
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
interface AirflowProviderProps {
|
|
3
3
|
children?: React.ReactNode;
|
|
4
|
-
dagId
|
|
4
|
+
dagId?: string | null;
|
|
5
|
+
onUnauthorized(): void;
|
|
5
6
|
}
|
|
6
|
-
export declare const AirflowProvider: ({ children, dagId: _dagId, }: AirflowProviderProps) =>
|
|
7
|
+
export declare const AirflowProvider: ({ children, dagId: _dagId, onUnauthorized, }: AirflowProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export declare const useAirflowContext: () => {
|
|
9
|
+
dagId?: string | null;
|
|
8
10
|
airflowAvailable: boolean;
|
|
9
|
-
dagId: string;
|
|
10
|
-
onChangeDagId(dagId: string): void;
|
|
11
|
+
onChangeDagId(dagId: string | null): void;
|
|
11
12
|
onLostConnection(): void;
|
|
12
13
|
};
|
|
13
14
|
export default AirflowProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AirflowProvider.d.ts","sourceRoot":"","sources":["../../src/providers/AirflowProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AirflowProvider.d.ts","sourceRoot":"","sources":["../../src/providers/AirflowProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAgBhF,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,cAAc,IAAI,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,eAAe,GAAI,8CAI7B,oBAAoB,4CAyEtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;YAhGpB,MAAM,GAAG,IAAI;sBACH,OAAO;yBACJ,MAAM,GAAG,IAAI,GAAG,IAAI;wBACrB,IAAI;CA+FzB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,78 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useState } from "react";
|
|
3
|
+
import useSWR from "swr";
|
|
3
4
|
import { useSnackbarContext } from "./SnackBarProvider";
|
|
4
5
|
const AirflowContext = createContext({
|
|
5
|
-
airflowAvailable: false,
|
|
6
6
|
dagId: "",
|
|
7
|
+
airflowAvailable: false,
|
|
7
8
|
onChangeDagId: () => { },
|
|
8
9
|
onLostConnection: () => { },
|
|
9
10
|
});
|
|
10
|
-
export const AirflowProvider = ({ children, dagId: _dagId, }) => {
|
|
11
|
-
const
|
|
11
|
+
export const AirflowProvider = ({ children, dagId: _dagId, onUnauthorized, }) => {
|
|
12
|
+
const fetcher = async (url) => {
|
|
13
|
+
const res = await fetch(url);
|
|
14
|
+
if (res.status === 401) {
|
|
15
|
+
onUnauthorized();
|
|
16
|
+
}
|
|
17
|
+
if (!res.ok && res.status !== 404) {
|
|
18
|
+
const error = new Error("An error occurred while fetching the data.");
|
|
19
|
+
throw { ...error, info: await res.json(), status: res.status };
|
|
20
|
+
}
|
|
21
|
+
return res.json();
|
|
22
|
+
};
|
|
23
|
+
const { enqueueSnackbar } = useSnackbarContext();
|
|
12
24
|
const [dagId, setDagId] = useState(_dagId);
|
|
13
25
|
const [firstRun, setFirstRun] = useState(true);
|
|
14
|
-
const
|
|
15
|
-
const
|
|
26
|
+
const [previousAirflowAvailable, setPreviousAirflowAvailable] = useState(false);
|
|
27
|
+
const { error, mutate } = useSWR("airflow/check_connection", fetcher, {
|
|
28
|
+
refreshInterval: 10000,
|
|
29
|
+
onSuccess: () => {
|
|
30
|
+
if (firstRun) {
|
|
31
|
+
setFirstRun(false);
|
|
32
|
+
}
|
|
33
|
+
else if (!previousAirflowAvailable) {
|
|
34
|
+
enqueueSnackbar("Соединение с Airflow установлено!", "info");
|
|
35
|
+
}
|
|
36
|
+
setPreviousAirflowAvailable(true);
|
|
37
|
+
},
|
|
38
|
+
onError: () => {
|
|
39
|
+
if (firstRun) {
|
|
40
|
+
enqueueSnackbar(`Не удалось установить соединение с Airflow!`, "warning");
|
|
41
|
+
setFirstRun(false);
|
|
42
|
+
}
|
|
43
|
+
else if (previousAirflowAvailable) {
|
|
44
|
+
enqueueSnackbar(`Потеряно соединение с Airflow!`, "warning");
|
|
45
|
+
}
|
|
46
|
+
setPreviousAirflowAvailable(false);
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
const airflowAvailable = error == null;
|
|
16
50
|
const setContext = useCallback((dagId) => {
|
|
17
51
|
setDagId(dagId);
|
|
18
52
|
}, [dagId, setDagId]);
|
|
19
|
-
const checkConnection = () => {
|
|
20
|
-
setChannelBusy(true);
|
|
21
|
-
getRequest({
|
|
22
|
-
url: "airflow/check_connection",
|
|
23
|
-
data: {},
|
|
24
|
-
successHandler: (_resp) => {
|
|
25
|
-
if (!airflowAvailable) {
|
|
26
|
-
setAirflowAvailable(true);
|
|
27
|
-
if (firstRun) {
|
|
28
|
-
setFirstRun(false);
|
|
29
|
-
setChannelBusy(false);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
enqueueSnackbar("Соединение с Airflow установлено!", "info");
|
|
33
|
-
}
|
|
34
|
-
setChannelBusy(false);
|
|
35
|
-
},
|
|
36
|
-
errorHandler: (resp) => {
|
|
37
|
-
if (!airflowAvailable && firstRun) {
|
|
38
|
-
setFirstRun(false);
|
|
39
|
-
enqueueSnackbar(`Не удалось установить соединение с Airflow!${(resp?.status == 401 && " Ошибка авторизации.") || ""}`, "warning");
|
|
40
|
-
}
|
|
41
|
-
if (airflowAvailable) {
|
|
42
|
-
setAirflowAvailable(false);
|
|
43
|
-
enqueueSnackbar(`Потеряно соединение с Airflow!${(resp?.status == 401 && " Ошибка авторизации.") || ""}`, "warning");
|
|
44
|
-
}
|
|
45
|
-
setChannelBusy(false);
|
|
46
|
-
},
|
|
47
|
-
}).catch((e) => {
|
|
48
|
-
if (e)
|
|
49
|
-
console.log(e);
|
|
50
|
-
setChannelBusy(false);
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
if (firstRun) {
|
|
55
|
-
checkConnection();
|
|
56
|
-
}
|
|
57
|
-
const interval = setInterval(() => {
|
|
58
|
-
if (channelBusy)
|
|
59
|
-
return;
|
|
60
|
-
checkConnection();
|
|
61
|
-
}, 10000);
|
|
62
|
-
return () => {
|
|
63
|
-
clearInterval(interval);
|
|
64
|
-
};
|
|
65
|
-
}, [firstRun, airflowAvailable, dagId, channelBusy]);
|
|
66
53
|
const onLostConnection = () => {
|
|
67
|
-
|
|
68
|
-
enqueueSnackbar("Потеряно соединение с Airflow!", "warning");
|
|
54
|
+
mutate();
|
|
69
55
|
};
|
|
70
|
-
return (
|
|
56
|
+
return (_jsx(AirflowContext.Provider, { value: {
|
|
71
57
|
airflowAvailable,
|
|
72
58
|
dagId,
|
|
73
59
|
onChangeDagId: setContext,
|
|
74
60
|
onLostConnection,
|
|
75
|
-
}
|
|
61
|
+
}, children: children }));
|
|
76
62
|
};
|
|
77
63
|
export const useAirflowContext = () => {
|
|
78
64
|
return useContext(AirflowContext);
|
|
@@ -5,21 +5,23 @@ interface DagRunStateProviderProps {
|
|
|
5
5
|
dagRun?: DagRun;
|
|
6
6
|
autorun?: boolean;
|
|
7
7
|
poolingByUser?: boolean;
|
|
8
|
-
autorunHandler?(dagRun: DagRun | null, autorun: boolean): void;
|
|
9
8
|
taskInstances?: TaskInstances;
|
|
10
|
-
|
|
9
|
+
autorunHandler?(dagRun: DagRun | null, autorun: boolean): void;
|
|
10
|
+
onUnauthorized(): void;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
declare const DagRunStateProvider: ({ children, dagRun: _dagRun, autorun: _autorun, poolingByUser, autorunHandler, onUnauthorized, }: DagRunStateProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export declare const useDagRunStateContext: () => {
|
|
14
14
|
isActive: boolean;
|
|
15
15
|
autorun: boolean;
|
|
16
16
|
dagRun: DagRun | null;
|
|
17
17
|
taskInstances: TaskInstances | null;
|
|
18
|
-
|
|
18
|
+
dagStartedOnce: boolean;
|
|
19
|
+
onUpdateState(isActive: boolean, dagRun: DagRun | null, taskInstances: TaskInstances | null): void;
|
|
20
|
+
error: boolean;
|
|
21
|
+
onDagStarted: () => void;
|
|
19
22
|
activate(): void;
|
|
20
23
|
fetchState(): void;
|
|
21
24
|
setAutorun(autorun: boolean): void;
|
|
22
|
-
scanInterval: number;
|
|
23
25
|
};
|
|
24
26
|
export default DagRunStateProvider;
|
|
25
27
|
//# sourceMappingURL=DagStateProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DagStateProvider.d.ts","sourceRoot":"","sources":["../../src/providers/DagStateProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DagStateProvider.d.ts","sourceRoot":"","sources":["../../src/providers/DagStateProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAkCjD,UAAU,wBAAwB;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/D,cAAc,IAAI,IAAI,CAAC;CACxB;AAED,QAAA,MAAM,mBAAmB,GAAI,kGAO1B,wBAAwB,4CAuJ1B,CAAC;AAEF,eAAO,MAAM,qBAAqB;cAvMtB,OAAO;aACR,OAAO;YACR,MAAM,GAAG,IAAI;mBACN,aAAa,GAAG,IAAI;oBACnB,OAAO;4BAEX,OAAO,UACT,MAAM,GAAG,IAAI,iBACN,aAAa,GAAG,IAAI,GAClC,IAAI;WACA,OAAO;kBACA,MAAM,IAAI;gBACZ,IAAI;kBACF,IAAI;wBACE,OAAO,GAAG,IAAI;CA2LnC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useEffectEvent, useState, } from "react";
|
|
3
|
+
import useSWR from "swr";
|
|
3
4
|
import { useAirflowContext } from "./AirflowProvider";
|
|
4
5
|
import { useSnackbarContext } from "./SnackBarProvider";
|
|
5
6
|
const DagRunStateContext = createContext({
|
|
@@ -7,107 +8,117 @@ const DagRunStateContext = createContext({
|
|
|
7
8
|
autorun: false,
|
|
8
9
|
dagRun: null,
|
|
9
10
|
taskInstances: null,
|
|
11
|
+
dagStartedOnce: false,
|
|
12
|
+
error: false,
|
|
10
13
|
onUpdateState: () => { },
|
|
14
|
+
onDagStarted: () => { },
|
|
11
15
|
fetchState: () => { },
|
|
12
16
|
activate: () => { },
|
|
13
17
|
setAutorun: () => { },
|
|
14
|
-
scanInterval: 300,
|
|
15
18
|
});
|
|
16
|
-
|
|
19
|
+
const DagRunStateProvider = ({ children, dagRun: _dagRun, autorun: _autorun, poolingByUser, autorunHandler, onUnauthorized, }) => {
|
|
17
20
|
const { airflowAvailable, dagId, onLostConnection } = useAirflowContext();
|
|
18
|
-
const [isActive, setIsActive] = useState(_dagRun ? ["queued", "running"].includes(_dagRun.state) : dagId?.length > 0);
|
|
19
|
-
const [channelBusy, setChannelBusy] = useState(false);
|
|
20
21
|
const [autorun, setAutorun] = useState(_autorun || false);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
}, [isActive, setIsActive]);
|
|
24
|
-
const [dagRun, setDagRun] = useState(_dagRun || null);
|
|
25
|
-
const [taskInstances, setTaskInstances] = useState(_taskInstances || null);
|
|
22
|
+
const [dagRunId, setDagRunId] = useState(_dagRun?.dagRunId);
|
|
23
|
+
const [dagStartedOnce, setDagStartedOnce] = useState(false);
|
|
26
24
|
const { enqueueSnackbar } = useSnackbarContext();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
setDagRun(resp.dagRun);
|
|
43
|
-
setTaskInstances(resp.taskInstances);
|
|
44
|
-
setIsActive(["queued", "running"].includes(resp.dagRun.state));
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
setIsActive(false);
|
|
48
|
-
enqueueSnackbar(`Ошибка при обновлении состояния задачи${(dagId && " ") || ""}${dagId || ""}!`, "error");
|
|
49
|
-
}
|
|
50
|
-
setChannelBusy(false);
|
|
51
|
-
},
|
|
52
|
-
errorHandler: (resp) => {
|
|
53
|
-
if (resp?.status !== 404) {
|
|
54
|
-
enqueueSnackbar(`Ошибка при обновлении состояния задачи${(dagId && " ") || ""}${dagId || ""}!`, "error");
|
|
55
|
-
}
|
|
56
|
-
if (resp?.status === 503) {
|
|
57
|
-
onLostConnection();
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
setIsActive(false);
|
|
61
|
-
}
|
|
62
|
-
setChannelBusy(false);
|
|
63
|
-
},
|
|
64
|
-
}).catch((e) => {
|
|
65
|
-
console.log(e);
|
|
66
|
-
setChannelBusy(false);
|
|
67
|
-
});
|
|
25
|
+
const defaultFetcher = async ([url, dagId, dagRunId, poolingByUser]) => {
|
|
26
|
+
const requestUrl = new URL("http://foo/" + url);
|
|
27
|
+
requestUrl.searchParams.append("dag_id", dagId);
|
|
28
|
+
if (dagRunId)
|
|
29
|
+
requestUrl.searchParams.append("dag_run_id", dagRunId);
|
|
30
|
+
requestUrl.searchParams.append("by_user", String(poolingByUser));
|
|
31
|
+
const resultUrl = requestUrl.pathname.substring(1) + requestUrl.search;
|
|
32
|
+
const res = await fetch(resultUrl, { signal: AbortSignal.timeout(10000) });
|
|
33
|
+
if (res.status === 401) {
|
|
34
|
+
onUnauthorized();
|
|
35
|
+
}
|
|
36
|
+
if (!res.ok) {
|
|
37
|
+
throw { ...(await res.json()), status: res.status };
|
|
38
|
+
}
|
|
39
|
+
return res.json();
|
|
68
40
|
};
|
|
41
|
+
const [shouldRevalidate, setShouldRevalidate] = useState(true);
|
|
42
|
+
const activate = useCallback(() => {
|
|
43
|
+
setShouldRevalidate(true);
|
|
44
|
+
}, []);
|
|
45
|
+
const { data, error, mutate } = useSWR(airflowAvailable &&
|
|
46
|
+
dagId && [
|
|
47
|
+
"airflow/dag_run",
|
|
48
|
+
dagId,
|
|
49
|
+
dagRunId ?? null,
|
|
50
|
+
Boolean(poolingByUser),
|
|
51
|
+
], defaultFetcher, {
|
|
52
|
+
refreshInterval: shouldRevalidate ? 1000 : 0,
|
|
53
|
+
onError: (err) => {
|
|
54
|
+
if (err?.status !== 404) {
|
|
55
|
+
enqueueSnackbar(`Ошибка при обновлении состояния задачи${(dagId && " ") || ""}${dagId || ""}!`, "error");
|
|
56
|
+
}
|
|
57
|
+
if (err?.status === 503) {
|
|
58
|
+
onLostConnection();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
setShouldRevalidate(false);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
keepPreviousData: true,
|
|
65
|
+
});
|
|
66
|
+
const dagRun = data?.dagRun ?? null;
|
|
67
|
+
const taskInstances = data?.taskInstances ?? null;
|
|
68
|
+
const updDagRunIdId = useEffectEvent((newDagRunId) => {
|
|
69
|
+
if (dagRunId !== newDagRunId) {
|
|
70
|
+
setDagRunId(newDagRunId);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
// Обновлять идентификатор запуска при изменении
|
|
69
74
|
useEffect(() => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (channelBusy)
|
|
76
|
-
return;
|
|
77
|
-
updateState();
|
|
78
|
-
}, 1000);
|
|
79
|
-
return () => {
|
|
80
|
-
clearInterval(interval);
|
|
81
|
-
};
|
|
82
|
-
}, [airflowAvailable, isActive, dagRun, dagId, autorun, channelBusy]);
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
if (dagRun == null)
|
|
85
|
-
setIsActive(true);
|
|
86
|
-
}, [dagRun]);
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
if (!airflowAvailable)
|
|
89
|
-
return;
|
|
90
|
-
if (isActive)
|
|
91
|
-
return;
|
|
92
|
-
if (autorunHandler)
|
|
75
|
+
updDagRunIdId(dagRun?.dagRunId ?? null);
|
|
76
|
+
console.log("effect 1");
|
|
77
|
+
}, [dagRun?.dagRunId ?? null]);
|
|
78
|
+
const autorunAction = useEffectEvent((dagRun) => {
|
|
79
|
+
if (autorunHandler) {
|
|
93
80
|
autorunHandler(dagRun, autorun);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// Если задача всё ещё выполняется, то есть смысл в ревалидации
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (dagRun) {
|
|
86
|
+
setShouldRevalidate(["queued", "running"].includes(dagRun.state));
|
|
87
|
+
}
|
|
88
|
+
// Запуск действия при success
|
|
89
|
+
if (dagRun?.state === "success") {
|
|
90
|
+
autorunAction(dagRun);
|
|
91
|
+
}
|
|
92
|
+
console.log("effect 2");
|
|
93
|
+
}, [dagRun?.state]);
|
|
94
|
+
const onUpdateState = (isActive, newDagRun, _taskInstances) => {
|
|
95
|
+
setShouldRevalidate(isActive);
|
|
96
|
+
setDagRunId(newDagRun?.dagRunId);
|
|
97
|
+
if (newDagRun == null)
|
|
98
|
+
mutate();
|
|
99
|
+
};
|
|
100
|
+
/**Вызывать сразу после запуска дага*/
|
|
101
|
+
const onDagStarted = () => {
|
|
102
|
+
// setIsActive(true);
|
|
103
|
+
setDagRunId(null);
|
|
104
|
+
// setTaskInstances(null);
|
|
105
|
+
setShouldRevalidate(true);
|
|
106
|
+
setDagStartedOnce(true);
|
|
99
107
|
};
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
const updateState = () => mutate();
|
|
109
|
+
return (_jsx(DagRunStateContext.Provider, { value: {
|
|
110
|
+
isActive: shouldRevalidate,
|
|
102
111
|
autorun,
|
|
103
112
|
dagRun,
|
|
104
113
|
taskInstances,
|
|
114
|
+
dagStartedOnce,
|
|
105
115
|
onUpdateState,
|
|
116
|
+
onDagStarted,
|
|
106
117
|
activate,
|
|
118
|
+
error: Boolean(error),
|
|
107
119
|
fetchState: updateState,
|
|
108
120
|
setAutorun: (autorun) => setAutorun(autorun),
|
|
109
|
-
|
|
110
|
-
} }, children));
|
|
121
|
+
}, children: children }));
|
|
111
122
|
};
|
|
112
123
|
export const useDagRunStateContext = () => {
|
|
113
124
|
return useContext(DagRunStateContext);
|
|
@@ -2,8 +2,10 @@ import React from "react";
|
|
|
2
2
|
interface SessionProviderProps {
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
pollingInterval: number;
|
|
5
|
+
autoRedirect?: boolean;
|
|
6
|
+
onUnauthorized?(): void;
|
|
5
7
|
}
|
|
6
|
-
|
|
8
|
+
declare const SessionProvider: ({ children, pollingInterval, autoRedirect, onUnauthorized, }: SessionProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export declare const useSessionContext: () => {
|
|
8
10
|
expiresIn: number;
|
|
9
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionProvider.d.ts","sourceRoot":"","sources":["../../src/providers/SessionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAU9E,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,
|
|
1
|
+
{"version":3,"file":"SessionProvider.d.ts","sourceRoot":"","sources":["../../src/providers/SessionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAU9E,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,IAAI,IAAI,CAAC;CACzB;AAED,QAAA,MAAM,eAAe,GAAI,8DAKtB,oBAAoB,4CA8CtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;eAjEjB,MAAM;CAmElB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
3
3
|
import { getRequest } from "../http";
|
|
4
|
+
import { useSnackbarContext } from "./SnackBarProvider";
|
|
4
5
|
const SessionContext = createContext({
|
|
5
6
|
expiresIn: 0,
|
|
6
7
|
});
|
|
7
|
-
|
|
8
|
+
const SessionProvider = ({ children, pollingInterval, autoRedirect, onUnauthorized, }) => {
|
|
8
9
|
const { enqueueSnackbar } = useSnackbarContext();
|
|
9
10
|
const [expires, setExpires] = useState(false);
|
|
10
11
|
const alertExpire = () => enqueueSnackbar("Сессия завершилась, перезагрузите страницу!", "default");
|
|
11
12
|
const fetchSessionExpiryAge = () => getRequest({
|
|
12
13
|
url: "base/check_session",
|
|
13
14
|
successHandler: (_resp) => { },
|
|
14
|
-
errorHandler: (
|
|
15
|
+
errorHandler: (e) => {
|
|
16
|
+
if (e?.status === 401 && autoRedirect && onUnauthorized) {
|
|
17
|
+
onUnauthorized();
|
|
18
|
+
}
|
|
15
19
|
setExpires(true);
|
|
16
20
|
alertExpire();
|
|
17
21
|
},
|
|
18
|
-
}).catch(() => {
|
|
22
|
+
}).catch((e) => {
|
|
23
|
+
if (e?.status === 401 && autoRedirect && onUnauthorized) {
|
|
24
|
+
onUnauthorized();
|
|
25
|
+
}
|
|
19
26
|
setExpires(true);
|
|
20
27
|
alertExpire();
|
|
21
28
|
});
|
|
@@ -27,9 +34,9 @@ export const SessionProvider = ({ children, pollingInterval, }) => {
|
|
|
27
34
|
}, pollingInterval * 1000);
|
|
28
35
|
return () => clearInterval(interval);
|
|
29
36
|
}, [expires]);
|
|
30
|
-
return (
|
|
37
|
+
return (_jsx(SessionContext.Provider, { value: {
|
|
31
38
|
expiresIn: pollingInterval,
|
|
32
|
-
}
|
|
39
|
+
}, children: children }));
|
|
33
40
|
};
|
|
34
41
|
export const useSessionContext = () => {
|
|
35
42
|
return useContext(SessionContext);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
interface SnackBarProps {
|
|
3
|
-
children?: React.ReactNode;
|
|
3
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
declare const SnackBarProvider: ({ children }: SnackBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare const useSnackbarContext: () => {
|
|
7
7
|
enqueueSnackbar(message: string, variant: "default" | "error" | "success" | "warning" | "info"): void;
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnackBarProvider.d.ts","sourceRoot":"","sources":["../../src/providers/SnackBarProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAezD,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"SnackBarProvider.d.ts","sourceRoot":"","sources":["../../src/providers/SnackBarProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAezD,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;CAChD;AA8CD,QAAA,MAAM,gBAAgB,GAAI,cAAc,aAAa,4CAMpD,CAAC;AAEF,eAAO,MAAM,kBAAkB;6BA/DlB,MAAM,WACN,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAC5D,IAAI;CA+DR,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
2
3
|
import Button from "@mui/material/Button";
|
|
3
4
|
import { SnackbarProvider, useSnackbar } from "notistack";
|
|
4
5
|
const SnackBarContext = createContext({
|
|
@@ -6,10 +7,9 @@ const SnackBarContext = createContext({
|
|
|
6
7
|
});
|
|
7
8
|
const SnackBarProviderUtilities = ({ children }) => {
|
|
8
9
|
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
|
|
9
|
-
const action = (snackbarId) => (
|
|
10
|
-
React.createElement(Button, { size: "small", variant: "text", color: "inherit", onClick: () => {
|
|
10
|
+
const action = (snackbarId) => (_jsx(_Fragment, { children: _jsx(Button, { size: "small", variant: "text", color: "inherit", onClick: () => {
|
|
11
11
|
closeSnackbar(snackbarId);
|
|
12
|
-
}
|
|
12
|
+
}, children: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C" }) }));
|
|
13
13
|
function handleEnqueueSnackbar(message, variant) {
|
|
14
14
|
enqueueSnackbar(message, {
|
|
15
15
|
variant: variant,
|
|
@@ -21,13 +21,12 @@ const SnackBarProviderUtilities = ({ children }) => {
|
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
return (
|
|
24
|
+
return (_jsx(SnackBarContext.Provider, { value: {
|
|
25
25
|
enqueueSnackbar: handleEnqueueSnackbar,
|
|
26
|
-
}
|
|
26
|
+
}, children: children }));
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
React.createElement(SnackBarProviderUtilities, null, children)));
|
|
28
|
+
const SnackBarProvider = ({ children }) => {
|
|
29
|
+
return (_jsx(SnackbarProvider, { maxSnack: 5, autoHideDuration: 5000, preventDuplicate: true, children: _jsx(SnackBarProviderUtilities, { children: children }) }));
|
|
31
30
|
};
|
|
32
31
|
export const useSnackbarContext = () => {
|
|
33
32
|
return useContext(SnackBarContext);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { default as DagStateProvider } from "./DagStateProvider";
|
|
2
1
|
export * from "./DagStateProvider";
|
|
3
|
-
export { default as
|
|
2
|
+
export { default as DagStateProvider } from "./DagStateProvider";
|
|
4
3
|
export * from "./SessionProvider";
|
|
5
|
-
export { default as
|
|
4
|
+
export { default as SessionProvider } from "./SessionProvider";
|
|
6
5
|
export * from "./SnackBarProvider";
|
|
7
|
-
export { default as
|
|
6
|
+
export { default as SnackBarProvider } from "./SnackBarProvider";
|
|
8
7
|
export * from "./AirflowProvider";
|
|
8
|
+
export { default as AirflowProvider } from "./AirflowProvider";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE/D,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|