Skip to content

Commit

Permalink
Added inflight to subscription form
Browse files Browse the repository at this point in the history
  • Loading branch information
szczygiel-m committed Sep 9, 2024
1 parent d513daf commit 5deb421
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions hermes-console/src/views/group-topics/GroupTopicsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
operation="add"
:group="groupId"
:topic="null"
:roles="roles"
@created="pushToTopic"
@cancel="hideTopicForm"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@
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';
import SubscriptionPathFilters from '@/views/subscription/subscription-form/subscription-basic-filters/SubscriptionPathFilters.vue';
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];
Expand All @@ -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 >=
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -264,6 +264,7 @@
/>
<text-field
v-if="isAdmin(roles)"
v-model="form.subscriptionPolicy.inflightMessagesCount"
:rules="validators.inflightMessagesCount"
prepend-icon="$warning"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
operation="edit"
:subscription="subscription"
:topic="subscription.topicName"
:roles="roles"
@created="refreshPage"
@cancel="hideSubscriptionForm"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
operation="add"
:subscription="null"
:topic="props.topicName"
:roles="roles"
@created="pushToSubscription"
@cancel="hideSubscriptionForm"
/>
Expand Down
9 changes: 4 additions & 5 deletions hermes-console/src/views/topic/topic-form/TopicForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@
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';
const props = defineProps<{
topic: TopicWithSchema | null;
group: string | null;
operation: 'add' | 'edit';
roles: Role[] | undefined;
}>();
const emit = defineEmits<{
created: [topic: string];
Expand Down Expand Up @@ -51,8 +52,6 @@
},
];
const roles = useRoles(null, null)?.roles;
const ownerSelectorPlaceholder = computed(
() =>
configStore.loadedConfig.owner.sources.find(
Expand All @@ -77,7 +76,7 @@
);
const allowedContentTypes = computed(() =>
isAdmin(roles?.value) ? adminContentTypes : dataSources.contentTypes,
isAdmin(props.roles) ? adminContentTypes : dataSources.contentTypes,
);
const isAvroContentTypeSelected = computed(
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
operation="edit"
:topic="topic"
:group="null"
:roles="roles"
@created="refreshPage"
@cancel="hideTopicForm"
/>
Expand Down

0 comments on commit 5deb421

Please sign in to comment.