diff --git a/.github/workflows/forms-flow-web-cd.yml b/.github/workflows/forms-flow-web-cd.yml index 19b7a8d6e1..6406860c6f 100644 --- a/.github/workflows/forms-flow-web-cd.yml +++ b/.github/workflows/forms-flow-web-cd.yml @@ -37,7 +37,7 @@ jobs: run: | VER=$(cat VERSION) echo "VERSION=$VER" >> $GITHUB_ENV - + - name: Set version if: ${{ github.ref == 'refs/heads/master' }} working-directory: . @@ -45,7 +45,7 @@ jobs: VER=$(cat VERSION) VER=${VER/-alpha/''} echo "VERSION=$VER" >> $GITHUB_ENV - + - run: echo ${{ env.VERSION }} - run: npm ci @@ -55,4 +55,4 @@ jobs: env: BUCKET: ${{ secrets.BUCKET}} VERSION: ${{ env.VERSION }} - working-directory: ./forms-flow-web/scripts + working-directory: ./forms-flow-web/scripts \ No newline at end of file diff --git a/.github/workflows/forms-flow-web-ci.yml b/.github/workflows/forms-flow-web-ci.yml index d49b5bc7c5..a9a5159b7e 100644 --- a/.github/workflows/forms-flow-web-ci.yml +++ b/.github/workflows/forms-flow-web-ci.yml @@ -7,13 +7,11 @@ on: - develop - master - release/** - - 5.2.0-alpha pull_request: branches: - develop - master - release/** - - 5.2.0-alpha paths: - "forms-flow-web/**" @@ -93,4 +91,4 @@ jobs: - name: build to check strictness id: build run: | - npm run build + npm run build \ No newline at end of file diff --git a/deployment/docker/docker-compose.yml b/deployment/docker/docker-compose.yml index b49941e0ee..fa333d8d65 100644 --- a/deployment/docker/docker-compose.yml +++ b/deployment/docker/docker-compose.yml @@ -23,7 +23,7 @@ services: forms-flow-forms: container_name: forms-flow-forms - image: formsflow/forms-flow-forms:v5.2.0-alpha + image: formsflow/forms-flow-forms:v5.2.1 # The app will restart until Mongo is listening restart: always @@ -85,6 +85,7 @@ services: # - CAMUNDA_HIKARI_IDLE_TIMEOUT=${CAMUNDA_HIKARI_IDLE_TIMEOUT} # - CAMUNDA_HIKARI_MAX_POOLSIZE=${CAMUNDA_HIKARI_MAX_POOLSIZE} # - CAMUNDA_HIKARI_VALID_TIMEOUT=${CAMUNDA_HIKARI_VALID_TIMEOUT} +# - CAMUNDA_BPM_HISTORY_LEVEL=${CAMUNDA_BPM_HISTORY_LEVEL} # - CAMUNDA_AUTHORIZATION_FLAG=${CAMUNDA_AUTHORIZATION_FLAG} # - CAMUNDA_AUTHORIZATION_REVOKE_CHECK_FLAG=${CAMUNDA_AUTHORIZATION_REVOKE_CHECK_FLAG} # - CAMUNDA_JOB_CORE_POOL_SIZE=${CAMUNDA_JOB_CORE_POOL_SIZE} @@ -95,7 +96,6 @@ services: # - CAMUNDA_JOB_WAIT_TIME_MILLIS=${CAMUNDA_JOB_WAIT_TIME_MILLIS} # - CAMUNDA_JOB_MAX_WAIT=${CAMUNDA_JOB_MAX_WAIT} # - CAMUNDA_METRICS_FLAG=${CAMUNDA_METRICS_FLAG} -# - CAMUNDA_BPM_HISTORY_LEVEL=${CAMUNDA_BPM_HISTORY_LEVEL} - CAMUNDA_APP_ROOT_LOG_FLAG=${CAMUNDA_APP_ROOT_LOG_FLAG:-error} - FORMSFLOW_API_URL=${FORMSFLOW_API_URL} - FORMIO_URL=${FORMIO_DEFAULT_PROJECT_URL} @@ -288,4 +288,4 @@ networks: volumes: mdb-data: - postgres: + postgres: \ No newline at end of file diff --git a/deployment/openshift/web_dc.yaml b/deployment/openshift/web_dc.yaml index 1492342fca..a8f08549fe 100644 --- a/deployment/openshift/web_dc.yaml +++ b/deployment/openshift/web_dc.yaml @@ -48,7 +48,6 @@ objects: "REACT_APP_EXPORT_PDF_ENABLED":"${REACT_APP_EXPORT_PDF_ENABLED}", "REACT_APP_PUBLIC_WORKFLOW_ENABLED":"&{REACT_APP_PUBLIC_WORKFLOW_ENABLED}"," "REACT_APP_DOCUMENT_SERVICE_URL":"${REACT_APP_DOCUMENT_SERVICE_URL}", - "REACT_APP_KEYCLOAK_ENABLE_CLIENT_AUTH":"${REACT_APP_KEYCLOAK_ENABLE_CLIENT_AUTH}", "REACT_APP_KEYCLOAK_ENABLE_CLIENT_AUTH":"${REACT_APP_KEYCLOAK_ENABLE_CLIENT_AUTH}" } @@ -287,10 +286,6 @@ parameters: displayName: REACT_APP_DOCUMENT_SERVICE_URL description: Document related services api url required: false - - name: REACT_APP_KEYCLOAK_ENABLE_CLIENT_AUTH - displayName: REACT_APP_KEYCLOAK_ENABLE_CLIENT_AUTH - description: client based auth - required: false - name: REACT_APP_KEYCLOAK_ENABLE_CLIENT_AUTH displayName: REACT_APP_KEYCLOAK_ENABLE_CLIENT_AUTH description: client based auth diff --git a/forms-flow-api/migrations/versions/91f9cd061108_add_default_filter.py b/forms-flow-api/migrations/versions/91f9cd061108_add_default_filter.py index 3064c2142f..a505e81ccb 100644 --- a/forms-flow-api/migrations/versions/91f9cd061108_add_default_filter.py +++ b/forms-flow-api/migrations/versions/91f9cd061108_add_default_filter.py @@ -7,7 +7,7 @@ """ from alembic import op import sqlalchemy as sa -from formsflow_api.models import Filter + # revision identifiers, used by Alembic. revision = '91f9cd061108' @@ -18,31 +18,21 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - # Add 'All tasks' filter as default if no other filters available. conn = op.get_bind() filter_entry = conn.execute(sa.text("SELECT * FROM Filter")).fetchone() if not filter_entry: - filter_obj = Filter() - filter_obj.name = "All Tasks" - filter_obj.variables = [{"name": "applicationId", "label": "Application Id"},{"name": "formName", "label": "Form Name"}] - filter_obj.status = 'active' - filter_obj.created_by = 'system' - filter_obj.creted = 'now()' - filter_obj.criteria = {} - filter_obj.users = {} - filter_obj.roles = {} - filter_obj.task_visible_attributes = { - "applicationId": True, - "dueDate": True, - "priority": True, - "assignee": True, - "taskTitle": True, - "createdDate": True, - "groups": True, - "followupDate": True, - } - filter_obj.save() + # Creating a new filter entry + insert_stmt = """ + INSERT INTO public.Filter(name, variables, status, created_by, created, criteria, users, roles, task_visible_attributes) + VALUES ( + 'All Tasks', + ARRAY['{"name": "applicationId", "label": "Application Id"}'::json, '{"name": "formName", "label": "Form Name"}'::json], + 'active','system',now(),'{}'::json,'{}','{}', + '{"applicationId": true, "dueDate": true, "priority": true, "assignee": true, "taskTitle": true, "createdDate": true, "groups": true, "followupDate": true}'::json + ) + """ + conn.execute(sa.text(insert_stmt)) # ### end Alembic commands ### diff --git a/forms-flow-bpm/docker-compose.yml b/forms-flow-bpm/docker-compose.yml index 6d777cd5a1..0a10b9c3f5 100644 --- a/forms-flow-bpm/docker-compose.yml +++ b/forms-flow-bpm/docker-compose.yml @@ -37,6 +37,7 @@ services: # - CAMUNDA_HIKARI_IDLE_TIMEOUT=${CAMUNDA_HIKARI_IDLE_TIMEOUT} # - CAMUNDA_HIKARI_MAX_POOLSIZE=${CAMUNDA_HIKARI_MAX_POOLSIZE} # - CAMUNDA_HIKARI_VALID_TIMEOUT=${CAMUNDA_HIKARI_VALID_TIMEOUT} +# - CAMUNDA_BPM_HISTORY_LEVEL=${CAMUNDA_BPM_HISTORY_LEVEL} # - CAMUNDA_AUTHORIZATION_FLAG=${CAMUNDA_AUTHORIZATION_FLAG} # - CAMUNDA_AUTHORIZATION_REVOKE_CHECK_FLAG=${CAMUNDA_AUTHORIZATION_REVOKE_CHECK_FLAG} # - CAMUNDA_JOB_CORE_POOL_SIZE=${CAMUNDA_JOB_CORE_POOL_SIZE} @@ -47,7 +48,6 @@ services: # - CAMUNDA_JOB_WAIT_TIME_MILLIS=${CAMUNDA_JOB_WAIT_TIME_MILLIS} # - CAMUNDA_JOB_MAX_WAIT=${CAMUNDA_JOB_MAX_WAIT} # - CAMUNDA_METRICS_FLAG=${CAMUNDA_METRICS_FLAG} -# - CAMUNDA_BPM_HISTORY_LEVEL=${CAMUNDA_BPM_HISTORY_LEVEL} - CAMUNDA_APP_ROOT_LOG_FLAG=${CAMUNDA_APP_ROOT_LOG_FLAG:-error} - FORMSFLOW_API_URL=${FORMSFLOW_API_URL} - FORMIO_URL=${FORMIO_DEFAULT_PROJECT_URL} @@ -82,4 +82,4 @@ networks: driver: "bridge" volumes: - postgres: + postgres: \ No newline at end of file diff --git a/forms-flow-forms/docker-compose.yml b/forms-flow-forms/docker-compose.yml index 6604397710..0eecc122fa 100644 --- a/forms-flow-forms/docker-compose.yml +++ b/forms-flow-forms/docker-compose.yml @@ -36,7 +36,7 @@ services: forms-flow-forms: container_name: forms-flow-forms - image: formsflow/forms-flow-forms:v5.2.0-alpha + image: formsflow/forms-flow-forms:v5.2.1 # The app will restart until Mongo is listening restart: always links: @@ -64,4 +64,4 @@ networks: driver: 'bridge' volumes: - mdb-data: + mdb-data: \ No newline at end of file diff --git a/forms-flow-web-root-config/nginx.conf b/forms-flow-web-root-config/nginx.conf index 5c2333f75f..e3736f0e81 100644 --- a/forms-flow-web-root-config/nginx.conf +++ b/forms-flow-web-root-config/nginx.conf @@ -19,8 +19,7 @@ http { default_type application/octet-stream; server_tokens off; underscores_in_headers on; - gzip on; - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + # Use a w3c standard log format log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' @@ -46,9 +45,8 @@ http { index index.html; error_log /dev/stdout info; access_log /dev/stdout; - + location / { - add_header 'Access-Control-Allow-Origin' '*'; root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; diff --git a/forms-flow-web-root-config/package.json b/forms-flow-web-root-config/package.json index 99813a5276..f7ac825670 100644 --- a/forms-flow-web-root-config/package.json +++ b/forms-flow-web-root-config/package.json @@ -52,4 +52,4 @@ "word-wrap": "1.2.4", "postcss": "8.4.31" } -} +} \ No newline at end of file diff --git a/forms-flow-web/Dockerfile b/forms-flow-web/Dockerfile index 0853e3ef40..b06ed44d78 100644 --- a/forms-flow-web/Dockerfile +++ b/forms-flow-web/Dockerfile @@ -31,4 +31,4 @@ COPY nginx.conf /etc/nginx/nginx.conf EXPOSE 8080 # Start Nginx server -CMD ["nginx", "-g", "daemon off;"] +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/forms-flow-web/docker-compose.yml b/forms-flow-web/docker-compose.yml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/forms-flow-web/package.json b/forms-flow-web/package.json index bbce1721a3..6ff198255f 100644 --- a/forms-flow-web/package.json +++ b/forms-flow-web/package.json @@ -31,10 +31,8 @@ }, "license": "MIT", "devDependencies": { - "@craco/craco": "6.4.5", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^12.1.1", - "craco-plugin-single-spa-application": "git+https://github.com/AOT-Technologies/craco-plugin-single-spa-application.git", "msw": "^0.36.0", "redux-mock-store": "^1.5.4" }, @@ -103,10 +101,7 @@ "sockjs-client": "^1.5.1", "source-map-explorer": "^2.5.2", "stompjs": "^2.3.3", - "ws": "^7.4.6", - "single-spa": "^5.9.4", - "single-spa-layout": "^2.1.0", - "single-spa-react": "^5.0.0" + "ws": "^7.4.6" }, "resolutions": { "browserslist": "^4.17.6", @@ -135,4 +130,4 @@ "not ie <= 11", "not op_mini all" ] -} +} \ No newline at end of file diff --git a/forms-flow-web/scripts/index.js b/forms-flow-web/scripts/index.js index 497f4c6578..2f98970f48 100644 --- a/forms-flow-web/scripts/index.js +++ b/forms-flow-web/scripts/index.js @@ -51,9 +51,9 @@ const run = async (params) => { */ async function upload(file_name, file, type = "application/javascript", encode = true) { const params = { - Bucket: BUCKET, - Key: `${component}/${file_name}`, - Body: createReadStream(file), + Bucket: BUCKET, + Key: `${component}/${file_name}`, + Body: createReadStream(file), ContentType: type, ContentEncoding:"gzip" }; @@ -61,7 +61,7 @@ async function upload(file_name, file, type = "application/javascript", encode = delete params.ContentEncoding; } run(params); - + } Walk.walk(`../build`, walkFunc) @@ -121,4 +121,4 @@ function walkFunc(err, pathname, dirent) { } } return Promise.resolve(); -} +} \ No newline at end of file diff --git a/forms-flow-web/scripts/minioClient.js b/forms-flow-web/scripts/minioClient.js deleted file mode 100644 index 584cb7e863..0000000000 --- a/forms-flow-web/scripts/minioClient.js +++ /dev/null @@ -1,118 +0,0 @@ -/* eslint-disable no-unused-vars */ -require("dotenv").config(); - -const { createReadStream, createWriteStream } = require("fs"); -const { createGzip } = require("zlib"); - -const Minio = require("minio"); -const pjson = require(`../package.json`); -const path = require("path"); -const Walk = require("@root/walk"); - -// Instantiate the minio client with the endpoint -// and access keys as shown below. - -const minioClient = new Minio.Client({ - endPoint: process.env.S3_ENDPOINT, - port: Number(process.env.S3_PORT), - useSSL: process.env.NODE_ENV === "production", - accessKey: process.env.S3_ACCESS_KEY, - secretKey: process.env.S3_SECRET_KEY, -}); - -const metaData = { - "Content-Type": "application/javascript", - "Content-Encoding": "gzip", -}; - -/** - * - * @param {string} file_name - artifact name - * @param {string} file - artifact path - */ -function upload(file_name, file, meta) { - minioClient.fPutObject( - process.env.S3_BUCKET_NAME, - `forms-flow-web/${pjson.version}/${file_name}`, - file, - meta, - function (err, etag) { - if (err) { - // Fail CD if upload fails - throw err; - } - console.log(`${file_name} uploaded successfully.`); - } - ); -} - -const compressFileAndUpload = (fileName, filePath) => { - const stream = createReadStream(`${filePath}/${fileName}`); - stream - .pipe(createGzip()) - .pipe(createWriteStream(`${filePath}/single-spa-build.gz.js`)) - .on("finish", () => { - console.log(`Successfully compressed the file at ${filePath}`); - upload( - "single-spa-build.gz.js", - `${filePath}/single-spa-build.gz.js`, - metaData - ); - }); -}; - -Walk.walk(`../build`, walkFunc) - .then(function () { - console.log("Collected all artifacts to upload"); - }) - .catch(function (reason) { - console.log("Failed to collect the artifacts", reason); - }); - -// walkFunc must be async, or return a Promise -function walkFunc(err, pathname, dirent) { - if (err) { - // throw an error to stop walking - // (or return to ignore and keep going) - console.warn("fs stat error for %s: %s", pathname, err.message); - return Promise.resolve(); - } - - // return false to skip a directory - // (ex: skipping "dot file" directories) - if (dirent.isDirectory() && dirent.name.startsWith(".")) { - return Promise.resolve(false); - } - - if (dirent.isFile()) { - try { - console.log( - `Collecting artifact -> ${path.dirname(pathname)}/${dirent.name}` - ); - if (dirent.name === "single-spa-build.js") { - compressFileAndUpload(dirent.name, `${path.dirname(pathname)}`); - } else if (path.dirname(pathname).includes("static")) { - if (`${path.dirname(pathname).includes("js")}`) { - upload( - `${path.dirname(pathname).substring(9).replace(/\\/g, "/")}/${ - dirent.name - }`, - `${path.dirname(pathname)}/${dirent.name}`, - { "Content-Type": "application/javascript" } - ); - } else { - upload( - `${path.dirname(pathname).substring(9).replace(/\\/g, "/")}/${ - dirent.name - }`, - `${path.dirname(pathname)}/${dirent.name}`, - { "Content-Type": "application/octet-stream" } - ); - } - } - } catch (err) { - console.log("Upload failed", err); - } - } - return Promise.resolve(); -} diff --git a/forms-flow-web/scripts/package-lock.json b/forms-flow-web/scripts/package-lock.json index 4515ab6ac7..652eb345df 100644 --- a/forms-flow-web/scripts/package-lock.json +++ b/forms-flow-web/scripts/package-lock.json @@ -1155,4 +1155,4 @@ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" } } -} +} \ No newline at end of file diff --git a/forms-flow-web/scripts/package.json b/forms-flow-web/scripts/package.json index e8e07ba763..0870f9ec3d 100644 --- a/forms-flow-web/scripts/package.json +++ b/forms-flow-web/scripts/package.json @@ -19,4 +19,4 @@ "resolutions": { "fast-xml-parser": ">=4.2.4" } -} +} \ No newline at end of file diff --git a/forms-flow-web/scripts/sample.env b/forms-flow-web/scripts/sample.env index 5e2890a8a3..ae072d295e 100644 --- a/forms-flow-web/scripts/sample.env +++ b/forms-flow-web/scripts/sample.env @@ -4,5 +4,4 @@ S3_ENDPOINT=localhost S3_ACCESS_KEY=minioadmin S3_SECRET_KEY=minioadmin S3_PORT=9000 -S3_BUCKET_NAME=test-bucket - +S3_BUCKET_NAME=test-bucket \ No newline at end of file diff --git a/forms-flow-web/src/_tests_/test-components/test-serviceflow/index.test.js b/forms-flow-web/src/_tests_/test-components/test-serviceflow/index.test.js index e244ef13ab..591bd447f5 100644 --- a/forms-flow-web/src/_tests_/test-components/test-serviceflow/index.test.js +++ b/forms-flow-web/src/_tests_/test-components/test-serviceflow/index.test.js @@ -56,13 +56,7 @@ it("should render the serviceflow index component without breaking", async () => path: "/task", route: "/task", }); - expect(screen.getByText("assignee_name_1")).toBeInTheDocument(); - expect(screen.getByText("History")).toBeInTheDocument(); - expect(screen.getByText("Diagram")).toBeInTheDocument(); - expect(screen.getByText("Form")).toBeInTheDocument(); - expect(screen.getByText("Claim")).toBeInTheDocument(); - expect(screen.getByText("Set follow-up Date")).toBeInTheDocument(); - expect(screen.getByText("Set Due date")).toBeInTheDocument(); - expect(screen.getAllByText("Review Submission")).toHaveLength(2); + expect(screen.getByText("List View")).toBeInTheDocument(); + expect(screen.getByText("Card View")).toBeInTheDocument(); } });