From 1a9a5c20cbeca4dbe7813764e00442678742785b Mon Sep 17 00:00:00 2001 From: Aindriu Lavelle Date: Tue, 26 Sep 2023 13:33:15 +0100 Subject: [PATCH] Update to alter the envStatusTimeString Signed-off-by: Aindriu Lavelle --- .../Kafka/KafkaEnvironments.test.tsx | 8 ++++---- .../KafkaConnectEnvironments.test.tsx | 8 ++++---- .../SchemaRegistryEnvironments.test.tsx | 4 ++-- .../components/EnvironmentStatus.test.tsx | 6 +++--- .../environment-test-helper.test.ts | 2 +- .../environment/environment-test-helper.ts | 2 +- coral/types/api.d.ts | 9 +++------ core/src/main/java/io/aiven/klaw/dao/Env.java | 2 +- .../klaw/model/response/EnvModelResponse.java | 2 +- .../klaw/model/response/EnvUpdatedStatus.java | 2 +- .../EnvsClustersTenantsControllerService.java | 7 ++++--- openapi.yaml | 19 ++++++++----------- 12 files changed, 33 insertions(+), 38 deletions(-) diff --git a/coral/src/app/features/configuration/environments/Kafka/KafkaEnvironments.test.tsx b/coral/src/app/features/configuration/environments/Kafka/KafkaEnvironments.test.tsx index 5bbef9484d..9425b0ad41 100644 --- a/coral/src/app/features/configuration/environments/Kafka/KafkaEnvironments.test.tsx +++ b/coral/src/app/features/configuration/environments/Kafka/KafkaEnvironments.test.tsx @@ -39,7 +39,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse = clusterName: "DEV", envStatus: "OFFLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", otherParams: "", showDeleteEnv: false, totalNoPages: "1", @@ -69,7 +69,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse = clusterName: "DEV_CLS", envStatus: "ONLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", otherParams: "", showDeleteEnv: false, totalNoPages: "1", @@ -103,7 +103,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse = clusterName: "TST", envStatus: "ONLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", otherParams: "default.partitions=2,max.partitions=2,default.replication.factor=1,max.replication.factor=1,topic.prefix=,topic.suffix=", showDeleteEnv: false, @@ -138,7 +138,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse = clusterName: "DEV", envStatus: "OFFLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", otherParams: "", showDeleteEnv: false, totalNoPages: "1", diff --git a/coral/src/app/features/configuration/environments/KafkaConnect/KafkaConnectEnvironments.test.tsx b/coral/src/app/features/configuration/environments/KafkaConnect/KafkaConnectEnvironments.test.tsx index df41433d5b..d1df1c8d89 100644 --- a/coral/src/app/features/configuration/environments/KafkaConnect/KafkaConnectEnvironments.test.tsx +++ b/coral/src/app/features/configuration/environments/KafkaConnect/KafkaConnectEnvironments.test.tsx @@ -39,7 +39,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse = clusterName: "TST_CONNCT", envStatus: "ONLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", showDeleteEnv: false, totalNoPages: "1", currentPage: "1", @@ -58,7 +58,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse = clusterName: "DEV", envStatus: "OFFLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", showDeleteEnv: false, totalNoPages: "1", currentPage: "1", @@ -76,7 +76,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse = tenantName: "default", clusterName: "UIKLAW", envStatus: "ONLINE", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", envStatusTime: "2023-09-21T11:47:15.664615239", showDeleteEnv: false, totalNoPages: "1", @@ -95,7 +95,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse = tenantName: "default", clusterName: "UIKLAW", envStatus: "ONLINE", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", envStatusTime: "2023-09-21T11:47:15.664615239", showDeleteEnv: false, totalNoPages: "1", diff --git a/coral/src/app/features/configuration/environments/SchemaRegistry/SchemaRegistryEnvironments.test.tsx b/coral/src/app/features/configuration/environments/SchemaRegistry/SchemaRegistryEnvironments.test.tsx index 905b97d41a..f3266af41b 100644 --- a/coral/src/app/features/configuration/environments/SchemaRegistry/SchemaRegistryEnvironments.test.tsx +++ b/coral/src/app/features/configuration/environments/SchemaRegistry/SchemaRegistryEnvironments.test.tsx @@ -39,7 +39,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse = clusterName: "TST_SCHEMA", envStatus: "ONLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", showDeleteEnv: false, totalNoPages: "1", currentPage: "1", @@ -62,7 +62,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse = clusterName: "DEV_CLS", envStatus: "ONLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", showDeleteEnv: false, totalNoPages: "1", currentPage: "1", diff --git a/coral/src/app/features/configuration/environments/components/EnvironmentStatus.test.tsx b/coral/src/app/features/configuration/environments/components/EnvironmentStatus.test.tsx index bf0df9adff..82b07ad984 100644 --- a/coral/src/app/features/configuration/environments/components/EnvironmentStatus.test.tsx +++ b/coral/src/app/features/configuration/environments/components/EnvironmentStatus.test.tsx @@ -90,7 +90,7 @@ describe("EnvironmentStatus", () => { result: "success", envStatus: "ONLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", }); expect(screen.getByText("Working")).toBeVisible(); @@ -111,7 +111,7 @@ describe("EnvironmentStatus", () => { result: "success", envStatus: "OFFLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", }); expect(screen.getByText("Working")).toBeVisible(); @@ -157,7 +157,7 @@ describe("EnvironmentStatus", () => { result: "success", envStatus: "OFFLINE", envStatusTime: "2023-09-21T11:47:15.664615239", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", }); expect(screen.getByText("Working")).toBeVisible(); diff --git a/coral/src/domain/environment/environment-test-helper.test.ts b/coral/src/domain/environment/environment-test-helper.test.ts index 62397a9dbf..ba35e87f5e 100644 --- a/coral/src/domain/environment/environment-test-helper.test.ts +++ b/coral/src/domain/environment/environment-test-helper.test.ts @@ -14,7 +14,7 @@ describe("environment-test-helper.ts", () => { defaultReplicationFactor: undefined, envStatus: "ONLINE", envStatusTime: "2023-09-08T12:34:10.615919098", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", id: "1", maxPartitions: undefined, maxReplicationFactor: undefined, diff --git a/coral/src/domain/environment/environment-test-helper.ts b/coral/src/domain/environment/environment-test-helper.ts index e53972ce71..1d466b7038 100644 --- a/coral/src/domain/environment/environment-test-helper.ts +++ b/coral/src/domain/environment/environment-test-helper.ts @@ -10,7 +10,7 @@ const defaultEnvironmentDTO: KlawApiModel<"EnvModelResponse"> = { tenantName: "default", clusterName: "DEV", envStatus: "ONLINE", - entStatusRequestedAtTime: "2023-09-21T11:46:15.664615239", + envStatusTimeString: "2023-09-21T11:46:15.664615239", envStatusTime: "2023-09-08T12:34:10.615919098", otherParams: "default.partitions=2,max.partitions=2,default.replication.factor=1,max.replication.factor=1,topic.prefix=,topic.suffix=", diff --git a/coral/types/api.d.ts b/coral/types/api.d.ts index 8059408220..32f9e89418 100644 --- a/coral/types/api.d.ts +++ b/coral/types/api.d.ts @@ -905,8 +905,7 @@ export type components = { envStatus?: "OFFLINE" | "ONLINE" | "NOT_KNOWN"; /** Format: date-time */ envStatusTime?: string; - /** Format: date-time */ - entStatusRequestedAtTime?: string; + envStatusTimeString?: string; associatedEnv?: components["schemas"]["EnvTag"]; params?: components["schemas"]["EnvParams"]; }; @@ -1154,8 +1153,7 @@ export type components = { envStatus: "OFFLINE" | "ONLINE" | "NOT_KNOWN"; /** Format: date-time */ envStatusTime: string; - /** Format: date-time */ - entStatusRequestedAtTime: string; + envStatusTimeString: string; }; TopicsCountPerEnv: { status?: string; @@ -1416,8 +1414,7 @@ export type components = { envStatus: "OFFLINE" | "ONLINE" | "NOT_KNOWN"; /** Format: date-time */ envStatusTime: string; - /** Format: date-time */ - entStatusRequestedAtTime: string; + envStatusTimeString: string; otherParams: string; showDeleteEnv: boolean; totalNoPages: string; diff --git a/core/src/main/java/io/aiven/klaw/dao/Env.java b/core/src/main/java/io/aiven/klaw/dao/Env.java index ea899006f0..ea3d564495 100644 --- a/core/src/main/java/io/aiven/klaw/dao/Env.java +++ b/core/src/main/java/io/aiven/klaw/dao/Env.java @@ -51,7 +51,7 @@ public class Env implements Serializable { @Transient private LocalDateTime envStatusTime; - @Transient private LocalDateTime entStatusRequestedAtTime; + @Transient private String envStatusTimeString; @Convert(converter = EnvTagConverter.class) @Column(name = "associatedenv") diff --git a/core/src/main/java/io/aiven/klaw/model/response/EnvModelResponse.java b/core/src/main/java/io/aiven/klaw/model/response/EnvModelResponse.java index 55a92ae5da..24bf86df21 100644 --- a/core/src/main/java/io/aiven/klaw/model/response/EnvModelResponse.java +++ b/core/src/main/java/io/aiven/klaw/model/response/EnvModelResponse.java @@ -34,7 +34,7 @@ public class EnvModelResponse implements Serializable { @NotNull private LocalDateTime envStatusTime; - @NotNull private LocalDateTime entStatusRequestedAtTime; + @NotNull private String envStatusTimeString; @NotNull private String otherParams; diff --git a/core/src/main/java/io/aiven/klaw/model/response/EnvUpdatedStatus.java b/core/src/main/java/io/aiven/klaw/model/response/EnvUpdatedStatus.java index da7a10585a..d10e6d839d 100644 --- a/core/src/main/java/io/aiven/klaw/model/response/EnvUpdatedStatus.java +++ b/core/src/main/java/io/aiven/klaw/model/response/EnvUpdatedStatus.java @@ -13,5 +13,5 @@ public class EnvUpdatedStatus { @NotNull private LocalDateTime envStatusTime; - @NotNull private LocalDateTime entStatusRequestedAtTime; + @NotNull private String envStatusTimeString; } diff --git a/core/src/main/java/io/aiven/klaw/service/EnvsClustersTenantsControllerService.java b/core/src/main/java/io/aiven/klaw/service/EnvsClustersTenantsControllerService.java index cae9350512..94f0eb526e 100644 --- a/core/src/main/java/io/aiven/klaw/service/EnvsClustersTenantsControllerService.java +++ b/core/src/main/java/io/aiven/klaw/service/EnvsClustersTenantsControllerService.java @@ -1249,7 +1249,7 @@ public KwReport getPublicKey() { } public EnvUpdatedStatus getUpdateEnvStatus(String envId) throws KlawBadRequestException { - LocalDateTime statusRequestedAtTime = LocalDateTime.now(ZoneOffset.UTC); + EnvUpdatedStatus envUpdatedStatus = new EnvUpdatedStatus(); int tenantId = commonUtilsService.getTenantId(getUserName()); List allEnvs = manageDatabase.getAllEnvList(tenantId); @@ -1285,7 +1285,7 @@ public EnvUpdatedStatus getUpdateEnvStatus(String envId) throws KlawBadRequestEx LocalDateTime statusTime = LocalDateTime.now(ZoneOffset.UTC); env.get().setEnvStatus(status); env.get().setEnvStatusTime(statusTime); - env.get().setEntStatusRequestedAtTime(statusRequestedAtTime); + env.get().setEnvStatusTimeString(DATE_TIME_DDMMMYYYY_HHMMSS_FORMATTER.format(statusTime)); // Is this required can we remove it? kwClusters.setClusterStatus(status); @@ -1296,7 +1296,8 @@ public EnvUpdatedStatus getUpdateEnvStatus(String envId) throws KlawBadRequestEx envUpdatedStatus.setResult(ApiResultStatus.SUCCESS.value); envUpdatedStatus.setEnvStatus(status); envUpdatedStatus.setEnvStatusTime(statusTime); - envUpdatedStatus.setEntStatusRequestedAtTime(statusRequestedAtTime); + envUpdatedStatus.setEnvStatusTimeString( + DATE_TIME_DDMMMYYYY_HHMMSS_FORMATTER.format(statusTime)); return envUpdatedStatus; } diff --git a/openapi.yaml b/openapi.yaml index 5c857e5080..b799f8f686 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -6916,9 +6916,8 @@ "type" : "string", "format" : "date-time" }, - "entStatusRequestedAtTime" : { - "type" : "string", - "format" : "date-time" + "envStatusTimeString" : { + "type" : "string" }, "associatedEnv" : { "$ref" : "#/components/schemas/EnvTag" @@ -7646,12 +7645,11 @@ "type" : "string", "format" : "date-time" }, - "entStatusRequestedAtTime" : { - "type" : "string", - "format" : "date-time" + "envStatusTimeString" : { + "type" : "string" } }, - "required" : [ "entStatusRequestedAtTime", "envStatus", "envStatusTime", "result" ] + "required" : [ "envStatus", "envStatusTime", "envStatusTimeString", "result" ] }, "TopicsCountPerEnv" : { "properties" : { @@ -8399,9 +8397,8 @@ "type" : "string", "format" : "date-time" }, - "entStatusRequestedAtTime" : { - "type" : "string", - "format" : "date-time" + "envStatusTimeString" : { + "type" : "string" }, "otherParams" : { "type" : "string" @@ -8437,7 +8434,7 @@ "writeOnly" : true } }, - "required" : [ "allPageNos", "clusterId", "clusterName", "currentPage", "entStatusRequestedAtTime", "envStatus", "envStatusTime", "id", "name", "otherParams", "params", "showDeleteEnv", "tenantId", "tenantName", "totalNoPages", "totalRecs", "type" ] + "required" : [ "allPageNos", "clusterId", "clusterName", "currentPage", "envStatus", "envStatusTime", "envStatusTimeString", "id", "name", "otherParams", "params", "showDeleteEnv", "tenantId", "tenantName", "totalNoPages", "totalRecs", "type" ] }, "AclInfo" : { "properties" : {