-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: portal administration application (#710)
Co-authored-by: Gustav Eikaas <[email protected]> Co-authored-by: Noggling <[email protected]> Co-authored-by: Edward Brunton <[email protected]>
- Loading branch information
1 parent
f17f776
commit dee5213
Showing
139 changed files
with
13,944 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
--- | ||
"fusion-project-portal": minor | ||
--- | ||
Portal administration application. for managing portal configurations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Get Fusion token | ||
description: "Runs a composite step action" | ||
inputs: | ||
client-id: | ||
description: "SP client id" | ||
required: true | ||
tenant-id: | ||
description: "Equinor tenant id" | ||
required: true | ||
resource-id: | ||
description: "Resource id" | ||
required: true | ||
|
||
outputs: | ||
token: | ||
description: "Fusion token" | ||
value: ${{ steps.token.outputs.token }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "Login to Azure" | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{inputs.client-id}} | ||
tenant-id: ${{ inputs.tenant-id }} | ||
allow-no-subscriptions: true | ||
|
||
- name: "Obtain token for upload" | ||
id: token | ||
shell: bash | ||
run: echo "token=$(az account get-access-token --resource '${{ inputs.resource-id }}' | jq '.accessToken')" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Deploy apps CI | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
paths: | ||
- "client/apps/portal-administration/**" | ||
|
||
permissions: | ||
actions: read | ||
checks: write | ||
contents: read | ||
deployments: write | ||
id-token: write | ||
|
||
jobs: | ||
build: | ||
environment: non-prod | ||
name: Deploy | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Get fusion token | ||
id: "get-fusion-token" | ||
uses: ./.github/actions/get-fusion-token | ||
with: | ||
client-id: ${{secrets.AZURE_SP_FUSION}} | ||
tenant-id: ${{secrets.AZURE_TENANT_ID}} | ||
resource-id: ${{secrets.AZURE_FUSION_SCOPE}} | ||
|
||
- name: Install | ||
run: | | ||
cd client | ||
yarn install | ||
npm i -g @equinor/fusion-framework-cli | ||
cd apps/portal-administration | ||
yarn install | ||
- name: Build | ||
run: | | ||
cd client | ||
yarn build | ||
- name: Deploy | ||
run: | | ||
cd client/apps/portal-administration | ||
yarn bundle | ||
curl -T "app-bundle.zip" -H "Authorization: bearer ${{steps.get-fusion-token.outputs.token}}" -H "Content-Disposition: attachment; filename=app-bundle.zip" -H "Content-Type: application/zip" -X POST --show-error -i --url https://fusion-s-portal-ci.azurewebsites.net/api/apps/portal-administration/versions | ||
- name: Publish | ||
run: | | ||
curl -H "Authorization: bearer ${{steps.get-fusion-token.outputs.token}}" -X POST --show-error -i --url https://fusion-s-portal-ci.azurewebsites.net/api/apps/portal-administration/publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,5 @@ testem.log | |
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
Thumbs.db | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { mergeAppConfigs, defineAppConfig } from '@equinor/fusion-framework-cli'; | ||
export default defineAppConfig((_env, { base }) => | ||
mergeAppConfigs(base, { | ||
environment: { | ||
endpoints: { | ||
client: { | ||
baseUri: 'https://backend-fusion-project-portal-test.radix.equinor.com', | ||
defaultScopes: ['api://02f3484c-cad0-4d1d-853d-3a9e604b38f3/access_as_user'], | ||
}, | ||
}, | ||
}, | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineAppManifest, mergeManifests } from '@equinor/fusion-framework-cli'; | ||
|
||
export default defineAppManifest((env, { base }) => { | ||
return mergeManifests(base, { | ||
name: 'Portal Administration', | ||
shortName: 'PA', | ||
description: 'Portal Administration tool for fusion as a service', | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "portal-administration", | ||
"version": "1.0.0", | ||
"description": "", | ||
"private": true, | ||
"type": "module", | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"build": "fusion-framework-cli app build", | ||
"dev": "fusion-framework-cli app dev", | ||
"docker": "cd .. && sh docker-script.sh app-react", | ||
"bundle": "fusion-framework-cli app pack" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@equinor/fusion-framework-cli": "^9.12.14", | ||
"@types/react": "^18.2.20", | ||
"@types/react-dom": "^18.2.7", | ||
"typescript": "^5.1.3", | ||
"vitest": "^2.0.5" | ||
}, | ||
"dependencies": { | ||
"react-router-dom": "^6.26.0", | ||
"@equinor/fusion-react-side-sheet": "^1.3.3", | ||
"@equinor/fusion-framework-module-navigation": "^4.0.6", | ||
"@equinor/fusion-framework-react-app": "^5.2.7", | ||
"@ag-grid-community/core": "^32.1.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"@ag-grid-community/react": "^32.1.0", | ||
"@equinor/eds-core-react": "^0.40.1", | ||
"@equinor/eds-icons": "^0.19.3", | ||
"@equinor/eds-tokens": "^0.9.2", | ||
"@equinor/fusion-react-searchable-dropdown": "^0.5.2", | ||
"@equinor/workspace-ag-grid": "^3.0.2", | ||
"@hookform/resolvers": "^3.9.0", | ||
"@tanstack/react-query": "^5.51.23", | ||
"@tanstack/react-query-devtools": "^5.51.23", | ||
"react-hook-form": "^7.52.2", | ||
"rxjs": "^7.8.1", | ||
"styled-components": "^6.1.1", | ||
"uuidv7": "^1.0.1", | ||
"zod": "^3.23.8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { RouterProvider } from 'react-router-dom'; | ||
import { useRouter } from '@equinor/fusion-framework-react-app/navigation'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import styled from 'styled-components'; | ||
import routes from './routes'; | ||
import { tokens } from '@equinor/eds-tokens'; | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
const Style = { | ||
Root: styled.div` | ||
background-color: ${tokens.colors.ui.background__light.hex}; | ||
position: absolute; | ||
height: 100%; | ||
width: 100%; | ||
overflow: hidden; | ||
`, | ||
}; | ||
|
||
export default function () { | ||
const router = useRouter(routes); | ||
return ( | ||
<Style.Root> | ||
<QueryClientProvider client={queryClient}> | ||
<RouterProvider router={router} fallbackElement={<p>Error...</p>} /> | ||
</QueryClientProvider> | ||
</Style.Root> | ||
); | ||
} |
37 changes: 37 additions & 0 deletions
37
client/apps/portal-administration/src/components/Actions/ActivateSelectedButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Button, Icon } from '@equinor/eds-core-react'; | ||
import { AppManifestResponse, FormattedError, PortalApp } from '../../types'; | ||
import { UseMutateAsyncFunction } from '@tanstack/react-query'; | ||
import { Result } from '../../query/apps-queries'; | ||
import { add_circle_outlined } from '@equinor/eds-icons'; | ||
|
||
type ActivateSelectedButtonProps = { | ||
selection: PortalApp[]; | ||
activateSelected: UseMutateAsyncFunction< | ||
Result[], | ||
FormattedError, | ||
PortalApp[], | ||
{ | ||
prevApps: AppManifestResponse[]; | ||
newApps: AppManifestResponse[]; | ||
} | ||
>; | ||
}; | ||
|
||
export const ActivateSelectedButton = ({ selection, activateSelected }: ActivateSelectedButtonProps) => { | ||
const isActive = selection.some((a) => a.isActive); | ||
|
||
if (isActive) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Button | ||
id="activate-selected" | ||
onClick={() => { | ||
activateSelected(selection.filter((a) => !a.isActive)); | ||
}} | ||
> | ||
<Icon data={add_circle_outlined} size={16} /> Activate Selected | ||
</Button> | ||
); | ||
}; |
32 changes: 32 additions & 0 deletions
32
...t/apps/portal-administration/src/components/Actions/ActivateSelectedWithContextButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Button, Icon } from '@equinor/eds-core-react'; | ||
import { PortalApp } from '../../types'; | ||
|
||
import { add_circle_filled } from '@equinor/eds-icons'; | ||
|
||
type ActivateSelectedWithContextButtonProps = { | ||
selection: PortalApp[]; | ||
activateSelectedWithContext: VoidFunction; | ||
}; | ||
|
||
export const ActivateSelectedWithContextButton = ({ | ||
selection, | ||
activateSelectedWithContext, | ||
}: ActivateSelectedWithContextButtonProps) => { | ||
const isActive = selection.some((a) => a.isActive); | ||
|
||
if (isActive) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Button | ||
id="activate-selected" | ||
variant="ghost" | ||
onClick={() => { | ||
activateSelectedWithContext(); | ||
}} | ||
> | ||
<Icon data={add_circle_filled} size={16} /> Activate Selected with Context | ||
</Button> | ||
); | ||
}; |
29 changes: 29 additions & 0 deletions
29
client/apps/portal-administration/src/components/Actions/EditSelectedButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Button, Icon } from '@equinor/eds-core-react'; | ||
import { PortalApp } from '../../types'; | ||
|
||
import { add_circle_outlined, edit } from '@equinor/eds-icons'; | ||
|
||
type EditSelectedButtonProps = { | ||
selection: PortalApp[]; | ||
editSelection: VoidFunction; | ||
}; | ||
|
||
export const EditSelectedButton = ({ selection, editSelection }: EditSelectedButtonProps) => { | ||
const isActive = selection.some((a) => !a.isActive); | ||
|
||
if (isActive) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Button | ||
id="activate-selected" | ||
variant="ghost" | ||
onClick={() => { | ||
editSelection(); | ||
}} | ||
> | ||
<Icon data={edit} size={16} /> Edit Selected | ||
</Button> | ||
); | ||
}; |
Oops, something went wrong.