diff --git a/.github/workflows/publish_foss_docker.yml b/.github/workflows/publish_foss_docker.yml index 8149ee290..3075a7f3d 100644 --- a/.github/workflows/publish_foss_docker.yml +++ b/.github/workflows/publish_foss_docker.yml @@ -79,7 +79,7 @@ jobs: file: docker/Dockerfile platforms: ${{ matrix.platform }} push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} - outputs: type=image,name=${{ env.DOCKER_TAG }},push-by-digest=true,name-canonical=true,push=true + outputs: type=image,name=${{ env.DOCKER_REPO }},push-by-digest=true,name-canonical=true,push=true - name: Export digest run: | diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsSidebar/ContactCustomAttributes.vue b/app/javascript/dashboard/components-next/Contacts/ContactsSidebar/ContactCustomAttributes.vue index f2a5c1ee8..4964668df 100644 --- a/app/javascript/dashboard/components-next/Contacts/ContactsSidebar/ContactCustomAttributes.vue +++ b/app/javascript/dashboard/components-next/Contacts/ContactsSidebar/ContactCustomAttributes.vue @@ -2,6 +2,7 @@ import { ref, computed } from 'vue'; import { useI18n } from 'vue-i18n'; import { useMapGetter } from 'dashboard/composables/store'; +import { useUISettings } from 'dashboard/composables/useUISettings'; import ContactCustomAttributeItem from 'dashboard/components-next/Contacts/ContactsSidebar/ContactCustomAttributeItem.vue'; @@ -14,6 +15,8 @@ const props = defineProps({ const { t } = useI18n(); +const { uiSettings } = useUISettings(); + const searchQuery = ref(''); const contactAttributes = useMapGetter('attributes/getContactAttributes') || []; @@ -46,20 +49,49 @@ const processContactAttributes = ( }, []); }; +const sortAttributesOrder = computed( + () => + uiSettings.value.conversation_elements_order_conversation_contact_panel ?? + [] +); + +const sortByUISettings = attributes => { + // Get saved order from UI settings + // Same as conversation panel contact attribute order + const order = sortAttributesOrder.value; + + // If no order defined, return original array + if (!order?.length) return attributes; + + const orderMap = new Map(order.map((key, index) => [key, index])); + + // Sort attributes based on their position in saved order + return [...attributes].sort((a, b) => { + // Get positions, use Infinity if not found in order (pushes to end) + const aPos = orderMap.get(a.attributeKey) ?? Infinity; + const bPos = orderMap.get(b.attributeKey) ?? Infinity; + return aPos - bPos; + }); +}; + const usedAttributes = computed(() => { - return processContactAttributes( + const attributes = processContactAttributes( contactAttributes.value, props.selectedContact?.customAttributes, (key, custom) => key in custom ); + + return sortByUISettings(attributes); }); const unusedAttributes = computed(() => { - return processContactAttributes( + const attributes = processContactAttributes( contactAttributes.value, props.selectedContact?.customAttributes, (key, custom) => !(key in custom) ); + + return sortByUISettings(attributes); }); const filteredUnusedAttributes = computed(() => { diff --git a/app/javascript/dashboard/components-next/sidebar/SidebarSubGroup.vue b/app/javascript/dashboard/components-next/sidebar/SidebarSubGroup.vue index a938a202e..8e3c3009e 100644 --- a/app/javascript/dashboard/components-next/sidebar/SidebarSubGroup.vue +++ b/app/javascript/dashboard/components-next/sidebar/SidebarSubGroup.vue @@ -2,7 +2,6 @@ import { computed, ref } from 'vue'; import SidebarGroupLeaf from './SidebarGroupLeaf.vue'; import SidebarGroupSeparator from './SidebarGroupSeparator.vue'; -import SidebarGroupEmptyLeaf from './SidebarGroupEmptyLeaf.vue'; import { useSidebarContext } from './provider'; import { useEventListener } from '@vueuse/core'; @@ -26,11 +25,6 @@ const accessibleItems = computed(() => ); const hasAccessibleItems = computed(() => { - if (props.children.length === 0) { - // cases like segment, folder and labels where users can create new items - return true; - } - return accessibleItems.value.length > 0; }); @@ -55,7 +49,7 @@ useEventListener(scrollableContainer, 'scroll', () => { :icon class="my-1" /> -