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

feat(cmdClick-task): Added command click functionality to tasks names to open in separate tab #18480

Merged
merged 3 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v2.0.0-beta.13 [unreleased]

### Features

1. [18480](https://github.com/influxdata/influxdb/pull/18480): Allows tasks to open in new tabs
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think this is a feature, it's like, table stakes of a browser.

if it has to be in the changelog, i think it should go under ### UI Enhancements


## v2.0.0-beta.12 [2020-06-11]

### Features
Expand Down
9 changes: 0 additions & 9 deletions ui/src/tasks/actions/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,6 @@ export const setAllTaskOptionsByID = (taskID: string) => async (
}
}

export const selectTask = (taskID: string) => (
dispatch: Dispatch<Action>,
getState: GetState
) => {
const org = getOrg(getState())

dispatch(push(`/orgs/${org.id}/tasks/${taskID}`))
}

export const goToTasks = () => (
dispatch: Dispatch<Action>,
getState: GetState
Expand Down
23 changes: 13 additions & 10 deletions ui/src/tasks/components/TaskCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ import InlineLabels from 'src/shared/components/inlineLabels/InlineLabels'
import LastRunTaskStatus from 'src/shared/components/lastRunTaskStatus/LastRunTaskStatus'

// Actions
import {
addTaskLabel,
deleteTaskLabel,
selectTask,
} from 'src/tasks/actions/thunks'
import {addTaskLabel, deleteTaskLabel} from 'src/tasks/actions/thunks'

// Types
import {ComponentColor} from '@influxdata/clockface'
Expand All @@ -36,7 +32,6 @@ interface PassedProps {
task: Task
onActivate: (task: Task) => void
onDelete: (task: Task) => void
onSelect: typeof selectTask
onClone: (task: Task) => void
onRunTask: (taskID: string) => void
onUpdate: (name: string, taskID: string) => void
Expand Down Expand Up @@ -139,10 +134,18 @@ export class TaskCard extends PureComponent<Props & WithRouterProps> {
)
}

private handleNameClick = (e: MouseEvent) => {
e.preventDefault()

this.props.onSelect(this.props.task.id)
private handleNameClick = (event: MouseEvent) => {
const {
params: {orgID},
router,
task,
} = this.props
const url = `/orgs/${orgID}/tasks/${task.id}`
if (event.metaKey) {
window.open(url, '_blank')
} else {
router.push(url)
}
}

private handleViewRuns = () => {
Expand Down
6 changes: 2 additions & 4 deletions ui/src/tasks/components/TasksList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import EmptyTasksList from 'src/tasks/components/EmptyTasksList'
import {Task} from 'src/types'
import {SortTypes} from 'src/shared/utils/sort'
import {Sort} from '@influxdata/clockface'
import {selectTask, addTaskLabel, runTask} from 'src/tasks/actions/thunks'
import {addTaskLabel, runTask} from 'src/tasks/actions/thunks'
import {checkTaskLimits as checkTaskLimitsAction} from 'src/cloud/actions/limits'
import {TaskSortKey} from 'src/shared/components/resource_sort_dropdown/generateSortItems'

Expand All @@ -27,7 +27,6 @@ interface Props {
onClone: (task: Task) => void
onFilterChange: (searchTerm: string) => void
totalCount: number
onSelect: typeof selectTask
onAddTaskLabel: typeof addTaskLabel
onRunTask: typeof runTask
onUpdate: (name: string, taskID: string) => void
Expand Down Expand Up @@ -100,7 +99,7 @@ export default class TasksList extends PureComponent<Props, State> {
sortType,
onActivate,
onDelete,
onSelect,
onSelectTask,
onClone,
onUpdate,
onRunTask,
Expand All @@ -121,7 +120,6 @@ export default class TasksList extends PureComponent<Props, State> {
onActivate={onActivate}
onDelete={onDelete}
onClone={onClone}
onSelect={onSelect}
onUpdate={onUpdate}
onRunTask={onRunTask}
onFilterChange={onFilterChange}
Expand Down
5 changes: 0 additions & 5 deletions ui/src/tasks/containers/TasksPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
updateTaskStatus,
updateTaskName,
deleteTask,
selectTask,
cloneTask,
addTaskLabel,
runTask,
Expand Down Expand Up @@ -56,7 +55,6 @@ interface ConnectedDispatchProps {
updateTaskName: typeof updateTaskName
deleteTask: typeof deleteTask
cloneTask: typeof cloneTask
selectTask: typeof selectTask
setSearchTerm: typeof setSearchTermAction
setShowInactive: typeof setShowInactiveAction
onAddTaskLabel: typeof addTaskLabel
Expand Down Expand Up @@ -109,7 +107,6 @@ class TasksPage extends PureComponent<Props, State> {
public render(): JSX.Element {
const {sortKey, sortDirection, sortType} = this.state
const {
selectTask,
setSearchTerm,
updateTaskName,
searchTerm,
Expand Down Expand Up @@ -160,7 +157,6 @@ class TasksPage extends PureComponent<Props, State> {
onDelete={this.handleDelete}
onCreate={this.handleCreateTask}
onClone={this.handleClone}
onSelect={selectTask}
onAddTaskLabel={onAddTaskLabel}
onRunTask={onRunTask}
onFilterChange={setSearchTerm}
Expand Down Expand Up @@ -293,7 +289,6 @@ const mdtp: ConnectedDispatchProps = {
updateTaskStatus,
updateTaskName,
deleteTask,
selectTask,
cloneTask,
setSearchTerm: setSearchTermAction,
setShowInactive: setShowInactiveAction,
Expand Down