Skip to content

Conversation

@samarp-jain
Copy link
Contributor

Audit Logs Screen Created

@samarp-jain samarp-jain requested a review from a team as a code owner May 21, 2025 06:05
Copy link
Contributor

@umeshmore45 umeshmore45 left a comment

Choose a reason for hiding this comment

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

url: `${
config.CS_URL[token_payload?.region as keyof typeof config.CS_URL]
}/stack/${res.data.stack.api_key}/dashboard`,
url: `${config.CS_URL[token_payload?.region as keyof typeof config.CS_URL]
Copy link
Contributor

Choose a reason for hiding this comment

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

Add null checks

};

const getAuditData = async (req: Request): Promise<any> => {
const projectId = path.basename(req?.params?.projectId);
Copy link
Contributor

Choose a reason for hiding this comment

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

path?.basename?.()

}

try {
const mainPath = process.cwd().split("migration-v2")[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

process?.cwd?.().split?.("migration-v2")?.[0];

let fileData;
if (fs.existsSync(filePath)) {
const fileContent = await fsPromises.readFile(filePath, 'utf8');
fileData = JSON.parse(fileContent);
Copy link
Contributor

Choose a reason for hiding this comment

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

Check type then parse

const formattedOptions: StackOption[] = stacks.map((stack: any) => ({
label: stack.stackName,
value: stack.stackUid,
...stack
Copy link
Contributor

Choose a reason for hiding this comment

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

stack?.stackUid

const label1 = useSelector((state: RootState) => state?.migration?.newMigrationData?.stackDetails?.label);
const value1 = useSelector((state: RootState) => state?.migration?.newMigrationData?.stackDetails?.value);
useEffect(() => {
if (stacks && stacks.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

stacks?.length > 0

searchText,
filter
);
if (response.data) {
Copy link
Contributor

Choose a reason for hiding this comment

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

response?.data

<ExecutionLog projectId={projectId} />
)}
{active === "AuditLogs" &&
<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

<></>

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove div

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this from pr

const filter = req?.params?.filter;
const srcFunc = "getAuditData";

if (projectId.includes('..') || stackId.includes('..') || moduleName.includes('..')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add optional chaining => projectId?.includes. stackId?.includes, moduleName?.includes


const stackFolders = fs.readdirSync(logsDir);

const stackFolder = stackFolders.find(folder => folder.startsWith(stackId));
Copy link
Contributor

Choose a reason for hiding this comment

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

Add optional chaining => tackFolders?.find, folder?.startsWith

throw new BadRequestError("Migration data not found for this stack");
}

const auditLogPath = path.resolve(logsDir, stackFolder, GET_AUDT_DATA?.LOGS_DIR, GET_AUDT_DATA?.AUDIT_DIR, GET_AUDT_DATA?.AUDIT_REPORT);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add optional chaining => path?.resolve

}
let transformedData = transformAndFlattenData(fileData);
if (filter != GET_AUDT_DATA.FILTERALL) {
const filters = filter.split("-");
Copy link
Contributor

Choose a reason for hiding this comment

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

Add optional chaining => filter?.split

modalElement.classList.add('position-right');
}
}
}, [isOpen]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add optional chaining in all line of code in useEffect

@umeshmore45
Copy link
Contributor

@samarp-jain are we done with changes ?

@samarp-jain
Copy link
Contributor Author

samarp-jain commented May 28, 2025

@samarp-jain are we done with changes ?
@umeshmore45 we do have one bug that nutan has reported on execution logs related to resolution which is in audit logs as well so I am trying to resolve it in same PR

…s components, including table height adjustments and pagination improvements
…ntifiers and filtering options for improved log management
…enhance response handling in migration controller for improved status management
@AishDani AishDani merged commit 786c903 into dev May 29, 2025
7 checks passed
@samarp-jain samarp-jain deleted the feature/audit-log branch June 10, 2025 09:37
umeshmore45 pushed a commit that referenced this pull request Jun 10, 2025
umeshmore45 pushed a commit that referenced this pull request Jun 11, 2025
umeshmore45 pushed a commit that referenced this pull request Jun 11, 2025
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.

5 participants