Skip to content

Commit 7c9baf8

Browse files
authored
Merge branch 'main' into changesets-release/orchestrator/main
2 parents 27fda7b + 86a9000 commit 7c9baf8

File tree

10 files changed

+55
-68
lines changed

10 files changed

+55
-68
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-bulk-import': patch
3+
---
4+
5+
Remove interactive column sorting and fix case-insensitive sort ordering.

workspaces/bulk-import/packages/app/e2e-tests/app.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,10 @@ test.describe('Bulk Import', () => {
110110
- row "select all repositories ${translations.table.headers.name} ${translations.table.headers.url} ${translations.table.headers.organization} ${translations.table.headers.status}":
111111
- columnheader "select all repositories ${translations.table.headers.name}":
112112
- checkbox "select all repositories"
113-
- button "${translations.table.headers.name}"
114-
- columnheader "${translations.table.headers.url}":
115-
- button "${translations.table.headers.url}"
116-
- columnheader "${translations.table.headers.organization}":
117-
- button "${translations.table.headers.organization}"
118-
- columnheader "${translations.table.headers.status}":
119-
- button "${translations.table.headers.status}"
113+
- text: ${translations.table.headers.name}
114+
- columnheader "${translations.table.headers.url}"
115+
- columnheader "${translations.table.headers.organization}"
116+
- columnheader "${translations.table.headers.status}"
120117
`);
121118

122119
await runAccessibilityTests(sharedPage, testInfo);

workspaces/bulk-import/plugins/bulk-import/src/components/AddRepositories/RepositoriesHeader.tsx

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,33 @@
1414
* limitations under the License.
1515
*/
1616

17-
import type { ChangeEvent, MouseEvent } from 'react';
17+
import type { ChangeEvent } from 'react';
1818

1919
import Checkbox from '@mui/material/Checkbox';
2020
import TableCell from '@mui/material/TableCell';
2121
import TableHead from '@mui/material/TableHead';
2222
import TableRow from '@mui/material/TableRow';
23-
import TableSortLabel from '@mui/material/TableSortLabel';
2423

2524
import { useGitlabConfigured } from '../../hooks';
2625
import { useImportFlow } from '../../hooks/useImportFlow';
2726
import { useTranslation } from '../../hooks/useTranslation';
28-
import { ImportFlow, Order } from '../../types';
27+
import { ImportFlow } from '../../types';
2928
import { getRepositoriesListColumns } from '../Repositories/RepositoriesListColumns';
3029
import { getOrganizationsColumnHeader } from './OrganizationsColumnHeader';
3130
import { getRepositoriesColumnHeader } from './RepositoriesColumnHeader';
3231
import { getReposSelectDrawerColumnHeader } from './ReposSelectDrawerColumnHeader';
3332

3433
export const RepositoriesHeader = ({
3534
onSelectAllClick,
36-
order,
37-
orderBy,
3835
numSelected,
3936
rowCount,
40-
onRequestSort,
4137
isDataLoading,
4238
showOrganizations,
4339
showImportJobs,
4440
isRepoSelectDrawer = false,
4541
isApprovalToolGitlab = false,
4642
}: {
4743
numSelected?: number;
48-
onRequestSort: (event: MouseEvent<unknown>, property: any) => void;
49-
order: Order;
50-
orderBy: string | undefined;
5144
rowCount?: number;
5245
isDataLoading?: boolean;
5346
showOrganizations?: boolean;
@@ -57,9 +50,6 @@ export const RepositoriesHeader = ({
5750
onSelectAllClick?: (event: ChangeEvent<HTMLInputElement>) => void;
5851
}) => {
5952
const { t } = useTranslation();
60-
const createSortHandler = (property: any) => (event: MouseEvent<unknown>) => {
61-
onRequestSort(event, property);
62-
};
6353

6454
const gitlabConfigured = useGitlabConfigured();
6555
const importFlow = useImportFlow();
@@ -110,7 +100,6 @@ export const RepositoriesHeader = ({
110100
padding: tableCellStyle(),
111101
fontWeight: '700',
112102
}}
113-
sortDirection={orderBy === headCell.field ? order : 'asc'}
114103
>
115104
{index === 0 && !showOrganizations && !showImportJobs && (
116105
<Checkbox
@@ -134,14 +123,7 @@ export const RepositoriesHeader = ({
134123
disabled={isDataLoading}
135124
/>
136125
)}
137-
<TableSortLabel
138-
active={orderBy === headCell.field}
139-
direction={orderBy === headCell.field ? order : 'asc'}
140-
onClick={createSortHandler(headCell.field)}
141-
disabled={headCell.sorting === false}
142-
>
143-
{headCell.title}
144-
</TableSortLabel>
126+
{headCell.title}
145127
</TableCell>
146128
))}
147129
</TableRow>

workspaces/bulk-import/plugins/bulk-import/src/components/AddRepositories/RepositoriesTable.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {
3131
AddedRepositories,
3232
AddRepositoriesFormValues,
3333
AddRepositoryData,
34-
Order,
3534
RepositoryStatus,
3635
} from '../../types';
3736
import {
@@ -84,8 +83,6 @@ export const RepositoriesTable = ({
8483
const { t } = useTranslation();
8584
const { setFieldValue, values, setStatus } =
8685
useFormikContext<AddRepositoriesFormValues>();
87-
const [order, setOrder] = useState<Order>('asc');
88-
const [orderBy, setOrderBy] = useState<string>();
8986
const [selected, setSelected] = useState<AddedRepositories>({});
9087
const [rowsPerPage, setRowsPerPage] = useState(5);
9188
const [tableData, setTableData] = useState<AddRepositoryData[]>([]);
@@ -139,17 +136,11 @@ export const RepositoriesTable = ({
139136
: evaluateRowForOrg(tableData, values.repositories);
140137

141138
filteredRows = [...(filteredRows || [])]?.sort(
142-
getComparator(order, orderBy as string),
139+
getComparator('asc', 'repoName'),
143140
);
144141

145142
return filteredRows;
146-
}, [tableData, order, orderBy, values?.repositories, showOrganizations]);
147-
148-
const handleRequestSort = (_event: MouseEvent<unknown>, property: string) => {
149-
const isAsc = orderBy === property && order === 'asc';
150-
setOrder(isAsc ? 'desc' : 'asc');
151-
setOrderBy(property);
152-
};
143+
}, [tableData, values?.repositories, showOrganizations]);
153144

154145
const updateSelectedRepositories = useCallback(
155146
(newSelected: AddedRepositories) => {
@@ -330,10 +321,7 @@ export const RepositoriesTable = ({
330321
: selectedRepositoriesOnActivePage.length
331322
}
332323
isDataLoading={loading}
333-
order={order}
334-
orderBy={orderBy}
335324
onSelectAllClick={handleSelectAllClick}
336-
onRequestSort={handleRequestSort}
337325
rowCount={getRowCount() || 0}
338326
showOrganizations={drawerOrganization ? false : showOrganizations}
339327
isRepoSelectDrawer={!!drawerOrganization}

workspaces/bulk-import/plugins/bulk-import/src/components/Repositories/RepositoriesList.tsx

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import type { MouseEvent } from 'react';
18-
import { useMemo, useState } from 'react';
17+
import { useState } from 'react';
1918
import { useLocation, useNavigate } from 'react-router-dom';
2019

2120
import { Table } from '@backstage/core-components';
@@ -45,20 +44,13 @@ export const RepositoriesList = () => {
4544
const location = useLocation();
4645
const queryParams = new URLSearchParams(location.search);
4746
const { t } = useTranslation();
48-
const [order, setOrder] = useState<SortingOrderEnum>(SortingOrderEnum.Asc);
49-
const [orderBy, setOrderBy] = useState<string>('repoName');
5047
const { openDialog, setOpenDialog, deleteComponent } = useDeleteDialog();
5148
const { openDrawer, setOpenDrawer, drawerData } = useDrawer();
5249
const [pageNumber, setPageNumber] = useState(0);
5350
const [rowsPerPage, setRowsPerPage] = useState(5);
5451
const [debouncedSearch, setDebouncedSearch] = useState('');
5552
const gitlabConfigured = useGitlabConfigured();
5653

57-
const orderByColumn = useMemo(() => {
58-
return orderBy?.replace(/\.([a-zA-Z])/g, (_, char) =>
59-
char.toUpperCase('en-US'),
60-
) as keyof typeof AddedRepositoryColumnNameEnum;
61-
}, [orderBy]);
6254
const {
6355
data: importJobs,
6456
error: errJobs,
@@ -68,8 +60,8 @@ export const RepositoriesList = () => {
6860
pageNumber + 1,
6961
rowsPerPage,
7062
debouncedSearch,
71-
AddedRepositoryColumnNameEnum[orderByColumn],
72-
order,
63+
AddedRepositoryColumnNameEnum.repoName,
64+
SortingOrderEnum.Asc,
7365
);
7466

7567
const closeDialog = () => {
@@ -87,12 +79,6 @@ export const RepositoriesList = () => {
8779
setOpenDrawer(false);
8880
};
8981

90-
const handleRequestSort = (_event: MouseEvent<unknown>, property: string) => {
91-
const isAsc = orderBy === property && order === 'asc';
92-
setOrder(isAsc ? SortingOrderEnum.Desc : SortingOrderEnum.Asc);
93-
setOrderBy(property);
94-
};
95-
9682
// Avoid a layout jump when reaching the last page with empty rows.
9783
const emptyRows =
9884
pageNumber > 0 ? Math.max(0, rowsPerPage - importJobs.totalJobs) : 0;
@@ -135,14 +121,7 @@ export const RepositoriesList = () => {
135121
},
136122
}}
137123
components={{
138-
Header: () => (
139-
<RepositoriesHeader
140-
order={order}
141-
orderBy={orderBy}
142-
onRequestSort={handleRequestSort}
143-
showImportJobs
144-
/>
145-
),
124+
Header: () => <RepositoriesHeader showImportJobs />,
146125
Body: () => (
147126
<AddedRepositoriesTableBody
148127
error={errJobs}

workspaces/bulk-import/plugins/bulk-import/src/utils/repository-utils.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ export const descendingComparator = (
102102
value1 = order[(value1 as ImportStatus) || RepositoryStatus.NotGenerated];
103103
value2 = order[(value2 as ImportStatus) || RepositoryStatus.NotGenerated];
104104
}
105+
106+
// Convert strings to lowercase for case-insensitive comparison
107+
if (typeof value1 === 'string' && typeof value2 === 'string') {
108+
value1 = value1.toLowerCase();
109+
value2 = value2.toLowerCase();
110+
}
111+
105112
if (value2 < value1) {
106113
return -1;
107114
}

workspaces/lightspeed/app-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,19 @@ techdocs:
6363

6464
auth:
6565
# see https://backstage.io/docs/auth/ to learn about auth providers
66+
environment: development
6667
providers:
6768
# See https://backstage.io/docs/auth/guest/provider
6869
guest: {}
70+
# Uncomment if using GitHub provider
71+
# See https://backstage.io/docs/auth/github/provider#configuration
72+
# github:
73+
# development:
74+
# clientId: ${AUTH_GITHUB_CLIENT_ID}
75+
# clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
76+
# signIn:
77+
# resolvers:
78+
# - resolver: usernameMatchingUserEntityName
6979

7080
scaffolder: {}
7181
# see https://backstage.io/docs/features/software-templates/configuration for software template options

workspaces/lightspeed/packages/app/src/App.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ import { RequirePermission } from '@backstage/plugin-permission-react';
5353
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';
5454
import { lightspeedTranslations } from '@red-hat-developer-hub/backstage-plugin-lightspeed/alpha';
5555
import { LightspeedPage } from '@red-hat-developer-hub/backstage-plugin-lightspeed';
56+
import { githubAuthApiRef } from '@backstage/core-plugin-api';
5657

58+
const githubProvider = {
59+
id: 'github-auth-provider',
60+
title: 'GitHub',
61+
message: 'Sign in using GitHub',
62+
apiRef: githubAuthApiRef,
63+
};
5764
const app = createApp({
5865
apis,
5966
__experimentalTranslations: {
@@ -78,7 +85,9 @@ const app = createApp({
7885
});
7986
},
8087
components: {
81-
SignInPage: props => <SignInPage {...props} auto providers={['guest']} />,
88+
SignInPage: props => (
89+
<SignInPage {...props} auto providers={['guest', githubProvider]} />
90+
),
8291
},
8392
});
8493

workspaces/lightspeed/packages/backend/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,7 @@ backend.add(
6262
import('@red-hat-developer-hub/backstage-plugin-lightspeed-backend'),
6363
);
6464

65+
// GitHub auth
66+
backend.add(import('@backstage/plugin-auth-backend-module-github-provider'));
67+
6568
backend.start();

workspaces/redhat-resource-optimization/scripts/dynamic-plugins.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Environment variables:
2828
Sub-commands:
2929
clean Removes directories generated by this script.
3030
oci Generates an OCI artifact containing the dynamic plugins. This is the prefered distribution method.
31+
push Pushes the OCI artifact to the container registry.
3132
tgz Generates a tarball containing the dynamic plugins in $dynamic_plugins_root_dir/artifacts.
3233
EOF
3334
}
@@ -111,6 +112,12 @@ function oci {
111112
git restore plugins/*/package.json
112113
}
113114

115+
function push {
116+
_assert_version_is_set
117+
echo "Pushing image to $REGISTRY_URL/$ORG_ID/$REPO:$VERSION"
118+
$_pocker push $REGISTRY_URL/$ORG_ID/$REPO:$VERSION
119+
}
120+
114121
if [[ $# -eq 0 || $1 =~ -h|--help ]]; then
115122
_usage
116123
else

0 commit comments

Comments
 (0)