From 0ccca58e9f68408a6d74728dde0370b050f5dde5 Mon Sep 17 00:00:00 2001 From: Murali Basani Date: Mon, 22 Jan 2024 16:52:29 +0100 Subject: [PATCH 1/3] Add promotion persmission (#2182) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add promotion persmission Signed-off-by: muralibasani * Validate checks Signed-off-by: muralibasani * Updating permission validation Signed-off-by: muralibasani * Validation for topic create requests Signed-off-by: muralibasani * Validation for topic create requests Signed-off-by: muralibasani * Validation for topic create requests Signed-off-by: muralibasani * Validation for topic create requests Signed-off-by: muralibasani * Update text Signed-off-by: muralibasani * Update text Signed-off-by: muralibasani * Limiting users on FE as well Signed-off-by: muralibasani * Button disabled with hover text Signed-off-by: muralibasani --------- Signed-off-by: muralibasani Co-authored-by: muralibasani Co-authored-by: Aindriú Lavelle <121855584+aindriu-aiven@users.noreply.github.com> --- .../klaw/dao/migration/MigrateData2x8x0.java | 64 +++++++++++++++++++ .../aiven/klaw/error/KlawErrorMessages.java | 5 ++ .../io/aiven/klaw/helpers/KwConstants.java | 3 + .../klaw/model/enums/PermissionType.java | 1 + .../model/response/AuthenticationInfo.java | 2 + .../klaw/service/DefaultDataService.java | 13 ++++ .../klaw/service/TopicControllerService.java | 19 ++++-- .../klaw/service/UtilControllerService.java | 15 +++++ .../main/resources/templates/execTopics.html | 34 +++++++++- .../klaw/config/MigrationUtilityTest.java | 2 +- .../service/TopicControllerServiceTest.java | 21 ++++++ 11 files changed, 173 insertions(+), 6 deletions(-) create mode 100644 core/src/main/java/io/aiven/klaw/dao/migration/MigrateData2x8x0.java diff --git a/core/src/main/java/io/aiven/klaw/dao/migration/MigrateData2x8x0.java b/core/src/main/java/io/aiven/klaw/dao/migration/MigrateData2x8x0.java new file mode 100644 index 0000000000..1826a328fc --- /dev/null +++ b/core/src/main/java/io/aiven/klaw/dao/migration/MigrateData2x8x0.java @@ -0,0 +1,64 @@ +package io.aiven.klaw.dao.migration; + +import static io.aiven.klaw.helpers.KwConstants.KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY; +import static io.aiven.klaw.model.enums.PermissionType.APPROVE_TOPICS_CREATE; + +import io.aiven.klaw.config.ManageDatabase; +import io.aiven.klaw.dao.KwProperties; +import io.aiven.klaw.dao.UserInfo; +import io.aiven.klaw.helpers.db.rdbms.InsertDataJdbc; +import io.aiven.klaw.helpers.db.rdbms.SelectDataJdbc; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; + +@DataMigration(version = "2.8.0", order = 4) +@Slf4j +@Configuration // Spring will automatically scan and instantiate this class for retrieval. +public class MigrateData2x8x0 { + + @Autowired private InsertDataJdbc insertDataJdbc; + @Autowired private SelectDataJdbc selectDataJdbc; + + @Autowired private ManageDatabase manageDatabase; + + public MigrateData2x8x0() {} + + @MigrationRunner() + public boolean migrate() { + log.info( + "Start to migrate 2.8.0 data. Add new server property " + + KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY); + + List allUserInfo = selectDataJdbc.selectAllUsersAllTenants(); + Set tenantIds = + allUserInfo.stream().map(UserInfo::getTenantId).collect(Collectors.toSet()); + + for (int tenantId : tenantIds) { + List kwPropertiesList = selectDataJdbc.selectAllKwPropertiesPerTenant(tenantId); + if (kwPropertiesList.stream() + .noneMatch( + kwProperties -> + kwProperties + .getKwKey() + .equals(KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY))) { + KwProperties kwProperties38 = + new KwProperties( + KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY, + tenantId, + "false", + "Enforce extra permission " + APPROVE_TOPICS_CREATE + " to create new topics"); + kwPropertiesList.add(kwProperties38); + + insertDataJdbc.insertDefaultKwProperties(List.of(kwProperties38)); + manageDatabase.loadEnvMapForOneTenant(tenantId); + manageDatabase.loadKwPropsPerOneTenant(null, tenantId); + } + } + + return true; + } +} diff --git a/core/src/main/java/io/aiven/klaw/error/KlawErrorMessages.java b/core/src/main/java/io/aiven/klaw/error/KlawErrorMessages.java index df1f129d5f..4d5d6b7605 100644 --- a/core/src/main/java/io/aiven/klaw/error/KlawErrorMessages.java +++ b/core/src/main/java/io/aiven/klaw/error/KlawErrorMessages.java @@ -1,5 +1,7 @@ package io.aiven.klaw.error; +import static io.aiven.klaw.model.enums.PermissionType.APPROVE_TOPICS_CREATE; + public class KlawErrorMessages { public static final String ACTIVE_DIRECTORY_ERR_CODE_101 = "AD101"; @@ -346,6 +348,9 @@ public class KlawErrorMessages { public static final String TOPICS_ERR_115 = "PartitionId cannot be empty or less than zero. Number of Offsets cannot be less than zero."; + public static final String TOPICS_ERR_116 = + "Please check if permission " + APPROVE_TOPICS_CREATE + " is assigned to you."; + // Topic Validation public static final String TOPICS_VLD_ERR_101 = "Failure. Invalid Topic request type. Possible Value : Create/Promote"; diff --git a/core/src/main/java/io/aiven/klaw/helpers/KwConstants.java b/core/src/main/java/io/aiven/klaw/helpers/KwConstants.java index 270f2e70ed..6300c3e331 100644 --- a/core/src/main/java/io/aiven/klaw/helpers/KwConstants.java +++ b/core/src/main/java/io/aiven/klaw/helpers/KwConstants.java @@ -23,6 +23,9 @@ public class KwConstants { public static final String CLUSTER_CONN_URL_KEY = "klaw.clusterapi.url"; public static final String EMAIL_NOTIFICATIONS_ENABLED_KEY = "klaw.mail.notifications.enable"; + public static final String KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY = + "klaw.extra.permission.topic.create"; + public static final String USER_ROLE = "USER"; public static final String REQUESTOR_SUBSCRIPTIONS = "requestor_subscriptions"; diff --git a/core/src/main/java/io/aiven/klaw/model/enums/PermissionType.java b/core/src/main/java/io/aiven/klaw/model/enums/PermissionType.java index b02f855bc5..d4f0ced30d 100644 --- a/core/src/main/java/io/aiven/klaw/model/enums/PermissionType.java +++ b/core/src/main/java/io/aiven/klaw/model/enums/PermissionType.java @@ -13,6 +13,7 @@ public enum PermissionType { REQUEST_CREATE_OPERATIONAL_CHANGES("To request for Operational changes"), APPROVE_TOPICS("To approve topics requests"), + APPROVE_TOPICS_CREATE("To approve topic create requests"), APPROVE_SUBSCRIPTIONS("To approve producer or consumer subscriptions"), APPROVE_SCHEMAS("To approve schemas"), APPROVE_CONNECTORS("To approve kafka connectors"), diff --git a/core/src/main/java/io/aiven/klaw/model/response/AuthenticationInfo.java b/core/src/main/java/io/aiven/klaw/model/response/AuthenticationInfo.java index 7deaeeb02b..b1b3b9afa4 100644 --- a/core/src/main/java/io/aiven/klaw/model/response/AuthenticationInfo.java +++ b/core/src/main/java/io/aiven/klaw/model/response/AuthenticationInfo.java @@ -61,4 +61,6 @@ public class AuthenticationInfo { @NotNull private String myteamtopics; @NotNull private String myOrgTopics; @NotNull private String googleFeedbackFormLink; + @NotNull private String klawOptionalPermissionNewTopicCreationEnabled; + @NotNull private String klawOptionalPermissionNewTopicCreation; } diff --git a/core/src/main/java/io/aiven/klaw/service/DefaultDataService.java b/core/src/main/java/io/aiven/klaw/service/DefaultDataService.java index 7bd678cc42..4d3dcb8273 100644 --- a/core/src/main/java/io/aiven/klaw/service/DefaultDataService.java +++ b/core/src/main/java/io/aiven/klaw/service/DefaultDataService.java @@ -1,5 +1,8 @@ package io.aiven.klaw.service; +import static io.aiven.klaw.helpers.KwConstants.KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY; +import static io.aiven.klaw.model.enums.PermissionType.APPROVE_TOPICS_CREATE; + import io.aiven.klaw.dao.*; import io.aiven.klaw.helpers.KwConstants; import io.aiven.klaw.helpers.db.rdbms.HandleDbRequestsJdbc; @@ -302,6 +305,16 @@ public List createDefaultProperties(int tenantId, String mailId) { KwConstants.MAIL_TOPICUPDATEREQUEST_CONTENT, "Email notification body for a new Topic Update Request"); kwPropertiesList.add(kwProperties37); + + KwProperties kwProperties38 = + new KwProperties( + KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY, + tenantId, + "false", + "Enforce extra permission " + + APPROVE_TOPICS_CREATE + + " to allow users to create new topics"); + kwPropertiesList.add(kwProperties38); return kwPropertiesList; } diff --git a/core/src/main/java/io/aiven/klaw/service/TopicControllerService.java b/core/src/main/java/io/aiven/klaw/service/TopicControllerService.java index 663aa2f855..6219bbe0cc 100644 --- a/core/src/main/java/io/aiven/klaw/service/TopicControllerService.java +++ b/core/src/main/java/io/aiven/klaw/service/TopicControllerService.java @@ -16,7 +16,9 @@ import static io.aiven.klaw.error.KlawErrorMessages.TOPICS_ERR_113; import static io.aiven.klaw.error.KlawErrorMessages.TOPICS_ERR_114; import static io.aiven.klaw.error.KlawErrorMessages.TOPICS_ERR_115; +import static io.aiven.klaw.error.KlawErrorMessages.TOPICS_ERR_116; import static io.aiven.klaw.error.KlawErrorMessages.TOPICS_VLD_ERR_121; +import static io.aiven.klaw.helpers.KwConstants.KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY; import static io.aiven.klaw.helpers.KwConstants.ORDER_OF_TOPIC_ENVS; import static io.aiven.klaw.helpers.UtilMethods.updateEnvStatus; import static io.aiven.klaw.service.MailUtils.MailType.TOPIC_CLAIM_REQUESTED; @@ -706,14 +708,23 @@ public ApiResponse deleteTopicRequests(String topicId) throws KlawException { */ public ApiResponse approveTopicRequests(String topicId) throws KlawException { log.info("approveTopicRequests {}", topicId); - if (commonUtilsService.isNotAuthorizedUser(getPrincipal(), PermissionType.APPROVE_TOPICS)) { - return ApiResponse.NOT_AUTHORIZED; - } - String userName = getUserName(); int tenantId = commonUtilsService.getTenantId(userName); TopicRequest topicRequest = getTopicRequestFromTopicId(Integer.parseInt(topicId), tenantId); + String isOptionalExtraPermissionForPromote = + manageDatabase.getKwPropertyValue( + KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY, tenantId); + if (topicRequest.getRequestOperationType().equals(RequestOperationType.CREATE.value) + && Boolean.parseBoolean(isOptionalExtraPermissionForPromote) + && commonUtilsService.isNotAuthorizedUser( + getPrincipal(), PermissionType.APPROVE_TOPICS_CREATE)) { + return ApiResponse.notOk(ApiResultStatus.NOT_AUTHORIZED.value + ". " + TOPICS_ERR_116); + } else if (commonUtilsService.isNotAuthorizedUser( + getPrincipal(), PermissionType.APPROVE_TOPICS)) { + return ApiResponse.NOT_AUTHORIZED; + } + ApiResponse validationResponse = validateTopicRequest(topicRequest, userName); if (!validationResponse.isSuccess()) { return validationResponse; diff --git a/core/src/main/java/io/aiven/klaw/service/UtilControllerService.java b/core/src/main/java/io/aiven/klaw/service/UtilControllerService.java index ff2e6e215c..fbf307fd36 100644 --- a/core/src/main/java/io/aiven/klaw/service/UtilControllerService.java +++ b/core/src/main/java/io/aiven/klaw/service/UtilControllerService.java @@ -3,6 +3,7 @@ import static io.aiven.klaw.error.KlawErrorMessages.*; import static io.aiven.klaw.helpers.KwConstants.APPROVER_SUBSCRIPTIONS; import static io.aiven.klaw.helpers.KwConstants.CORAL_INDEX_FILE_PATH; +import static io.aiven.klaw.helpers.KwConstants.KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY; import static io.aiven.klaw.helpers.KwConstants.REQUESTOR_SUBSCRIPTIONS; import static io.aiven.klaw.model.enums.AuthenticationType.ACTIVE_DIRECTORY; import static io.aiven.klaw.model.enums.RolesType.SUPERADMIN; @@ -599,6 +600,20 @@ public AuthenticationInfo getAuth() { broadCastText += " Announcement : " + broadCastTextGlobal; } + String isOptionalExtraPermissionForTopicCreateEnabled = + manageDatabase.getKwPropertyValue( + KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY, tenantId); + + authenticationInfo.setKlawOptionalPermissionNewTopicCreationEnabled( + isOptionalExtraPermissionForTopicCreateEnabled); + + if (commonUtilsService.isNotAuthorizedUser( + getPrincipal(), PermissionType.APPROVE_TOPICS_CREATE)) { + authenticationInfo.setKlawOptionalPermissionNewTopicCreation("false"); + } else { + authenticationInfo.setKlawOptionalPermissionNewTopicCreation("true"); + } + UserInfo userInfo = manageDatabase.getHandleDbRequests().getUsersInfo(userName); authenticationInfo.setCanSwitchTeams("" + userInfo.isSwitchTeams()); diff --git a/core/src/main/resources/templates/execTopics.html b/core/src/main/resources/templates/execTopics.html index 681ded7f07..238bf2fa7d 100644 --- a/core/src/main/resources/templates/execTopics.html +++ b/core/src/main/resources/templates/execTopics.html @@ -518,8 +518,40 @@

Topic Approvals

Topic : {{ topicRequest.topicname }}

- + + + + + + + diff --git a/core/src/test/java/io/aiven/klaw/config/MigrationUtilityTest.java b/core/src/test/java/io/aiven/klaw/config/MigrationUtilityTest.java index 2b0969188f..b902dc9f2b 100644 --- a/core/src/test/java/io/aiven/klaw/config/MigrationUtilityTest.java +++ b/core/src/test/java/io/aiven/klaw/config/MigrationUtilityTest.java @@ -130,7 +130,7 @@ public void CheckAllProdDataMigrationClassesHaveAMigrationRunner() { Reflections reflections = new Reflections(PROD_PACKAGE_TO_SCAN); Set> classes = reflections.getTypesAnnotatedWith(DataMigration.class); // When adding a new package you will need to increment this by 1. - assertThat(classes.size()).isEqualTo(4); + assertThat(classes.size()).isEqualTo(5); Set uniqueOrder = new HashSet<>(); // Check Order Numbers are correctly assigned classes.forEach( diff --git a/core/src/test/java/io/aiven/klaw/service/TopicControllerServiceTest.java b/core/src/test/java/io/aiven/klaw/service/TopicControllerServiceTest.java index 1c07ebac1e..4e4a7b462b 100644 --- a/core/src/test/java/io/aiven/klaw/service/TopicControllerServiceTest.java +++ b/core/src/test/java/io/aiven/klaw/service/TopicControllerServiceTest.java @@ -1,6 +1,7 @@ package io.aiven.klaw.service; import static io.aiven.klaw.error.KlawErrorMessages.TOPICS_VLD_ERR_121; +import static io.aiven.klaw.helpers.KwConstants.KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; @@ -1670,6 +1671,26 @@ public void getTopicsWithPatternFilterOneResult() throws KlawNotAuthorizedExcept assertThat(topicsList.get(0)).hasSize(1); } + @Test + @Order(59) + public void approvePromoteTopicRequests() throws KlawException { + int topicId = 1001; + TopicRequest topicRequest = getTopicRequest(TOPIC_1); + topicRequest.setRequestOperationType(RequestOperationType.CREATE.value); + + when(commonUtilsService.isNotAuthorizedUser("userDetails", PermissionType.APPROVE_TOPICS)) + .thenReturn(false); + when(commonUtilsService.isNotAuthorizedUser( + "userDetails", PermissionType.APPROVE_TOPICS_CREATE)) + .thenReturn(true); + when(handleDbRequests.getTopicRequestsForTopic(anyInt(), anyInt())).thenReturn(topicRequest); + when(manageDatabase.getKwPropertyValue(KLAW_OPTIONAL_PERMISSION_NEW_TOPIC_CREATION_KEY, 0)) + .thenReturn("true"); + + ApiResponse apiResponse1 = topicControllerService.approveTopicRequests(topicId + ""); + assertThat(apiResponse1.getMessage()).contains(ApiResponse.NOT_AUTHORIZED.getMessage()); + } + private List getSchemas(int number) { List schemas = new ArrayList<>(); for (int i = 0; i < number; i++) { From 6f5377759ea1d967296c5d399accf227df32c6c2 Mon Sep 17 00:00:00 2001 From: Mirjam Aulbach Date: Tue, 23 Jan 2024 13:38:15 +0100 Subject: [PATCH 2/3] fix(ui): Add padding for navigation. (#2239) Add padding for navigation. Signed-off-by: Mirjam Aulbach --- core/src/main/resources/static/assets/css/style.css | 2 +- core/src/main/resources/templates/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/resources/static/assets/css/style.css b/core/src/main/resources/static/assets/css/style.css index 7aed1e114e..e27ff28a38 100644 --- a/core/src/main/resources/static/assets/css/style.css +++ b/core/src/main/resources/static/assets/css/style.css @@ -10279,7 +10279,7 @@ Layouts .page-wrapper { background: #eef5f9; padding-bottom: 60px; - padding-top: 60px; + padding-top: 85px; } /******************* diff --git a/core/src/main/resources/templates/index.html b/core/src/main/resources/templates/index.html index 64c4f3aea8..41dfe4c41b 100644 --- a/core/src/main/resources/templates/index.html +++ b/core/src/main/resources/templates/index.html @@ -442,7 +442,7 @@

Shortcuts

-
+
Explore the new user interface

You're currently logged in as superadmin. To experience the new user interface, switch to your user account. From b9bd01c2e6a4a93a58d9ab4173b5ae0e1088e857 Mon Sep 17 00:00:00 2001 From: Mirjam Aulbach Date: Tue, 23 Jan 2024 14:02:12 +0100 Subject: [PATCH 3/3] refactor(coral): Change (Consumer) offsets to 'offset lag' (#2240) Change (Consumer) offsets to 'offset lag' Signed-off-by: Mirjam Aulbach --- .../components/ConsumerOffsetsValues.test.tsx | 30 +++++++++++-------- .../components/ConsumerOffsetsValues.tsx | 10 +++---- .../TopicSubscriptionsDetailsModal.test.tsx | 16 +++++----- .../TopicSubscriptionsDetailsModal.tsx | 2 +- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/coral/src/app/features/topics/details/subscriptions/components/ConsumerOffsetsValues.test.tsx b/coral/src/app/features/topics/details/subscriptions/components/ConsumerOffsetsValues.test.tsx index 71f21366a7..90e06e3879 100644 --- a/coral/src/app/features/topics/details/subscriptions/components/ConsumerOffsetsValues.test.tsx +++ b/coral/src/app/features/topics/details/subscriptions/components/ConsumerOffsetsValues.test.tsx @@ -58,20 +58,22 @@ describe("ConsumerOffsetValues.tsx", () => { it("does not call getConsumerOffsets on load", () => { expect(mockGetConsumerOffsets).not.toHaveBeenCalled(); }); + it("renders correct initial state", () => { const fetchButton = screen.getByRole("button", { - name: "Fetch the consumer offsets of the current subscription", + name: "Fetch the consumer offset lag of the current subscription", }); - const offsetsText = screen.getByText("Fetch offsets to display data."); + const offsetLagText = screen.getByText("Fetch offset lag to display data."); expect(fetchButton).toBeEnabled(); - expect(offsetsText).toBeVisible(); + expect(offsetLagText).toBeVisible(); }); - it("renders Consumer offsets when clicking Fetch offsets button (one partition)", async () => { + + it("renders Consumer offset lag when clicking Fetch offset lag button (one partition)", async () => { mockGetConsumerOffsets.mockResolvedValue(testOffsetsDataOnePartition); const fetchButton = screen.getByRole("button", { - name: "Fetch the consumer offsets of the current subscription", + name: "Fetch the consumer offset lag of the current subscription", }); await userEvent.click(fetchButton); @@ -82,16 +84,17 @@ describe("ConsumerOffsetValues.tsx", () => { expect(offsets).toBeVisible(); const refetchButton = screen.getByRole("button", { - name: "Refetch the consumer offsets of the current subscription", + name: "Refetch the consumer offset lag of the current subscription", }); expect(refetchButton).toBeEnabled(); }); - it("renders Consumer offsets when clicking Fetch offsets button (two partitions)", async () => { + + it("renders Consumer offset lag when clicking Fetch offset lag button (two partitions)", async () => { mockGetConsumerOffsets.mockResolvedValue(testOffsetsDataTwoPartitions); const fetchButton = screen.getByRole("button", { - name: "Fetch the consumer offsets of the current subscription", + name: "Fetch the consumer offset lag of the current subscription", }); await userEvent.click(fetchButton); @@ -106,26 +109,27 @@ describe("ConsumerOffsetValues.tsx", () => { expect(offsetsPartitionTwo).toBeVisible(); const refetchButton = screen.getByRole("button", { - name: "Refetch the consumer offsets of the current subscription", + name: "Refetch the consumer offset lag of the current subscription", }); expect(refetchButton).toBeEnabled(); }); - it("renders no data message when clicking Fetch offsets button (no data)", async () => { + + it("renders no data message when clicking Fetch offset lag button (no data)", async () => { mockGetConsumerOffsets.mockResolvedValue(testOffsetsNoData); const fetchButton = screen.getByRole("button", { - name: "Fetch the consumer offsets of the current subscription", + name: "Fetch the consumer offset lag of the current subscription", }); await userEvent.click(fetchButton); - const noOffsets = screen.getByText("No offsets are currently retained."); + const noOffsets = screen.getByText("No offset lag is currently retained."); expect(noOffsets).toBeVisible(); const refetchButton = screen.getByRole("button", { - name: "Refetch the consumer offsets of the current subscription", + name: "Refetch the consumer offset lag of the current subscription", }); expect(refetchButton).toBeEnabled(); diff --git a/coral/src/app/features/topics/details/subscriptions/components/ConsumerOffsetsValues.tsx b/coral/src/app/features/topics/details/subscriptions/components/ConsumerOffsetsValues.tsx index 463154ecbe..a213fefa3c 100644 --- a/coral/src/app/features/topics/details/subscriptions/components/ConsumerOffsetsValues.tsx +++ b/coral/src/app/features/topics/details/subscriptions/components/ConsumerOffsetsValues.tsx @@ -61,13 +61,13 @@ const ConsumerOffsetsValues = ({ {!shouldFetch && ( - Fetch offsets to display data. + Fetch offset lag to display data. )} {offsetsData.length === 0 && offsetsDataFetched && ( - No offsets are currently retained. + No offset lag is currently retained. )} {isFetching ? ( @@ -80,7 +80,7 @@ const ConsumerOffsetsValues = ({ Render as many skeletons as partitions for refetch */} {(offsetsData.length === 0 ? ["skeleton"] : offsetsData).map( (_, index) => { - return ; + return ; } )} @@ -112,10 +112,10 @@ const ConsumerOffsetsValues = ({ loading={isFetching} aria-label={`${ shouldFetch ? "Refetch" : "Fetch" - } the consumer offsets of the current subscription`} + } the consumer offset lag of the current subscription`} icon={refreshIcon} > - {shouldFetch ? "Refetch" : "Fetch"} offsets + {shouldFetch ? "Refetch" : "Fetch"} offset lag diff --git a/coral/src/app/features/topics/details/subscriptions/components/TopicSubscriptionsDetailsModal.test.tsx b/coral/src/app/features/topics/details/subscriptions/components/TopicSubscriptionsDetailsModal.test.tsx index 08a7f99eff..0564482540 100644 --- a/coral/src/app/features/topics/details/subscriptions/components/TopicSubscriptionsDetailsModal.test.tsx +++ b/coral/src/app/features/topics/details/subscriptions/components/TopicSubscriptionsDetailsModal.test.tsx @@ -139,7 +139,7 @@ describe("TopicSubscriptionsDetailsModal.tsx", () => { cleanup(); }); - it("does not fetch data for Consumer offsets on load", async () => { + it("does not fetch data for Consumer offset lag on load", async () => { expect(mockGetConsumerOffsets).not.toHaveBeenCalled(); }); @@ -195,7 +195,7 @@ describe("TopicSubscriptionsDetailsModal.tsx", () => { findDefinition(defaultPropsAiven.serviceAccountData.password) ).toBeVisible(); - expect(screen.queryByText("Consumer offsets")).not.toBeInTheDocument(); + expect(screen.queryByText("Consumer offset lag")).not.toBeInTheDocument(); }); }); @@ -215,7 +215,7 @@ describe("TopicSubscriptionsDetailsModal.tsx", () => { cleanup(); }); - it("does not fetch data for Consumer offsets on load", async () => { + it("does not fetch data for Consumer offset lag on load", async () => { expect(mockGetConsumerOffsets).not.toHaveBeenCalled(); }); @@ -261,17 +261,17 @@ describe("TopicSubscriptionsDetailsModal.tsx", () => { findDefinition(defaultPropsNonAiven.selectedSubscription.acl_ip) ).toBeVisible(); - expect(findTerm("Consumer offsets")).toBeVisible(); - expect(findDefinition("Fetch offsets to display data.")).toBeVisible(); + expect(findTerm("Consumer offset lag")).toBeVisible(); + expect(findDefinition("Fetch offset lag to display data.")).toBeVisible(); expect( screen.queryByText("Service account password") ).not.toBeInTheDocument(); }); - it("fetches Consumer offsets data when Fetch offset button is clicked", async () => { + it("fetches Consumer offset lag data when Fetch offset button is clicked", async () => { const fetchButton = screen.getByRole("button", { - name: "Fetch the consumer offsets of the current subscription", + name: "Fetch the consumer offset lag of the current subscription", }); await userEvent.click(fetchButton); @@ -310,7 +310,7 @@ describe("TopicSubscriptionsDetailsModal.tsx", () => { jest.resetAllMocks(); }); - it("does not fetch data for Consumer offsets on load", async () => { + it("does not fetch data for Consumer offset lag on load", async () => { expect(mockGetConsumerOffsets).not.toHaveBeenCalled(); }); diff --git a/coral/src/app/features/topics/details/subscriptions/components/TopicSubscriptionsDetailsModal.tsx b/coral/src/app/features/topics/details/subscriptions/components/TopicSubscriptionsDetailsModal.tsx index 5f0b6a5bd2..840bf08474 100644 --- a/coral/src/app/features/topics/details/subscriptions/components/TopicSubscriptionsDetailsModal.tsx +++ b/coral/src/app/features/topics/details/subscriptions/components/TopicSubscriptionsDetailsModal.tsx @@ -193,7 +193,7 @@ const TopicSubscriptionsDetailsModal = ({ - Consumer offsets + Consumer offset lag