@cccsaurora/howler-ui 2.16.0-dev.347 → 2.16.0-dev.376
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from '@mui/material';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Stack } from '@mui/material';
|
|
3
3
|
import api from '@cccsaurora/howler-ui/api';
|
|
4
4
|
import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
|
|
5
5
|
import useMyActionFunctions from '@cccsaurora/howler-ui/components/routes/action/useMyActionFunctions';
|
|
@@ -13,6 +13,9 @@ const ActionButton = ({ actionId, hitId, label, ...otherProps }) => {
|
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
dispatchApi(api.search.action.post({ query: `action_id:${actionId}`, rows: 1 })).then(result => setAction(result.items[0]));
|
|
15
15
|
}, [actionId, dispatchApi]);
|
|
16
|
+
if (!actionId || !hitId) {
|
|
17
|
+
return (_jsxs(Stack, { spacing: 1, children: [_jsx("strong", { style: { color: 'red' }, children: t('markdown.error') }), _jsx("code", { style: { fontSize: '0.8rem' }, children: t('markdown.actionbutton.error') })] }));
|
|
18
|
+
}
|
|
16
19
|
return (_jsx(Button, { variant: otherProps.variant ?? 'outlined', disabled: !action, onClick: () => executeAction(actionId, `howler.id:${hitId}`), color: otherProps.color ?? 'primary', children: label ?? action?.name ?? t('loading') }));
|
|
17
20
|
};
|
|
18
21
|
export default ActionButton;
|
|
@@ -210,10 +210,6 @@ export const useHelpers = () => {
|
|
|
210
210
|
fr: "Exécute une action howler à partir d'un ID d'action spécifique (de l'URL lors de la visualisation de l'action, par ex. yaIKVqiKhWpyCsWdqsE4D)"
|
|
211
211
|
},
|
|
212
212
|
componentCallback: (actionId, hitId, context) => {
|
|
213
|
-
if (!actionId || !hitId) {
|
|
214
|
-
console.warn('Missing parameters for the action button.');
|
|
215
|
-
return null;
|
|
216
|
-
}
|
|
217
213
|
return _jsx(ActionButton, { actionId: actionId, hitId: hitId, ...(context.hash ?? {}) });
|
|
218
214
|
}
|
|
219
215
|
},
|
|
@@ -286,6 +286,7 @@
|
|
|
286
286
|
"markdown.error": "An Error Has Occurred.",
|
|
287
287
|
"markdown.json.invalid": "Invalid JSON Provided. Consider using the {{json <data>}} utility to convert objects into JSON strings.",
|
|
288
288
|
"markdown.props.missing": "You are missing keyword arguments for this helper:",
|
|
289
|
+
"markdown.actionbutton.error": "You must provide two arguments: action id and hit id.",
|
|
289
290
|
"modal.action.title": "Save Action",
|
|
290
291
|
"modal.action.description": "Provide a name that allows other users to identify the purpose of this action.",
|
|
291
292
|
"modal.action.empty": "Action Name cannot be empty.",
|
|
@@ -288,6 +288,7 @@
|
|
|
288
288
|
"markdown.error": "Une erreur s'est produite.",
|
|
289
289
|
"markdown.json.invalid": "JSON non valide fourni. Pensez à utiliser l'utilitaire {{json <data>}} pour convertir les objets en chaînes JSON.",
|
|
290
290
|
"markdown.props.missing": "Il manque des arguments de mots-clés pour cette aide:",
|
|
291
|
+
"markdown.actionbutton.error": "Vous devez fournir deux arguments : l'identifiant de l'action et l'identifiant du hit.",
|
|
291
292
|
"modal.action.title": "Enregistrer l'action",
|
|
292
293
|
"modal.action.description": "Donnez un nom qui permette aux autres utilisateurs d'identifier l'objectif de cette action.",
|
|
293
294
|
"modal.action.empty": "Le nom de l'action ne peut pas être vide.",
|