diff --git a/hermes-console/src/api/constraints.ts b/hermes-console/src/api/constraints.ts index 334bfe82d1..76289499c6 100644 --- a/hermes-console/src/api/constraints.ts +++ b/hermes-console/src/api/constraints.ts @@ -5,6 +5,7 @@ export interface ConstraintsConfig { export interface Constraint { consumersNumber: number; + reason: string; } export interface SubscriptionConstraint { diff --git a/hermes-console/src/composables/constraints/use-constraints/useConstraints.spec.ts b/hermes-console/src/composables/constraints/use-constraints/useConstraints.spec.ts index eadcc32ea3..88c735e421 100644 --- a/hermes-console/src/composables/constraints/use-constraints/useConstraints.spec.ts +++ b/hermes-console/src/composables/constraints/use-constraints/useConstraints.spec.ts @@ -53,6 +53,9 @@ describe('useConstraints', () => { expect(topicConstraints.value?.['pl.group.Topic1'].consumersNumber).toBe( 2, ); + expect(topicConstraints.value?.['pl.group.Topic1'].reason).toBe( + 'Some reason', + ); expect( subscriptionConstraints.value?.['pl.group.Topic$subscription2'] .consumersNumber, diff --git a/hermes-console/src/dummy/constraints.ts b/hermes-console/src/dummy/constraints.ts index afdca4a5d6..42503a44a7 100644 --- a/hermes-console/src/dummy/constraints.ts +++ b/hermes-console/src/dummy/constraints.ts @@ -4,6 +4,7 @@ export const dummyConstraints: ConstraintsConfig = { topicConstraints: { 'pl.group.Topic1': { consumersNumber: 2, + reason: 'Some reason', }, 'pl.group.Topic2': { consumersNumber: 4, diff --git a/hermes-console/src/i18n/en-US/index.ts b/hermes-console/src/i18n/en-US/index.ts index 01ec3f08b8..d8f9876672 100644 --- a/hermes-console/src/i18n/en-US/index.ts +++ b/hermes-console/src/i18n/en-US/index.ts @@ -148,12 +148,14 @@ const en_US = { topicName: 'Topic name', subscriptionName: 'Subscription name', consumersNumber: 'Consumers count', + reason: 'Reason', save: 'Save', cancel: 'Cancel', }, editForm: { title: 'Edit constraints for: “{resourceId}”', consumersNumber: 'Consumers count', + reason: 'Reason', save: 'Save', remove: 'Remove', cancel: 'Cancel', diff --git a/hermes-console/src/views/admin/constraints/create-constraint-form/CreateConstraintFormView.vue b/hermes-console/src/views/admin/constraints/create-constraint-form/CreateConstraintFormView.vue index 84513b15d0..31e454a02e 100644 --- a/hermes-console/src/views/admin/constraints/create-constraint-form/CreateConstraintFormView.vue +++ b/hermes-console/src/views/admin/constraints/create-constraint-form/CreateConstraintFormView.vue @@ -8,6 +8,7 @@ }>(); const consumersNumber: Ref = ref(1); + const reason: Ref = ref(''); const topicName: Ref = ref(''); const subscriptionName: Ref = ref(''); @@ -17,7 +18,10 @@ }>(); const onCreated = async () => { - const constraint: Constraint = { consumersNumber: consumersNumber.value }; + const constraint: Constraint = { + consumersNumber: consumersNumber.value, + reason: reason.value, + }; let resourceId = ''; if (props.isSubscription) { resourceId = subscriptionFqn(topicName.value, subscriptionName.value); @@ -65,6 +69,15 @@ > + + + + (); const consumersNumber: Ref = ref(props.constraint.consumersNumber); + const reason: Ref = ref(props.constraint.reason); const onUpdated = () => { - const constraint: Constraint = { consumersNumber: consumersNumber.value }; + const constraint: Constraint = { + consumersNumber: consumersNumber.value, + reason: reason.value, + }; emit('update', props.resourceId, constraint); }; @@ -43,6 +47,15 @@ > + + + +