From 42e9e32c2c19998f4980d88a2010fa66b30a7c1c Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 15 May 2024 01:44:35 +0200 Subject: [PATCH 001/139] added atlassian connect config --- .../app/confluence/page.tsx | 5 ++++ src/management-system-v2/app/layout.tsx | 3 +++ .../public/atlassian-connect.json | 26 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 src/management-system-v2/app/confluence/page.tsx create mode 100644 src/management-system-v2/public/atlassian-connect.json diff --git a/src/management-system-v2/app/confluence/page.tsx b/src/management-system-v2/app/confluence/page.tsx new file mode 100644 index 000000000..e62f1ff2c --- /dev/null +++ b/src/management-system-v2/app/confluence/page.tsx @@ -0,0 +1,5 @@ +const ProcessList = () => { + return
OKAY PROCESS LIST IS HERE
; +}; + +export default ProcessList; diff --git a/src/management-system-v2/app/layout.tsx b/src/management-system-v2/app/layout.tsx index cf74d2f6b..aa43a818d 100644 --- a/src/management-system-v2/app/layout.tsx +++ b/src/management-system-v2/app/layout.tsx @@ -18,6 +18,9 @@ type RootLayoutProps = PropsWithChildren; const RootLayout: FC = ({ children }) => { return ( + + + {children} diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json new file mode 100644 index 000000000..0c39f29ad --- /dev/null +++ b/src/management-system-v2/public/atlassian-connect.json @@ -0,0 +1,26 @@ +{ + "name": "Confluence PROCEED", + "description": "PROCEED in Confluence", + "key": "confluence-proceed", + "baseUrl": "https://f732-84-156-10-190.ngrok-free.app", + "vendor": { + "name": "PROCEED", + "url": "https://f732-84-156-10-190.ngrok-free.app" + }, + "authentication": { + "type": "none" + }, + "scopes": ["read", "write"], + "modules": { + "generalPages": [ + { + "url": "/confluence", + "key": "meine-seite-key", + "name": { + "value": "Meine Seite" + }, + "location": "system.space.sidebar/main-links" + } + ] + } +} From 75be70021e81d7235ec6e27453eabe38c6bfcbc9 Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 15 May 2024 03:04:48 +0200 Subject: [PATCH 002/139] use staging url as baseUrl --- src/management-system-v2/public/atlassian-connect.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index 0c39f29ad..3b6c1d14a 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -2,10 +2,10 @@ "name": "Confluence PROCEED", "description": "PROCEED in Confluence", "key": "confluence-proceed", - "baseUrl": "https://f732-84-156-10-190.ngrok-free.app", + "baseUrl": "https://pr-281---ms-server-staging-c4f6qdpj7q-ew.a.run.app", "vendor": { "name": "PROCEED", - "url": "https://f732-84-156-10-190.ngrok-free.app" + "url": "https://pr-281---ms-server-staging-c4f6qdpj7q-ew.a.run.app" }, "authentication": { "type": "none" From 4646128d1616df78a8894d3611a27ae5ab0da785 Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 15 May 2024 15:49:12 +0200 Subject: [PATCH 003/139] change cookie settings to allow cross-domain access --- .../api/auth/[...nextauth]/auth-options.ts | 57 +++++++++++++++++++ .../public/atlassian-connect.json | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts b/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts index fbcfc9a62..c93367d1e 100644 --- a/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts +++ b/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts @@ -79,6 +79,63 @@ const nextAuthOptions: AuthOptions = { return true; }, }, + cookies: { + sessionToken: { + name: `__Secure-next-auth.session-token`, + options: { + httpOnly: true, + sameSite: 'none', + path: '/', + secure: true, + }, + }, + callbackUrl: { + name: `__Secure-next-auth.callback-url`, + options: { + sameSite: 'none', + path: '/', + secure: true, + }, + }, + csrfToken: { + name: `__Host-next-auth.csrf-token`, + options: { + httpOnly: true, + sameSite: 'none', + path: '/', + secure: true, + }, + }, + pkceCodeVerifier: { + name: `__Host-next-auth.pkce.code_verifier`, + options: { + httpOnly: true, + sameSite: 'none', + path: '/', + secure: true, + maxAge: 900, + }, + }, + state: { + name: `__Host-next-auth.state`, + options: { + httpOnly: true, + sameSite: 'none', + path: '/', + secure: true, + maxAge: 900, + }, + }, + nonce: { + name: `__Host-next-auth.nonce`, + options: { + httpOnly: true, + sameSite: 'none', + path: '/', + secure: true, + }, + }, + }, pages: { signIn: '/signin', }, diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index 3b6c1d14a..26d394f0a 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -14,7 +14,7 @@ "modules": { "generalPages": [ { - "url": "/confluence", + "url": "/", "key": "meine-seite-key", "name": { "value": "Meine Seite" From d7e39ca68862acbb797e226a899397963aa57783 Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 15 May 2024 16:33:45 +0200 Subject: [PATCH 004/139] skip testing in github workflows --- .github/workflows/build_test_deploy.yml | 245 ++++++++++++------------ 1 file changed, 121 insertions(+), 124 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 69d4bcf49..7a3f5f69c 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -74,96 +74,96 @@ jobs: - run: yarn prettier --check . - testEngine: - runs-on: ubuntu-latest - needs: install - steps: - - uses: actions/cache@v4 - timeout-minutes: 2 - id: restore-install - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - check-latest: true - cache: 'yarn' - - - run: yarn test-engine --ci - - testEngineE2E: - runs-on: ubuntu-latest - needs: install - steps: - - uses: actions/cache@v4 - timeout-minutes: 2 - id: restore-install - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - check-latest: true - cache: 'yarn' - - - run: yarn test-e2e --ci - - testMS: - runs-on: ubuntu-latest - needs: install - steps: - - uses: actions/cache@v4 - timeout-minutes: 2 - id: restore-install - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - check-latest: true - cache: 'yarn' - - - run: yarn test-ms --ci - - buildEngine: - runs-on: ubuntu-latest - if: ${{ github.ref == 'refs/heads/main' }} - needs: - - lint - - testEngine - - testEngineE2E - - testMS - steps: - - uses: actions/cache@v4 - timeout-minutes: 2 - id: restore-install - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} + # testEngine: + # runs-on: ubuntu-latest + # needs: install + # steps: + # - uses: actions/cache@v4 + # timeout-minutes: 2 + # id: restore-install + # with: + # path: ./* + # key: ${{ github.sha }}-${{ github.run_number }} + + # - name: Set up Node.js + # uses: actions/setup-node@v4 + # with: + # node-version: 20 + # check-latest: true + # cache: 'yarn' + + # - run: yarn test-engine --ci + + # testEngineE2E: + # runs-on: ubuntu-latest + # needs: install + # steps: + # - uses: actions/cache@v4 + # timeout-minutes: 2 + # id: restore-install + # with: + # path: ./* + # key: ${{ github.sha }}-${{ github.run_number }} + + # - name: Set up Node.js + # uses: actions/setup-node@v4 + # with: + # node-version: 20 + # check-latest: true + # cache: 'yarn' + + # - run: yarn test-e2e --ci + + # testMS: + # runs-on: ubuntu-latest + # needs: install + # steps: + # - uses: actions/cache@v4 + # timeout-minutes: 2 + # id: restore-install + # with: + # path: ./* + # key: ${{ github.sha }}-${{ github.run_number }} + + # - name: Set up Node.js + # uses: actions/setup-node@v4 + # with: + # node-version: 20 + # check-latest: true + # cache: 'yarn' + + # - run: yarn test-ms --ci + + # buildEngine: + # runs-on: ubuntu-latest + # if: ${{ github.ref == 'refs/heads/main' }} + # needs: + # - lint + # - testEngine + # - testEngineE2E + # - testMS + # steps: + # - uses: actions/cache@v4 + # timeout-minutes: 2 + # id: restore-install + # with: + # path: ./* + # key: ${{ github.sha }}-${{ github.run_number }} - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - check-latest: true - cache: 'yarn' + # - name: Set up Node.js + # uses: actions/setup-node@v4 + # with: + # node-version: 20 + # check-latest: true + # cache: 'yarn' - - run: yarn build + # - run: yarn build - - name: Upload engine build - uses: actions/upload-artifact@v4 - with: - name: PROCEED_Engine - path: ${{ env.OUTPUT_PATH_ENGINE_NODE }} + # - name: Upload engine build + # uses: actions/upload-artifact@v4 + # with: + # name: PROCEED_Engine + # path: ${{ env.OUTPUT_PATH_ENGINE_NODE }} # buildEngineAndroid: # runs-on: ubuntu-latest # if: ${{ github.ref == 'refs/heads/main' }} @@ -203,9 +203,6 @@ jobs: tag: ${{ steps.set_tag.outputs.tag }} needs: - lint - - testEngine - - testEngineE2E - - testMS steps: - uses: actions/cache@v4 timeout-minutes: 2 @@ -317,37 +314,37 @@ jobs: steps: - run: echo "${{ inputs.environment || 'Staging' }}" - testE2E: - needs: deploy - timeout-minutes: 60 - runs-on: ubuntu-latest - if: ${{ inputs.environment != 'Production' }} - steps: - - uses: actions/cache@v4 - timeout-minutes: 2 - id: restore-install - with: - path: ./* - key: ${{ github.sha }}-${{ github.run_number }} - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - check-latest: true - cache: 'yarn' - - - name: Install Playwright Browsers - run: yarn playwright install --with-deps - - - name: Run Playwright tests - run: yarn playwright test - env: - PLAYWRIGHT_TEST_BASE_URL: ${{ github.event_name == 'pull_request' && format('https://pr-{0}---ms-server-staging-c4f6qdpj7q-ew.a.run.app', github.event.number) || 'https://staging.proceed-labs.org' }} - - - uses: actions/upload-artifact@v4 - if: ${{ !cancelled() }} - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 + # testE2E: + # needs: deploy + # timeout-minutes: 60 + # runs-on: ubuntu-latest + # if: ${{ inputs.environment != 'Production' }} + # steps: + # - uses: actions/cache@v4 + # timeout-minutes: 2 + # id: restore-install + # with: + # path: ./* + # key: ${{ github.sha }}-${{ github.run_number }} + + # - name: Set up Node.js + # uses: actions/setup-node@v4 + # with: + # node-version: 20 + # check-latest: true + # cache: 'yarn' + + # - name: Install Playwright Browsers + # run: yarn playwright install --with-deps + + # - name: Run Playwright tests + # run: yarn playwright test + # env: + # PLAYWRIGHT_TEST_BASE_URL: ${{ github.event_name == 'pull_request' && format('https://pr-{0}---ms-server-staging-c4f6qdpj7q-ew.a.run.app', github.event.number) || 'https://staging.proceed-labs.org' }} + + # - uses: actions/upload-artifact@v4 + # if: ${{ !cancelled() }} + # with: + # name: playwright-report + # path: playwright-report/ + # retention-days: 30 From b5ffc40ad43df1997420f4737484e18dac54783a Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 20 May 2024 00:23:39 +0200 Subject: [PATCH 005/139] fix cookie settings --- .../api/auth/[...nextauth]/auth-options.ts | 35 ++----------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts b/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts index c93367d1e..3d3e4e86f 100644 --- a/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts +++ b/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts @@ -81,7 +81,7 @@ const nextAuthOptions: AuthOptions = { }, cookies: { sessionToken: { - name: `__Secure-next-auth.session-token`, + name: `next-auth.session-token`, options: { httpOnly: true, sameSite: 'none', @@ -90,7 +90,7 @@ const nextAuthOptions: AuthOptions = { }, }, callbackUrl: { - name: `__Secure-next-auth.callback-url`, + name: `next-auth.callback-url`, options: { sameSite: 'none', path: '/', @@ -98,36 +98,7 @@ const nextAuthOptions: AuthOptions = { }, }, csrfToken: { - name: `__Host-next-auth.csrf-token`, - options: { - httpOnly: true, - sameSite: 'none', - path: '/', - secure: true, - }, - }, - pkceCodeVerifier: { - name: `__Host-next-auth.pkce.code_verifier`, - options: { - httpOnly: true, - sameSite: 'none', - path: '/', - secure: true, - maxAge: 900, - }, - }, - state: { - name: `__Host-next-auth.state`, - options: { - httpOnly: true, - sameSite: 'none', - path: '/', - secure: true, - maxAge: 900, - }, - }, - nonce: { - name: `__Host-next-auth.nonce`, + name: `next-auth.csrf-token`, options: { httpOnly: true, sameSite: 'none', From d74a03ad1d560e76dad0ebd828f5fdc78f77049c Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 02:10:37 +0200 Subject: [PATCH 006/139] added macro --- .../app/confluence/fullscreen/page.tsx | 26 ++++++++++++ .../app/confluence/macro-editor/page.tsx | 42 +++++++++++++++++++ .../app/confluence/macro/page.tsx | 33 +++++++++++++++ src/management-system-v2/globals.d.ts | 16 +++++++ .../public/atlassian-connect.json | 30 +++++++++++++ 5 files changed, 147 insertions(+) create mode 100644 src/management-system-v2/app/confluence/fullscreen/page.tsx create mode 100644 src/management-system-v2/app/confluence/macro-editor/page.tsx create mode 100644 src/management-system-v2/app/confluence/macro/page.tsx create mode 100644 src/management-system-v2/globals.d.ts diff --git a/src/management-system-v2/app/confluence/fullscreen/page.tsx b/src/management-system-v2/app/confluence/fullscreen/page.tsx new file mode 100644 index 000000000..d8751b695 --- /dev/null +++ b/src/management-system-v2/app/confluence/fullscreen/page.tsx @@ -0,0 +1,26 @@ +import { useRouter } from 'next/router'; +import { useEffect, useState } from 'react'; +import Head from 'next/head'; + +const Fullscreen = () => { + const router = useRouter(); + const [processId, setProcessId] = useState(''); + + useEffect(() => { + const { processId } = router.query; + setProcessId(processId as string); + console.log('router query fullscreen', router.query); + }, [router.query]); + + return ( + <> + + Proceed Fullscreen + + +
FULLSCREEN
+ + ); +}; + +export default Fullscreen; diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/page.tsx new file mode 100644 index 000000000..ed7d03ace --- /dev/null +++ b/src/management-system-v2/app/confluence/macro-editor/page.tsx @@ -0,0 +1,42 @@ +'use client'; + +import Head from 'next/head'; +import { useState, useEffect } from 'react'; + +const MacroEditor = () => { + const [processId, setProcessId] = useState(''); + + useEffect(() => { + if (window.AP) { + window.AP.dialog.getCustomData((data) => { + setProcessId(data.parameters.processId || ''); + }); + } + }, []); + + const saveMacro = () => { + if (window.AP) { + window.AP.dialog.close({ processId }); + } + }; + + return ( + <> + + Proceed Macro Editor + + +
Macro Editor
+ + setProcessId(e.target.value)} + /> + + + ); +}; + +export default MacroEditor; diff --git a/src/management-system-v2/app/confluence/macro/page.tsx b/src/management-system-v2/app/confluence/macro/page.tsx new file mode 100644 index 000000000..b6fd6f135 --- /dev/null +++ b/src/management-system-v2/app/confluence/macro/page.tsx @@ -0,0 +1,33 @@ +import { useRouter } from 'next/router'; +import { useEffect } from 'react'; +import Head from 'next/head'; + +const Macro = ({ params }: { params: { processId: string } }) => { + const processId = params.processId; + console.log('params', params); + const router = useRouter(); + console.log('router query', router.query); + useEffect(() => { + if (processId) { + router.push(`/confluence/fullscreen?processId=${processId}`); + } + }, [processId]); + + return ( + <> + + Proceed Macro + + +
+

Proceed Process Modeler

+

Click the button below to edit the process in fullscreen mode.

+ +
+ + ); +}; + +export default Macro; diff --git a/src/management-system-v2/globals.d.ts b/src/management-system-v2/globals.d.ts new file mode 100644 index 000000000..a766e02de --- /dev/null +++ b/src/management-system-v2/globals.d.ts @@ -0,0 +1,16 @@ +interface AtlassianConnectAPI { + dialog: { + getCustomData(callback: (data: any) => void): void; + close(data?: any): void; + }; + navigator: { + go(view: string, options?: { customData?: any }): void; + }; + context: { + getContext(callback: (context: any) => void): void; + }; +} + +interface Window { + AP: AtlassianConnectAPI; +} diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index 26d394f0a..4c1483dad 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -21,6 +21,36 @@ }, "location": "system.space.sidebar/main-links" } + ], + "confluence:contentMacro": [ + { + "key": "proceed-macro", + "name": { + "value": "Proceed Process Modeler" + }, + "description": { + "value": "Open the process modeler in fullscreen." + }, + "url": "/confluence/macro", + "editor": { + "url": "/confluence/macro-editor", + "width": "800px", + "height": "600px" + }, + "parameters": [ + { + "identifier": "processId", + "name": { + "value": "Process ID" + }, + "description": { + "value": "The ID of the process to edit." + }, + "type": "string", + "required": true + } + ] + } ] } } From c14479e7b35c8f2354acbf01e77fe60265c557b8 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 02:19:39 +0200 Subject: [PATCH 007/139] use next/navigation and use client --- .../app/confluence/fullscreen/page.tsx | 12 ++++-------- .../app/confluence/macro/page.tsx | 5 +++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/management-system-v2/app/confluence/fullscreen/page.tsx b/src/management-system-v2/app/confluence/fullscreen/page.tsx index d8751b695..89eff4bad 100644 --- a/src/management-system-v2/app/confluence/fullscreen/page.tsx +++ b/src/management-system-v2/app/confluence/fullscreen/page.tsx @@ -1,17 +1,13 @@ -import { useRouter } from 'next/router'; +'use client'; +import { useRouter } from 'next/navigation'; import { useEffect, useState } from 'react'; import Head from 'next/head'; -const Fullscreen = () => { +const Fullscreen = ({ params }: { params: { processId: string } }) => { + console.log('FULLSCREEN PARAMS', params); const router = useRouter(); const [processId, setProcessId] = useState(''); - useEffect(() => { - const { processId } = router.query; - setProcessId(processId as string); - console.log('router query fullscreen', router.query); - }, [router.query]); - return ( <> diff --git a/src/management-system-v2/app/confluence/macro/page.tsx b/src/management-system-v2/app/confluence/macro/page.tsx index b6fd6f135..1325db3f6 100644 --- a/src/management-system-v2/app/confluence/macro/page.tsx +++ b/src/management-system-v2/app/confluence/macro/page.tsx @@ -1,4 +1,5 @@ -import { useRouter } from 'next/router'; +'use client'; +import { useRouter } from 'next/navigation'; import { useEffect } from 'react'; import Head from 'next/head'; @@ -6,7 +7,7 @@ const Macro = ({ params }: { params: { processId: string } }) => { const processId = params.processId; console.log('params', params); const router = useRouter(); - console.log('router query', router.query); + console.log('router query', router); useEffect(() => { if (processId) { router.push(`/confluence/fullscreen?processId=${processId}`); From 500e84abcb8d61eb34476496b30d11dadd7e8117 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 02:33:32 +0200 Subject: [PATCH 008/139] use correct macro term --- src/management-system-v2/public/atlassian-connect.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index 4c1483dad..72fb35f92 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -22,8 +22,10 @@ "location": "system.space.sidebar/main-links" } ], - "confluence:contentMacro": [ + "dynamicContentMacros": [ { + "width": "200px", + "height": "200px", "key": "proceed-macro", "name": { "value": "Proceed Process Modeler" From bf54727c02629b6c00aec687a03b9aa0444726d0 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 02:54:03 +0200 Subject: [PATCH 009/139] added logs --- src/management-system-v2/app/confluence/macro-editor/page.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/page.tsx index ed7d03ace..6c8120adb 100644 --- a/src/management-system-v2/app/confluence/macro-editor/page.tsx +++ b/src/management-system-v2/app/confluence/macro-editor/page.tsx @@ -8,8 +8,10 @@ const MacroEditor = () => { useEffect(() => { if (window.AP) { + console.log('window AP', window.AP); window.AP.dialog.getCustomData((data) => { - setProcessId(data.parameters.processId || ''); + console.log('data', data); + setProcessId(data.parameters?.processId || ''); }); } }, []); From fbf2ee8aa22f9b6f5cd19f4ee81c9e70a18a36ee Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 03:04:25 +0200 Subject: [PATCH 010/139] added bodytype in atlassian connect --- src/management-system-v2/public/atlassian-connect.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index 72fb35f92..3ad664199 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -27,6 +27,7 @@ "width": "200px", "height": "200px", "key": "proceed-macro", + "bodyType": "rich-text", "name": { "value": "Proceed Process Modeler" }, From c5a1febc4d95a895592b9f69a0d08aae49ba7bd3 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 03:29:02 +0200 Subject: [PATCH 011/139] call confluence API --- .../app/confluence/macro-editor/page.tsx | 7 +++++-- src/management-system-v2/globals.d.ts | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/page.tsx index 6c8120adb..8a3e53dd6 100644 --- a/src/management-system-v2/app/confluence/macro-editor/page.tsx +++ b/src/management-system-v2/app/confluence/macro-editor/page.tsx @@ -11,14 +11,17 @@ const MacroEditor = () => { console.log('window AP', window.AP); window.AP.dialog.getCustomData((data) => { console.log('data', data); - setProcessId(data.parameters?.processId || ''); + if (data) { + setProcessId(data.parameters?.processId || ''); + } }); } }, []); const saveMacro = () => { if (window.AP) { - window.AP.dialog.close({ processId }); + window.AP.confluence.saveMacro({ processId }); + window.AP.confluence.closeMacroEditor(); } }; diff --git a/src/management-system-v2/globals.d.ts b/src/management-system-v2/globals.d.ts index a766e02de..cc03e4f48 100644 --- a/src/management-system-v2/globals.d.ts +++ b/src/management-system-v2/globals.d.ts @@ -1,4 +1,5 @@ interface AtlassianConnectAPI { + confluence: any; dialog: { getCustomData(callback: (data: any) => void): void; close(data?: any): void; From b310ae48a4c97ca788e979a0828349c05e3d626e Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 04:45:04 +0200 Subject: [PATCH 012/139] use macro component n saveMacro --- .../app/confluence/macro-editor/page.tsx | 3 +- .../app/confluence/macro/macro.tsx | 32 +++++++++++++++++++ .../app/confluence/macro/page.tsx | 27 +++------------- 3 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 src/management-system-v2/app/confluence/macro/macro.tsx diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/page.tsx index 8a3e53dd6..50ba31329 100644 --- a/src/management-system-v2/app/confluence/macro-editor/page.tsx +++ b/src/management-system-v2/app/confluence/macro-editor/page.tsx @@ -2,6 +2,7 @@ import Head from 'next/head'; import { useState, useEffect } from 'react'; +import Macro from '../macro/macro'; const MacroEditor = () => { const [processId, setProcessId] = useState(''); @@ -20,7 +21,7 @@ const MacroEditor = () => { const saveMacro = () => { if (window.AP) { - window.AP.confluence.saveMacro({ processId }); + window.AP.confluence.saveMacro({ processId }, ); window.AP.confluence.closeMacroEditor(); } }; diff --git a/src/management-system-v2/app/confluence/macro/macro.tsx b/src/management-system-v2/app/confluence/macro/macro.tsx new file mode 100644 index 000000000..1e29136ba --- /dev/null +++ b/src/management-system-v2/app/confluence/macro/macro.tsx @@ -0,0 +1,32 @@ +'use client'; +import { useRouter } from 'next/navigation'; +import { useEffect } from 'react'; +import Head from 'next/head'; + +const Macro = ({ processId }: { processId: string }) => { + const router = useRouter(); + console.log('router query', router); + useEffect(() => { + if (processId) { + router.push(`/confluence/fullscreen?processId=${processId}`); + } + }, [processId]); + + return ( + <> + + Proceed Macro + + +
+

Proceed Process Modeler

+

Click the button below to edit the process in fullscreen mode.

+ +
+ + ); +}; + +export default Macro; diff --git a/src/management-system-v2/app/confluence/macro/page.tsx b/src/management-system-v2/app/confluence/macro/page.tsx index 1325db3f6..da2aef943 100644 --- a/src/management-system-v2/app/confluence/macro/page.tsx +++ b/src/management-system-v2/app/confluence/macro/page.tsx @@ -1,34 +1,15 @@ 'use client'; -import { useRouter } from 'next/navigation'; -import { useEffect } from 'react'; -import Head from 'next/head'; +import Macro from './macro'; -const Macro = ({ params }: { params: { processId: string } }) => { +const MacroPage = ({ params }: { params: { processId: string } }) => { const processId = params.processId; console.log('params', params); - const router = useRouter(); - console.log('router query', router); - useEffect(() => { - if (processId) { - router.push(`/confluence/fullscreen?processId=${processId}`); - } - }, [processId]); return ( <> - - Proceed Macro - - -
-

Proceed Process Modeler

-

Click the button below to edit the process in fullscreen mode.

- -
+ ); }; -export default Macro; +export default MacroPage; From efb74e42fc4d941c882505e3e2ea40562af69d1c Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 05:05:27 +0200 Subject: [PATCH 013/139] use macro as module --- src/management-system-v2/app/confluence/macro-editor/page.tsx | 2 +- src/management-system-v2/public/atlassian-connect.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/page.tsx index 50ba31329..65bef35b2 100644 --- a/src/management-system-v2/app/confluence/macro-editor/page.tsx +++ b/src/management-system-v2/app/confluence/macro-editor/page.tsx @@ -21,7 +21,7 @@ const MacroEditor = () => { const saveMacro = () => { if (window.AP) { - window.AP.confluence.saveMacro({ processId }, ); + window.AP.confluence.saveMacro({ processId }, 'TEST'); window.AP.confluence.closeMacroEditor(); } }; diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index 3ad664199..2b95cbaed 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -10,6 +10,7 @@ "authentication": { "type": "none" }, + "apiVersion": 1, "scopes": ["read", "write"], "modules": { "generalPages": [ @@ -22,7 +23,7 @@ "location": "system.space.sidebar/main-links" } ], - "dynamicContentMacros": [ + "macro": [ { "width": "200px", "height": "200px", From 58943994091e61e5a8dd6f862d77513d290bc129 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 05:14:34 +0200 Subject: [PATCH 014/139] use dynamicContentMacros --- src/management-system-v2/public/atlassian-connect.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index 2b95cbaed..b23e7cc43 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -23,7 +23,7 @@ "location": "system.space.sidebar/main-links" } ], - "macro": [ + "dynamicContentMacros": [ { "width": "200px", "height": "200px", From 7c94a6459cff485dc98535b0f760c364efac05ff Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 05:35:06 +0200 Subject: [PATCH 015/139] change bodytype to none --- src/management-system-v2/app/confluence/macro-editor/page.tsx | 2 +- src/management-system-v2/public/atlassian-connect.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/page.tsx index 65bef35b2..2ecefd2e3 100644 --- a/src/management-system-v2/app/confluence/macro-editor/page.tsx +++ b/src/management-system-v2/app/confluence/macro-editor/page.tsx @@ -21,7 +21,7 @@ const MacroEditor = () => { const saveMacro = () => { if (window.AP) { - window.AP.confluence.saveMacro({ processId }, 'TEST'); + window.AP.confluence.saveMacro({ processId }); window.AP.confluence.closeMacroEditor(); } }; diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index b23e7cc43..044fd5d31 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -28,7 +28,7 @@ "width": "200px", "height": "200px", "key": "proceed-macro", - "bodyType": "rich-text", + "bodyType": "none", "name": { "value": "Proceed Process Modeler" }, From 5e3660fc29788c130045211f9972c423289effb2 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 05:43:18 +0200 Subject: [PATCH 016/139] added outputtype --- src/management-system-v2/public/atlassian-connect.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index 044fd5d31..50e88a7eb 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -29,6 +29,7 @@ "height": "200px", "key": "proceed-macro", "bodyType": "none", + "outputType": "block", "name": { "value": "Proceed Process Modeler" }, From f6a05ac9c27446b3df6173d0044286c2d9c1854a Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 17:34:36 +0200 Subject: [PATCH 017/139] added missing cookie attributes --- .../api/auth/[...nextauth]/auth-options.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts b/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts index 3d3e4e86f..6b74ea943 100644 --- a/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts +++ b/src/management-system-v2/app/api/auth/[...nextauth]/auth-options.ts @@ -106,6 +106,35 @@ const nextAuthOptions: AuthOptions = { secure: true, }, }, + pkceCodeVerifier: { + name: `next-auth.pkce.code_verifier`, + options: { + httpOnly: true, + sameSite: 'none', + path: '/', + secure: true, + maxAge: 900, + }, + }, + state: { + name: `next-auth.state`, + options: { + httpOnly: true, + sameSite: 'none', + path: '/', + secure: true, + maxAge: 900, + }, + }, + nonce: { + name: `next-auth.nonce`, + options: { + httpOnly: true, + sameSite: 'none', + path: '/', + secure: true, + }, + }, }, pages: { signIn: '/signin', From 5f08f91f789478533c8b2320155c0c58b8a2c71d Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 19:26:20 +0200 Subject: [PATCH 018/139] use viewer for macro --- .../app/confluence/macro/macro.tsx | 20 +++----------- .../app/confluence/macro/page.tsx | 27 ++++++++++++++++--- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/management-system-v2/app/confluence/macro/macro.tsx b/src/management-system-v2/app/confluence/macro/macro.tsx index 1e29136ba..5b47e2263 100644 --- a/src/management-system-v2/app/confluence/macro/macro.tsx +++ b/src/management-system-v2/app/confluence/macro/macro.tsx @@ -2,29 +2,17 @@ import { useRouter } from 'next/navigation'; import { useEffect } from 'react'; import Head from 'next/head'; +import Viewer from '@/components/bpmn-viewer'; const Macro = ({ processId }: { processId: string }) => { const router = useRouter(); console.log('router query', router); - useEffect(() => { - if (processId) { - router.push(`/confluence/fullscreen?processId=${processId}`); - } - }, [processId]); + console.log('processId', processId); + const mockedProcessDefinitionId = '_39b08e20-1c28-4b0c-919b-e823e5b650ed'; return ( <> - - Proceed Macro - - -
-

Proceed Process Modeler

-

Click the button below to edit the process in fullscreen mode.

- -
+ ); }; diff --git a/src/management-system-v2/app/confluence/macro/page.tsx b/src/management-system-v2/app/confluence/macro/page.tsx index da2aef943..975a4de09 100644 --- a/src/management-system-v2/app/confluence/macro/page.tsx +++ b/src/management-system-v2/app/confluence/macro/page.tsx @@ -1,13 +1,34 @@ -'use client'; +import Layout from '@/app/(dashboard)/[environmentId]/layout-client'; import Macro from './macro'; +import { getCurrentUser } from '@/components/auth'; +import { getEnvironmentById } from '@/lib/data/legacy/iam/environments'; +import { getUserOrganizationEnviroments } from '@/lib/data/legacy/iam/memberships'; +import { Environment } from '@/lib/data/environment-schema'; -const MacroPage = ({ params }: { params: { processId: string } }) => { +const MacroPage = async ({ params }: { params: { processId: string } }) => { const processId = params.processId; console.log('params', params); + const { session, userId } = await getCurrentUser(); + + const userEnvironments: Environment[] = [getEnvironmentById(userId)]; + userEnvironments.push( + ...getUserOrganizationEnviroments(userId).map((environmentId) => + getEnvironmentById(environmentId), + ), + ); + return ( <> - + + + ); }; From 83ff6ce135da4f6eb1eea9e995e5958ea6c2befd Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 19:57:36 +0200 Subject: [PATCH 019/139] try using delivered processId of macro editor in macro --- .../app/confluence/macro-editor/page.tsx | 10 +++++----- .../app/confluence/macro/macro.tsx | 17 +++++++++++++++-- .../app/confluence/macro/page.tsx | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/page.tsx index 2ecefd2e3..4b685d23d 100644 --- a/src/management-system-v2/app/confluence/macro-editor/page.tsx +++ b/src/management-system-v2/app/confluence/macro-editor/page.tsx @@ -8,19 +8,19 @@ const MacroEditor = () => { const [processId, setProcessId] = useState(''); useEffect(() => { - if (window.AP) { + if (window.AP && window.AP.confluence) { console.log('window AP', window.AP); - window.AP.dialog.getCustomData((data) => { - console.log('data', data); + window.AP.confluence.getMacroData((data: any) => { + console.log('confluence macroData', data); if (data) { - setProcessId(data.parameters?.processId || ''); + setProcessId(data.processId || data.parameters?.processId || ''); } }); } }, []); const saveMacro = () => { - if (window.AP) { + if (window.AP && window.AP.confluence) { window.AP.confluence.saveMacro({ processId }); window.AP.confluence.closeMacroEditor(); } diff --git a/src/management-system-v2/app/confluence/macro/macro.tsx b/src/management-system-v2/app/confluence/macro/macro.tsx index 5b47e2263..8e8d0256c 100644 --- a/src/management-system-v2/app/confluence/macro/macro.tsx +++ b/src/management-system-v2/app/confluence/macro/macro.tsx @@ -1,14 +1,27 @@ 'use client'; import { useRouter } from 'next/navigation'; -import { useEffect } from 'react'; +import { useEffect, useState } from 'react'; import Head from 'next/head'; import Viewer from '@/components/bpmn-viewer'; -const Macro = ({ processId }: { processId: string }) => { +const Macro = () => { + const [processId, setProcessId] = useState(''); const router = useRouter(); console.log('router query', router); console.log('processId', processId); + useEffect(() => { + if (window.AP && window.AP.confluence) { + console.log('window AP', window.AP); + window.AP.confluence.getMacroData((data: any) => { + console.log('confluence macroData', data); + if (data) { + setProcessId(data.processId || data.parameters?.processId || ''); + } + }); + } + }, []); + const mockedProcessDefinitionId = '_39b08e20-1c28-4b0c-919b-e823e5b650ed'; return ( <> diff --git a/src/management-system-v2/app/confluence/macro/page.tsx b/src/management-system-v2/app/confluence/macro/page.tsx index 975a4de09..ba2d38992 100644 --- a/src/management-system-v2/app/confluence/macro/page.tsx +++ b/src/management-system-v2/app/confluence/macro/page.tsx @@ -27,7 +27,7 @@ const MacroPage = async ({ params }: { params: { processId: string } }) => { userEnvironments={userEnvironments} activeSpace={{ spaceId: userId || '', isOrganization: false }} > - + ); From 640637d6b36048c570a6088c14b38bcce68d9ec0 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 20:19:12 +0200 Subject: [PATCH 020/139] added logs --- src/management-system-v2/app/confluence/macro/macro.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/management-system-v2/app/confluence/macro/macro.tsx b/src/management-system-v2/app/confluence/macro/macro.tsx index 8e8d0256c..5a3a8c79c 100644 --- a/src/management-system-v2/app/confluence/macro/macro.tsx +++ b/src/management-system-v2/app/confluence/macro/macro.tsx @@ -11,6 +11,7 @@ const Macro = () => { console.log('processId', processId); useEffect(() => { + console.log('USEEFFECT', window.AP); if (window.AP && window.AP.confluence) { console.log('window AP', window.AP); window.AP.confluence.getMacroData((data: any) => { @@ -22,6 +23,10 @@ const Macro = () => { } }, []); + useEffect(() => { + console.log('window.AP useEffect', window.AP); + }, [window, window.AP]); + const mockedProcessDefinitionId = '_39b08e20-1c28-4b0c-919b-e823e5b650ed'; return ( <> From 23ad86d41b96be35b327f0bfddae7d4c265c249f Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 21 May 2024 20:32:44 +0200 Subject: [PATCH 021/139] added head with atlassian cdn in macro --- src/management-system-v2/app/confluence/macro/page.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/management-system-v2/app/confluence/macro/page.tsx b/src/management-system-v2/app/confluence/macro/page.tsx index ba2d38992..a2e9cc17d 100644 --- a/src/management-system-v2/app/confluence/macro/page.tsx +++ b/src/management-system-v2/app/confluence/macro/page.tsx @@ -4,6 +4,7 @@ import { getCurrentUser } from '@/components/auth'; import { getEnvironmentById } from '@/lib/data/legacy/iam/environments'; import { getUserOrganizationEnviroments } from '@/lib/data/legacy/iam/memberships'; import { Environment } from '@/lib/data/environment-schema'; +import Head from 'next/head'; const MacroPage = async ({ params }: { params: { processId: string } }) => { const processId = params.processId; @@ -20,6 +21,10 @@ const MacroPage = async ({ params }: { params: { processId: string } }) => { return ( <> + + Proceed Macro Editor + + Date: Tue, 21 May 2024 20:52:58 +0200 Subject: [PATCH 022/139] move Head to macro component instead of page.tsx --- src/management-system-v2/app/confluence/macro/macro.tsx | 6 +++++- src/management-system-v2/app/confluence/macro/page.tsx | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/management-system-v2/app/confluence/macro/macro.tsx b/src/management-system-v2/app/confluence/macro/macro.tsx index 5a3a8c79c..77d2ce97a 100644 --- a/src/management-system-v2/app/confluence/macro/macro.tsx +++ b/src/management-system-v2/app/confluence/macro/macro.tsx @@ -9,7 +9,7 @@ const Macro = () => { const router = useRouter(); console.log('router query', router); console.log('processId', processId); - + console.log('COMPONENT LOADED', window.AP); useEffect(() => { console.log('USEEFFECT', window.AP); if (window.AP && window.AP.confluence) { @@ -30,6 +30,10 @@ const Macro = () => { const mockedProcessDefinitionId = '_39b08e20-1c28-4b0c-919b-e823e5b650ed'; return ( <> + + Proceed Macro Editor + + ); diff --git a/src/management-system-v2/app/confluence/macro/page.tsx b/src/management-system-v2/app/confluence/macro/page.tsx index a2e9cc17d..2813c74a2 100644 --- a/src/management-system-v2/app/confluence/macro/page.tsx +++ b/src/management-system-v2/app/confluence/macro/page.tsx @@ -21,10 +21,6 @@ const MacroPage = async ({ params }: { params: { processId: string } }) => { return ( <> - - Proceed Macro Editor - - Date: Wed, 22 May 2024 02:53:02 +0200 Subject: [PATCH 023/139] add processId in route for confluence macro --- .../app/confluence/macro-editor/page.tsx | 37 ++++++++-------- .../confluence/macro/[processId]/macro.tsx | 16 +++++++ .../macro/{ => [processId]}/page.tsx | 14 ++++++- .../app/confluence/macro/macro.tsx | 42 ------------------- .../public/atlassian-connect.json | 2 +- 5 files changed, 47 insertions(+), 64 deletions(-) create mode 100644 src/management-system-v2/app/confluence/macro/[processId]/macro.tsx rename src/management-system-v2/app/confluence/macro/{ => [processId]}/page.tsx (75%) delete mode 100644 src/management-system-v2/app/confluence/macro/macro.tsx diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/page.tsx index 4b685d23d..8c79af3eb 100644 --- a/src/management-system-v2/app/confluence/macro-editor/page.tsx +++ b/src/management-system-v2/app/confluence/macro-editor/page.tsx @@ -1,37 +1,36 @@ 'use client'; -import Head from 'next/head'; import { useState, useEffect } from 'react'; -import Macro from '../macro/macro'; const MacroEditor = () => { const [processId, setProcessId] = useState(''); useEffect(() => { - if (window.AP && window.AP.confluence) { - console.log('window AP', window.AP); - window.AP.confluence.getMacroData((data: any) => { - console.log('confluence macroData', data); - if (data) { - setProcessId(data.processId || data.parameters?.processId || ''); - } - }); + if (typeof window !== 'undefined') { + console.log('window', window); + if (window.AP && window.AP.confluence) { + console.log('window AP', window.AP); + window.AP.confluence.getMacroData((data: any) => { + console.log('confluence macroData', data); + if (data) { + setProcessId(data.processId || data.parameters?.processId || ''); + } + }); + } } - }, []); + }); const saveMacro = () => { - if (window.AP && window.AP.confluence) { - window.AP.confluence.saveMacro({ processId }); - window.AP.confluence.closeMacroEditor(); - } + // if (window.AP && window.AP.confluence) { + // window.AP.confluence.saveMacro({ processId }); + // window.AP.confluence.closeMacroEditor(); + // } + console.log('SAVE MACRO', processId); + window.AP.dialog.close({ processId }); }; return ( <> - - Proceed Macro Editor - -
Macro Editor
{ + console.log('processId', processId); + console.log('bpmn', bpmn); + + return ( + <> + + + ); +}; + +export default Macro; diff --git a/src/management-system-v2/app/confluence/macro/page.tsx b/src/management-system-v2/app/confluence/macro/[processId]/page.tsx similarity index 75% rename from src/management-system-v2/app/confluence/macro/page.tsx rename to src/management-system-v2/app/confluence/macro/[processId]/page.tsx index 2813c74a2..b8833af0c 100644 --- a/src/management-system-v2/app/confluence/macro/page.tsx +++ b/src/management-system-v2/app/confluence/macro/[processId]/page.tsx @@ -4,13 +4,14 @@ import { getCurrentUser } from '@/components/auth'; import { getEnvironmentById } from '@/lib/data/legacy/iam/environments'; import { getUserOrganizationEnviroments } from '@/lib/data/legacy/iam/memberships'; import { Environment } from '@/lib/data/environment-schema'; -import Head from 'next/head'; +import { getProcessBPMN } from '@/lib/data/processes'; const MacroPage = async ({ params }: { params: { processId: string } }) => { const processId = params.processId; console.log('params', params); const { session, userId } = await getCurrentUser(); + console.log('userId', userId); const userEnvironments: Environment[] = [getEnvironmentById(userId)]; userEnvironments.push( @@ -19,6 +20,15 @@ const MacroPage = async ({ params }: { params: { processId: string } }) => { ), ); + const BPMN = await getProcessBPMN(processId, userId).then((res) => { + if (typeof res === 'object' && 'error' in res) { + throw res.error; + } + return res; + }); + + console.log('BPMN', BPMN); + return ( <> { userEnvironments={userEnvironments} activeSpace={{ spaceId: userId || '', isOrganization: false }} > - + ); diff --git a/src/management-system-v2/app/confluence/macro/macro.tsx b/src/management-system-v2/app/confluence/macro/macro.tsx deleted file mode 100644 index 77d2ce97a..000000000 --- a/src/management-system-v2/app/confluence/macro/macro.tsx +++ /dev/null @@ -1,42 +0,0 @@ -'use client'; -import { useRouter } from 'next/navigation'; -import { useEffect, useState } from 'react'; -import Head from 'next/head'; -import Viewer from '@/components/bpmn-viewer'; - -const Macro = () => { - const [processId, setProcessId] = useState(''); - const router = useRouter(); - console.log('router query', router); - console.log('processId', processId); - console.log('COMPONENT LOADED', window.AP); - useEffect(() => { - console.log('USEEFFECT', window.AP); - if (window.AP && window.AP.confluence) { - console.log('window AP', window.AP); - window.AP.confluence.getMacroData((data: any) => { - console.log('confluence macroData', data); - if (data) { - setProcessId(data.processId || data.parameters?.processId || ''); - } - }); - } - }, []); - - useEffect(() => { - console.log('window.AP useEffect', window.AP); - }, [window, window.AP]); - - const mockedProcessDefinitionId = '_39b08e20-1c28-4b0c-919b-e823e5b650ed'; - return ( - <> - - Proceed Macro Editor - - - - - ); -}; - -export default Macro; diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index 50e88a7eb..86547a872 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -36,7 +36,7 @@ "description": { "value": "Open the process modeler in fullscreen." }, - "url": "/confluence/macro", + "url": "/confluence/macro/{processId}", "editor": { "url": "/confluence/macro-editor", "width": "800px", From c8389958685ecfe24592e2e45a18eef651f02d61 Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 22 May 2024 03:06:05 +0200 Subject: [PATCH 024/139] bugfix --- src/management-system-v2/app/confluence/macro-editor/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/page.tsx index 8c79af3eb..aa9aaa762 100644 --- a/src/management-system-v2/app/confluence/macro-editor/page.tsx +++ b/src/management-system-v2/app/confluence/macro-editor/page.tsx @@ -18,7 +18,7 @@ const MacroEditor = () => { }); } } - }); + }, []); const saveMacro = () => { // if (window.AP && window.AP.confluence) { From e3c2e2556cebfeb1b0b2fbcee06110b6d2b57535 Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 22 May 2024 03:07:30 +0200 Subject: [PATCH 025/139] use confluence functions --- .../app/confluence/macro-editor/page.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/page.tsx index aa9aaa762..3f8138108 100644 --- a/src/management-system-v2/app/confluence/macro-editor/page.tsx +++ b/src/management-system-v2/app/confluence/macro-editor/page.tsx @@ -21,12 +21,12 @@ const MacroEditor = () => { }, []); const saveMacro = () => { - // if (window.AP && window.AP.confluence) { - // window.AP.confluence.saveMacro({ processId }); - // window.AP.confluence.closeMacroEditor(); - // } + if (window.AP && window.AP.confluence) { + window.AP.confluence.saveMacro({ processId }); + window.AP.confluence.closeMacroEditor(); + } console.log('SAVE MACRO', processId); - window.AP.dialog.close({ processId }); + // window.AP.dialog.close({ processId }); }; return ( From 38c5da1ad8ce434b5e08ec9d6019838fb5b039ba Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 22 May 2024 18:36:12 +0200 Subject: [PATCH 026/139] useQuery to fetch updated BPMN in macro --- .../confluence/macro/[processId]/macro.tsx | 42 +++++++++++++++++-- .../app/confluence/macro/[processId]/page.tsx | 2 +- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/management-system-v2/app/confluence/macro/[processId]/macro.tsx b/src/management-system-v2/app/confluence/macro/[processId]/macro.tsx index 54ffbf224..5ac6cfc14 100644 --- a/src/management-system-v2/app/confluence/macro/[processId]/macro.tsx +++ b/src/management-system-v2/app/confluence/macro/[processId]/macro.tsx @@ -1,14 +1,48 @@ 'use client'; import BPMNCanvas from '@/components/bpmn-canvas'; import Viewer from '@/components/bpmn-viewer'; +import { getProcessBPMN } from '@/lib/data/processes'; +import { useQuery, useSuspenseQuery } from '@tanstack/react-query'; +import { useEffect, useState } from 'react'; -const Macro = ({ processId, bpmn }: { processId: string; bpmn: string }) => { - console.log('processId', processId); - console.log('bpmn', bpmn); +const Macro = ({ + processId, + bpmn, + userId, +}: { + processId: string; + bpmn: string; + userId: string; +}) => { + const [shouldFetch, setShouldFetch] = useState(false); + + const { data } = useQuery({ + queryKey: [userId, 'process', processId, 'bpmn'], + queryFn: async () => { + console.log('USE QUERY'); + + const res = await getProcessBPMN(processId, userId); + console.log('res', res); + if (typeof res === 'object' && 'error' in res) { + throw res.error; + } + return res; + }, + enabled: shouldFetch, + }); + + const BPMN = data || bpmn; + + useEffect(() => { + if (processId) { + setShouldFetch(true); + } + }, [processId]); return ( <> - + {/* */} + ); }; diff --git a/src/management-system-v2/app/confluence/macro/[processId]/page.tsx b/src/management-system-v2/app/confluence/macro/[processId]/page.tsx index b8833af0c..dae0b3269 100644 --- a/src/management-system-v2/app/confluence/macro/[processId]/page.tsx +++ b/src/management-system-v2/app/confluence/macro/[processId]/page.tsx @@ -38,7 +38,7 @@ const MacroPage = async ({ params }: { params: { processId: string } }) => { userEnvironments={userEnvironments} activeSpace={{ spaceId: userId || '', isOrganization: false }} > - +
); From 4270a9e6b6a518ec3a87936fa55c5a4eda9a4d67 Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 23 May 2024 02:41:25 +0200 Subject: [PATCH 027/139] added second macro for creation of processes in confluence --- .../macro-editor/{ => create}/page.tsx | 0 .../confluence/macro-editor/embedd/page.tsx | 47 +++++++++++++++++++ .../public/atlassian-connect.json | 36 +++++++++++++- 3 files changed, 81 insertions(+), 2 deletions(-) rename src/management-system-v2/app/confluence/macro-editor/{ => create}/page.tsx (100%) create mode 100644 src/management-system-v2/app/confluence/macro-editor/embedd/page.tsx diff --git a/src/management-system-v2/app/confluence/macro-editor/page.tsx b/src/management-system-v2/app/confluence/macro-editor/create/page.tsx similarity index 100% rename from src/management-system-v2/app/confluence/macro-editor/page.tsx rename to src/management-system-v2/app/confluence/macro-editor/create/page.tsx diff --git a/src/management-system-v2/app/confluence/macro-editor/embedd/page.tsx b/src/management-system-v2/app/confluence/macro-editor/embedd/page.tsx new file mode 100644 index 000000000..3f8138108 --- /dev/null +++ b/src/management-system-v2/app/confluence/macro-editor/embedd/page.tsx @@ -0,0 +1,47 @@ +'use client'; + +import { useState, useEffect } from 'react'; + +const MacroEditor = () => { + const [processId, setProcessId] = useState(''); + + useEffect(() => { + if (typeof window !== 'undefined') { + console.log('window', window); + if (window.AP && window.AP.confluence) { + console.log('window AP', window.AP); + window.AP.confluence.getMacroData((data: any) => { + console.log('confluence macroData', data); + if (data) { + setProcessId(data.processId || data.parameters?.processId || ''); + } + }); + } + } + }, []); + + const saveMacro = () => { + if (window.AP && window.AP.confluence) { + window.AP.confluence.saveMacro({ processId }); + window.AP.confluence.closeMacroEditor(); + } + console.log('SAVE MACRO', processId); + // window.AP.dialog.close({ processId }); + }; + + return ( + <> +
Macro Editor
+ + setProcessId(e.target.value)} + /> + + + ); +}; + +export default MacroEditor; diff --git a/src/management-system-v2/public/atlassian-connect.json b/src/management-system-v2/public/atlassian-connect.json index 86547a872..97fc7aff3 100644 --- a/src/management-system-v2/public/atlassian-connect.json +++ b/src/management-system-v2/public/atlassian-connect.json @@ -27,7 +27,7 @@ { "width": "200px", "height": "200px", - "key": "proceed-macro", + "key": "proceed-create-macro", "bodyType": "none", "outputType": "block", "name": { @@ -38,7 +38,39 @@ }, "url": "/confluence/macro/{processId}", "editor": { - "url": "/confluence/macro-editor", + "url": "/confluence/macro-editor/create", + "width": "800px", + "height": "600px" + }, + "parameters": [ + { + "identifier": "processId", + "name": { + "value": "Process ID" + }, + "description": { + "value": "The ID of the process to edit." + }, + "type": "string", + "required": true + } + ] + }, + { + "width": "200px", + "height": "200px", + "key": "proceed-embedd-macro", + "bodyType": "none", + "outputType": "block", + "name": { + "value": "Embedd PROCEED Process" + }, + "description": { + "value": "Embedd PROCEED Processes into Confluence" + }, + "url": "/confluence/macro/{processId}", + "editor": { + "url": "/confluence/macro-editor/embedd", "width": "800px", "height": "600px" }, From cdb5c373521e1e483ecbf40cb525e370df25d6d5 Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 23 May 2024 05:07:22 +0200 Subject: [PATCH 028/139] added processlist in atlassian design for confluence --- .../app/confluence/page.tsx | 40 +- .../app/confluence/process-list.module.scss | 3 + .../app/confluence/process-list.tsx | 365 ++++++ src/management-system-v2/next.config.js | 1 + src/management-system-v2/package.json | 13 + yarn.lock | 1027 ++++++++++++++++- 6 files changed, 1400 insertions(+), 49 deletions(-) create mode 100644 src/management-system-v2/app/confluence/process-list.module.scss create mode 100644 src/management-system-v2/app/confluence/process-list.tsx diff --git a/src/management-system-v2/app/confluence/page.tsx b/src/management-system-v2/app/confluence/page.tsx index e62f1ff2c..13d172093 100644 --- a/src/management-system-v2/app/confluence/page.tsx +++ b/src/management-system-v2/app/confluence/page.tsx @@ -1,5 +1,39 @@ -const ProcessList = () => { - return
OKAY PROCESS LIST IS HERE
; +import { Space } from 'antd'; +import ProcessList from './process-list'; +import { getCurrentEnvironment, getCurrentUser } from '@/components/auth'; +import { getProcesses } from '@/lib/data/legacy/_process'; +import { Process } from '@/lib/data/process-schema'; +import Layout from '@/app/(dashboard)/[environmentId]/layout-client'; +import { Environment } from '@/lib/data/environment-schema'; +import { getEnvironmentById } from '@/lib/data/legacy/iam/environments'; +import { getUserOrganizationEnviroments } from '@/lib/data/legacy/iam/memberships'; + +const ConfluencePage = async () => { + const { session, userId } = await getCurrentUser(); + const { ability } = await getCurrentEnvironment(userId); + // get all the processes the user has access to + const ownedProcesses = (await getProcesses(ability)) as Process[]; + + const userEnvironments: Environment[] = [getEnvironmentById(userId)]; + userEnvironments.push( + ...getUserOrganizationEnviroments(userId).map((environmentId) => + getEnvironmentById(environmentId), + ), + ); + + return ( + +
+ +
+
+ ); }; -export default ProcessList; +export default ConfluencePage; diff --git a/src/management-system-v2/app/confluence/process-list.module.scss b/src/management-system-v2/app/confluence/process-list.module.scss new file mode 100644 index 000000000..7dff84967 --- /dev/null +++ b/src/management-system-v2/app/confluence/process-list.module.scss @@ -0,0 +1,3 @@ +.CheckboxSelect { + width: 500px; +} diff --git a/src/management-system-v2/app/confluence/process-list.tsx b/src/management-system-v2/app/confluence/process-list.tsx new file mode 100644 index 000000000..60a62b536 --- /dev/null +++ b/src/management-system-v2/app/confluence/process-list.tsx @@ -0,0 +1,365 @@ +'use client'; + +import DynamicTable from '@atlaskit/dynamic-table'; +import Button from '@atlaskit/button/new'; +import { ButtonGroup } from '@atlaskit/button'; +import Modal, { + ModalBody, + ModalFooter, + ModalHeader, + ModalTitle, + ModalTransition, +} from '@atlaskit/modal-dialog'; +import Form, { + FormHeader, + FormSection, + FormFooter, + RequiredAsterisk, + Field, + HelperMessage, + ErrorMessage, + CheckboxField, + ValidMessage, + useFormState, +} from '@atlaskit/form'; +import TextField from '@atlaskit/textfield'; +import TextArea from '@atlaskit/textarea'; +import Tag from '@atlaskit/tag'; +import { Fragment, useEffect, useState } from 'react'; +import Checkbox from '@atlaskit/checkbox'; +import SearchIcon from '@atlaskit/icon/glyph/search'; +import '@atlaskit/css-reset'; +import { CheckboxSelect } from '@atlaskit/select'; +import { Col, Input, Row, Space } from 'antd'; +import styles from './process-list.module.scss'; +import { Process, ProcessMetadata } from '@/lib/data/process-schema'; +import { updateProcess, deleteProcesses } from '@/lib/data/processes'; +import { useEnvironment } from '@/components/auth-can'; +import { useRouter } from 'next/navigation'; + +const SubmitButton = ({ submit }: { submit: (values: any) => void }) => { + const formState = useFormState<{ name: string; description: string }>({ + values: true, + pristine: true, + dirty: true, + valid: true, + }); + console.log('formState', formState); + return ( + + ); +}; +const ProcessModal = ({ + title, + open, + close, + processData, +}: { + title: string; + open: boolean; + close: (values?: { name: string; description: string }) => void; + processData: Process | ConfluenceProcess | null; +}) => { + const submit = (values: { name: string; description: string }) => { + close(values); + }; + console.log('processData', processData); + return ( + + {open && ( + close()}> +
+ {({ formProps, getState }) => ( + + + {title} + + + + + + { + const res = !value || value.length < 3 ? 'TOO_SHORT' : undefined; + return res; + }} + > + {({ fieldProps }) => } + + + (value && value.length < 3 ? 'TOO_SHORT' : undefined)} + > + {({ fieldProps }: any) => ( +