-
Notifications
You must be signed in to change notification settings - Fork 8
Feature/execution log #664
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
Conversation
- Implemented ExecutionLogs component to display migration logs with filtering options. - Created FilterModal for selecting log levels (info, error). - Integrated API call to fetch migration logs with pagination and filtering. - Updated Settings component to include Execution Logs section. - Added styles for ExecutionLogs and FilterModal components. - Defined TypeScript interfaces for log entries and filter options. - Enhanced user experience with loading states and no data messages.
…te to the previous migration step. - Updated ExecutionLogs component to improve error handling and user feedback with custom empty states. - Refactored filter modal styles .
…tionLogs component
…tate, css fix for empty state and dropdown
| const testStacks = useSelector( | ||
| (state: RootState) => state?.migration?.newMigrationData?.testStacks | ||
| ); | ||
| console.info(testStacks.length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove console
| const [selectedStack, setSelectedStack] = useState<DropdownOption>( | ||
| { | ||
| label: stackIds[stackIds.length - 1]?.label ?? '' , | ||
| value: stackIds[stackIds.length - 1]?.value ?? '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be stackIds[stackIds?.length - 1]
| try { | ||
| let filterValueCopy: FilterOption[] = [...filterOption]; | ||
|
|
||
| if (!filterValueCopy.length && isChecked) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be filterValueCopy?.length
| } else if (isChecked) { | ||
| // Remove the old value and keep updated one in case old value exists | ||
| const updatedFilter = filterValueCopy.filter((v) => v.value !== value.value); | ||
| filterValueCopy = [...updatedFilter, value]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be
const updatedFilter = filterValueCopy?.filter((v) => v?.value !== value?.value);
| filterValueCopy = [...updatedFilter, value]; | ||
| } else if (!isChecked) { | ||
| filterValueCopy = filterValueCopy.filter((v) => v.value !== value.value); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ?.
| // Method to handle Apply | ||
| const onApply = () => { | ||
| try { | ||
| if (!filterOption.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ?.
| return; | ||
| } | ||
|
|
||
| const usersQueryArray = filterOption.map((item) => item.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ?.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filterOption?.map?((item) => item?.value);
| updateValue({ value: item, isChecked: e.target.checked }) | ||
| } | ||
| version="v2" | ||
| label={item.label} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be item?.label. Please check whole file and added null checks
| <div className="tableFilterModalStories__suggestion-item"> | ||
| <Checkbox | ||
| checked={selectedLevels.some((v) => v.value === item.value)} | ||
| onChange={(e: React.ChangeEvent<HTMLInputElement>) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ?.
umeshmore45
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| try { | ||
| const logsDir = path.join(process.cwd(), 'logs'); | ||
| const mainPath = process.cwd()?.split("migration-v2")?.[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const mainPath = process?.cwd?.()?.split?.("migration-v2")?.[0];
| }) | ||
| .filter((entry) => entry !== null); | ||
| return logEntries; | ||
| ?.filter((entry) => entry !== null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filter?.(
| return { logs: [], total: 0 }; | ||
| } | ||
|
|
||
| logEntries = logEntries?.slice(1, logEntries.length - 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?.(
| if (searchText !== "null") { | ||
| logEntries = logEntries?.filter((log) => { | ||
| return ( | ||
| log?.level?.toLowerCase()?.includes(searchText?.toLowerCase() ?? '') || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets create genric func for this
| params?.projectId ?? '' | ||
| ); | ||
|
|
||
| if (status === 200) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s create constant for 200
| isRowSelect={false} | ||
| columnSelector={false} | ||
| canSearch={true} | ||
| searchPlaceholder={'Search Execution Logs'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constant
| customEmptyState={ | ||
| <EmptyState | ||
| forPage="list" | ||
| heading={searchText === '' ? 'No Logs' : 'No matching results found!'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constant
| searchText === '' | ||
| ? 'Try Executing the Migration.' | ||
| : 'Try changing the search query to find what you are looking for.' | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constant
| if (error instanceof Error) { | ||
| throw new Error(`Error in userSession: ${error.message}`); | ||
| } else { | ||
| throw new Error('Unknown error in userSession'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don’t push thios file
PR request to merge Execution Log Screen.