Skip to content

Commit

Permalink
Merge branch 'w/126.0/bugfix/fix-the-issue-that-new-version-is-not-lo…
Browse files Browse the repository at this point in the history
…aded-after-upgrade' into tmp/octopus/q/126.0
  • Loading branch information
bert-e committed Sep 14, 2023
2 parents b1f81ed + be48dc0 commit 138a4d8
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 24 deletions.
2 changes: 1 addition & 1 deletion shell-ui/index-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="preload" as="script" href="{{this}}" />
{{/each}}
<title>Document</title>
<script language="javascript">window.shellUIRemoteEntryUrl = "/shell/remoteEntry.js?" + Date.now();</script>
<script language="javascript">window.shellUIRemoteEntryUrl = "/shell/remoteEntry.js?version={{htmlWebpackPlugin.options.version}}"</script>
</head>
<body>
<div id="app"></div>
Expand Down
36 changes: 18 additions & 18 deletions shell-ui/src/initFederation/ConfigurationProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,30 +280,30 @@ export const ConfigurationProvider = ({
queryKey: `${ui.name}.${ui.kind}.${ui.version}-buildtime-WebFinger`,
refetchOnWindowFocus: false,
queryFn: () => {
return fetch(`${ui.url}/.well-known/micro-app-configuration`).then(
(r) => {
if (r.ok) {
return r.json();
} else {
return Promise.reject();
}
},
);
return fetch(
`${ui.url}/.well-known/micro-app-configuration?version=${ui.version}`,
).then((r) => {
if (r.ok) {
return r.json();
} else {
return Promise.reject();
}
});
},
},
{
queryKey: `${ui.name}.${ui.kind}.${ui.version}-runtime-WebFinger`,
refetchOnWindowFocus: false,
queryFn: () => {
return fetch(`${ui.url}/.well-known/runtime-app-configuration`).then(
(r) => {
if (r.ok) {
return r.json();
} else {
return Promise.reject();
}
},
);
return fetch(
`${ui.url}/.well-known/runtime-app-configuration?version=${ui.version}`,
).then((r) => {
if (r.ok) {
return r.json();
} else {
return Promise.reject();
}
});
},
},
]),
Expand Down
2 changes: 1 addition & 1 deletion shell-ui/src/initFederation/UIListProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const UIListProvider = ({
const { status, data } = useQuery(
'discoveredUIs',
() => {
return fetch(discoveryURL).then((r) => {
return fetch(discoveryURL, { cache: 'no-cache' }).then((r) => {
if (r.ok) {
return r.json();
} else {
Expand Down
5 changes: 4 additions & 1 deletion shell-ui/src/navbar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ export const useNavbarLinksToActions = (
},
};
const remoteEntryUrl = link.view.isFederated
? link.view.app.url + microAppConfiguration.spec.remoteEntryPath
? link.view.app.url +
microAppConfiguration.spec.remoteEntryPath +
'?version=' +
link.view.app.version
: '';
prefetch(remoteEntryUrl).catch((e) =>
console.error(`Failed to preload ${remoteEntryUrl}`, e),
Expand Down
2 changes: 2 additions & 0 deletions shell-ui/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const deps = require('./package.json').dependencies;
module.exports = {
entry: './src/index.tsx',
output: {
filename: '[name].[contenthash].js',
path: path.resolve(__dirname, 'build'),
publicPath: '/shell/',
},
Expand Down Expand Up @@ -172,6 +173,7 @@ module.exports = {
},
}),
new HtmlWebPackPlugin({
version: new Date().getTime(),
template: '!!handlebars-loader!./index-template.html',
filename: './index.html',
excludeChunks: ['shell'],
Expand Down
6 changes: 4 additions & 2 deletions ui/src/containers/AlertProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { useIntl } from 'react-intl';
import { useTypedSelector } from '../hooks';
import { ErrorBoundary } from 'react-error-boundary';
import type { FilterLabels, Alert } from '../services/alertUtils';
import { ErrorPage500 } from '@scality/core-ui';
Expand All @@ -10,10 +9,13 @@ import {
} from '@scality/module-federation';
import { STATUS_HEALTH } from '../constants';
import { useConfig } from '../FederableApp';
import { QueryObserverResult } from 'react-query';
export type Status = 'healthy' | 'warning' | 'critical';

const alertGlobal = {};
export const useAlerts = (filters: FilterLabels): { alerts: Alert[] } => {
export const useAlerts = (
filters: FilterLabels,
): Omit<QueryObserverResult<Alert[]>, 'data'> & { alerts?: Alert[] } => {
return alertGlobal.hooks.useAlerts(filters);
};
export const useHighestSeverityAlerts = (filters: FilterLabels) => {
Expand Down
2 changes: 1 addition & 1 deletion ui/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = (env) => ({
metalk8s_ui: './src/index.ts',
},
output: {
filename: 'static/js/[name].js',
filename: 'static/js/[name].[contenthash].js',
path: path.resolve(__dirname, 'build'),
publicPath: '/',
},
Expand Down

0 comments on commit 138a4d8

Please sign in to comment.