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

Adding opening new tab for table row middle mouse button click #1119

Merged
merged 4 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import {
} from '@patternfly/react-core';
import { Caption, Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { Link, useNavigate } from 'react-router-dom';
import { useSearchParam } from 'react-use';
import { ErrorSection } from '../Sections/ErrorSection/ErrorSection';
import { useGenerationRequests } from './useGenerationRequests';
import { openInNewTab } from '@app/utils/openInNewTab';

const columnNames = {
id: 'ID',
Expand Down Expand Up @@ -70,9 +71,16 @@ export const GenerationRequestTable = () => {
</Thead>
<Tbody>
{value.map((generation) => (
<Tr key={generation.id} isClickable onRowClick={() => navigate('/generations/' + generation.id)}>
<Tr
key={generation.id}
isClickable
onRowClick={() => navigate('/generations/' + generation.id)}
onAuxClick={() => openInNewTab('/generations/' + generation.id)}
>
<Td dataLabel={columnNames.id}>
<pre>{generation.id}</pre>
<Link to={'/generations/' + generation.id}>
<pre>{generation.id}</pre>
</Link>
</Td>
<Td dataLabel={columnNames.status}>
<Tooltip
Expand Down
14 changes: 11 additions & 3 deletions ui/src/app/components/ManifestsTableTable/ManifestsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import {
} from '@patternfly/react-core';
import { Caption, Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { Link, useNavigate } from 'react-router-dom';
import { useSearchParam } from 'react-use';
import { ErrorSection } from '../Sections/ErrorSection/ErrorSection';
import { useManifests } from './useSboms';
import { openInNewTab } from '@app/utils/openInNewTab';

const columnNames = {
id: 'ID',
Expand Down Expand Up @@ -70,9 +71,16 @@ export const ManifestsTable = () => {
</Thead>
<Tbody>
{value.map((manifest) => (
<Tr key={manifest.id} isClickable onRowClick={() => navigate('/manifests/' + manifest.id)}>
<Tr
key={manifest.id}
isClickable
onRowClick={() => navigate('/manifests/' + manifest.id)}
onAuxClick={() => openInNewTab('/manifests/' + manifest.id)}
>
<Td dataLabel={columnNames.id}>
<pre>{manifest.id}</pre>
<Link to={'/manifests/' + manifest.id}>
<pre>{manifest.id}</pre>
</Link>
</Td>
<Td dataLabel={columnNames.type}>
<Label style={{ cursor: 'pointer' }} color="purple">
Expand Down
16 changes: 12 additions & 4 deletions ui/src/app/components/RequestEventTable/RequestEventTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import {
} from '@patternfly/react-core';
import { Caption, Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { Link, useNavigate } from 'react-router-dom';
import { useSearchParam } from 'react-use';
import { ErrorSection } from '../Sections/ErrorSection/ErrorSection';
import { useRequestEvents } from './useRequestEvents';
import { openInNewTab } from '@app/utils/openInNewTab';

const columnNames = {
id: 'ID',
Expand Down Expand Up @@ -75,12 +76,19 @@ export const RequestEventTable = () => {
</Thead>
<Tbody>
{value.map((requestEvent) => (
<Tr key={requestEvent.id} isClickable onRowClick={() => navigate('/requestevents/' + requestEvent.id)}>
<Tr
key={requestEvent.id}
isClickable
onRowClick={() => navigate('/requestevents/' + requestEvent.id)}
onAuxClick={() => openInNewTab('/requestevents/' + requestEvent.id)}
>
<Td dataLabel={columnNames.id}>
<pre>{requestEvent.id}</pre>
<Link to={'/requestevents/' + requestEvent.id}>
goldmann marked this conversation as resolved.
Show resolved Hide resolved
<pre>{requestEvent.id}</pre>
</Link>
</Td>
<Td dataLabel={columnNames.eventStatus}>
<Tooltip
<Tooltip
isContentLeftAligned={true}
content={
<div>
Expand Down
21 changes: 21 additions & 0 deletions ui/src/app/utils/openInNewTab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
///
/// JBoss, Home of Professional Open Source.
/// Copyright 2023 Red Hat, Inc., and individual contributors
/// as indicated by the @author tags.
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///

export function openInNewTab(url: string) {
window.open(url, '_blank');
}
Loading