From 5deb421e04093135c52a80403fbb6381b5ce0d31 Mon Sep 17 00:00:00 2001 From: Mateusz Szczygiel Date: Mon, 9 Sep 2024 10:48:21 +0200 Subject: [PATCH] Added inflight to subscription form --- .../src/views/group-topics/GroupTopicsView.vue | 1 + .../subscription-form/SubscriptionForm.spec.ts | 3 --- .../subscription/subscription-form/SubscriptionForm.vue | 7 ++++--- .../subscription-metadata/SubscriptionMetadata.vue | 1 + .../views/topic/subscriptions-list/SubscriptionsList.vue | 1 + hermes-console/src/views/topic/topic-form/TopicForm.vue | 9 ++++----- .../src/views/topic/topic-header/TopicHeader.vue | 1 + 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/hermes-console/src/views/group-topics/GroupTopicsView.vue b/hermes-console/src/views/group-topics/GroupTopicsView.vue index 9772449af5..e1745eaf15 100644 --- a/hermes-console/src/views/group-topics/GroupTopicsView.vue +++ b/hermes-console/src/views/group-topics/GroupTopicsView.vue @@ -143,6 +143,7 @@ operation="add" :group="groupId" :topic="null" + :roles="roles" @created="pushToTopic" @cancel="hideTopicForm" /> diff --git a/hermes-console/src/views/subscription/subscription-form/SubscriptionForm.spec.ts b/hermes-console/src/views/subscription/subscription-form/SubscriptionForm.spec.ts index 0b2699e309..00d7d911d9 100644 --- a/hermes-console/src/views/subscription/subscription-form/SubscriptionForm.spec.ts +++ b/hermes-console/src/views/subscription/subscription-form/SubscriptionForm.spec.ts @@ -71,9 +71,6 @@ describe('SubscriptionForm', () => { expect( getAllByText('subscriptionForm.fields.inflightMessageTTL.label')[0], ).toBeVisible(); - expect( - getAllByText('subscriptionForm.fields.inflightMessagesCount.label')[0], - ).toBeVisible(); expect( getAllByText('subscriptionForm.fields.retryOn4xx.label')[0], ).toBeVisible(); diff --git a/hermes-console/src/views/subscription/subscription-form/SubscriptionForm.vue b/hermes-console/src/views/subscription/subscription-form/SubscriptionForm.vue index d30d422230..e32a2b57ef 100644 --- a/hermes-console/src/views/subscription/subscription-form/SubscriptionForm.vue +++ b/hermes-console/src/views/subscription/subscription-form/SubscriptionForm.vue @@ -7,7 +7,6 @@ import { useGlobalI18n } from '@/i18n'; import { useImportSubscription } from '@/composables/subscription/use-import-subscription/useImportSubscription'; import { useNotificationsStore } from '@/store/app-notifications/useAppNotifications'; - import { useRoles } from '@/composables/roles/use-roles/useRoles'; import ConsoleAlert from '@/components/console-alert/ConsoleAlert.vue'; import SelectField from '@/components/select-field/SelectField.vue'; import SubscriptionHeaderFilters from '@/views/subscription/subscription-form/subscription-header-filters/SubscriptionHeaderFilters.vue'; @@ -15,12 +14,14 @@ import SubscriptionPathFiltersDebug from '@/views/subscription/subscription-form/subscription-basic-filters/SubscriptionPathFiltersDebug.vue'; import TextField from '@/components/text-field/TextField.vue'; import TooltipIcon from '@/components/tooltip-icon/TooltipIcon.vue'; + import type { Role } from '@/api/role'; import type { Subscription } from '@/api/subscription'; const props = defineProps<{ topic: string; subscription: Subscription | null; operation: 'add' | 'edit'; + roles: Role[] | undefined; }>(); const emit = defineEmits<{ created: [subscription: string]; @@ -41,7 +42,6 @@ ? useCreateSubscription(props.topic) : useEditSubscription(props.topic, props.subscription!!); const { importFormData } = useImportSubscription(); - const roles = useRoles(null, null)?.roles; const showHighRequestTimeoutAlert = computed( () => form.value.subscriptionPolicy.requestTimeout >= @@ -72,7 +72,7 @@ } async function submit() { - if (isFormValid.value || isAdmin(roles?.value)) { + if (isFormValid.value || isAdmin(props.roles)) { const isOperationSucceeded = await createOrUpdateSubscription(); if (isOperationSucceeded) { emit('created', form.value.name); @@ -264,6 +264,7 @@ /> diff --git a/hermes-console/src/views/topic/subscriptions-list/SubscriptionsList.vue b/hermes-console/src/views/topic/subscriptions-list/SubscriptionsList.vue index 43b4f0b1f2..4cfa56b1a6 100644 --- a/hermes-console/src/views/topic/subscriptions-list/SubscriptionsList.vue +++ b/hermes-console/src/views/topic/subscriptions-list/SubscriptionsList.vue @@ -98,6 +98,7 @@ operation="add" :subscription="null" :topic="props.topicName" + :roles="roles" @created="pushToSubscription" @cancel="hideSubscriptionForm" /> diff --git a/hermes-console/src/views/topic/topic-form/TopicForm.vue b/hermes-console/src/views/topic/topic-form/TopicForm.vue index 787abfc564..c87d02391c 100644 --- a/hermes-console/src/views/topic/topic-form/TopicForm.vue +++ b/hermes-console/src/views/topic/topic-form/TopicForm.vue @@ -7,11 +7,11 @@ import { useGlobalI18n } from '@/i18n'; import { useImportTopic } from '@/composables/topic/use-import-topic/useImportTopic'; import { useNotificationsStore } from '@/store/app-notifications/useAppNotifications'; - import { useRoles } from '@/composables/roles/use-roles/useRoles'; import AceEditor from '@/components/ace-editor/AceEditor.vue'; import ConsoleAlert from '@/components/console-alert/ConsoleAlert.vue'; import SelectField from '@/components/select-field/SelectField.vue'; import TextField from '@/components/text-field/TextField.vue'; + import type { Role } from '@/api/role'; import type { SelectFieldOption } from '@/components/select-field/types'; import type { TopicWithSchema } from '@/api/topic'; @@ -19,6 +19,7 @@ topic: TopicWithSchema | null; group: string | null; operation: 'add' | 'edit'; + roles: Role[] | undefined; }>(); const emit = defineEmits<{ created: [topic: string]; @@ -51,8 +52,6 @@ }, ]; - const roles = useRoles(null, null)?.roles; - const ownerSelectorPlaceholder = computed( () => configStore.loadedConfig.owner.sources.find( @@ -77,7 +76,7 @@ ); const allowedContentTypes = computed(() => - isAdmin(roles?.value) ? adminContentTypes : dataSources.contentTypes, + isAdmin(props.roles) ? adminContentTypes : dataSources.contentTypes, ); const isAvroContentTypeSelected = computed( @@ -97,7 +96,7 @@ const showAvroAlert = computed(() => form.value.contentType === 'AVRO'); async function submit() { - if (isFormValid.value || isAdmin(roles?.value)) { + if (isFormValid.value || isAdmin(props.roles)) { const isOperationSucceeded = await createOrUpdateTopic(); if (isOperationSucceeded) { emit('created', form.value.name); diff --git a/hermes-console/src/views/topic/topic-header/TopicHeader.vue b/hermes-console/src/views/topic/topic-header/TopicHeader.vue index 7eeedbbd07..61a3f39f98 100644 --- a/hermes-console/src/views/topic/topic-header/TopicHeader.vue +++ b/hermes-console/src/views/topic/topic-header/TopicHeader.vue @@ -91,6 +91,7 @@ operation="edit" :topic="topic" :group="null" + :roles="roles" @created="refreshPage" @cancel="hideTopicForm" />