Skip to content

Commit

Permalink
Fixed routes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Apr 22, 2022
1 parent 31e96be commit d223253
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 73 deletions.
80 changes: 40 additions & 40 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"private": true,
"homepage": ".",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.3",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-regular-svg-icons": "^5.15.3",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/fontawesome-free": "^6.1.1",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/react-fontawesome": "^0.1.18",
"@rjsf/core": "^4.1.1",
"bootstrap": "^5.1.3",
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/admin/Groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { GroupsList } from './container/GroupsList';

export function Groups() {

let { path } = useRouteMatch();
let { path, url } = useRouteMatch();

return (
<>
Expand All @@ -26,7 +26,7 @@ export function Groups() {
<EditGroup />
} />
<Route path={`${path}`} exact render={
<Redirect to={`${path}/list`} />
<Redirect to={`${url}/list`} />
} />
</Switch>
</>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/admin/Roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { RoleList } from './container/RoleList';

export function Roles() {

let { path } = useRouteMatch();
let { path, url } = useRouteMatch();

return (
<>
Expand All @@ -26,7 +26,7 @@ export function Roles() {
<EditRole />
} />
<Route path={`${path}`} exact render={() =>
<Redirect to={`${path}/list`} />
<Redirect to={`${url}/list`} />
} />
</Switch>
</>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/dashboard/view/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { faSpinner } from '@fortawesome/free-solid-svg-icons';

export function Dashboard () {

const { path } = useRouteMatch();
const { path, url } = useRouteMatch();
const location = useLocation();

const isAdmin = useIsAdmin();
Expand Down Expand Up @@ -97,7 +97,7 @@ export function Dashboard () {
</Nav>
<Switch>
<Route exact path={`${path}`}>
<Redirect to={`${path}/metadata/manager/resolvers`} />
<Redirect to={`${url}/metadata/manager/resolvers`} />
</Route>
<Route path={`${path}/metadata/manager/resolvers`} component={SourcesTab} />
<Route path={`${path}/metadata/manager/providers`} component={ProvidersTab} />
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/metadata/Attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { MetadataAttributeBundleEdit } from './view/MetadataAttributeBundleEdit'

export function Attribute() {

let { path } = useRouteMatch();
let { path, url } = useRouteMatch();

return (
<Switch>
Expand All @@ -37,7 +37,7 @@ export function Attribute() {
<MetadataAttributeBundleEdit />
} />
<Route exact path={`${path}`} render={() =>
<Redirect to={`${path}/list`} />
<Redirect to={`${url}/list`} />
} />
</Switch>
);
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/metadata/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EditFilter } from './view/EditFilter';

export function Filter() {

const { path } = useRouteMatch();
const { path, url } = useRouteMatch();

return (
<Switch>
Expand All @@ -31,7 +31,7 @@ export function Filter() {
</MetadataFilterSelector>
} />
<Route exact path={`${path}/new`} render={() =>
<Redirect to={`${path}/new/common`} />
<Redirect to={`${url}/new/common`} />
} />
</Switch>
);
Expand Down
8 changes: 4 additions & 4 deletions ui/src/app/metadata/Metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { MetadataConfirmRestore } from './view/MetadataConfirmRestore';

export function Metadata () {

let { path } = useRouteMatch();
const { url, path } = useRouteMatch();

return (
<MetadataSelector>
Expand Down Expand Up @@ -57,9 +57,9 @@ export function Metadata () {
<Route path={`${path}/restore/:versionId/:section/edit`} render={() =>
<MetadataRestore />
} />
<Route exact path={`${path}`} render={() =>
<Redirect to={`${path}/configuration/options`} />
} />
{<Route exact path={`${path}`} render={() =>
<Redirect to={`${url}/configuration/options`} />
} />}
</Switch>
</MetadataSchema>
</MetadataXmlLoader>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/metadata/domain/source/component/SourceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function SourceList({ entities, onDelete, onEnable, onChangeGroup
{isAdmin && onChangeGroup &&
<td className="align-middle">
<label htmlFor={`group-${source.serviceProviderName}`} className="sr-only"><Translate value="action.source-group">Group</Translate></label>
<select
<Form.Select
id={`group-${source.id}`}
name={`group-${source.id}`}
className="form-control"
Expand All @@ -92,7 +92,7 @@ export default function SourceList({ entities, onDelete, onEnable, onChangeGroup
{groups.map((g, ridx) => (
<option key={ridx} value={g.resourceId}>{g.name}</option>
))}
</select>
</Form.Select>
</td>
}
{onDelete && isAdmin &&
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/metadata/editor/MetadataEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export function MetadataEditor ({ restore, current, reload }) {

const { type, id, section } = useParams();

console.log(type, id);

const { update, loading } = useMetadataUpdater(`${ API_BASE_PATH }${getMetadataPath(type)}`, current, reload);

const notificationDispatch = useNotificationDispatcher();
Expand Down Expand Up @@ -72,6 +70,8 @@ export function MetadataEditor ({ restore, current, reload }) {

const gotoDetail = (state = null) => {
setBlocking(false);

console.log(`/metadata/${type}/${id}`);
history.push(`/metadata/${type}/${id}`, state);
};

Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/metadata/new/NewSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { faCopy, faLink, faPlusSquare } from '@fortawesome/free-solid-svg-icons'

export function NewSource() {

const { path } = useRouteMatch();
const { path, url } = useRouteMatch();

const [showNav, setShowNav] = React.useState(true);

Expand Down Expand Up @@ -87,7 +87,7 @@ export function NewSource() {
<MetadataCopy onShowNav={ (s) => { setShowNav(s) } } />
} />
<Route exact path={`${path}`} render={() =>
<Redirect to={`${path}/blank`} />
<Redirect to={`${url}/blank`} />
} />
</Switch>
</MetadataSchema>
Expand Down
16 changes: 7 additions & 9 deletions ui/src/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.scss';
import App from './app/App';
import reportWebVitals from './reportWebVitals';
import { createRoot } from 'react-dom/client';

const container = document.getElementById('root');
const root = createRoot(container);

root.render(<App />);

ReactDOM.render(
<React.Fragment>
<App />
</React.Fragment>,
document.getElementById('root')
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
// reportWebVitals();

0 comments on commit d223253

Please sign in to comment.