From ec27914713aaa6d404a45d6360e80710566b3871 Mon Sep 17 00:00:00 2001 From: Mateusz <76775507+szczygiel-m@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:36:08 +0200 Subject: [PATCH] Feature/groups topics (#1702) Implemented groups and topic groups Co-authored-by: Karol Szapsza --- .github/workflows/ci-console.yml | 2 +- hermes-console-vue/.eslintrc.cjs | 2 + hermes-console-vue/json-server/db.json | 24 ++++ hermes-console-vue/json-server/routes.json | 8 +- hermes-console-vue/package.json | 3 + .../src/api/hermes-client/index.ts | 31 +++++ hermes-console-vue/src/api/topic.ts | 2 +- .../components/console-alert/ConsoleAlert.vue | 2 +- .../console-footer/ConsoleFooter.vue | 2 +- .../theme-switch/ThemeSwitch.spec.ts | 8 +- .../use-constraints/useConstraints.spec.ts | 43 +++--- .../use-constraints/useConstraints.ts | 51 +++++++ .../useConsumerGroups.spec.ts | 69 ++++++++++ .../use-consumer-groups/useConsumerGroups.ts | 46 +++++++ .../groups/use-groups/useGroups.spec.ts | 75 +++++++++++ .../groups/use-groups/useGroups.ts | 75 +++++++++++ .../useInconsistentTopics.spec.ts | 53 ++++++++ .../useInconsistentTopics.ts | 44 ++++++ .../use-readiness/useReadiness.spec.ts | 51 +++++++ .../readiness/use-readiness/useReadiness.ts | 41 ++++++ .../use-subscription/useSubscription.spec.ts | 28 ++-- .../topic/use-topic/useTopic.spec.ts | 2 +- .../use-constraints/useConstraints.ts | 34 ----- .../useConsumerGroups.spec.ts | 59 --------- .../use-consumer-groups/useConsumerGroups.ts | 27 ---- .../useInconsistentTopics.spec.ts | 56 -------- .../useInconsistentTopics.ts | 27 ---- .../use-readiness/useReadiness.spec.ts | 54 -------- .../composables/use-readiness/useReadiness.ts | 25 ---- hermes-console-vue/src/dummy/groups.ts | 33 +++++ hermes-console-vue/src/dummy/topics.ts | 16 +++ hermes-console-vue/src/i18n/en-US.ts | 48 +++++++ hermes-console-vue/src/main.ts | 1 + hermes-console-vue/src/mocks/handlers.ts | 125 ++++++++++++++++++ hermes-console-vue/src/router/index.ts | 26 ++-- .../admin/consistency/ConsistencyView.spec.ts | 35 ++--- .../admin/consistency/ConsistencyView.vue | 4 +- .../InconsistentTopicsListing.spec.ts | 28 +++- .../admin/constraints/ConstraintsView.spec.ts | 33 ++--- .../admin/constraints/ConstraintsView.vue | 4 +- .../ConstraintsListing.spec.ts | 22 ++- .../ConsumerGroupsView.spec.ts | 27 ++-- .../consumer-groups/ConsumerGroupsView.vue | 17 ++- .../ConsumerGroupMembers.spec.ts | 20 ++- .../admin/readiness/ReadinessView.spec.ts | 17 ++- .../views/admin/readiness/ReadinessView.vue | 6 +- .../group-topics/GroupTopicsView.spec.ts | 94 +++++++++++++ .../views/group-topics/GroupTopicsView.vue | 89 +++++++++++++ .../GroupTopicsListing.spec.ts | 82 ++++++++++++ .../GroupTopicsListing.vue | 68 ++++++++++ .../src/views/groups/GroupsView.spec.ts | 123 +++++++++++++++++ .../src/views/groups/GroupsView.vue | 85 ++++++++++++ .../views/groups/group-form/GroupForm.spec.ts | 92 +++++++++++++ .../src/views/groups/group-form/GroupForm.vue | 66 +++++++++ .../groups/group-listing/GroupListing.spec.ts | 91 +++++++++++++ .../groups/group-listing/GroupListing.vue | 81 ++++++++++++ .../src/views/home/HomeView.spec.ts | 2 +- .../views/subscription/SubscriptionView.vue | 25 ++-- .../subscription/filters-card/FiltersCard.vue | 4 +- .../subscription/headers-card/HeadersCard.vue | 4 +- .../HealthProblemsAlerts.vue | 18 ++- .../properties-card/PropertiesCard.spec.ts | 37 +++--- .../SubscriptionBreadcrumbs.spec.ts | 63 --------- .../SubscriptionBreadcrumbs.vue | 39 ------ .../SubscriptionMetadata.spec.ts | 10 ++ .../SubscriptionMetadata.vue | 5 +- .../UndeliveredMessagesCard.vue | 2 +- .../src/views/topic/TopicView.vue | 8 +- .../topic/properties-list/PropertiesList.vue | 4 +- hermes-console-vue/tsconfig.vitest.json | 2 +- hermes-management/build.gradle | 17 +-- .../management/config/JerseyProperties.java | 2 +- 72 files changed, 1930 insertions(+), 589 deletions(-) rename hermes-console-vue/src/composables/{ => constraints}/use-constraints/useConstraints.spec.ts (50%) create mode 100644 hermes-console-vue/src/composables/constraints/use-constraints/useConstraints.ts create mode 100644 hermes-console-vue/src/composables/consumer-groups/use-consumer-groups/useConsumerGroups.spec.ts create mode 100644 hermes-console-vue/src/composables/consumer-groups/use-consumer-groups/useConsumerGroups.ts create mode 100644 hermes-console-vue/src/composables/groups/use-groups/useGroups.spec.ts create mode 100644 hermes-console-vue/src/composables/groups/use-groups/useGroups.ts create mode 100644 hermes-console-vue/src/composables/inconsistent-topics/use-inconsistent-topics/useInconsistentTopics.spec.ts create mode 100644 hermes-console-vue/src/composables/inconsistent-topics/use-inconsistent-topics/useInconsistentTopics.ts create mode 100644 hermes-console-vue/src/composables/readiness/use-readiness/useReadiness.spec.ts create mode 100644 hermes-console-vue/src/composables/readiness/use-readiness/useReadiness.ts delete mode 100644 hermes-console-vue/src/composables/use-constraints/useConstraints.ts delete mode 100644 hermes-console-vue/src/composables/use-consumer-groups/useConsumerGroups.spec.ts delete mode 100644 hermes-console-vue/src/composables/use-consumer-groups/useConsumerGroups.ts delete mode 100644 hermes-console-vue/src/composables/use-inconsistent-topics/useInconsistentTopics.spec.ts delete mode 100644 hermes-console-vue/src/composables/use-inconsistent-topics/useInconsistentTopics.ts delete mode 100644 hermes-console-vue/src/composables/use-readiness/useReadiness.spec.ts delete mode 100644 hermes-console-vue/src/composables/use-readiness/useReadiness.ts create mode 100644 hermes-console-vue/src/dummy/groups.ts create mode 100644 hermes-console-vue/src/dummy/topics.ts create mode 100644 hermes-console-vue/src/views/group-topics/GroupTopicsView.spec.ts create mode 100644 hermes-console-vue/src/views/group-topics/GroupTopicsView.vue create mode 100644 hermes-console-vue/src/views/group-topics/group-topics-listing/GroupTopicsListing.spec.ts create mode 100644 hermes-console-vue/src/views/group-topics/group-topics-listing/GroupTopicsListing.vue create mode 100644 hermes-console-vue/src/views/groups/GroupsView.spec.ts create mode 100644 hermes-console-vue/src/views/groups/GroupsView.vue create mode 100644 hermes-console-vue/src/views/groups/group-form/GroupForm.spec.ts create mode 100644 hermes-console-vue/src/views/groups/group-form/GroupForm.vue create mode 100644 hermes-console-vue/src/views/groups/group-listing/GroupListing.spec.ts create mode 100644 hermes-console-vue/src/views/groups/group-listing/GroupListing.vue delete mode 100644 hermes-console-vue/src/views/subscription/subscription-breadcrumbs/SubscriptionBreadcrumbs.spec.ts delete mode 100644 hermes-console-vue/src/views/subscription/subscription-breadcrumbs/SubscriptionBreadcrumbs.vue diff --git a/.github/workflows/ci-console.yml b/.github/workflows/ci-console.yml index ac68d0a521..3431872abe 100644 --- a/.github/workflows/ci-console.yml +++ b/.github/workflows/ci-console.yml @@ -16,7 +16,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - name: Run frontend tests run: yarn && yarn test:unit - name: Run linter diff --git a/hermes-console-vue/.eslintrc.cjs b/hermes-console-vue/.eslintrc.cjs index 379c5bd2da..5fde39b3b2 100644 --- a/hermes-console-vue/.eslintrc.cjs +++ b/hermes-console-vue/.eslintrc.cjs @@ -43,5 +43,7 @@ module.exports = { memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], }, ], + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': ['error'], }, }; diff --git a/hermes-console-vue/json-server/db.json b/hermes-console-vue/json-server/db.json index d93c334615..06ed60aa9f 100644 --- a/hermes-console-vue/json-server/db.json +++ b/hermes-console-vue/json-server/db.json @@ -1,4 +1,28 @@ { + "groups": [ + "pl.allegro.public.offer", + "pl.allegro.public.offer.product", + "pl.allegro.public.order", + "pl.allegro.public.user", + "pl.allegro.public.group", + "pl.allegro.public.admin" + ], + "topicNames": [ + "pl.allegro.public.offer.product.ProductEventV1", + "pl.allegro.public.offer.product.ProductEventV2", + "pl.allegro.public.offer.product.ProductEventV3", + "pl.allegro.public.offer.product.ProductEventV4", + "pl.allegro.public.offer.OfferEventV1", + "pl.allegro.public.offer.OfferEventV2", + "pl.allegro.public.offer.OfferEventV3", + "pl.allegro.public.order.OrderEventV1", + "pl.allegro.public.order.OrderEventV2", + "pl.allegro.public.user.UserCreatedEvent", + "pl.allegro.public.user.UserChangedEvent", + "pl.allegro.public.group.DummyEvent", + "pl.allegro.public.admin.AdminOfferActionEvent", + "pl.allegro.public.admin.AdminOrderActionEvent" + ], "offlineClientsSource": { "source": "https://www.openstreetmap.org/export/embed.html?bbox=-0.004017949104309083%2C51.47612752641776%2C0.00030577182769775396%2C51.478569861898606&layer=mapnik" }, diff --git a/hermes-console-vue/json-server/routes.json b/hermes-console-vue/json-server/routes.json index 8a0bf70a46..cf76245007 100644 --- a/hermes-console-vue/json-server/routes.json +++ b/hermes-console-vue/json-server/routes.json @@ -1,7 +1,9 @@ { - "/readiness/datacenters": "/readinessDatacenters", - "/workload-constraints": "/constraints", "/consistency/inconsistencies/topics": "/inconsistentTopics", + "/groups": "/groups", + "/owners/sources/Service%20Catalog/:id": "/topicsOwners/:id", + "/readiness/datacenters": "/readinessDatacenters", + "/topics": "/topicNames", "/topics/:id/metrics": "/topicsMetrics/:id", "/topics/:id/preview": "/topicPreview", "/topics/:id/offline-clients-source": "/offlineClientsSource", @@ -12,5 +14,5 @@ "/topics/:topicName/subscriptions/:id/metrics": "/subscriptionsMetrics/:id", "/topics/:topicName/subscriptions/:id/undelivered": "/subscriptionUndeliveredMessages", "/topics/:topicName/subscriptions/:id/undelivered/last": "/subscriptionUndeliveredMessages/:id", - "/owners/sources/Service%20Catalog/:id": "/topicsOwners/:id" + "/workload-constraints": "/constraints" } diff --git a/hermes-console-vue/package.json b/hermes-console-vue/package.json index 599898e838..c92657b99c 100644 --- a/hermes-console-vue/package.json +++ b/hermes-console-vue/package.json @@ -2,6 +2,9 @@ "name": "hermes-console-vue", "description": "Console for Hermes Management", "license": "Apache-2.0", + "engines": { + "node": ">=18.0.0" + }, "scripts": { "dev": "vite", "build": "run-p type-check build-only", diff --git a/hermes-console-vue/src/api/hermes-client/index.ts b/hermes-console-vue/src/api/hermes-client/index.ts index d779f8b2e1..74c6205187 100644 --- a/hermes-console-vue/src/api/hermes-client/index.ts +++ b/hermes-console-vue/src/api/hermes-client/index.ts @@ -1,5 +1,8 @@ import axios from 'axios'; import type { AppConfiguration } from '@/api/app-configuration'; +import type { ConstraintsConfig } from '@/api/constraints'; +import type { ConsumerGroup } from '@/api/consumer-group'; +import type { DatacenterReadiness } from '@/api/datacenter-readiness'; import type { MessagePreview, TopicMetrics, @@ -60,3 +63,31 @@ export function fetchOfflineClientsSource( `/topics/${topicName}/offline-clients-source`, ); } + +export function fetchConstraints(): ResponsePromise { + return axios.get('/workload-constraints'); +} + +export function fetchReadiness(): ResponsePromise { + return axios.get('/readiness/datacenters'); +} + +export function fetchConsumerGroups( + topicName: string, + subscription: string, +): ResponsePromise { + return axios.get( + `/topics/${topicName}/subscriptions/${subscription}/consumer-groups`, + ); +} + +export function fetchInconsistentTopics(): ResponsePromise { + return axios.get('/consistency/inconsistencies/topics'); +} + +export function fetchTopicNames(): ResponsePromise { + return axios.get('/topics'); +} +export function fetchGroupNames(): ResponsePromise { + return axios.get('/groups'); +} diff --git a/hermes-console-vue/src/api/topic.ts b/hermes-console-vue/src/api/topic.ts index 6695c9d9e7..0f8f9da1e1 100644 --- a/hermes-console-vue/src/api/topic.ts +++ b/hermes-console-vue/src/api/topic.ts @@ -40,7 +40,7 @@ export enum Ack { } export interface PublishingAuth { - publishers: string[]; + publishers?: string[]; enabled: boolean; unauthenticatedAccessEnabled: boolean; } diff --git a/hermes-console-vue/src/components/console-alert/ConsoleAlert.vue b/hermes-console-vue/src/components/console-alert/ConsoleAlert.vue index 4d1a19ee80..98ab23e19e 100644 --- a/hermes-console-vue/src/components/console-alert/ConsoleAlert.vue +++ b/hermes-console-vue/src/components/console-alert/ConsoleAlert.vue @@ -9,7 +9,7 @@