@axelor/aos-mobile-core 8.1.1 → 8.1.3
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/lib/apiProviders/Action/ActionApiProvider.d.ts +1 -1
- package/lib/apiProviders/Action/GatewayActionApi.d.ts +1 -1
- package/lib/apiProviders/Action/GatewayActionApi.js +2 -2
- package/lib/apiProviders/Action/GatewayActionApi.js.map +1 -1
- package/lib/apiProviders/utils.js +5 -2
- package/lib/apiProviders/utils.js.map +1 -1
- package/lib/app/ContextsProvider.js +4 -1
- package/lib/app/ContextsProvider.js.map +1 -1
- package/lib/auth/hooks/use-auth-headers.js +40 -2
- package/lib/auth/hooks/use-auth-headers.js.map +1 -1
- package/lib/auth/screens/SettingsScreen.js +4 -1
- package/lib/auth/screens/SettingsScreen.js.map +1 -1
- package/lib/components/external/PlanningView/PlanningView.js +2 -1
- package/lib/components/external/PlanningView/PlanningView.js.map +1 -1
- package/lib/components/external/PlanningView/agenda.helpers.d.ts +0 -1
- package/lib/components/external/PlanningView/agenda.helpers.js +0 -5
- package/lib/components/external/PlanningView/agenda.helpers.js.map +1 -1
- package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.d.ts +2 -2
- package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.js +3 -2
- package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.js.map +1 -1
- package/lib/components/organisms/SignatureInput/SignatureInput.d.ts +8 -2
- package/lib/components/organisms/SignatureInput/SignatureInput.js +49 -23
- package/lib/components/organisms/SignatureInput/SignatureInput.js.map +1 -1
- package/lib/components/pages/FormView/FormView.js +1 -1
- package/lib/components/pages/FormView/FormView.js.map +1 -1
- package/lib/dashboards/component/AOPChart/AOPChart.js +3 -1
- package/lib/dashboards/component/AOPChart/AOPChart.js.map +1 -1
- package/lib/dashboards/component/RefreshChart/RefreshChart.js +4 -2
- package/lib/dashboards/component/RefreshChart/RefreshChart.js.map +1 -1
- package/lib/forms/studio/display.helpers.js +12 -1
- package/lib/forms/studio/display.helpers.js.map +1 -1
- package/lib/i18n/translations/en.json +16 -0
- package/lib/i18n/translations/fr.json +16 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/loader/ProcessProvider.d.ts +30 -0
- package/lib/loader/ProcessProvider.js +211 -0
- package/lib/loader/ProcessProvider.js.map +1 -0
- package/lib/loader/ProcessStorage.d.ts +18 -0
- package/lib/loader/ProcessStorage.js +95 -0
- package/lib/loader/ProcessStorage.js.map +1 -0
- package/lib/loader/components/atoms/ProcessCard/ProcessCard.d.ts +15 -0
- package/lib/loader/components/atoms/ProcessCard/ProcessCard.js +69 -0
- package/lib/loader/components/atoms/ProcessCard/ProcessCard.js.map +1 -0
- package/lib/loader/components/atoms/index.d.ts +1 -0
- package/lib/loader/components/atoms/index.js +19 -0
- package/lib/loader/components/atoms/index.js.map +1 -0
- package/lib/loader/components/index.d.ts +2 -0
- package/lib/loader/components/index.js +20 -0
- package/lib/loader/components/index.js.map +1 -0
- package/lib/loader/components/organisms/LoaderPopup/LoaderPopup.d.ts +13 -0
- package/lib/loader/components/organisms/LoaderPopup/LoaderPopup.js +104 -0
- package/lib/loader/components/organisms/LoaderPopup/LoaderPopup.js.map +1 -0
- package/lib/loader/components/organisms/index.d.ts +1 -0
- package/lib/loader/components/organisms/index.js +19 -0
- package/lib/loader/components/organisms/index.js.map +1 -0
- package/lib/loader/helpers.d.ts +5 -0
- package/lib/loader/helpers.js +59 -0
- package/lib/loader/helpers.js.map +1 -0
- package/lib/loader/hooks.d.ts +6 -0
- package/lib/loader/hooks.js +50 -0
- package/lib/loader/hooks.js.map +1 -0
- package/lib/loader/index.d.ts +6 -0
- package/lib/loader/index.js +24 -0
- package/lib/loader/index.js.map +1 -0
- package/lib/loader/types.d.ts +26 -0
- package/lib/loader/types.js +24 -0
- package/lib/loader/types.js.map +1 -0
- package/lib/screens/JsonFieldScreen.js +1 -1
- package/lib/screens/ProcessListScreen.d.ts +3 -0
- package/lib/screens/ProcessListScreen.js +75 -0
- package/lib/screens/ProcessListScreen.js.map +1 -0
- package/lib/screens/index.d.ts +11 -0
- package/lib/screens/index.js +8 -0
- package/lib/screens/index.js.map +1 -1
- package/lib/selections/SelectionProvider.d.ts +3 -0
- package/lib/selections/SelectionProvider.js +23 -0
- package/lib/selections/SelectionProvider.js.map +1 -1
- package/lib/selections/format.helpers.d.ts +2 -2
- package/lib/selections/format.helpers.js +2 -3
- package/lib/selections/format.helpers.js.map +1 -1
- package/lib/selections/hooks.js +4 -2
- package/lib/selections/hooks.js.map +1 -1
- package/lib/utils/date.d.ts +1 -0
- package/lib/utils/date.js +5 -0
- package/lib/utils/date.js.map +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { storage } from '../storage/Storage';
|
|
19
|
+
import { deserialize, serialize } from './helpers';
|
|
20
|
+
const NUMBER_UNREAD_PROCESS_KEY = 'NUMBER_UNREAD_PROCESS_KEY';
|
|
21
|
+
const PROCESS_LIST_KEY = 'PROCESS_LIST_KEY';
|
|
22
|
+
class ProcessStorage {
|
|
23
|
+
localStorage;
|
|
24
|
+
numberUnreadProcess;
|
|
25
|
+
processList;
|
|
26
|
+
refreshCallBacks;
|
|
27
|
+
constructor(localStorage) {
|
|
28
|
+
this.localStorage = localStorage;
|
|
29
|
+
this.numberUnreadProcess = 0;
|
|
30
|
+
this.processList = [];
|
|
31
|
+
this.refreshCallBacks = [];
|
|
32
|
+
}
|
|
33
|
+
updateState() {
|
|
34
|
+
if (this.refreshCallBacks.length > 0) {
|
|
35
|
+
const state = {
|
|
36
|
+
processList: this.getProcessList(),
|
|
37
|
+
numberUnreadProcess: this.getNumberUnreadProcess(),
|
|
38
|
+
};
|
|
39
|
+
this.refreshCallBacks.forEach(callBack => callBack(state));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
register(callBack) {
|
|
43
|
+
this.refreshCallBacks.push(callBack);
|
|
44
|
+
this.updateState();
|
|
45
|
+
}
|
|
46
|
+
getNumberUnreadProcess() {
|
|
47
|
+
if (this.numberUnreadProcess == null || this.numberUnreadProcess <= 0) {
|
|
48
|
+
this.numberUnreadProcess =
|
|
49
|
+
Number(this.localStorage.getItem(NUMBER_UNREAD_PROCESS_KEY)) || 0;
|
|
50
|
+
}
|
|
51
|
+
return this.numberUnreadProcess;
|
|
52
|
+
}
|
|
53
|
+
saveNumberUnreadProcess(value) {
|
|
54
|
+
if (value == null) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.numberUnreadProcess = value;
|
|
58
|
+
this.localStorage.setItem(NUMBER_UNREAD_PROCESS_KEY, this.numberUnreadProcess.toString());
|
|
59
|
+
this.updateState();
|
|
60
|
+
}
|
|
61
|
+
getProcessList() {
|
|
62
|
+
if (this.processList == null || this.processList.length === 0) {
|
|
63
|
+
this.processList = deserialize(this.localStorage.getItem(PROCESS_LIST_KEY));
|
|
64
|
+
}
|
|
65
|
+
return this.processList;
|
|
66
|
+
}
|
|
67
|
+
saveProcess(process) {
|
|
68
|
+
if (process == null || process.key == null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (this.processList.find(item => item.key === process.key) != null) {
|
|
72
|
+
this.processList = this.processList.map(item => {
|
|
73
|
+
if (item.key === process.key) {
|
|
74
|
+
return { ...item, ...process };
|
|
75
|
+
}
|
|
76
|
+
return item;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
this.processList.push(process);
|
|
81
|
+
}
|
|
82
|
+
this.localStorage.setItem(PROCESS_LIST_KEY, serialize(this.processList));
|
|
83
|
+
this.updateState();
|
|
84
|
+
}
|
|
85
|
+
saveProcessList(_processList) {
|
|
86
|
+
if (!Array.isArray(_processList)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.processList = _processList;
|
|
90
|
+
this.localStorage.setItem(PROCESS_LIST_KEY, serialize(_processList));
|
|
91
|
+
this.updateState();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export const processStorage = new ProcessStorage(storage);
|
|
95
|
+
//# sourceMappingURL=ProcessStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProcessStorage.js","sourceRoot":"","sources":["../../src/loader/ProcessStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAU,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AAEjD,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AAC9D,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C,MAAM,cAAc;IAWE;IAVZ,mBAAmB,CAAS;IAC5B,WAAW,CAAgB;IAC3B,gBAAgB,CAMV;IAEd,YAAoB,YAAqB;QAArB,iBAAY,GAAZ,YAAY,CAAS;QACvC,IAAI,CAAC,mBAAmB,GAAG,CA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,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ProcessStatus } from '../../../types';
|
|
3
|
+
interface ProcessCardProps {
|
|
4
|
+
style?: any;
|
|
5
|
+
processKey: string;
|
|
6
|
+
name: string;
|
|
7
|
+
status: ProcessStatus;
|
|
8
|
+
executed: boolean;
|
|
9
|
+
startedDate: string;
|
|
10
|
+
endDate: string;
|
|
11
|
+
onSuccess: () => void;
|
|
12
|
+
onError: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const ProcessCard: ({ style, processKey, name, status, executed, startedDate, endDate, onSuccess, onError, }: ProcessCardProps) => React.JSX.Element;
|
|
15
|
+
export default ProcessCard;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useCallback, useMemo } from 'react';
|
|
19
|
+
import { StyleSheet } from 'react-native';
|
|
20
|
+
import { ObjectCard, useThemeColor } from '@axelor/aos-mobile-ui';
|
|
21
|
+
import { formatDateTime } from '../../../../utils';
|
|
22
|
+
import { useTranslator } from '../../../../i18n';
|
|
23
|
+
import { processProvider } from '../../../ProcessProvider';
|
|
24
|
+
import { getProcessStatusColor } from '../../../helpers';
|
|
25
|
+
import { ProcessStatus } from '../../../types';
|
|
26
|
+
const ProcessCard = ({ style, processKey, name, status, executed, startedDate, endDate, onSuccess, onError, }) => {
|
|
27
|
+
const I18n = useTranslator();
|
|
28
|
+
const Colors = useThemeColor();
|
|
29
|
+
const styles = useMemo(() => getStyles(getProcessStatusColor(status, Colors)?.background), [Colors, status]);
|
|
30
|
+
const isSuccess = useMemo(() => status === ProcessStatus.Success, [status]);
|
|
31
|
+
const isTouchable = useMemo(() => {
|
|
32
|
+
const isCompleted = isSuccess || status === ProcessStatus.Failed;
|
|
33
|
+
return (isCompleted &&
|
|
34
|
+
!executed &&
|
|
35
|
+
typeof onSuccess === 'function' &&
|
|
36
|
+
typeof onError === 'function');
|
|
37
|
+
}, [executed, isSuccess, onError, onSuccess, status]);
|
|
38
|
+
const handleOnPress = useCallback(() => {
|
|
39
|
+
status === ProcessStatus.Success ? onSuccess() : onError();
|
|
40
|
+
processProvider.resolveProcess(processKey);
|
|
41
|
+
}, [status, onSuccess, onError, processKey]);
|
|
42
|
+
return (<ObjectCard style={[styles.card, style]} showArrow={isTouchable} touchable={isTouchable} onPress={handleOnPress} upperTexts={{
|
|
43
|
+
items: [
|
|
44
|
+
{ isTitle: true, displayText: name },
|
|
45
|
+
{
|
|
46
|
+
iconName: 'calendar-event',
|
|
47
|
+
indicatorText: I18n.t('Base_StartedOn'),
|
|
48
|
+
displayText: formatDateTime(startedDate, I18n.t('Base_DateTimeFormat')),
|
|
49
|
+
hideIf: startedDate == null,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
iconName: isSuccess ? 'calendar-check' : 'calendar-x',
|
|
53
|
+
indicatorText: I18n.t(isSuccess ? 'Base_CompletedOn' : 'Base_FaildedOn'),
|
|
54
|
+
displayText: formatDateTime(endDate, I18n.t('Base_DateTimeFormat')),
|
|
55
|
+
hideIf: endDate == null,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
}}/>);
|
|
59
|
+
};
|
|
60
|
+
const getStyles = (color) => StyleSheet.create({
|
|
61
|
+
card: {
|
|
62
|
+
marginHorizontal: 12,
|
|
63
|
+
marginVertical: 4,
|
|
64
|
+
borderLeftWidth: 7,
|
|
65
|
+
borderLeftColor: color,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
export default ProcessCard;
|
|
69
|
+
//# sourceMappingURL=ProcessCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProcessCard.js","sourceRoot":"","sources":["../../../../../src/loader/components/atoms/ProcessCard/ProcessCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAC,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAc7C,MAAM,WAAW,GAAG,CAAC,EACnB,KAAK,EACL,UAAU,EACV,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,OAAO,EACP,SAAS,EACT,OAAO,GACU,EAAE,EAAE;IACrB,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAE/B,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CAAC,SAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,EA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AAc,CACzB,WAAW,EACX,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAC9B;oBACD,MAAM,EAAE,WAAW,IAAI,IAAI;iBAC5B;gBACD;oBACE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY;oBACrD,aAAa,EAAE,IAAI,CAAC,CAAC,CACnB,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,CAClD;oBACD,WAAW,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC;oBACnE,MAAM,EAAE,OAAO,IAAI,IAAI;iBACxB;aACF;SACF,CAAC,EACF,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAClC,UAAU,CAAC,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,gBAAgB,EAAE,EAAE;QACpB,cAAc,EAAE,CAAC;QACjB,eAAe,EAAE,CAAC;QAClB,eAAe,EAAE,KAAK;KACvB;CACF,CAAC,CAAC;AAEL,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ProcessCard } from './ProcessCard/ProcessCard';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export { default as ProcessCard } from './ProcessCard/ProcessCard';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/loader/components/atoms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export * from './atoms';
|
|
19
|
+
export * from './organisms';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/loader/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface LoaderPopupProps {
|
|
3
|
+
start?: boolean;
|
|
4
|
+
autoLeave?: boolean;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
name: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
process: () => Promise<any>;
|
|
9
|
+
onSuccess: () => void;
|
|
10
|
+
onError: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const LoaderPopup: ({ start, autoLeave, timeout, name, disabled, process, onSuccess, onError, }: LoaderPopupProps) => React.JSX.Element;
|
|
13
|
+
export default LoaderPopup;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
19
|
+
import { ActivityIndicator, StyleSheet, View } from 'react-native';
|
|
20
|
+
import { Alert, Button, Label, Text, useConfig, useThemeColor, } from '@axelor/aos-mobile-ui';
|
|
21
|
+
import { useNavigation } from '../../../../hooks/use-navigation';
|
|
22
|
+
import { useTranslator } from '../../../../i18n';
|
|
23
|
+
import { processProvider } from '../../../ProcessProvider';
|
|
24
|
+
import { ProcessStatus } from '../../../types';
|
|
25
|
+
const LoaderPopup = ({ start = false, autoLeave = false, timeout = 1000, name, disabled = false, process, onSuccess, onError, }) => {
|
|
26
|
+
const I18n = useTranslator();
|
|
27
|
+
const Colors = useThemeColor();
|
|
28
|
+
const navigation = useNavigation();
|
|
29
|
+
const { setActivityIndicator } = useConfig();
|
|
30
|
+
const [loading, setLoading] = useState(false);
|
|
31
|
+
const [showPopup, setShowPopup] = useState(false);
|
|
32
|
+
const [processItem, setProcessItem] = useState();
|
|
33
|
+
const timeoutRef = useRef(null);
|
|
34
|
+
const processOptions = useMemo(() => ({
|
|
35
|
+
name,
|
|
36
|
+
disabled,
|
|
37
|
+
process,
|
|
38
|
+
onSuccess,
|
|
39
|
+
onError,
|
|
40
|
+
}), [name, disabled, process, onSuccess, onError]);
|
|
41
|
+
const onEndProcess = useCallback(() => {
|
|
42
|
+
setLoading(false);
|
|
43
|
+
setShowPopup(false);
|
|
44
|
+
}, []);
|
|
45
|
+
const handleNotifyMe = useCallback(() => {
|
|
46
|
+
setShowPopup(false);
|
|
47
|
+
setActivityIndicator(false);
|
|
48
|
+
processProvider.notifyMe(processItem.key);
|
|
49
|
+
navigation.goBack();
|
|
50
|
+
}, [navigation, processItem, setActivityIndicator]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (start) {
|
|
53
|
+
const processKey = new Date().getTime().toString();
|
|
54
|
+
const _process = processProvider.registerProcess(processKey, processOptions);
|
|
55
|
+
setProcessItem(_process);
|
|
56
|
+
processProvider.on(processKey, ProcessStatus.InProgress, () => setLoading(true));
|
|
57
|
+
processProvider.on(processKey, ProcessStatus.Success, () => onEndProcess());
|
|
58
|
+
processProvider.on(processKey, ProcessStatus.Failed, () => onEndProcess());
|
|
59
|
+
processProvider.runProcess(processKey, I18n);
|
|
60
|
+
}
|
|
61
|
+
}, [I18n, onEndProcess, processOptions, start]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (loading) {
|
|
64
|
+
setActivityIndicator(true);
|
|
65
|
+
timeoutRef.current = setTimeout(() => {
|
|
66
|
+
setActivityIndicator(false);
|
|
67
|
+
autoLeave ? handleNotifyMe() : setShowPopup(true);
|
|
68
|
+
}, timeout);
|
|
69
|
+
}
|
|
70
|
+
return () => {
|
|
71
|
+
setActivityIndicator(false);
|
|
72
|
+
clearTimeout(timeoutRef.current);
|
|
73
|
+
};
|
|
74
|
+
}, [
|
|
75
|
+
autoLeave,
|
|
76
|
+
handleNotifyMe,
|
|
77
|
+
loading,
|
|
78
|
+
setActivityIndicator,
|
|
79
|
+
setShowPopup,
|
|
80
|
+
timeout,
|
|
81
|
+
]);
|
|
82
|
+
return (<Alert visible={showPopup}>
|
|
83
|
+
<Label type="danger" message={I18n.t('Base_Loader_DoNotCloseTheApp')} iconName="exclamation-triangle-fill"/>
|
|
84
|
+
<View style={styles.loadingContainer}>
|
|
85
|
+
<ActivityIndicator size="large" color={Colors.primaryColor.background}/>
|
|
86
|
+
<Text style={styles.marginLeft} writingType="title">
|
|
87
|
+
{I18n.t('Base_Loader_LoadingInProgress')}
|
|
88
|
+
</Text>
|
|
89
|
+
</View>
|
|
90
|
+
<Button iconName="check-lg" title={I18n.t('Base_Loader_NotifyMe')} onPress={handleNotifyMe}/>
|
|
91
|
+
</Alert>);
|
|
92
|
+
};
|
|
93
|
+
const styles = StyleSheet.create({
|
|
94
|
+
loadingContainer: {
|
|
95
|
+
flexDirection: 'row',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
marginVertical: 15,
|
|
98
|
+
},
|
|
99
|
+
marginLeft: {
|
|
100
|
+
marginLeft: 10,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
export default LoaderPopup;
|
|
104
|
+
//# sourceMappingURL=LoaderPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoaderPopup.js","sourceRoot":"","sources":["../../../../../src/loader/components/organisms/LoaderPopup/LoaderPopup.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,K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CACN;MAAA,CAAC,MAAM,CACL,QAAQ,CAAC,UAAU,CACnB,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CACtC,OAAO,CAAC,CAAC,cAAc,CAAC,EAE5B;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,gBAAgB,EAAE;QAChB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,EAAE;KACnB;IACD,UAAU,EAAE;QACV,UAAU,EAAE,EAAE;KACf;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LoaderPopup } from './LoaderPopup/LoaderPopup';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export { default as LoaderPopup } from './LoaderPopup/LoaderPopup';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/loader/components/organisms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Color, ThemeColors } from '@axelor/aos-mobile-ui';
|
|
2
|
+
import { ProcessItem, ProcessStatus } from './types';
|
|
3
|
+
export declare const serialize: (list: ProcessItem[]) => string;
|
|
4
|
+
export declare const deserialize: (data: string) => any[];
|
|
5
|
+
export declare const getProcessStatusColor: (status: ProcessStatus, Colors: ThemeColors) => Color;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { ProcessStatus } from './types';
|
|
19
|
+
const serializeItem = (p) => {
|
|
20
|
+
return JSON.stringify(p);
|
|
21
|
+
};
|
|
22
|
+
const deserializeItem = (data) => {
|
|
23
|
+
return JSON.parse(data);
|
|
24
|
+
};
|
|
25
|
+
export const serialize = (list) => {
|
|
26
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
27
|
+
return '[]';
|
|
28
|
+
}
|
|
29
|
+
return JSON.stringify(list.map(p => serializeItem(p)));
|
|
30
|
+
};
|
|
31
|
+
export const deserialize = (data) => {
|
|
32
|
+
if (data == null || data.length === 0) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
if (!Array.isArray(data)) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
return data.map(i => deserializeItem(i));
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
console.error('Deserialization error:', e);
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export const getProcessStatusColor = (status, Colors) => {
|
|
47
|
+
switch (status) {
|
|
48
|
+
case ProcessStatus.InProgress:
|
|
49
|
+
return Colors.progressColor;
|
|
50
|
+
case ProcessStatus.Success:
|
|
51
|
+
return Colors.successColor;
|
|
52
|
+
case ProcessStatus.Failed:
|
|
53
|
+
return Colors.errorColor;
|
|
54
|
+
default:
|
|
55
|
+
console.warn(`Status provided with value ${status} is not supported by Process.`);
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/loader/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAc,aAAa,EAAC,MAAM,SAAS,CAAC;AAEnD,MAAM,aAAa,GAAG,CAAC,CAAc,EAAE,EAAE;IACvC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAmB,EAAU,EAAE;IACvD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAA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elor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
19
|
+
import { processProvider } from './ProcessProvider';
|
|
20
|
+
import { processStorage } from './ProcessStorage';
|
|
21
|
+
export const useLoaderListener = () => {
|
|
22
|
+
const [numberRunningProcesses, setNumberRunningProcesses] = useState(0);
|
|
23
|
+
const [numberUnreadProcess, setNumberUnreadProcess] = useState(0);
|
|
24
|
+
const [processList, setProcessList] = useState([]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setNumberRunningProcesses(processProvider.getNumberRunningProcess());
|
|
27
|
+
const handleProcessChange = newNumber => {
|
|
28
|
+
setNumberRunningProcesses(newNumber);
|
|
29
|
+
};
|
|
30
|
+
processProvider.subscribeNRProcess(handleProcessChange);
|
|
31
|
+
return () => {
|
|
32
|
+
processProvider.unsubscribeNRProcess(handleProcessChange);
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
const refreshData = useCallback(({ numberUnreadProcess: _numberUnreadProcess, processList: _processList, }) => {
|
|
36
|
+
setNumberUnreadProcess(_numberUnreadProcess);
|
|
37
|
+
setProcessList(_processList);
|
|
38
|
+
}, []);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
processStorage.register(refreshData);
|
|
41
|
+
}, [refreshData]);
|
|
42
|
+
return useMemo(() => {
|
|
43
|
+
return {
|
|
44
|
+
numberRunningProcesses,
|
|
45
|
+
numberUnreadProcess,
|
|
46
|
+
processList,
|
|
47
|
+
};
|
|
48
|
+
}, [numberRunningProcesses, numberUnreadProcess, processList]);
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/loader/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAGhD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GACvD,QAAQ,CAAS,CAAC,CAAC,CAAC;IACtB,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAC;IAC1E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAgB,EAAE,CAAC,CAAC;IAElE,SAAS,CAAC,GAAG,EAAE;QACb,yBAAyB,CAAC,eAAe,CAAC,uBAAuB,EAAE,CAAC,CAAC;QAErE,MAAM,mBAAmB,GAAG,SAAS,CAAC,EAAE;YACtC,yBAAyB,CAAC,SAAS,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,eAAe,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;QAExD,OAAO,GAAG,EAAE;YACV,eAAe,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,EACC,mBAAmB,EAAE,oBAAoB,EACzC,WAAW,EAAE,YAAY,GAC1B,EAAE,EAAE;QACH,sBAAsB,CAAC,oBAAoB,CAAC,CAAC;QAC7C,cAAc,CAAC,YAAY,CAAC,CAAC;IAC/B,CAAC,EACD,EAAE,CACH,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,OAAO;YACL,sBAAsB;YACtB,mBAAmB;YACnB,WAAW;SACZ,CAAC;IACJ,CAAC,EAAE,CAAC,sBAAsB,EAAE,mBAAmB,EAAE,WAAW,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './components';
|
|
2
|
+
export { processProvider } from './ProcessProvider';
|
|
3
|
+
export { processStorage } from './ProcessStorage';
|
|
4
|
+
export { ProcessStatus } from './types';
|
|
5
|
+
export { getProcessStatusColor } from './helpers';
|
|
6
|
+
export { useLoaderListener } from './hooks';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export * from './components';
|
|
19
|
+
export { processProvider } from './ProcessProvider';
|
|
20
|
+
export { processStorage } from './ProcessStorage';
|
|
21
|
+
export { ProcessStatus } from './types';
|
|
22
|
+
export { getProcessStatusColor } from './helpers';
|
|
23
|
+
export { useLoaderListener } from './hooks';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loader/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,qBAAqB,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ProcessOption = {
|
|
2
|
+
name: string;
|
|
3
|
+
disabled: boolean;
|
|
4
|
+
process: () => Promise<any>;
|
|
5
|
+
onSuccess: (response?: any) => void;
|
|
6
|
+
onError: (error?: any) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare enum ProcessStatus {
|
|
9
|
+
InProgress = 0,
|
|
10
|
+
Success = 1,
|
|
11
|
+
Failed = 2
|
|
12
|
+
}
|
|
13
|
+
export type CallBack = (...args: any[]) => void;
|
|
14
|
+
export type Event = {
|
|
15
|
+
[e in ProcessStatus]: CallBack[];
|
|
16
|
+
};
|
|
17
|
+
export type ProcessItem = ProcessOption & {
|
|
18
|
+
key: string;
|
|
19
|
+
loading: boolean;
|
|
20
|
+
notifyMe: boolean;
|
|
21
|
+
response: string;
|
|
22
|
+
status: number;
|
|
23
|
+
executed: boolean;
|
|
24
|
+
startedDate: string;
|
|
25
|
+
endDate: string;
|
|
26
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export var ProcessStatus;
|
|
19
|
+
(function (ProcessStatus) {
|
|
20
|
+
ProcessStatus[ProcessStatus["InProgress"] = 0] = "InProgress";
|
|
21
|
+
ProcessStatus[ProcessStatus["Success"] = 1] = "Success";
|
|
22
|
+
ProcessStatus[ProcessStatus["Failed"] = 2] = "Failed";
|
|
23
|
+
})(ProcessStatus || (ProcessStatus = {}));
|
|
24
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/loader/types.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,6DAAc,CAAA;IACd,uDAAW,CAAA;IACX,qDAAU,CAAA;AACZ,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB"}
|
|
@@ -49,7 +49,7 @@ const JsonFieldScreen = ({ route }) => {
|
|
|
49
49
|
return (<CustomFieldForm model={model} modelId={modelId} readonlyButton={true} additionalActions={[
|
|
50
50
|
{
|
|
51
51
|
key: 'validateChanges',
|
|
52
|
-
type: '
|
|
52
|
+
type: 'update',
|
|
53
53
|
useDefaultAction: true,
|
|
54
54
|
readonlyAfterAction: true,
|
|
55
55
|
},
|