From cc5f76c5df36ae5cb304382ae43c14d949f6a24f Mon Sep 17 00:00:00 2001 From: Edward Brunton <42774600+EdwardBrunton@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:41:25 +0200 Subject: [PATCH 01/10] fix: Rename meetings tab to meeting actions (#815) Co-authored-by: EdwardBrunton --- .changeset/pr-815-2119525784.md | 5 +++++ client/packages/components/src/components/task/Tasks.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/pr-815-2119525784.md diff --git a/.changeset/pr-815-2119525784.md b/.changeset/pr-815-2119525784.md new file mode 100644 index 000000000..91f0f5334 --- /dev/null +++ b/.changeset/pr-815-2119525784.md @@ -0,0 +1,5 @@ + +--- +"fusion-project-portal": patch +--- +Rename meetings tab to meeting actions diff --git a/client/packages/components/src/components/task/Tasks.tsx b/client/packages/components/src/components/task/Tasks.tsx index 988726d97..11b6648f3 100644 --- a/client/packages/components/src/components/task/Tasks.tsx +++ b/client/packages/components/src/components/task/Tasks.tsx @@ -51,7 +51,7 @@ export const Tasks: FC = ({ height }) => { All ({assignments.length}) - Meetings + Meeting Actions {isLoading.meetingsActions ? ( ) : ( From 7e684b8b92cd2eec3216eb535cdc56c411971551 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:33:52 +0200 Subject: [PATCH 02/10] Fusion Project Portal Release (#817) Co-authored-by: EdwardBrunton[bot] --- .changeset/pr-806-2098564848.md | 15 --------------- .changeset/pr-808-2100756531.md | 5 ----- .changeset/pr-815-2119525784.md | 5 ----- .changeset/pr-821-2129413296.md | 5 ----- CHANGELOG.md | 22 ++++++++++++++++++++++ package.json | 2 +- 6 files changed, 23 insertions(+), 31 deletions(-) delete mode 100644 .changeset/pr-806-2098564848.md delete mode 100644 .changeset/pr-808-2100756531.md delete mode 100644 .changeset/pr-815-2119525784.md delete mode 100644 .changeset/pr-821-2129413296.md diff --git a/.changeset/pr-806-2098564848.md b/.changeset/pr-806-2098564848.md deleted file mode 100644 index 26042e71e..000000000 --- a/.changeset/pr-806-2098564848.md +++ /dev/null @@ -1,15 +0,0 @@ - ---- -"fusion-project-portal": major ---- -- BREAKING CHANGE: The previous proxy endpoint: `/bundles/apps/{appKey}/resources/{*resourcePath}` is no more. Instead use `/fusion-apps/{*wildcard*}` to make proxy calls against the whole Fusion Apps API. See Fusion Apps API Swagger documentation for more information about routes. -- Migrated proxy from Fusion Portal to Fusion Apps API -- Updated packages to latest version -- Refactored and simplified code -- Removed unused Project Portal variables in frontend -- Update frontend to use the new proxy endpoints -- Make frontend client use the new types provided by fusion core -- Update the legacy app loader to use the new proxy endpoints and and fix types -- Move legacy app code to apps folder for cleaner repository -- Setup build of legacy app loader in build pipeline for constant build an deployment. -- Update all Fusion dependencies for frontend client diff --git a/.changeset/pr-808-2100756531.md b/.changeset/pr-808-2100756531.md deleted file mode 100644 index 82e3ec560..000000000 --- a/.changeset/pr-808-2100756531.md +++ /dev/null @@ -1,5 +0,0 @@ - ---- -"fusion-project-portal": patch ---- -Fix errors and add data owner on milestones diff --git a/.changeset/pr-815-2119525784.md b/.changeset/pr-815-2119525784.md deleted file mode 100644 index 91f0f5334..000000000 --- a/.changeset/pr-815-2119525784.md +++ /dev/null @@ -1,5 +0,0 @@ - ---- -"fusion-project-portal": patch ---- -Rename meetings tab to meeting actions diff --git a/.changeset/pr-821-2129413296.md b/.changeset/pr-821-2129413296.md deleted file mode 100644 index 606899611..000000000 --- a/.changeset/pr-821-2129413296.md +++ /dev/null @@ -1,5 +0,0 @@ - ---- -"fusion-project-portal": patch ---- -Update api version on meeting actions to the newest version. diff --git a/CHANGELOG.md b/CHANGELOG.md index 47913b4e3..8bedb30c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # fusion-project-portal +## 5.0.0 + +### Major Changes + +- d96ab34: - BREAKING CHANGE: The previous proxy endpoint: `/bundles/apps/{appKey}/resources/{*resourcePath}` is no more. Instead use `/fusion-apps/{*wildcard*}` to make proxy calls against the whole Fusion Apps API. See Fusion Apps API Swagger documentation for more information about routes. + - Migrated proxy from Fusion Portal to Fusion Apps API + - Updated packages to latest version + - Refactored and simplified code + - Removed unused Project Portal variables in frontend + - Update frontend to use the new proxy endpoints + - Make frontend client use the new types provided by fusion core + - Update the legacy app loader to use the new proxy endpoints and and fix types + - Move legacy app code to apps folder for cleaner repository + - Setup build of legacy app loader in build pipeline for constant build an deployment. + - Update all Fusion dependencies for frontend client + +### Patch Changes + +- b3edf8a: Fix errors and add data owner on milestones +- cc5f76c: Rename meetings tab to meeting actions +- 4a4eba3: Update api version on meeting actions to the newest version. + ## 4.1.4 ### Patch Changes diff --git a/package.json b/package.json index 7434f9b5f..2cf11955f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fusion-project-portal", - "version": "4.1.4", + "version": "5.0.0", "license": "MIT", "description": "Project Portal powered by Fusion", "devDependencies": { From 0d4055d8a9d2b3e125923afaa4220110e8e1edb6 Mon Sep 17 00:00:00 2001 From: Christopher Berge Hove Date: Tue, 22 Oct 2024 08:10:39 +0200 Subject: [PATCH 03/10] chore: Update app.config.ts and package.json in legacyAppLoader (#822) Co-authored-by: Noggling --- .changeset/pr-822-2137562008.md | 7 +++ client/.gitignore | 1 + client/apps/legacyAppLoader/app.config.ts | 44 +++++++------ client/apps/legacyAppLoader/package.json | 2 +- client/apps/legacyAppLoader/src/config.ts | 4 +- .../components/LegacyAppLoader.tsx | 45 ------------- .../components/LegacyAppWrapper.tsx | 63 ------------------- .../components/LegacyWrapper.tsx | 23 ------- .../core/src/app/hooks/use-app-loader.ts | 7 ++- 9 files changed, 36 insertions(+), 160 deletions(-) create mode 100644 .changeset/pr-822-2137562008.md delete mode 100644 client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyAppLoader.tsx delete mode 100644 client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyAppWrapper.tsx delete mode 100644 client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyWrapper.tsx diff --git a/.changeset/pr-822-2137562008.md b/.changeset/pr-822-2137562008.md new file mode 100644 index 000000000..5d1b0c1e8 --- /dev/null +++ b/.changeset/pr-822-2137562008.md @@ -0,0 +1,7 @@ + +--- +"fusion-project-portal": patch +--- +- Remove unused import and code in app.config.ts +- Update dev:appLoader script in package.json +- Remove unused components in legacyAppLoader diff --git a/client/.gitignore b/client/.gitignore index 1984de817..852101131 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -5,6 +5,7 @@ /tmp /out-tsc dist +appLegacyLoader.js # dependencies node_modules diff --git a/client/apps/legacyAppLoader/app.config.ts b/client/apps/legacyAppLoader/app.config.ts index fd7c03e5d..d8e0db361 100644 --- a/client/apps/legacyAppLoader/app.config.ts +++ b/client/apps/legacyAppLoader/app.config.ts @@ -1,24 +1,22 @@ -import { mergeAppConfigs, defineAppConfig } from '@equinor/fusion-framework-cli'; -export default defineAppConfig((_env, { base }) => - mergeAppConfigs( - {}, - { - environment: { - endpoints: { - client: { - baseUri: 'https://backend-fusion-project-portal-test.radix.equinor.com', - defaultScopes: ['api://02f3484c-cad0-4d1d-853d-3a9e604b38f3/access_as_user'], - }, - portal: { - baseUri: 'https://fusion-s-portal-ci.azurewebsites.net', - defaultScopes: ['5a842df8-3238-415d-b168-9f16a6a6031b/.default'], - }, - }, - fusionEnv: 'ci', - loadingText: 'Loading', - appKey: 'handover-garden', - basename: 'localhost:3000/apps/handover-garden/', +import { defineAppConfig } from '@equinor/fusion-framework-cli'; +export default defineAppConfig((_env) => ({ + environment: { + endpoints: { + client: { + baseUri: 'https://backend-fusion-project-portal-test.radix.equinor.com', + defaultScopes: ['api://02f3484c-cad0-4d1d-853d-3a9e604b38f3/access_as_user'], }, - } - ) -); + portal: { + baseUri: 'https://fusion-s-portal-ci.azurewebsites.net', + defaultScopes: ['5a842df8-3238-415d-b168-9f16a6a6031b/.default'], + }, + apps: { + defaultScopes: ['5a842df8-3238-415d-b168-9f16a6a6031b/.default'], + }, + }, + fusionEnv: 'ci', + loadingText: 'Loading', + appKey: 'project-control-and-analysis', + basename: 'localhost:3000/apps/project-control-and-analysis/', + }, +})); diff --git a/client/apps/legacyAppLoader/package.json b/client/apps/legacyAppLoader/package.json index 4b4bba320..046450b84 100644 --- a/client/apps/legacyAppLoader/package.json +++ b/client/apps/legacyAppLoader/package.json @@ -8,7 +8,7 @@ "prebuild": "rm -f ../../packages/portal-client/src/assets/appLegacyLoader.js", "build:appLoader": "fusion-framework-cli app build && mv ./dist/app-bundle.js ../../packages/portal-client/src/assets/appLegacyLoader.js", "build:resources": "tsc && vite build", - "dev:appLoader": "fusion-framework-cli app dev -c vite.config.js", + "dev:appLoader": "fusion-framework-cli app dev", "docker": "cd .. && sh docker-script.sh app-react", "update:fusion": "ncu -i -f /fusion/" }, diff --git a/client/apps/legacyAppLoader/src/config.ts b/client/apps/legacyAppLoader/src/config.ts index 42ed3642e..2576f6d7a 100644 --- a/client/apps/legacyAppLoader/src/config.ts +++ b/client/apps/legacyAppLoader/src/config.ts @@ -13,7 +13,7 @@ interface Client { export const configure: AppModuleInitiator< [NavigationModule], Fusion, - { config: { environment: { endpoints: { client: Client; portal: Client; fusion: Client } } } } + { config: { environment: { endpoints: { client: Client; portal: Client; apps: Client } } } } > = (configurator, { env, fusion }) => { configurator.configureHttpClient('portal-client', env.config?.environment.endpoints.client); configurator.configureHttpClient('portal', env.config?.environment.endpoints.portal); @@ -22,7 +22,7 @@ export const configure: AppModuleInitiator< // configurator.logger.level = 4; configurator.configureHttpClient('app', { baseUri: new URL('/apps-proxy/', location.origin).href, - defaultScopes: env.config?.environment.endpoints.fusion.defaultScopes, + defaultScopes: env.config?.environment.endpoints.apps.defaultScopes, }); enableAppModule(configurator); diff --git a/client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyAppLoader.tsx b/client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyAppLoader.tsx deleted file mode 100644 index 1e9097b84..000000000 --- a/client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyAppLoader.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { lazy } from 'react'; -import AppWrapperLegacy, { getLegacyFusion } from './LegacyAppWrapper'; - -import { AppConfig } from '@equinor/fusion-framework-module-app'; -import { AppManifest as LegacyAppManifest } from '@equinor/fusion'; - -import LegacyAppContainer from '../legacy-interopt/LegacyAppContainer'; -import { MessagePage } from './MessagePage'; -export type LegacyEnv = { - basename: string; - config: AppConfig; - manifest: LegacyAppManifest; -}; - -export const createLegacyAppLoader = (appKey: string) => - lazy(async () => { - const appContainer = getLegacyFusion().app.container as LegacyAppContainer; - const [basename] = window.location.pathname.match(/\/?apps\/[a-z|-]+\//) ?? ['']; - - if (Object.keys(appContainer.allApps).length === 0) { - await appContainer.getAllAsync(); - } - - const config = await appContainer.setCurrentAppAsync(appKey); - - if (!config) { - return { - default: () => , - }; - } - - const env = { - basename, - config, - manifest: { ...appContainer.currentApp } as LegacyAppManifest, - }; - - return { - default: () => ( - <> - - - ), - }; - }); diff --git a/client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyAppWrapper.tsx b/client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyAppWrapper.tsx deleted file mode 100644 index dce0449d9..000000000 --- a/client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyAppWrapper.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { Suspense, useMemo } from 'react'; - -import { useFramework } from '@equinor/fusion-framework-react'; - -import { GLOBAL_FUSION_CONTEXT_KEY } from '../legacy-interopt/static'; -import { createLegacyRender } from '../legacy-interopt'; - -import { MessagePage } from './MessagePage'; -import { ProgressLoader } from './ProgressLoader'; - -import { LegacyEnv } from './LegacyAppLoader'; - -const DEBUG_LOG = false; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore -export const getLegacyFusion = () => window[GLOBAL_FUSION_CONTEXT_KEY]; -/** - * Legacy wrapper element - * this should be removed in future when applications are moved over to ESM - */ - -export const AppWrapperLegacy = (props: { appKey: string; env: LegacyEnv }): JSX.Element => { - const { appKey, env } = props; - const fusion = useFramework(); - const legacyFusion = getLegacyFusion(); - const manifest = getLegacyFusion().app.container.get(appKey) || null; - - const AppComponent = useMemo(() => { - if (!manifest) { - console.warn('🌍❗️ Portal Legacy:', 'missing application manifest'); - return null; - } - - /** sanity check if the `registerApp` has been loaded */ - if (!manifest.render && !manifest.AppComponent) { - DEBUG_LOG && - console.warn('🌍❗️ Portal Legacy:', 'no render or component, make sure app script is loading'); - return null; - } - - DEBUG_LOG && console.debug('🌍 Portal:', 'creating application component', manifest); - - const render = manifest.render ?? createLegacyRender(manifest, legacyFusion); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return render(fusion, env); - }, [fusion, legacyFusion, manifest, env]); - - if (!AppComponent) { - return ( - -

Failed to render application, missing app component

-
- ); - } - return ( - }> - - - ); -}; - -export default AppWrapperLegacy; diff --git a/client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyWrapper.tsx b/client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyWrapper.tsx deleted file mode 100644 index 86014e963..000000000 --- a/client/apps/legacyAppLoader/src/fusion-app-loader/components/LegacyWrapper.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { useFramework } from '@equinor/fusion-framework-react'; -import { PropsWithChildren } from 'react'; - -import { AppModule } from '@equinor/fusion-framework-module-app'; -import { NavigationModule } from '@equinor/fusion-framework-module-navigation'; -import { LegacyFusionWrapper } from '../legacy-interopt/components'; -import { useAppModules } from '@equinor/fusion-framework-react-app'; -import { ProgressLoader } from './ProgressLoader'; - -export const LegacyWrapper = ({ children }: PropsWithChildren) => { - const framework = useFramework<[AppModule, NavigationModule]>(); - const appFramework = useAppModules<[AppModule]>(); - - return ( - } - appFramework={appFramework} - > - {children} - - ); -}; diff --git a/client/packages/core/src/app/hooks/use-app-loader.ts b/client/packages/core/src/app/hooks/use-app-loader.ts index f69988650..bf02c7a53 100644 --- a/client/packages/core/src/app/hooks/use-app-loader.ts +++ b/client/packages/core/src/app/hooks/use-app-loader.ts @@ -53,11 +53,11 @@ export const useAppLoader = (appKey: string) => { environment: { appKey, env: getFusionLegacyEnvIdentifier(), - loadingText: 'Loading', endpoints: { client: getLegacyClientConfig(), - fusion: getLegacyFusionConfig(), + portal: getLegacyFusionConfig(), + apps: getLegacyFusionConfig(), }, }, } as AppConfig< @@ -67,7 +67,8 @@ export const useAppLoader = (appKey: string) => { loadingText: string; endpoints: { client: Client; - fusion: Client; + portal: Client; + apps: Client; }; } >, From a59d1b50692b705200b1fb69d121be8fa3d3b630 Mon Sep 17 00:00:00 2001 From: Christopher Berge Hove Date: Tue, 22 Oct 2024 08:12:28 +0200 Subject: [PATCH 04/10] Fix/fixing errors (#824) Co-authored-by: Noggling --- .changeset/pr-824-2137572195.md | 5 +++++ .../components/milestones/Milestones.tsx | 12 ++++++++---- client/packages/portal-ui/src/header/Icon.tsx | 8 ++++---- 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 .changeset/pr-824-2137572195.md diff --git a/.changeset/pr-824-2137572195.md b/.changeset/pr-824-2137572195.md new file mode 100644 index 000000000..24e1368e2 --- /dev/null +++ b/.changeset/pr-824-2137572195.md @@ -0,0 +1,5 @@ + +--- +"fusion-project-portal": patch +--- +fixing icon error and waring of div inside table diff --git a/client/packages/portal-pages/src/pages/project-page/components/milestones/Milestones.tsx b/client/packages/portal-pages/src/pages/project-page/components/milestones/Milestones.tsx index 182f5c535..3991251a2 100644 --- a/client/packages/portal-pages/src/pages/project-page/components/milestones/Milestones.tsx +++ b/client/packages/portal-pages/src/pages/project-page/components/milestones/Milestones.tsx @@ -106,10 +106,14 @@ export const Milestones = () => { ); }) ) : ( - + + + + + )} diff --git a/client/packages/portal-ui/src/header/Icon.tsx b/client/packages/portal-ui/src/header/Icon.tsx index 892c13371..44ae1361b 100644 --- a/client/packages/portal-ui/src/header/Icon.tsx +++ b/client/packages/portal-ui/src/header/Icon.tsx @@ -17,8 +17,8 @@ export function PortalIcon({ icon }: { icon?: string }) { gradientUnits="userSpaceOnUse" gradientTransform="matrix(-13.5478 9.01983 -12.9578 -13.5478 18.0677 6.77391)" > - - + + - - + + Date: Tue, 22 Oct 2024 09:38:02 +0200 Subject: [PATCH 05/10] chore: Refactor LegacyFusionWrapper and create-fusion-context (#825) Co-authored-by: Noggling --- .changeset/pr-825-2137703982.md | 3 + .../components/LegacyFusionWrapper.tsx | 1 - .../legacy-interopt/create-fusion-context.ts | 395 +++++++++--------- .../create-service-resolver.ts | 2 +- 4 files changed, 191 insertions(+), 210 deletions(-) create mode 100644 .changeset/pr-825-2137703982.md diff --git a/.changeset/pr-825-2137703982.md b/.changeset/pr-825-2137703982.md new file mode 100644 index 000000000..017b123fe --- /dev/null +++ b/.changeset/pr-825-2137703982.md @@ -0,0 +1,3 @@ + +--- +--- diff --git a/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/components/LegacyFusionWrapper.tsx b/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/components/LegacyFusionWrapper.tsx index 56069b986..99c8d87ed 100644 --- a/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/components/LegacyFusionWrapper.tsx +++ b/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/components/LegacyFusionWrapper.tsx @@ -41,7 +41,6 @@ export const LegacyFusionWrapper = (props: PropsWithChildren diff --git a/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/create-fusion-context.ts b/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/create-fusion-context.ts index a5bbf8255..cd0caae76 100644 --- a/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/create-fusion-context.ts +++ b/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/create-fusion-context.ts @@ -1,217 +1,196 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ import { - createApiClients, - ResourceCache, - EventHub, - HttpClient, - AbortControllerManager, - createResourceCollections, - TelemetryLogger, - FeatureLogger, - SettingsContainer, - ComponentDisplayType, - AppContainer, - TasksContainer, - NotificationCenter, - PeopleContainer, - UserMenuContainer, - FusionContextRefs, - IFusionContext, -} from "@equinor/fusion"; -import { appContainerFactory } from "@equinor/fusion/lib/app/AppContainer"; - -import { NavigationUpdate } from "@equinor/fusion-framework-module-navigation"; - -import { LegacyAppContainer } from "./LegacyAppContainer"; -import { LegacyAuthContainer } from "./LegacyAuthContainer"; - -import createServiceResolver from "./create-service-resolver"; -import type { PortalFramework } from "./types"; -import legacySignIn from "./legacy-api-signin"; -import LegacyContextManager from "./LegacyContextManager"; - -import { GLOBAL_FUSION_CONTEXT_KEY } from "./static"; - -import { AppModule } from "@equinor/fusion-framework-module-app"; -import { AppModulesInstance } from "@equinor/fusion-framework-react-app"; + createApiClients, + ResourceCache, + EventHub, + HttpClient, + AbortControllerManager, + createResourceCollections, + TelemetryLogger, + FeatureLogger, + SettingsContainer, + ComponentDisplayType, + AppContainer, + TasksContainer, + NotificationCenter, + PeopleContainer, + UserMenuContainer, + FusionContextRefs, + IFusionContext, +} from '@equinor/fusion'; +import { appContainerFactory } from '@equinor/fusion/lib/app/AppContainer'; + +import { NavigationUpdate } from '@equinor/fusion-framework-module-navigation'; + +import { LegacyAppContainer } from './LegacyAppContainer'; +import { LegacyAuthContainer } from './LegacyAuthContainer'; + +import createServiceResolver from './create-service-resolver'; +import type { PortalFramework } from './types'; +import legacySignIn from './legacy-api-signin'; +import LegacyContextManager from './LegacyContextManager'; + +import { GLOBAL_FUSION_CONTEXT_KEY } from './static'; + +import { AppModule } from '@equinor/fusion-framework-module-app'; +import { AppModulesInstance } from '@equinor/fusion-framework-react-app'; export type FusionContextOptions = { - loadBundlesFromDisk: boolean; - environment?: { - env: string; - pullRequest?: string; - }; - telemetry?: { - instrumentationKey: string; - }; + loadBundlesFromDisk: boolean; + environment?: { + env: string; + pullRequest?: string; + clientId?: string; + }; + telemetry?: { + instrumentationKey: string; + }; }; export const createFusionContext = async (args: { - framework: PortalFramework; - refs: FusionContextRefs; - options?: FusionContextOptions; - appFramework: AppModulesInstance<[AppModule]>; + framework: PortalFramework; + refs: FusionContextRefs; + options?: FusionContextOptions; + appFramework: AppModulesInstance<[AppModule]>; }): Promise => { - const { framework, refs, options, appFramework } = args; - - const { - environment = { env: "ci" }, - loadBundlesFromDisk = false, - telemetry, - } = options ?? {}; - - const authContainer = new LegacyAuthContainer({ - auth: framework.modules.auth, - }); - - const telemetryLogger = new TelemetryLogger( - telemetry?.instrumentationKey ?? "", - authContainer - ); - - const abortControllerManager = new AbortControllerManager(new EventHub()); - - const { serviceDiscovery } = framework.modules; - if (!serviceDiscovery) { - throw Error("missing module for service discovery"); - } - const serviceResolver = await createServiceResolver( - serviceDiscovery, - authContainer - ); - - const resourceCollections = createResourceCollections(serviceResolver, { - loadBundlesFromDisk, - environment, - }); - - const resourceCache = new ResourceCache(new EventHub()); - - const httpClient = new HttpClient( - authContainer, - resourceCache, - abortControllerManager, - telemetryLogger, - new EventHub() - ); - - const apiClients = createApiClients( - httpClient, - resourceCollections, - serviceResolver - ); - - const featureLogger = new FeatureLogger(apiClients, new EventHub()); - - const history = framework.modules.navigation.navigator; - - const historyListenFn = history.listen.bind(history); - - /** - * TODO - write what this wrapper does!? - */ - // @ts-ignore - history.listen = ( - cb: ( - eventOrLocation: NavigationUpdate | NavigationUpdate["location"], - action?: NavigationUpdate["action"] - ) => void - ) => { - return historyListenFn((e: NavigationUpdate) => { - const event = new Proxy(e, { - get(target, p) { - // eslint-disable-next-line default-case - switch (p) { - case "action": - return target.action; - - case "location": - return target.location; - - case "state": - case "hash": - case "key": - case "search": - case "pathname": - // @ts-ignore - return target.location[p]; - } - }, - }); - cb(event, e.action); - }); - }; - - const coreSettings = new SettingsContainer( - "core", - authContainer.getCachedUser(), - new EventHub(), - { - componentDisplayType: ComponentDisplayType.Comfortable, - } - ); - - const appContainer = new LegacyAppContainer({ - framework, - eventHub: new EventHub(), - featureLogger, - telemetryLogger, - appModules: appFramework, - }) as unknown as AppContainer; - - appContainerFactory(appContainer); - - // @ts-ignore - const contextManager = new LegacyContextManager({ - featureLogger, - framework, - history: history as unknown as History, - }); - - const tasksContainer = new TasksContainer(apiClients, new EventHub()); - const notificationCenter = new NotificationCenter(new EventHub(), apiClients); - const peopleContainer = new PeopleContainer( - apiClients, - resourceCollections, - new EventHub() - ); - const userMenuSectionsContainer = new UserMenuContainer(new EventHub()); - - const fusionContext = { - auth: { container: authContainer }, - http: { - client: httpClient, - resourceCollections, - apiClients, - resourceCache, - serviceResolver, - }, - refs, - history, - settings: { - core: coreSettings, - apps: {}, - }, - app: { - container: appContainer, - }, - contextManager, - tasksContainer, - abortControllerManager, - notificationCenter, - peopleContainer, - userMenuSectionsContainer, - environment, - logging: { - telemetry: telemetryLogger, - feature: featureLogger, - }, - options: { environment }, - }; - // @ts-ignore - window[GLOBAL_FUSION_CONTEXT_KEY] = fusionContext; - - await legacySignIn(framework); - - return fusionContext as unknown as IFusionContext; + const { framework, refs, options, appFramework } = args; + + const { environment = { env: 'ci' }, loadBundlesFromDisk = false, telemetry } = options ?? {}; + + const authContainer = new LegacyAuthContainer({ + auth: framework.modules.auth, + }); + + const telemetryLogger = new TelemetryLogger(telemetry?.instrumentationKey ?? '', authContainer); + + const abortControllerManager = new AbortControllerManager(new EventHub()); + + const { serviceDiscovery } = framework.modules; + if (!serviceDiscovery) { + throw Error('missing module for service discovery'); + } + + const serviceResolver = await createServiceResolver(serviceDiscovery, authContainer, window.clientId); + + const resourceCollections = createResourceCollections(serviceResolver, { + loadBundlesFromDisk, + environment, + }); + + const resourceCache = new ResourceCache(new EventHub()); + + const httpClient = new HttpClient( + authContainer, + resourceCache, + abortControllerManager, + telemetryLogger, + new EventHub() + ); + + const apiClients = createApiClients(httpClient, resourceCollections, serviceResolver); + + const featureLogger = new FeatureLogger(apiClients, new EventHub()); + + const history = framework.modules.navigation.navigator; + + const historyListenFn = history.listen.bind(history); + + /** + * TODO - write what this wrapper does!? + */ + // @ts-ignore + history.listen = ( + cb: ( + eventOrLocation: NavigationUpdate | NavigationUpdate['location'], + action?: NavigationUpdate['action'] + ) => void + ) => { + return historyListenFn((e: NavigationUpdate) => { + const event = new Proxy(e, { + get(target, p) { + // eslint-disable-next-line default-case + switch (p) { + case 'action': + return target.action; + + case 'location': + return target.location; + + case 'state': + case 'hash': + case 'key': + case 'search': + case 'pathname': + // @ts-ignore + return target.location[p]; + } + }, + }); + cb(event, e.action); + }); + }; + + const coreSettings = new SettingsContainer('core', authContainer.getCachedUser(), new EventHub(), { + componentDisplayType: ComponentDisplayType.Comfortable, + }); + + const appContainer = new LegacyAppContainer({ + framework, + eventHub: new EventHub(), + featureLogger, + telemetryLogger, + appModules: appFramework, + }) as unknown as AppContainer; + + appContainerFactory(appContainer); + + // @ts-ignore + const contextManager = new LegacyContextManager({ + featureLogger, + framework, + history: history as unknown as History, + }); + + const tasksContainer = new TasksContainer(apiClients, new EventHub()); + const notificationCenter = new NotificationCenter(new EventHub(), apiClients); + const peopleContainer = new PeopleContainer(apiClients, resourceCollections, new EventHub()); + const userMenuSectionsContainer = new UserMenuContainer(new EventHub()); + + const fusionContext = { + auth: { container: authContainer }, + http: { + client: httpClient, + resourceCollections, + apiClients, + resourceCache, + serviceResolver, + }, + refs, + history, + settings: { + core: coreSettings, + apps: {}, + }, + app: { + container: appContainer, + }, + contextManager, + tasksContainer, + abortControllerManager, + notificationCenter, + peopleContainer, + userMenuSectionsContainer, + environment, + logging: { + telemetry: telemetryLogger, + feature: featureLogger, + }, + options: { environment }, + }; + // @ts-ignore + window[GLOBAL_FUSION_CONTEXT_KEY] = fusionContext; + + await legacySignIn(framework); + + return fusionContext as unknown as IFusionContext; }; diff --git a/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/create-service-resolver.ts b/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/create-service-resolver.ts index d3a141853..8fe9599d7 100644 --- a/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/create-service-resolver.ts +++ b/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/create-service-resolver.ts @@ -4,7 +4,7 @@ import { PortalFramework } from './types'; export const createServiceResolver = async ( provider: PortalFramework['modules']['serviceDiscovery'], authContainer: LegacyAuthContainer, - clientId: string = window.clientId + clientId: string ) => { const services = await provider.resolveServices().then((services) => services.reduce((acc, service) => { From 19f98d8df865068b340b2cfe26c5474da5047716 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:48:43 +0200 Subject: [PATCH 06/10] Fusion Project Portal Release (#823) Co-authored-by: Noggling[bot] --- .changeset/pr-822-2137562008.md | 7 ------- .changeset/pr-824-2137572195.md | 5 ----- .changeset/pr-825-2137703982.md | 3 --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 5 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 .changeset/pr-822-2137562008.md delete mode 100644 .changeset/pr-824-2137572195.md delete mode 100644 .changeset/pr-825-2137703982.md diff --git a/.changeset/pr-822-2137562008.md b/.changeset/pr-822-2137562008.md deleted file mode 100644 index 5d1b0c1e8..000000000 --- a/.changeset/pr-822-2137562008.md +++ /dev/null @@ -1,7 +0,0 @@ - ---- -"fusion-project-portal": patch ---- -- Remove unused import and code in app.config.ts -- Update dev:appLoader script in package.json -- Remove unused components in legacyAppLoader diff --git a/.changeset/pr-824-2137572195.md b/.changeset/pr-824-2137572195.md deleted file mode 100644 index 24e1368e2..000000000 --- a/.changeset/pr-824-2137572195.md +++ /dev/null @@ -1,5 +0,0 @@ - ---- -"fusion-project-portal": patch ---- -fixing icon error and waring of div inside table diff --git a/.changeset/pr-825-2137703982.md b/.changeset/pr-825-2137703982.md deleted file mode 100644 index 017b123fe..000000000 --- a/.changeset/pr-825-2137703982.md +++ /dev/null @@ -1,3 +0,0 @@ - ---- ---- diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bedb30c5..887dd7bfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # fusion-project-portal +## 5.0.1 + +### Patch Changes + +- 0d4055d: - Remove unused import and code in app.config.ts + - Update dev:appLoader script in package.json + - Remove unused components in legacyAppLoader +- a59d1b5: fixing icon error and waring of div inside table + ## 5.0.0 ### Major Changes diff --git a/package.json b/package.json index 2cf11955f..527205e45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fusion-project-portal", - "version": "5.0.0", + "version": "5.0.1", "license": "MIT", "description": "Project Portal powered by Fusion", "devDependencies": { From c9b0ad586fd329cd402fe2f074bc28c055c5bd18 Mon Sep 17 00:00:00 2001 From: Christopher Berge Hove Date: Tue, 22 Oct 2024 10:04:06 +0200 Subject: [PATCH 07/10] fix: providing the right env key to appLoader (#826) Co-authored-by: Noggling --- .changeset/pr-826-2137768494.md | 5 +++++ client/packages/core/src/app/hooks/use-app-loader.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/pr-826-2137768494.md diff --git a/.changeset/pr-826-2137768494.md b/.changeset/pr-826-2137768494.md new file mode 100644 index 000000000..b29bc4fb7 --- /dev/null +++ b/.changeset/pr-826-2137768494.md @@ -0,0 +1,5 @@ + +--- +"fusion-project-portal": patch +--- +providing the right env key to appLoader diff --git a/client/packages/core/src/app/hooks/use-app-loader.ts b/client/packages/core/src/app/hooks/use-app-loader.ts index bf02c7a53..28d768041 100644 --- a/client/packages/core/src/app/hooks/use-app-loader.ts +++ b/client/packages/core/src/app/hooks/use-app-loader.ts @@ -52,7 +52,7 @@ export const useAppLoader = (appKey: string) => { ...config, environment: { appKey, - env: getFusionLegacyEnvIdentifier(), + fusionEnv: getFusionLegacyEnvIdentifier(), loadingText: 'Loading', endpoints: { client: getLegacyClientConfig(), @@ -63,7 +63,7 @@ export const useAppLoader = (appKey: string) => { } as AppConfig< ConfigEnvironment & { appKey: string; - env: string; + fusionEnv: string; loadingText: string; endpoints: { client: Client; From 7a89ae30103e4b07fb9e73de6b68de17f1d2a823 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 10:17:59 +0200 Subject: [PATCH 08/10] Fusion Project Portal Release (#827) Co-authored-by: Noggling[bot] --- .changeset/pr-826-2137768494.md | 5 ----- CHANGELOG.md | 6 ++++++ package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/pr-826-2137768494.md diff --git a/.changeset/pr-826-2137768494.md b/.changeset/pr-826-2137768494.md deleted file mode 100644 index b29bc4fb7..000000000 --- a/.changeset/pr-826-2137768494.md +++ /dev/null @@ -1,5 +0,0 @@ - ---- -"fusion-project-portal": patch ---- -providing the right env key to appLoader diff --git a/CHANGELOG.md b/CHANGELOG.md index 887dd7bfe..a31bf2b3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # fusion-project-portal +## 5.0.2 + +### Patch Changes + +- c9b0ad5: providing the right env key to appLoader + ## 5.0.1 ### Patch Changes diff --git a/package.json b/package.json index 527205e45..fe9965304 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fusion-project-portal", - "version": "5.0.1", + "version": "5.0.2", "license": "MIT", "description": "Project Portal powered by Fusion", "devDependencies": { From 6e599cf8fc3710c8f01465682e9c582e1db5e0f9 Mon Sep 17 00:00:00 2001 From: Christopher Berge Hove Date: Tue, 22 Oct 2024 10:44:38 +0200 Subject: [PATCH 09/10] =?UTF-8?q?refactor:=20Improve=20loading=20logic=20i?= =?UTF-8?q?n=20LegacyAppContainer,=20by=20loading=20app=E2=80=A6=20(#828)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Noggling --- .changeset/pr-828-2137854066.md | 5 +++++ .../legacy-interopt/LegacyAppContainer.ts | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 .changeset/pr-828-2137854066.md diff --git a/.changeset/pr-828-2137854066.md b/.changeset/pr-828-2137854066.md new file mode 100644 index 000000000..6b2fd75bf --- /dev/null +++ b/.changeset/pr-828-2137854066.md @@ -0,0 +1,5 @@ + +--- +"fusion-project-portal": patch +--- +Improve loading logic in LegacyAppContainer, by loading app from new app api with proxy diff --git a/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/LegacyAppContainer.ts b/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/LegacyAppContainer.ts index 7560b2296..26a07c647 100644 --- a/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/LegacyAppContainer.ts +++ b/client/apps/legacyAppLoader/src/app-loader/legacy-interopt/LegacyAppContainer.ts @@ -228,13 +228,13 @@ export class LegacyAppContainer extends EventEmitter { * assume if the manifest missing AppComponent or render, that loading is required */ - if (!AppComponent && !render) { - await this.#loadScript(key); + const manifest = this.#manifests.value[appKey] as unknown as AppManifest; + + if (!AppComponent && !render && manifest.build) { + await this.#loadScript(manifest); } await new Promise((resolve) => window.requestAnimationFrame(resolve)); - const manifest = this.#manifests.value[appKey] as unknown as AppManifest; - const currentApp = appProvider.current; if (currentApp && currentApp.appKey === appKey) { @@ -285,8 +285,9 @@ export class LegacyAppContainer extends EventEmitter { return this.updateComplete; } - async #loadScript(appKey: string): Promise { + async #loadScript(manifest: AppManifest): Promise { return new Promise((resolve, reject) => { + const { appKey, build } = manifest; const script = document.createElement('script'); script.async = true; script.id = appKey; @@ -296,8 +297,7 @@ export class LegacyAppContainer extends EventEmitter { script.addEventListener('load', () => resolve()); script.addEventListener('abort', () => reject()); script.addEventListener('error', () => reject()); - // Todo: Fix uri to mach the new structure - script.src = `${window['clientBaseUri']}/api/bundles/${appKey}.js`; + script.src = `/apps-proxy/bundles/apps/${appKey}/${build?.version}/${build?.entryPoint}`; }); } @@ -305,7 +305,7 @@ export class LegacyAppContainer extends EventEmitter { console.log('Updating'); this.#updateTask = new Promise((resolve, reject) => { this.#updateTask.state = 'pending'; - this.#appModules.app.getAllAppManifests().subscribe({ + this.#appModules.app.getAppManifests({ filterByCurrentUser: true }).subscribe({ complete: () => { this.#updateTask.state = 'fulfilled'; this.#lastUpdated = Date.now(); From 47968d843c6fe4b5ffa354581977cb1d816009bd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:57:08 +0200 Subject: [PATCH 10/10] Fusion Project Portal Release (#829) Co-authored-by: Noggling[bot] --- .changeset/pr-828-2137854066.md | 5 ----- CHANGELOG.md | 6 ++++++ package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/pr-828-2137854066.md diff --git a/.changeset/pr-828-2137854066.md b/.changeset/pr-828-2137854066.md deleted file mode 100644 index 6b2fd75bf..000000000 --- a/.changeset/pr-828-2137854066.md +++ /dev/null @@ -1,5 +0,0 @@ - ---- -"fusion-project-portal": patch ---- -Improve loading logic in LegacyAppContainer, by loading app from new app api with proxy diff --git a/CHANGELOG.md b/CHANGELOG.md index a31bf2b3e..e6b15eac8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # fusion-project-portal +## 5.0.3 + +### Patch Changes + +- 6e599cf: Improve loading logic in LegacyAppContainer, by loading app from new app api with proxy + ## 5.0.2 ### Patch Changes diff --git a/package.json b/package.json index fe9965304..d958490e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fusion-project-portal", - "version": "5.0.2", + "version": "5.0.3", "license": "MIT", "description": "Project Portal powered by Fusion", "devDependencies": {