Skip to content

Commit db04af6

Browse files
committed
chore(auth): refactor /admin routes into /dashboard
1 parent d049463 commit db04af6

File tree

15 files changed

+37
-37
lines changed

15 files changed

+37
-37
lines changed

cypress/e2e/repo.cy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('Repo', () => {
22
beforeEach(() => {
3-
cy.visit('/admin/repo');
3+
cy.visit('/dashboard/repo');
44

55
// prevent failures on 404 request and uncaught promises
66
cy.on('uncaught:exception', () => false);
@@ -18,7 +18,7 @@ describe('Repo', () => {
1818

1919
cy
2020
// find the entry for finos/test-repo
21-
.get('a[href="/admin/repo/test-repo"]')
21+
.get('a[href="/dashboard/repo/test-repo"]')
2222
// take it's parent row
2323
.closest('tr')
2424
// find the nearby span containing Code we can click to open the tooltip

src/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-d
55
import { AuthProvider } from './ui/auth/AuthProvider';
66

77
// core components
8-
import Admin from './ui/layouts/Admin';
8+
import Dashboard from './ui/layouts/Dashboard';
99
import Login from './ui/views/Login/Login';
1010
import './ui/assets/css/material-dashboard-react.css';
1111
import NotAuthorized from './ui/views/Extras/NotAuthorized';
@@ -17,10 +17,10 @@ ReactDOM.render(
1717
<AuthProvider>
1818
<Router history={hist}>
1919
<Routes>
20-
<Route exact path='/admin/*' element={<Admin />} />
20+
<Route exact path='/dashboard/*' element={<Dashboard />} />
2121
<Route exact path='/login' element={<Login />} />
2222
<Route exact path='/not-authorized' element={<NotAuthorized />} />
23-
<Route exact path='/' element={<Navigate from='/' to='/admin/repo' />} />
23+
<Route exact path='/' element={<Navigate from='/' to='/dashboard/repo' />} />
2424
<Route path='*' element={<NotFound />} />
2525
</Routes>
2626
</Router>

src/proxy/processors/push-action/blockForAuth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const exec = async (req, action) => {
1010
'\n\n\n' +
1111
`\x1B[32mGitProxy has received your push ✅\x1B[0m\n\n` +
1212
'🔗 Shareable Link\n\n' +
13-
`\x1B[34m${url}/admin/push/${action.id}\x1B[0m` +
13+
`\x1B[34m${url}/dashboard/push/${action.id}\x1B[0m` +
1414
'\n\n\n';
1515
step.setAsyncBlock(message);
1616

src/routes.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,55 +36,55 @@ const dashboardRoutes = [
3636
name: 'Repositories',
3737
icon: RepoIcon,
3838
component: (props) => <PrivateRoute component={RepoList} />,
39-
layout: '/admin',
39+
layout: '/dashboard',
4040
visible: true,
4141
},
4242
{
4343
path: '/repo/:id',
4444
name: 'Repo Details',
4545
icon: Person,
4646
component: (props) => <PrivateRoute component={RepoDetails} />,
47-
layout: '/admin',
47+
layout: '/dashboard',
4848
visible: false,
4949
},
5050
{
5151
path: '/push',
5252
name: 'Dashboard',
5353
icon: Dashboard,
5454
component: (props) => <PrivateRoute component={OpenPushRequests} />,
55-
layout: '/admin',
55+
layout: '/dashboard',
5656
visible: true,
5757
},
5858
{
5959
path: '/push/:id',
6060
name: 'Open Push Requests',
6161
icon: Person,
6262
component: (props) => <PrivateRoute component={PushDetails} />,
63-
layout: '/admin',
63+
layout: '/dashboard',
6464
visible: false,
6565
},
6666
{
6767
path: '/profile',
6868
name: 'My Account',
6969
icon: AccountCircle,
7070
component: (props) => <PrivateRoute component={User} />,
71-
layout: '/admin',
71+
layout: '/dashboard',
7272
visible: true,
7373
},
7474
{
75-
path: '/user',
75+
path: '/admin/user',
7676
name: 'Users',
7777
icon: Group,
7878
component: (props) => <PrivateRoute adminOnly component={UserList} />,
79-
layout: '/admin',
79+
layout: '/dashboard',
8080
visible: true,
8181
},
8282
{
83-
path: '/user/:id',
83+
path: '/admin/user/:id',
8484
name: 'User',
8585
icon: Person,
8686
component: (props) => <PrivateRoute adminOnly component={User} />,
87-
layout: '/admin',
87+
layout: '/dashboard',
8888
visible: false,
8989
},
9090
];

src/service/routes/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ router.get('/oidc/callback', (req, res, next) => {
6767
return res.status(401).end();
6868
}
6969
console.log('Logged in successfully. User:', user);
70-
return res.redirect(`${uiHost}:${uiPort}/admin/profile`);
70+
return res.redirect(`${uiHost}:${uiPort}/dashboard/profile`);
7171
});
7272
})(req, res, next);
7373
});

src/ui/components/Sidebar/Sidebar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default function Sidebar(props) {
7373
);
7474
const brand = (
7575
<div className={classes.logo}>
76-
<a style={{ textDecoration: 'none' }} href='/admin/repo'>
76+
<a style={{ textDecoration: 'none' }} href='/dashboard/repo'>
7777
<div style={{ textAlign: 'center' }}>
7878
<img
7979
style={{ verticalAlign: 'middle', filter: 'brightness(0) invert(1)' }}

src/ui/views/Login/Login.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ export default function UserProfile() {
7676
}
7777

7878
if (gitAccountError) {
79-
return <Navigate to={{ pathname: '/admin/profile' }} />;
79+
return <Navigate to={{ pathname: '/dashboard/profile' }} />;
8080
}
8181
if (success) {
82-
return <Navigate to={{ pathname: '/admin/profile', state: { authed: true } }} />;
82+
return <Navigate to={{ pathname: '/dashboard/profile', state: { authed: true } }} />;
8383
}
8484

8585
return (
@@ -169,8 +169,8 @@ export default function UserProfile() {
169169
<div style={{ textAlign: 'center', opacity: 0.9, fontSize: '12px' }}>
170170
<Badge overlap='rectangular' color='error' badgeContent={'NEW'} />{' '}
171171
<span style={{ paddingLeft: '20px' }}>
172-
View our <a href='/admin/push'>open source activity feed</a> or{' '}
173-
<a href='/admin/repo'>scroll through projects</a> we contribute to
172+
View our <a href='/dashboard/push'>open source activity feed</a> or{' '}
173+
<a href='/dashboard/repo'>scroll through projects</a> we contribute to
174174
</span>
175175
</div>
176176
</GridItem>

src/ui/views/OpenPushRequests/components/PushesTable.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function PushesTable(props) {
2323
const [isError, setIsError] = useState(false);
2424
const navigate = useNavigate();
2525

26-
const openPush = (push) => navigate(`/admin/push/${push}`, { replace: true });
26+
const openPush = (push) => navigate(`/dashboard/push/${push}`, { replace: true });
2727

2828
useEffect(() => {
2929
const query = {};

src/ui/views/PushDetails/PushDetails.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@ export default function Dashboard() {
4848
const authorise = async (attestationData) => {
4949
await authorisePush(id, setMessage, setUserAllowedToApprove, attestationData);
5050
if (isUserAllowedToApprove) {
51-
navigate('/admin/push/');
51+
navigate('/dashboard/push/');
5252
}
5353
};
5454

5555
const reject = async () => {
5656
await rejectPush(id, setMessage, setUserAllowedToReject);
5757
if (isUserAllowedToReject) {
58-
navigate('/admin/push/');
58+
navigate('/dashboard/push/');
5959
}
6060
};
6161

6262
const cancel = async () => {
6363
await cancelPush(id, setAuth, setIsError);
64-
navigate(`/admin/push/`);
64+
navigate(`/dashboard/push/`);
6565
};
6666

6767
if (isLoading) return <div>Loading...</div>;
@@ -178,15 +178,15 @@ export default function Dashboard() {
178178
htmlColor='green'
179179
/>
180180
</span>
181-
<a href={`/admin/user/${data.attestation.reviewer.username}`}>
181+
<a href={`/dashboard/user/${data.attestation.reviewer.username}`}>
182182
<img
183183
style={{ width: '45px', borderRadius: '20px' }}
184184
src={`https://github.com/${data.attestation.reviewer.gitAccount}.png`}
185185
/>
186186
</a>
187187
<div>
188188
<p>
189-
<a href={`/admin/user/${data.attestation.reviewer.username}`}>
189+
<a href={`/dashboard/user/${data.attestation.reviewer.username}`}>
190190
{data.attestation.reviewer.gitAccount}
191191
</a>{' '}
192192
approved this contribution

src/ui/views/PushDetails/components/AttestationView.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function AttestationView(props) {
6262
<p style={{ fontSize: '15px', paddingLeft: '34px' }}>
6363
Prior to making this code contribution publicly accessible via GitHub, this code
6464
contribution was reviewed and approved by{' '}
65-
<a href={`/admin/user/${props.data.reviewer.username}`}>
65+
<a href={`/dashboard/admin/user/${props.data.reviewer.username}`}>
6666
{props.data.reviewer.gitAccount}
6767
</a>
6868
. As a reviewer, it was their responsibility to confirm that open sourcing this
@@ -72,7 +72,7 @@ export default function AttestationView(props) {
7272
<DialogContent>
7373
<p>
7474
<span>
75-
<a href={`/admin/user/${props.data.reviewer.username}`}>
75+
<a href={`/dashboard/admin/user/${props.data.reviewer.username}`}>
7676
{props.data.reviewer.gitAccount}
7777
</a>{' '}
7878
approved this contribution{' '}

0 commit comments

Comments
 (0)