From 08a1c00e95c7d56e73ae7de77766f4f139d77fed Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Wed, 29 May 2024 18:25:17 +0100 Subject: [PATCH] feat: Add CTAs to create instance from Portlets Tab - MEED-6919 - Meeds-io/MIPs#139 (#90) --- .../locale/portlet/LayoutEditor_en.properties | 3 +- .../instances/drawer/InstanceDrawer.vue | 17 ++- .../portlets/components/portlets/Item.vue | 3 + .../portlets/components/portlets/List.vue | 16 +++ .../portlets/components/portlets/Menu.vue | 131 ++++++++++++++++++ .../portlets/drawer/InstancesDrawer.vue | 19 ++- .../webapp/vue-app/portlets/initComponents.js | 2 + .../src/main/webapp/vue-app/portlets/main.js | 7 + 8 files changed, 191 insertions(+), 7 deletions(-) create mode 100644 layout-webapp/src/main/webapp/vue-app/portlets/components/portlets/Menu.vue diff --git a/layout-webapp/src/main/resources/locale/portlet/LayoutEditor_en.properties b/layout-webapp/src/main/resources/locale/portlet/LayoutEditor_en.properties index b5c653346..9d0fa0aec 100644 --- a/layout-webapp/src/main/resources/locale/portlet/LayoutEditor_en.properties +++ b/layout-webapp/src/main/resources/locale/portlet/LayoutEditor_en.properties @@ -282,6 +282,7 @@ layout.portletInstanceUpdatedSuccessfully=Portlet Instance updated successfully portlets.portletInstancesList=Instances using {0} portlets.previewInstance=Preview the instance -portlets.noPortletInstancesYet=No instance is using this portlet for now +portlets.noPortletInstancesYet=Create your first instance using this portlet portlets.instancePreview=Preview portlets.uploadPreviewTitle=Upload an illustration for portlet instance +portlets.label.createInstance=Create instance diff --git a/layout-webapp/src/main/webapp/vue-app/portlets/components/instances/drawer/InstanceDrawer.vue b/layout-webapp/src/main/webapp/vue-app/portlets/components/instances/drawer/InstanceDrawer.vue index d91337bdb..14588b921 100644 --- a/layout-webapp/src/main/webapp/vue-app/portlets/components/instances/drawer/InstanceDrawer.vue +++ b/layout-webapp/src/main/webapp/vue-app/portlets/components/instances/drawer/InstanceDrawer.vue @@ -24,6 +24,7 @@ id="portletInstanceDrawer" v-model="drawer" :loading="saving" + :go-back-button="goBackButton" allow-expand right> \ No newline at end of file diff --git a/layout-webapp/src/main/webapp/vue-app/portlets/components/portlets/drawer/InstancesDrawer.vue b/layout-webapp/src/main/webapp/vue-app/portlets/components/portlets/drawer/InstancesDrawer.vue index 36a397e80..713f35ac0 100644 --- a/layout-webapp/src/main/webapp/vue-app/portlets/components/portlets/drawer/InstancesDrawer.vue +++ b/layout-webapp/src/main/webapp/vue-app/portlets/components/portlets/drawer/InstancesDrawer.vue @@ -30,6 +30,13 @@ diff --git a/layout-webapp/src/main/webapp/vue-app/portlets/initComponents.js b/layout-webapp/src/main/webapp/vue-app/portlets/initComponents.js index 4a8b0b52d..857d070cf 100644 --- a/layout-webapp/src/main/webapp/vue-app/portlets/initComponents.js +++ b/layout-webapp/src/main/webapp/vue-app/portlets/initComponents.js @@ -41,6 +41,7 @@ import PortletInput from './components/instances/form/PortletInput.vue'; import PortletList from './components/portlets/List.vue'; import PortletItem from './components/portlets/Item.vue'; +import PortletMenu from './components/portlets/Menu.vue'; import PortletInstancesDrawer from './components/portlets/drawer/InstancesDrawer.vue'; @@ -66,6 +67,7 @@ const components = { 'portlets-list': PortletList, 'portlets-item': PortletItem, + 'portlets-item-menu': PortletMenu, 'portlets-item-instances-drawer': PortletInstancesDrawer, }; diff --git a/layout-webapp/src/main/webapp/vue-app/portlets/main.js b/layout-webapp/src/main/webapp/vue-app/portlets/main.js index 951914c1f..cd2b23a9b 100644 --- a/layout-webapp/src/main/webapp/vue-app/portlets/main.js +++ b/layout-webapp/src/main/webapp/vue-app/portlets/main.js @@ -47,6 +47,7 @@ export function init() { portlets: [], portletInstances: [], portletInstanceCategories: [], + selectedCategoryId: null, loading: 0, collator: new Intl.Collator(eXo.env.portal.language, {numeric: true, sensitivity: 'base'}), }), @@ -74,12 +75,17 @@ export function init() { this.$root.$on('portlet-instance-deleted', this.refreshPortletInstances); this.$root.$on('portlet-instance-category-saved', this.refreshPortletInstanceCategories); this.$root.$on('portlet-instance-category-deleted', this.refreshPortletInstanceCategories); + this.$root.$on('portlet-instance-category-deleted', this.refreshPortletInstances); + this.$root.$on('portlet-instance-category-selected', this.selectCategory); this.refreshPortlets(); this.refreshPortletInstances(); this.refreshPortletInstanceCategories(); }, methods: { + selectCategory(categoryId) { + this.selectedCategoryId = categoryId; + }, refreshPortlets() { this.loading++; return this.$portletService.getPortlets() @@ -99,6 +105,7 @@ export function init() { this.loading++; return this.$portletInstanceCategoryService.getPortletInstanceCategories() .then(data => this.portletInstanceCategories = data || []) + .then(() => this.portletInstanceCategories = data || []) .finally(() => this.loading--); }, },