Skip to content

Commit 9091fbd

Browse files
authored
feat: update the routes to all be variablized (#4173)
1 parent 3b75f7c commit 9091fbd

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/tasks/components/TaskRunsCard.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,18 @@ import {
1515
JustifyContent,
1616
} from '@influxdata/clockface'
1717

18-
// Actions For Tasks
19-
import {relativeTimestampFormatter} from 'src/shared/utils/relativeTimestampFormatter'
20-
2118
// Actions
19+
import {relativeTimestampFormatter} from 'src/shared/utils/relativeTimestampFormatter'
2220
import {runTask, getRuns, updateTaskStatus} from 'src/tasks/actions/thunks'
2321
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
24-
25-
// Actions For Members
2622
import {getMembers} from 'src/members/actions/thunks'
2723
import {getOrg} from 'src/organizations/selectors'
28-
2924
import {TaskPage, setCurrentTasksPage} from 'src/tasks/actions/creators'
3025

3126
// Types
3227
import {ComponentColor, Button} from '@influxdata/clockface'
3328
import {Task, AppState} from 'src/types'
29+
import {DEFAULT_PROJECT_NAME} from 'src/flows'
3430

3531
// DateTime
3632
import {DEFAULT_TIME_FORMAT} from 'src/utils/datetime/constants'
@@ -99,15 +95,19 @@ const TaskRunsCard: FC<Props> = ({task}) => {
9995
})
10096
.then(resp => {
10197
if (resp.length) {
102-
setRoute(`/orgs/${org.id}/notebooks/${resp[0].notebookID}`)
98+
setRoute(
99+
`/orgs/${org.id}/${DEFAULT_PROJECT_NAME.toLowerCase()}/${
100+
resp[0].notebookID
101+
}`
102+
)
103103
} else {
104104
setRoute(`/notebook/from/task/${task.id}`)
105105
}
106106
})
107107
.catch(() => {
108108
setRoute(`/notebook/from/task/${task.id}`)
109109
})
110-
}, [isFlagEnabled('createWithFlows'), task])
110+
}, [isFlagEnabled('createWithFlows'), org.id, task])
111111

112112
if (!task) {
113113
return null

src/tasks/components/TaskRunsPage.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ import {RemoteDataState} from 'src/types'
1818
import {DEFAULT_TIME_FORMAT} from 'src/utils/datetime/constants'
1919
import {createDateTimeFormatter} from 'src/utils/datetime/formatters'
2020

21+
jest.mock('src/flows', () => {
22+
return () => <></>
23+
})
24+
2125
const runIDs = [
2226
'07a7f99e81cf2000',
2327
'07a7f99e81cf3000',

src/utils/deepLinks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const buildDeepLinkingMap = (org: Organization) => ({
1818
[`/me/${PROJECT_NAME_PLURAL.toLowerCase()}`]: `/orgs/${
1919
org.id
2020
}/${PROJECT_NAME_PLURAL.toLowerCase()}`,
21+
'/me/notebooks': `/orgs/${org.id}/${PROJECT_NAME_PLURAL.toLowerCase()}`,
2122
'/me/pythonclient': `/orgs/${org.id}/load-data/client-libraries/python`,
2223
'/me/secrets': `/orgs/${org.id}/settings/secrets`,
2324
'/me/tasks': `/orgs/${org.id}/tasks`,

0 commit comments

Comments
 (0)