Browse Source

Feature: Desktop view - Add static object attributes per entity.

Dominik Klein 3 months ago
parent
commit
ad8b4770f8

+ 3 - 6
app/frontend/apps/desktop/pages/ticket/components/TicketSidebar/TicketSidebarCustomer/TicketSidebarCustomerContent.vue

@@ -5,11 +5,8 @@ import { computed } from 'vue'
 
 import CommonUserAvatar from '#shared/components/CommonUserAvatar/CommonUserAvatar.vue'
 import ObjectAttributes from '#shared/components/ObjectAttributes/ObjectAttributes.vue'
-import type {
-  ObjectManagerFrontendAttribute,
-  Organization,
-  UserQuery,
-} from '#shared/graphql/types.ts'
+import type { ObjectAttribute } from '#shared/entities/object-attributes/types/store.ts'
+import type { Organization, UserQuery } from '#shared/graphql/types.ts'
 import { normalizeEdges } from '#shared/utils/helpers.ts'
 
 import type { MenuItem } from '#desktop/components/CommonPopoverMenu/types.ts'
@@ -31,7 +28,7 @@ interface Props extends TicketSidebarContentProps {
   secondaryOrganizations: ReturnType<
     typeof normalizeEdges<Partial<Organization>>
   >
-  objectAttributes: ObjectManagerFrontendAttribute[]
+  objectAttributes: ObjectAttribute[]
 }
 
 const props = defineProps<Props>()

+ 0 - 1
app/frontend/apps/desktop/pages/ticket/components/TicketSidebar/TicketSidebarCustomer/__tests__/TicketSidebarCustomerContent.spec.ts

@@ -81,7 +81,6 @@ const renderTicketSidebarCustomerContent = async (
       secondaryOrganizations,
       objectAttributes: [
         {
-          __typename: 'ObjectManagerFrontendAttribute',
           name: 'email',
           display: 'Email',
           dataType: 'input',

+ 3 - 6
app/frontend/apps/desktop/pages/ticket/components/TicketSidebar/TicketSidebarOrganization/TicketSidebarOrganizationContent.vue

@@ -4,11 +4,8 @@
 import type { AvatarOrganization } from '#shared/components/CommonOrganizationAvatar'
 import CommonOrganizationAvatar from '#shared/components/CommonOrganizationAvatar/CommonOrganizationAvatar.vue'
 import ObjectAttributes from '#shared/components/ObjectAttributes/ObjectAttributes.vue'
-import type {
-  ObjectManagerFrontendAttribute,
-  OrganizationQuery,
-  User,
-} from '#shared/graphql/types.ts'
+import type { ObjectAttribute } from '#shared/entities/object-attributes/types/store.ts'
+import type { OrganizationQuery, User } from '#shared/graphql/types.ts'
 import { normalizeEdges } from '#shared/utils/helpers.ts'
 
 import type { MenuItem } from '#desktop/components/CommonPopoverMenu/types.ts'
@@ -21,7 +18,7 @@ import TicketSidebarContent from '../TicketSidebarContent.vue'
 interface Props extends TicketSidebarContentProps {
   organization: OrganizationQuery['organization']
   organizationMembers: ReturnType<typeof normalizeEdges<Partial<User>>>
-  objectAttributes: ObjectManagerFrontendAttribute[]
+  objectAttributes: ObjectAttribute[]
 }
 
 defineProps<Props>()

+ 0 - 9
app/frontend/apps/desktop/pages/ticket/components/TicketSidebar/TicketSidebarOrganization/__tests__/TicketSidebarOrganizationContent.spec.ts

@@ -35,7 +35,6 @@ const renderTicketSidebarOrganizationContent = async (options: any = {}) => {
       },
       objectAttributes: [
         {
-          __typename: 'ObjectManagerFrontendAttribute',
           name: 'domain',
           display: 'Domain',
           dataType: 'input',
@@ -61,14 +60,6 @@ const renderTicketSidebarOrganizationContent = async (options: any = {}) => {
 
 describe('TicketSidebarOrganizationContent.vue', () => {
   it('renders organization info', async () => {
-    // mockOrganizationQuery({
-    //   organization: {
-    //     name: 'Zammad Foundation',
-    //     domain: 'zammad.org',
-    //     active: true,
-    //   },
-    // })
-
     const wrapper = await renderTicketSidebarOrganizationContent()
 
     expect(wrapper.getByRole('heading', { level: 2 })).toHaveTextContent(

+ 2 - 2
app/frontend/shared/components/ObjectAttributes/ObjectAttributes.vue

@@ -2,14 +2,14 @@
 
 <script setup lang="ts">
 import { useSharedVisualConfig } from '#shared/composables/useSharedVisualConfig.ts'
-import type { ObjectManagerFrontendAttribute } from '#shared/graphql/types.ts'
+import type { ObjectAttribute } from '#shared/entities/object-attributes/types/store.ts'
 import type { ObjectLike } from '#shared/types/utils.ts'
 
 import { useDisplayObjectAttributes } from './useDisplayObjectAttributes.ts'
 
 export interface Props {
   object: ObjectLike
-  attributes: ObjectManagerFrontendAttribute[]
+  attributes: ObjectAttribute[]
   skipAttributes?: string[]
   accessors?: Record<string, string>
   alwaysShowAfterFields?: boolean

+ 2 - 2
app/frontend/shared/components/ObjectAttributes/attributes/AttributeBoolean/attributeBooleanTypes.ts

@@ -1,8 +1,8 @@
 // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
 
-import type { ObjectManagerFrontendAttribute } from '#shared/graphql/types.ts'
+import type { ObjectAttribute } from '#shared/entities/object-attributes/types/store.ts'
 
-export interface ObjectAttributeBoolean extends ObjectManagerFrontendAttribute {
+export interface ObjectAttributeBoolean extends ObjectAttribute {
   dataType: 'boolean'
   dataOption: {
     default: boolean

+ 2 - 2
app/frontend/shared/components/ObjectAttributes/attributes/AttributeDate/attributeDateTypes.ts

@@ -1,8 +1,8 @@
 // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
 
-import type { ObjectManagerFrontendAttribute } from '#shared/graphql/types.ts'
+import type { ObjectAttribute } from '#shared/entities/object-attributes/types/store.ts'
 
-export interface ObjectAttributeDate extends ObjectManagerFrontendAttribute {
+export interface ObjectAttributeDate extends ObjectAttribute {
   dataType: 'date' | 'datetime'
   dataOption: {
     relation: string

+ 2 - 2
app/frontend/shared/components/ObjectAttributes/attributes/AttributeInput/attributeInputTypes.ts

@@ -1,8 +1,8 @@
 // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
 
-import type { ObjectManagerFrontendAttribute } from '#shared/graphql/types.ts'
+import type { ObjectAttribute } from '#shared/entities/object-attributes/types/store.ts'
 
-export interface ObjectAttributeInput extends ObjectManagerFrontendAttribute {
+export interface ObjectAttributeInput extends ObjectAttribute {
   dataType: 'input'
   dataOption: {
     item_class: string

+ 2 - 3
app/frontend/shared/components/ObjectAttributes/attributes/AttributeMultiSelect/attributeMultiSelectTypes.ts

@@ -1,9 +1,8 @@
 // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
 
-import type { ObjectManagerFrontendAttribute } from '#shared/graphql/types.ts'
+import type { ObjectAttribute } from '#shared/entities/object-attributes/types/store.ts'
 
-export interface ObjectAttributeMultiSelect
-  extends ObjectManagerFrontendAttribute {
+export interface ObjectAttributeMultiSelect extends ObjectAttribute {
   dataType: 'multiselect' | 'multi_tree_select'
   dataOption: {
     historical_options?: Record<string, string>

+ 2 - 3
app/frontend/shared/components/ObjectAttributes/attributes/AttributeRichtext/attributeRichtextTypes.ts

@@ -1,9 +1,8 @@
 // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
 
-import type { ObjectManagerFrontendAttribute } from '#shared/graphql/types.ts'
+import type { ObjectAttribute } from '#shared/entities/object-attributes/types/store.ts'
 
-export interface ObjectAttributeRichtext
-  extends ObjectManagerFrontendAttribute {
+export interface ObjectAttributeRichtext extends ObjectAttribute {
   dataType: 'richtext'
   dataOption: {
     maxlength: number

Some files were not shown because too many files changed in this diff