ticket-overviews.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. import { TicketOverviewsDocument } from '@shared/entities/ticket/graphql/queries/ticket/overviews.api'
  3. import type { TicketOverviewsQuery } from '@shared/graphql/types'
  4. import { EnumOrderDirection } from '@shared/graphql/types'
  5. import { mockGraphQLApi } from '../mock-graphql-api'
  6. export const getApiTicketOverviews = (): TicketOverviewsQuery => ({
  7. ticketOverviews: {
  8. pageInfo: {
  9. endCursor: null,
  10. hasNextPage: false,
  11. },
  12. edges: [
  13. {
  14. cursor: 'node1',
  15. node: {
  16. id: '1',
  17. name: __('Overview 1'),
  18. link: 'overview_1',
  19. ticketCount: 1,
  20. orderBy: 'created_at',
  21. orderDirection: EnumOrderDirection.Descending,
  22. prio: 100,
  23. active: true,
  24. viewColumns: [
  25. { key: 'number', value: 'Number' },
  26. { key: 'title', value: 'Title' },
  27. { key: 'created_at', value: 'Created at' },
  28. { key: 'updated_at', value: 'Updated at' },
  29. { key: 'priority', value: 'Priority' },
  30. ],
  31. orderColumns: [
  32. { key: 'number', value: 'Number' },
  33. { key: 'title', value: 'Title' },
  34. { key: 'created_at', value: 'Created at' },
  35. { key: 'updated_at', value: 'Updated at' },
  36. ],
  37. },
  38. },
  39. {
  40. cursor: 'node2',
  41. node: {
  42. id: '2',
  43. name: __('Overview 2'),
  44. link: 'overview_2',
  45. ticketCount: 2,
  46. orderBy: 'created_at',
  47. orderDirection: EnumOrderDirection.Ascending,
  48. prio: 200,
  49. active: true,
  50. viewColumns: [
  51. { key: 'number', value: 'Number' },
  52. { key: 'title', value: 'Title' },
  53. { key: 'created_at', value: 'Created at' },
  54. { key: 'updated_at', value: 'Updated at' },
  55. ],
  56. orderColumns: [
  57. { key: 'number', value: 'Number' },
  58. { key: 'title', value: 'Title' },
  59. { key: 'created_at', value: 'Created at' },
  60. { key: 'updated_at', value: 'Updated at' },
  61. ],
  62. },
  63. },
  64. {
  65. cursor: 'node3',
  66. node: {
  67. id: '3',
  68. name: __('Overview 3'),
  69. link: 'overview_3',
  70. ticketCount: 3,
  71. orderBy: 'created_at',
  72. orderDirection: EnumOrderDirection.Ascending,
  73. prio: 300,
  74. active: true,
  75. viewColumns: [
  76. { key: 'number', value: 'Number' },
  77. { key: 'title', value: 'Title' },
  78. { key: 'created_at', value: 'Created at' },
  79. { key: 'updated_at', value: 'Updated at' },
  80. ],
  81. orderColumns: [
  82. { key: 'number', value: 'Number' },
  83. { key: 'title', value: 'Title' },
  84. { key: 'created_at', value: 'Created at' },
  85. { key: 'updated_at', value: 'Updated at' },
  86. ],
  87. },
  88. },
  89. ],
  90. },
  91. })
  92. export const mockTicketOverviews = (overviews?: TicketOverviewsQuery) => {
  93. return mockGraphQLApi(TicketOverviewsDocument).willResolve(
  94. overviews || getApiTicketOverviews(),
  95. )
  96. }