Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activitylog fix #2168

Merged
merged 10 commits into from
Jan 4, 2024
Merged

Activitylog fix #2168

merged 10 commits into from
Jan 4, 2024

Conversation

muralibasani
Copy link
Contributor

Linked issue

Resolves: #2120

What kind of change does this PR introduce?

  • Only after approvals, activitylog entry is inserted

  • ActivityLogModel object with constraints is sent to FE now

  • [ X] Bug fix

  • New feature

  • [ X] Refactor

  • Docs update

  • CI update

What is the current behavior?

Describe the state of the application before this PR. Illustrations appreciated (videos, gifs, screenshots).

What is the new behavior?

Describe the state of the application after this PR. Illustrations appreciated (videos, gifs, screenshots).

Other information

Additional changes, explanations of the approach taken, unresolved issues, necessary follow ups, etc.

Requirements (all must be checked before review)

  • The pull request title follows our guidelines
  • Tests for the changes have been added (if relevant)
  • The latest changes from the main branch have been pulled
  • pnpm lint has been run successfully

muralibasani and others added 4 commits January 3, 2024 17:05
@@ -144,25 +127,20 @@ public synchronized Map<String, String> insertIntoRequestConnector(
connectorRequest.setRequesttime((new Timestamp(System.currentTimeMillis())));
kafkaConnectorRequestsRepo.save(connectorRequest);

UserInfo userInfo = jdbcSelectHelper.selectUserInfo(connectorRequest.getRequestor());
// ActivityLog activityLog = new ActivityLog();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just delete this commented out code

// operationalRequest.getTopicname() + "-" + operationalRequest.getConsumerGroup());
// activityLog.setUser(operationalRequest.getRequestor());
// activityLog.setEnv(operationalRequest.getEnvironment());
// activityLog.setTenantId(operationalRequest.getTenantId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should delete this commented out code

String requestor) {
ActivityLog activityLog = new ActivityLog();
activityLog.setReq_no(getNextActivityLogRequestId(tenantId));
activityLog.setActivityName(requestType + "Request");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this "Request" need a space to separate the words e.g. " Request"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one. Will do.

@@ -556,7 +556,7 @@ export type components = {
errCode?: string;
message: string;
debugMessage?: string;
data?: Record<string, never>;
data?: unknown;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mathieu-anderson is unknown acceptable here?

Signed-off-by: muralibasani <[email protected]>
+ "-"
+ aclReq.getTopicname()
+ "-"
+ aclReq.getAcl_ssl()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think but can't be 100% sure it is normally either acl_ssl or acl_ip depending on which type of acl it is do we just need to add a tertiary stmt here to decide onthe correct one.

@@ -711,6 +712,14 @@ public ApiResponse approveConnectorRequests(String connectorId)
if (Objects.equals(updateConnectorReqStatus, ApiResultStatus.SUCCESS.value)) {
setConnectorHistory(connectorRequest, userDetails, tenantId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider putting the seConnectorHistory and InsertIntoActivityLog (for all of the variations kafka/connect/schema/acl) into their own methods as its a nice compartmentalized piece of code and with a good method name will be self explanatory about what is happening with a glance in this method.

});
}

public String getEnvName(String envId, String activityName, int tenantId) {
Optional<Env> envFound;

if ("SchemaRequest".equals(activityName)) {
if ("SchemaRequest".equalsIgnoreCase(activityName)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is legacy but we probably should have these "SchemaRequest" and "ConnectorRequest" as class constants if we dont have an enum for them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice suggestion. I flipped the condition abit

Copy link
Contributor

@aindriu-aiven aindriu-aiven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had a few coments

Signed-off-by: muralibasani <[email protected]>
Copy link
Contributor

@aindriu-aiven aindriu-aiven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@muralibasani muralibasani merged commit cb44cd4 into main Jan 4, 2024
28 checks passed
@muralibasani muralibasani deleted the activitylog-fix branch January 4, 2024 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ActivityLog should be updated for each approvals
2 participants