Skip to content

Commit

Permalink
fix: Remove createLegacyApp, add render to index (#960)
Browse files Browse the repository at this point in the history
* fix: Remove createLegacyApp, add render to index
  • Loading branch information
taustad authored May 23, 2023
1 parent 2b0ff59 commit ddcc88c
Show file tree
Hide file tree
Showing 12 changed files with 16,725 additions and 52,416 deletions.
4 changes: 2 additions & 2 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM node:lts-alpine as build

WORKDIR /app
COPY . .
RUN npm ci
RUN yarn install
RUN mkdir -p node_modules/.cache && chmod -R 777 node_modules/.cache


Expand All @@ -23,4 +23,4 @@ RUN adduser -S -u 1001 -G non-root-group non-root-user
USER 1001

EXPOSE 3000
ENTRYPOINT npm start
ENTRYPOINT yarn run start
52,326 changes: 0 additions & 52,326 deletions frontend/package-lock.json

This file was deleted.

32 changes: 17 additions & 15 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,33 @@
]
},
"dependencies": {
"@ag-grid-community/client-side-row-model": "^27.3.0",
"@ag-grid-community/core": "^27.3.0",
"@ag-grid-community/csv-export": "^27.3.0",
"@ag-grid-community/react": "^27.3.0",
"@ag-grid-enterprise/column-tool-panel": "^27.3.0",
"@ag-grid-enterprise/excel-export": "^27.3.0",
"@ag-grid-enterprise/filter-tool-panel": "^27.3.0",
"@equinor/eds-core-react": "^0.25.0",
"@equinor/eds-icons": "^0.14.0",
"@equinor/eds-tokens": "^0.7.1",
"@equinor/eds-utils": "^0.7.0",
"@equinor/fusion": "^3.4.9",
"@equinor/fusion-components": "^2.10.5",
"@equinor/fusion-framework-module-ag-grid": "^3.0.1",
"@equinor/fusion-framework-module-msal": "^1.0.23",
"@equinor/fusion-framework-react": "^4.0.6",
"@equinor/fusion-framework-react-app": "^3.0.14",
"@equinor/fusion-framework-react-module": "^2.0.2",
"@equinor/fusion-observable": "^7.0.3",
"@equinor/fusion-query": "^2.0.7",
"@equinor/fusion-react-ag-grid-addons": "^0.3.2",
"@equinor/fusion-react-icon": "^0.2.15",
"@equinor/fusion-react-textarea": "^0.5.14",
"@equinor/fusion-react-tooltip": "^1.1.5",
"@equinor/fusion-cli": "3.0.0-beta.39",
"@equinor/fusion-components": "2.10.6",
"@equinor/fusion-framework-module-ag-grid": "^4.0.0",
"@equinor/fusion-framework-module-navigation": "^2.1.1",
"@equinor/fusion-framework-react-app": "^4.0.14",
"@equinor/fusion-framework-react-module-context": "^6.0.6",
"@equinor/fusion-react-ag-grid-addons": "^0.4.0",
"@equinor/fusion-react-textarea": "^0.5.15",
"@floating-ui/react-dom": "^1.3.0",
"@floating-ui/react-dom-interactions": "^0.13.3",
"@lit/reactive-element": "^1.3.0",
"@material-ui/core": "^4.12.3",
"@tippyjs/react": "^4.2.6",
"ag-charts-community": "^6.2.1",
"ag-charts-react": "^6.2.1",
"ag-charts-community": "^7.3.0",
"ag-charts-react": "^7.3.0",
"ag-grid-community": "^28.1.0",
"ag-grid-enterprise": "^28.1.0",
"ag-grid-react": "^28.1.0",
Expand Down Expand Up @@ -101,7 +104,6 @@
]
},
"devDependencies": {
"@equinor/fusion-cli": "3.0.0-beta.37",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Components/AgGrid/AgChartsCompareCases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const AgChartsCompareCases = ({
return condition ? elements : []
}

const defaultOptions = {
const defaultOptions: any = {
data,
title: { text: chartTitle ?? "" },
subtitle: { text: unit ?? "" },
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Components/AgGrid/AgChartsPie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const AgChartsPie = ({
},
}

const defaultOptions = {
const defaultOptions: any = {
data,
title: { text: chartTitle ?? "" },
subtitle: { text: unit ?? "" },
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Components/AgGrid/AgChartsTimeseries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const AgChartsTimeseries = ({
return condition ? elements : []
}

const defaultOptions = {
const defaultOptions: any = {
data,
title: { text: chartTitle ?? "" },
subtitle: { text: unit ?? "" },
Expand Down
20 changes: 1 addition & 19 deletions frontend/src/app/FusionRouterBootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,12 @@ import { useMemo } from "react"
import { Router } from "react-router-dom"

interface Props {
children: React.ReactNode;
children: any;
}

const appKey = "conceptapp"
const fusionPrefix = `/apps/${appKey}`

/**
* This component is required for the app to be loaded properly in the Fusion portal.
*
* A little gotcha regarding the fusionPrefix. In localhost you interact with the
* application on the root (/) level. In the CI/QA/PRODUCTION environments, the
* application is running in the Fusion portal, meaning that the root path to
* the application is /apps/corporate-project-review. Therefore, we need to
* consider based on the environment.
*
* {@todo}
* According to Odin (Fusion Core), setting the basename from the environment
* causes issues with a Fusion tool called App Configurator. Currently, this is
* not an application we have knowledge about.
*
* @export
* @param {Props} {children}
* @return {*} {JSX.Element}
*/
export function FusionRouterBootstrap({ children }: Props): JSX.Element {
const { env } = useFusionEnvironment()
const history = useMemo(() => {
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { AppModuleInitiator } from "@equinor/fusion-framework-app"
import { enableAgGrid } from "@equinor/fusion-framework-module-ag-grid"
import { enableNavigation } from "@equinor/fusion-framework-module-navigation"
import { enableContext } from "@equinor/fusion-framework-module-context"

export const configurator: AppModuleInitiator = (config) => {
enableAgGrid(config)
config.useFrameworkServiceClient("portal")
enableNavigation(config, window.location.pathname.match(/^\/?apps/) ? "/apps/conceptapp" : "/")
enableContext(config, (builder) => {
builder.setContextType(["ProjectMaster"])
})
}
26 changes: 7 additions & 19 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
/* eslint-disable import/no-import-module-exports */
import { Context, ContextTypes, registerApp } from "@equinor/fusion"
import createApp, { createLegacyApp } from "@equinor/fusion-framework-react-app"
import { enableAgGrid } from "@equinor/fusion-framework-module-ag-grid"
import { LicenseManager } from "ag-grid-enterprise"
import App from "./app/App"
import { registerApp as registerLegacy } from "@equinor/fusion"
import { createComponent } from "@equinor/fusion-framework-react-app"

// @ts-ignore
if (window.Fusion?.modules?.agGrid?.licenseKey) {
// @ts-ignore
LicenseManager.setLicenseKey(window.Fusion?.modules?.agGrid?.licenseKey)
}
import App from "./app/App"
import { configurator } from "./config"

registerApp("conceptapp", {
AppComponent: createLegacyApp(App, (config) => enableAgGrid(config)),
context: {
types: [ContextTypes.ProjectMaster],
buildUrl: (context: Context | null) => (context ? `/${context.id}` : ""),
getContextFromUrl: (url: string) => url.split("/")[1],
},
name: "DCD Concept App",
registerLegacy("conceptapp", {
render: createComponent(App, configurator),
AppComponent: App,
})

if (module.hot) module.hot.accept()
56 changes: 30 additions & 26 deletions frontend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
{
"compilerOptions": {
"target": "es5",
"sourceMap": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
"compilerOptions": {
"declaration": true,
"importHelpers": true,
"sourceMap": true,
"module": "ESNext",
"outDir": "lib",
"rootDir": "src",
"strict": true,
"target": "ES6",
"composite": false,
"skipLibCheck": true,
"jsx": "react-jsx",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noEmit": true,
"moduleResolution": "node"
},
"include": [
"src",
"./src/types.d.ts",
"src/**/*",
"./css-modules.d.ts"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src",
"./src/types.d.ts"
]
}
"typedocOptions": {
"entryPoints": [
"src/pages/Dashboard.tsx",
"src/pages/contract/GeneralPage.tsx"
],
"out": "docs"
}
}
Loading

0 comments on commit ddcc88c

Please sign in to comment.