Skip to content

Commit

Permalink
bcbox/coms file upload poc
Browse files Browse the repository at this point in the history
  • Loading branch information
midhun-aot committed Nov 22, 2023
1 parent 7091b8e commit b69aa67
Show file tree
Hide file tree
Showing 11 changed files with 283 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ RUN echo "$ssh_prv_key" | sed 's/\\n/\n/g' > /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa.pub

# COPY id_rsa_epd /root/.ssh/id_rsa
# COPY id_rsa_epd.pub /root/.ssh/id_rsa.pub

# RUN chmod 600 /root/.ssh/id_rsa

# RUN chmod 600 /root/.ssh/id_rsa.pub

# RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts

RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts

RUN git clone git@github.com:AOT-Technologies/forms-flow-ai-ee.git -b epd-ff-ee-5.2.0 /tmp/forms-flow-ai/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
- REACT_APP_MT_ADMIN_BASE_URL_VERSION=${MT_ADMIN_BASE_URL_VERSION}
- REACT_APP_CUSTOM_SUBMISSION_URL=${CUSTOM_SUBMISSION_URL}
- REACT_APP_CUSTOM_SUBMISSION_ENABLED=${CUSTOM_SUBMISSION_ENABLED:-false}
- REACT_APP_DRAFT_ENABLED=${DRAFT_ENABLED:-false}
- REACT_APP_DRAFT_ENABLED=${DRAFT_ENABLED:-true}
- REACT_APP_DRAFT_POLLING_RATE=${DRAFT_POLLING_RATE:-15000}
- REACT_APP_EXPORT_PDF_ENABLED=${EXPORT_PDF_ENABLED:-false}
- REACT_APP_PUBLIC_WORKFLOW_ENABLED=${PUBLIC_WORKFLOW_ENABLED:-false}
Expand All @@ -45,6 +45,7 @@ services:
- REACT_APP_ENABLE_APPLICATIONS_MODULE=${ENABLE_APPLICATIONS_MODULE:-true}
- REACT_APP_CUSTOM_MAP_URL=${EPD_CUSTOM_MAP_URL:-http://localhost:4000/map}
- REACT_APP_CUSTOM_LOGOUT_URL=${EPD_IDP_LOGOUT_URL:-https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https://epd-keycloak-dev.apps.silver.devops.gov.bc.ca/auth/realms/forms-flow-ai/protocol/openid-connect/logout?post_logout_redirect_uri=http://localhost:4000}
- REACT_APP_CUSTOM_FILE_UPLOAD=${EPD_APP_FILE_UPLOAD:-http://localhost:4000/fileupload}
ports:
- "3000:8080"
tty: true
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ window["_env_"] = {
REACT_APP_ENABLE_APPLICATIONS_MODULE: "${REACT_APP_ENABLE_APPLICATIONS_MODULE}",
REACT_APP_CUSTOM_MAP_URL: "${REACT_APP_CUSTOM_MAP_URL}",
REACT_APP_CUSTOM_LOGOUT_URL: "${REACT_APP_CUSTOM_LOGOUT_URL}",
REACT_APP_CUSTOM_FILE_UPLOAD: "${REACT_APP_CUSTOM_FILE_UPLOAD}",

};
9 changes: 9 additions & 0 deletions forms-flow-ai/forms-flow-ai-ee/forms-flow-web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ RUN echo "$ssh_prv_key" | sed 's/\\n/\n/g' > /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa.pub

# COPY id_rsa_epd /root/.ssh/id_rsa
# COPY id_rsa_epd.pub /root/.ssh/id_rsa.pub

# RUN chmod 600 /root/.ssh/id_rsa

# RUN chmod 600 /root/.ssh/id_rsa.pub

# RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts

RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts

RUN git clone git@github.com:AOT-Technologies/forms-flow-ai-ee.git -b epd-ff-ee-5.2.0 /tmp/forms-flow-ai/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import React from "react";
import ReactDOM from "react-dom";
import { ReactComponent } from "react-formio";
import settingsForm from "./appFileUpload.settingsForm";


export default class AppFileUpload extends ReactComponent {
/**
* This function tells the form builder about your component. It's name, icon and what group it should be in.
*
* @returns {{title: string, icon: string, group: string, documentation: string, weight: number, schema: *}}
*/
static get builderInfo() {
return {
title: "Application File Upload",
icon: "map-marker",
group: "basic",
documentation: "", //TODO
weight: 120,
schema: AppFileUpload.schema(),
};
}

/**
* This function is the default settings for the component. At a minimum you want to set the type to the registered
* type of your component (i.e. when you call Components.setComponent('type', MyComponent) these types should match.
*
* @param sources
* @returns {*}
*/
static schema() {
return ReactComponent.schema({
type: "AppFileUpload",
label: "File Upload",
});
}

/*
* Defines the settingsForm when editing a component in the builder.
*/
static editForm = settingsForm;

static eventRegistered = false;

/**
* This function is called when the DIV has been rendered and added to the DOM. You can now instantiate the react component.
*
* @param DOMElement
* #returns ReactInstance
*
*
*/
attachReact(element) {
let instance;

ReactDOM.render(
<a
href="javascript:void(0)"
onClick={() => {
console.log('file upload');
var customeApplicationId = this.data.applicationId;


let mapURL =
process.env.REACT_APP_CUSTOM_FILE_UPLOAD || window._env_.REACT_APP_CUSTOM_FILE_UPLOAD;

window.open(
mapURL + "?appId=" + customeApplicationId ,
"_blank",
"popup=yes,width=500px,heigth=500px"
);

console.log("adding listner end");

return false;
}}
>
Upload Documents
</a>,
element,
() => (this.reactInstance = instance)
);
}

/**
* Automatically detach any react components.
*
* @param element
*/
detachReact(element) {
if (element) {
ReactDOM.unmountComponentAtNode(element);
}
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import baseEditForm from 'formiojs/components/_classes/component/Component.form';

const settingsForm = (...extend) => {
return baseEditForm([
{
key: 'display',
components: [
{
key: 'placeholder',
ignore: true,
},
]
},
{
key: 'data',
components: [],
},
{
key: 'validation',
components: [],
},
{
key: 'api',
components: [],
},
{
key: 'conditional',
components: [],
},
{
key: 'logic',
components: [],
},
], ...extend);
};

export default settingsForm;

Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import fileUpload from "./custom-file-upload/fileUpload";
import Maps from './map-component/Mapservice';
import AppFileUpload from "./Application-file-upload/AppFileUpload";

const components = {
fileUpload: fileUpload,
Maps: Maps,
AppFileUpload:AppFileUpload,
};

export default components;
Expand Down
Loading

0 comments on commit b69aa67

Please sign in to comment.