Skip to content

Commit

Permalink
SHIBUI-2552: Maintenance root context UI fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis authored and credman committed Apr 1, 2023
1 parent 9f278dd commit 7f833b9
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Shibboleth IDP UI</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/">
<base href="%PUBLIC_URL%/">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/png" sizes="96x96" href="assets/favicon-96x96.png">
</head>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function App() {
<Contention>
<UserConfirmation>
{(message, confirm, confirmCallback, setConfirm, getConfirmation) =>
<Router getUserConfirmation={getConfirmation} basename={BASE_PATH}>
<Router getUserConfirmation={getConfirmation} basename={`/${BASE_PATH}`}>
<ConfirmWindow message={message} confirm={confirm} confirmCallback={confirmCallback} setConfirm={setConfirm} />
<QueryParamProvider ReactRouterRoute={Route}>
<Header />
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/core/components/VersionInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function VersionInfo () {
'mode':'no-cors'
}
}
const { data = {} } = useFetch(`${ACTUATOR_PATH}/info`, opts, []);
const { data = {} } = useFetch(`${ACTUATOR_PATH}info`, opts, []);

const [ versionData, setVersionData ] = React.useState('');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { defaultsDeep } from "lodash";
import { BASE_PATH } from '../../../App.constant';

export const AttributeBundleDefinition = {
label: 'Metadata Attribute Bundle',
type: '@MetadataAttributeBundle',
steps: [],
schema: `/assets/schema/attribute/bundle.schema.json`,
schema: `${BASE_PATH}assets/schema/attribute/bundle.schema.json`,

uiSchema: {
attributes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function MetadataFilterConfigurationListItem ({ filter, isLast, isFirst,

const definition = React.useMemo(() => getDefinition(filter['@type'], ), [filter]);

const { get, response } = useFetch(`${BASE_PATH}`);
const { get, response } = useFetch(``);

const [schema, setSchema] = React.useState();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export const FileBackedHttpMetadataProviderWizard = {

export const FileBackedHttpMetadataProviderEditor = {
...FileBackedHttpMetadataProviderWizard,
schema: 'assets/schema/provider/filebacked-http.schema.json',
schema: `${BASE_PATH}assets/schema/provider/filebacked-http.schema.json`,
steps: [
{
id: 'common',
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/store/baseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import API_BASE_PATH from '../App.constant';
import { get_cookie } from '../core/utility/get_cookie';

export const getBaseQuery = (config = {}) => fetchBaseQuery({
baseUrl: `${API_BASE_PATH}`,
baseUrl: `/${API_BASE_PATH}`,
prepareHeaders: (headers) => {
const token = get_cookie('XSRF-TOKEN');

Expand Down
21 changes: 13 additions & 8 deletions ui/src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ module.exports = function (app) {

const port = 8080;

const context = process.env.PUBLIC_URL;
const rewriteFn = function (path, req) {
return path.replace(context, '');
};

app.use(
'/api',
`${context}/api`,
createProxyMiddleware({
target: `http://localhost:${port}`,
target: `http://localhost:${port}${context}/`,
changeOrigin: true,
onProxyRes: function (proxyRes, req, res) {
proxyRes.headers['Access-Control-Allow-Origin'] = '*';
Expand All @@ -17,25 +22,25 @@ module.exports = function (app) {
);

app.use(
'/actuator',
`${context}/actuator`,
createProxyMiddleware({
target: `http://localhost:${port}`,
target: `http://localhost:${port}${context}/`,
changeOrigin: true
})
);

app.use(
'/login',
`${context}/login`,
createProxyMiddleware({
target: `http://localhost:${port}`,
target: `http://localhost:${port}${context}/`,
changeOrigin: true
})
);

app.use(
'/logout',
`${context}/logout`,
createProxyMiddleware({
target: `http://localhost:${port}`,
target: `http://localhost:${port}${context}/`,
changeOrigin: true
})
);
Expand Down

0 comments on commit 7f833b9

Please sign in to comment.