Skip to content

Commit

Permalink
fix(console): handle timeline case
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Irby committed Aug 30, 2023
1 parent 1c971ee commit eea57e8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions console/client/src/layout/IDELayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,29 @@ export function IDELayout() {

return setInvalidTabMessage(msg)
}
// Handle timeline tab id
if (id === timelineTab.id) {
return setActiveTab({id: timelineTab.id, type: timelineTab.type})
}
if (modules.length) {
const ids = id.split('.')
// Handle edge case where the id contains and invalid module or verb
if (modules.length) {
const [moduleId, verbId] = ids
// Check to see if they exist on controller
// Handle Module does not exist
const moduleExist = modules.find(module => module?.name === moduleId)
if (!moduleExist) {
setInvalidTabMessage(`Module ${moduleId} does not exist`)
return setActiveTab({id: timelineTab.id, type: timelineTab.type})
}
// Handle Verb does not exists
const verbExist = moduleExist?.verbs.some(
({verb}) => verb?.name === verbId
)
if (moduleExist && !verbExist) {
if (!verbExist) {
setInvalidTabMessage(`Verb ${verbId} does not exist on ${moduleId}`)
return setActiveTab({id: timelineTab.id, type: timelineTab.type})
}
if (!moduleExist) {
setInvalidTabMessage(`Module ${moduleId} does not exist`)
return setActiveTab({id: timelineTab.id, type: timelineTab.type})
}
}
// Handle if tab is not already in tab list
if (
Expand Down

0 comments on commit eea57e8

Please sign in to comment.