This commit is contained in:
Alicia Sykes 2024-04-20 12:07:57 +01:00 committed by GitHub
commit 8d0f68a327
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 2 deletions

View File

@ -34,7 +34,6 @@
</template> </template>
<script> <script>
// Import form elements, icons and utils
import ErrorHandler from '@/utils/ErrorHandler'; import ErrorHandler from '@/utils/ErrorHandler';
import Button from '@/components/FormElements/Button'; import Button from '@/components/FormElements/Button';
import UpdateIcon from '@/assets/interface-icons/widget-update.svg'; import UpdateIcon from '@/assets/interface-icons/widget-update.svg';
@ -125,7 +124,6 @@ const COMPAT = {
export default { export default {
name: 'Widget', name: 'Widget',
components: { components: {
// Register form elements
Button, Button,
UpdateIcon, UpdateIcon,
OpenIcon, OpenIcon,
@ -173,6 +171,7 @@ export default {
return this.widget.hideControls; return this.widget.hideControls;
}, },
component() { component() {
this.appendUserCustomComponents();
const type = COMPAT[this.widgetType] || this.widget.type; const type = COMPAT[this.widgetType] || this.widget.type;
if (!type) { if (!type) {
ErrorHandler('Widget type was not found'); ErrorHandler('Widget type was not found');
@ -201,6 +200,15 @@ export default {
setLoaderState(loading) { setLoaderState(loading) {
this.loading = loading; this.loading = loading;
}, },
/* If user has specified custom widgets, append them to list */
appendUserCustomComponents() {
const customWidgets = this.appConfig?.customWidgets;
if (customWidgets && Array.isArray(customWidgets)) {
customWidgets.forEach((widget) => {
COMPAT[widget.identifier] = widget.component;
});
}
},
}, },
}; };
</script> </script>