Skip to content

Commit

Permalink
Update to alter the envStatusTimeString
Browse files Browse the repository at this point in the history
Signed-off-by: Aindriu Lavelle <[email protected]>
  • Loading branch information
aindriu-aiven committed Sep 26, 2023
1 parent 1455587 commit 1a9a5c2
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion coral/src/domain/environment/environment-test-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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=",
Expand Down
9 changes: 3 additions & 6 deletions coral/types/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/io/aiven/klaw/dao/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ public class EnvUpdatedStatus {

@NotNull private LocalDateTime envStatusTime;

@NotNull private LocalDateTime entStatusRequestedAtTime;
@NotNull private String envStatusTimeString;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Env> allEnvs = manageDatabase.getAllEnvList(tenantId);
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
19 changes: 8 additions & 11 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6916,9 +6916,8 @@
"type" : "string",
"format" : "date-time"
},
"entStatusRequestedAtTime" : {
"type" : "string",
"format" : "date-time"
"envStatusTimeString" : {
"type" : "string"
},
"associatedEnv" : {
"$ref" : "#/components/schemas/EnvTag"
Expand Down Expand Up @@ -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" : {
Expand Down Expand Up @@ -8399,9 +8397,8 @@
"type" : "string",
"format" : "date-time"
},
"entStatusRequestedAtTime" : {
"type" : "string",
"format" : "date-time"
"envStatusTimeString" : {
"type" : "string"
},
"otherParams" : {
"type" : "string"
Expand Down Expand Up @@ -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" : {
Expand Down

0 comments on commit 1a9a5c2

Please sign in to comment.