Skip to content

Commit 9cb8104

Browse files
committed
Merge branch 'main' into 946-associate-commits-by-email-rebase
2 parents 47a23a7 + 15c68a3 commit 9cb8104

File tree

88 files changed

+2723
-2031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2723
-2031
lines changed

.github/workflows/unused-dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
node-version: '22.x'
2222
- name: 'Run depcheck'
2323
run: |
24-
npx depcheck --skip-missing --ignores="tsx,@babel/*,@commitlint/*,eslint,eslint-*,husky,mocha,ts-mocha,ts-node,concurrently,nyc,prettier,typescript,tsconfig-paths,vite-tsconfig-paths"
24+
npx depcheck --skip-missing --ignores="tsx,@babel/*,@commitlint/*,eslint,eslint-*,husky,mocha,ts-mocha,ts-node,concurrently,nyc,prettier,typescript,tsconfig-paths,vite-tsconfig-paths,history,@types/domutils"
2525
echo $?
2626
if [[ $? == 1 ]]; then
2727
echo "Unused dependencies or devDependencies found"

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@
7979
To create a production bundle, use `npm run build` or `yarn build`.
8080
-->
8181
</body>
82-
<script type="module" src="/src/index.jsx"></script>
82+
<script type="module" src="/src/index.tsx"></script>
8383
</html>

package-lock.json

Lines changed: 96 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@finos/git-proxy",
3-
"version": "1.18.2",
3+
"version": "1.19.0",
44
"description": "Deploy custom push protections and policies on top of Git.",
55
"scripts": {
66
"cli": "node ./packages/git-proxy-cli/index.js",
7-
"client": "vite --config vite.config.js",
7+
"client": "vite --config vite.config.ts",
88
"clientinstall": "npm install --prefix client",
99
"server": "tsx index.ts",
1010
"start": "concurrently \"npm run server\" \"npm run client\"",
@@ -88,14 +88,17 @@
8888
"@babel/preset-react": "^7.22.5",
8989
"@commitlint/cli": "^19.0.0",
9090
"@commitlint/config-conventional": "^19.0.0",
91+
"@types/domutils": "^1.7.8",
9192
"@types/express": "^5.0.1",
9293
"@types/express-http-proxy": "^1.6.6",
9394
"@types/lodash": "^4.17.15",
9495
"@types/mocha": "^10.0.10",
9596
"@types/node": "^22.13.5",
97+
"@types/react-dom": "^17.0.11",
98+
"@types/react-html-parser": "^2.0.7",
9699
"@types/yargs": "^17.0.33",
97-
"@typescript-eslint/eslint-plugin": "^8.26.1",
98-
"@typescript-eslint/parser": "^8.26.1",
100+
"@typescript-eslint/eslint-plugin": "^8.29.0",
101+
"@typescript-eslint/parser": "^8.29.0",
99102
"@vitejs/plugin-react": "^4.0.2",
100103
"chai": "^4.2.0",
101104
"chai-http": "^4.3.0",

src/ui/views/RepoList/Components/RepoOverview.jsx renamed to src/constants/languageColors.ts

Lines changed: 2 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import React, { useEffect } from 'react';
2-
import { Snackbar, TableCell, TableRow } from '@material-ui/core';
3-
import GridContainer from '../../../components/Grid/GridContainer';
4-
import GridItem from '../../../components/Grid/GridItem';
5-
import { CodeReviewIcon, LawIcon, PeopleIcon } from '@primer/octicons-react';
1+
// src/constants/languageColors.ts
62

7-
const colors = {
3+
export const languageColors: Record<string, string> = {
84
'1C Enterprise': '#814CCC',
95
'2-Dimensional Array': '#38761D',
106
'4D': '#004289',
@@ -563,127 +559,3 @@ const colors = {
563559
ZIL: '#dc75e5',
564560
Zimpl: '#d67711',
565561
};
566-
567-
import axios from 'axios';
568-
import moment from 'moment';
569-
import CodeActionButton from '../../../components/CustomButtons/CodeActionButton';
570-
571-
export default function Repositories(props) {
572-
const [github, setGitHub] = React.useState({});
573-
574-
const [errorMessage, setErrorMessage] = React.useState('');
575-
const [snackbarOpen, setSnackbarOpen] = React.useState(false);
576-
577-
useEffect(() => {
578-
getGitHubRepository();
579-
}, [props.data.project, props.data.name]);
580-
581-
const getGitHubRepository = async () => {
582-
await axios
583-
.get(`https://api.github.com/repos/${props.data.project}/${props.data.name}`)
584-
.then((res) => {
585-
setGitHub(res.data);
586-
})
587-
.catch((error) => {
588-
setErrorMessage(
589-
`Error fetching GitHub repository ${props.data.project}/${props.data.name}: ${error}`,
590-
);
591-
setSnackbarOpen(true);
592-
});
593-
};
594-
595-
const { project: org, name, proxyURL } = props?.data || {};
596-
const cloneURL = `${proxyURL}/${org}/${name}.git`;
597-
598-
return (
599-
<TableRow>
600-
<TableCell>
601-
<div style={{ padding: '15px' }}>
602-
<a href={`/dashboard/repo/${props.data.name}`}>
603-
<span style={{ fontSize: '17px' }}>
604-
{props.data.project}/{props.data.name}
605-
</span>
606-
</a>
607-
{github.parent && (
608-
<span
609-
style={{
610-
fontSize: '11.5px',
611-
display: 'block',
612-
opacity: 0.8,
613-
}}
614-
>
615-
Forked from{' '}
616-
<a
617-
style={{
618-
fontWeight: 'normal',
619-
color: 'inherit',
620-
}}
621-
href={github.parent.html_url}
622-
>
623-
{github.parent.full_name}
624-
</a>
625-
</span>
626-
)}
627-
{github.description && <p style={{ maxWidth: '80%' }}>{github.description}</p>}
628-
<GridContainer>
629-
{github.language && (
630-
<GridItem>
631-
<span
632-
style={{
633-
height: '12px',
634-
width: '12px',
635-
backgroundColor: `${colors[github.language]}`,
636-
borderRadius: '50px',
637-
display: 'inline-block',
638-
marginRight: '5px',
639-
}}
640-
></span>
641-
{github.language}
642-
</GridItem>
643-
)}
644-
{github.license && (
645-
<GridItem>
646-
<LawIcon size='small' />{' '}
647-
<span style={{ marginLeft: '5px' }}>{github.license.spdx_id}</span>
648-
</GridItem>
649-
)}
650-
<GridItem>
651-
<PeopleIcon size='small' />{' '}
652-
<span style={{ marginLeft: '5px' }}>{props.data.users?.canPush?.length || 0}</span>
653-
</GridItem>
654-
<GridItem>
655-
<CodeReviewIcon size='small' />{' '}
656-
<span style={{ marginLeft: '5px' }}>
657-
{props.data.users?.canAuthorise?.length || 0}
658-
</span>
659-
</GridItem>
660-
{(github.created_at || github.updated_at || github.pushed_at) && (
661-
<GridItem>
662-
Last updated{' '}
663-
{moment
664-
.max([
665-
moment(github.created_at),
666-
moment(github.updated_at),
667-
moment(github.pushed_at),
668-
])
669-
.fromNow()}
670-
</GridItem>
671-
)}
672-
</GridContainer>
673-
</div>
674-
</TableCell>
675-
<TableCell align='right'>
676-
<div style={{ padding: '15px' }}>
677-
<CodeActionButton cloneURL={cloneURL} />
678-
</div>
679-
</TableCell>
680-
<Snackbar
681-
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
682-
open={snackbarOpen}
683-
autoHideDuration={6000}
684-
onClose={() => setSnackbarOpen(false)}
685-
message={errorMessage}
686-
/>
687-
</TableRow>
688-
);
689-
}

src/context.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/context.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { createContext } from 'react';
2+
import { UserContextType } from './ui/views/RepoDetails/RepoDetails';
3+
4+
export const UserContext = createContext<UserContextType>({
5+
user: {
6+
admin: false,
7+
},
8+
});

src/db/mongo/users.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const getUsers = async function (query: any = {}) {
1717
}
1818
console.log(`Getting users for query= ${JSON.stringify(query)}`);
1919
const collection = await connect(collectionName);
20-
return collection.find(query, { password: 0 }).toArray();
20+
return collection.find(query).project({ password: 0 }).toArray();
2121
};
2222

2323
export const deleteUser = async function (username: string) {

src/index.jsx renamed to src/index.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import { createBrowserHistory } from 'history';
43
import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-dom';
54
import { AuthProvider } from './ui/auth/AuthProvider';
65

@@ -11,16 +10,14 @@ import './ui/assets/css/material-dashboard-react.css';
1110
import NotAuthorized from './ui/views/Extras/NotAuthorized';
1211
import NotFound from './ui/views/Extras/NotFound';
1312

14-
const hist = createBrowserHistory();
15-
1613
ReactDOM.render(
1714
<AuthProvider>
18-
<Router history={hist}>
15+
<Router>
1916
<Routes>
20-
<Route exact path='/dashboard/*' element={<Dashboard />} />
21-
<Route exact path='/login' element={<Login />} />
22-
<Route exact path='/not-authorized' element={<NotAuthorized />} />
23-
<Route exact path='/' element={<Navigate from='/' to='/dashboard/repo' />} />
17+
<Route path='/dashboard/*' element={<Dashboard />} />
18+
<Route path='/login' element={<Login />} />
19+
<Route path='/not-authorized' element={<NotAuthorized />} />
20+
<Route path='/' element={<Navigate to='/dashboard/repo' />} />
2421
<Route path='*' element={<NotFound />} />
2522
</Routes>
2623
</Router>

src/routes.jsx renamed to src/routes.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ import RepoDetails from './ui/views/RepoDetails/RepoDetails';
2727
import RepoList from './ui/views/RepoList/RepoList';
2828

2929
import { RepoIcon } from '@primer/octicons-react';
30-
3130
import { Group, AccountCircle, Dashboard } from '@material-ui/icons';
31+
import { Route } from './types/models';
3232

33-
const dashboardRoutes = [
33+
const dashboardRoutes: Route[] = [
3434
{
3535
path: '/repo',
3636
name: 'Repositories',

0 commit comments

Comments
 (0)