Giter Club home page Giter Club logo

samagra-development / workflow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sakshamharyana-se/enketo

5.0 5.0 29.0 5.99 MB

Workflow is an Open Source project aimed towards the creation of data flow models using config files thereby allowing you to easily create and interact with stateful applications with minimum setup.

Home Page: https://samagra-development.github.io/workflow

JavaScript 8.55% HTML 79.19% CSS 10.74% Shell 0.08% SCSS 1.15% Dockerfile 0.02% Pug 0.10% Python 0.06% TypeScript 0.10%
enketo form hacktoberfest hacktoberfest-accepted hacktoberfest2022 nestjs odk odk-xforms reactjs state-machine webform workflows xforms

workflow's People

Contributors

amit-s19 avatar ansh-sarkar avatar chakshugautam avatar choxx avatar coderaman-tech avatar drish-xd avatar harshil-jani avatar mecskyverse avatar rohan-nordstone avatar rohan27s avatar sanjaysinghrajpoot avatar shruti3004 avatar siddhesh4501 avatar tushar5526 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

workflow's Issues

Issue with Logging in Workflow/File Upload

Description

I would like to report an issue regarding the logging behavior in the Workflow/File Upload feature. The application logs certain events to the console, even when the application is running on port 3000 and I reload a different website, such as example.com.

How to reproduce

  1. Open the application and navigate to the Workflow/File Upload feature.
  2. Select an option in the form.
  3. Check the console logs for the following entries:
    1. Logs the form from index.js:37
    2. Logs true repeated multiple times per second from controller-webform.js:23
    3. Logs "Broadcasting file update" from form-controller.js:221
  4. When the app is running in port 3000, but if we reload a different website say example.com, it logs all given entries again

Screenshots

Logs:

image

Reload bug video:
Samagra_Issue.webm

Versions

  • Operating System : Ubuntu 22.04
  • Browser : Chrome

Logs

image

feat: save as draft feature for image upload

Description

Images are uploaded to the Minio once the user submits the form. But to enable Save as draft feature we should also save the images whenever the file upload event is triggered. In this way we can save the progress of the form.

The following issue can be resolved from here:
https://github.com/Samagra-Development/workflow/blob/feat/file-upload/packages/enketo-express/public/js/src/module/form-controller.js#L195

Approach:

  • Filtering the events on the basis of the event == fileUpload.
  • Hitting the /form/uploadFile API.
  • Testing it with the wrapper codebase.

Using XState as a orchestrator for UI

Project Details

Workflow is a complete package that allows you to deploy an application with authentication, database, backend, storage service, frontend and enketo forms with just a single command.

Enketo has been used all around the world for a wide range of uses from needs assessments in humanitarian aid, to raising historical awareness, to clinical research, to election monitoring.

Feature to be implemented

We need to create a state machine based system in React which allows to handle UI changes according to the state transitions and actions using XState and move application to NextJs

What needs to be built

  1. Migrate app to NextJS
  2. Add Redux Persist
  3. Implement State Machine logic for UI

Screenshot 2023-05-07 at 8 02 04 PM

Learning Path

Complexity

Medium

Skills Required

React, Redux, XState, LocalForage, Enketo

Name of Mentors

@amit-s19

Project Size

8 weeks

Product Setup

Follow this link

Acceptance Criteria

  • React app is now a NextJS based app
  • Redux is now integrated with properly written dispatchers, reducers, actions and middlewares
  • Transform React app to be powered through state machines and UI is handled through state transitions using XState
  • Enketo forms render properly

Milestones

  • Setting up the project locally
  • Understanding NextJS
  • Figuring out how state machine works and how to implement in React
  • Understanding Redux and integrating in React
  • Integrating State Machines in the app

C4GT

This issue is nominated for Code for GovTech (C4GT) 2023 edition.
C4GT is India's first annual coding program to create a community that can build and contribute to global Digital Public Goods. If you want to use Open Source GovTech to create impact, then this is the opportunity for you! More about C4GT here: https://codeforgovtech.in/

Generalised scripts to generate prod secrets

Write a CLI script in any language (preferrable python, bash, js) that rotates the secrets in a .env file.

It should be generalised enough to work with any .env file, so we can use it for other projects as well.

For example: Providing names of variables for which secrets are to be rotated in the .env file

Remove UP HRH forms.

Form workflow to uphrh-workflow repo.
Move UP HRH forms to that repo.
Delete branches and data from this repo.
Follow trunk based development

feat: UI changes from configuration

Description

Adding a Spec-driven UI changes. Currently, for any instance we have to replace all the primary, secondary and tertiary colours values in the code. Instead it should be the part of config. The config can look like:

{
    "primaryColor": "#F34621",
    "secondaryColor": "#F34621"
    "backgroundColor": "#F34621"
    "fontFamily": "#F34621"
} 

Form Builder and Manager UI

Description

P.S. These will be divided into separate issues and tracked there.

  1. A route to allow for testing your XLSX forms. Something like this
  2. API to onboard an XML to the workflow. Currently, all of these are hardcoded and manually uploaded in the form-manager.

Extract Form Controller as a Separate Package

Description

Currently, the form-controller is part of Enketo client and can live outside of it as a package. Keeping it outside of Enketo will allow for

  1. Decoupling would allow for easier upgrades to Enketo.
  2. Enable it to be written in TypeScript. Faster and safer development lifecycle.
  3. Ability to add tests for features without Enketo.

Things to implement

  • Extract form-controller as a separate package and import into enketo
  • Use Typescript to refactor the code (index.js -> index.ts)
  • Make the build command, automatically push the package to the NPM registry
  • Use babel and browserify to convert the nodeJS APIs to browser based APIs
  • Enable easy setup of the form-controller package using the npm install command.

Copy to Clipboard Feature and removing overflow

Description

  • Create a feature where we can copy the XML/JSON written in textarea on Generic Form Component
  • Remove the overflow on Generic Forms

Steps followed and expected result

  • There must be a button that should be named "Copy" with the respective icon on top of it.

  • Whenever the user clicks on the button the XML/JSON shown in the textarea must be copied to the clipboard.

  • Additionally, remove the unwanted scroll on the generic form component.

Screenshots

Remove the unwanted overflow(scroll)
image

Copy button(with an icon) should be added at the marked place
image

Making Workflow Responsive

Description

Make the User Interface of workflow responsive for mobile screens

Steps followed and expected result

  • The UI must be presentable on the mobile screen
  • Make it responsive for App.js and GenericForm/index.js

Screenshots

image

image

We can't access any type of forms currently from enketo.

Description

After starting the project from gitpod and following all the standard rules but there is some issue at the end of enketo express causing forms to load we are getting this error in our iframe

How to reproduce

Start a new workspace and open port 3000 and open any type of form

Screenshots

image
we are getting loading error.

Create and Update .env file in apps/wrapper directory through gitpod scripts

Description

Currently, to see live changes in the app we have to use npm install in ./apps/wrapper directory and then hardcode the .env file in the directory then stop the wrapper container to be able to interact.
In place of that what we can do is we can automatically add and update a .env file in the wrapper directory through gitpod scripts in our workspace.
Or we can add a bash script that will install dependencies, stop the wrapper container and start the server all at once with just one script for live interaction.

Steps followed and expected result

Add a bash script or update the gitpod script whichever path we want to choose and remove the hardcoded steps to copy-paste .env from here and there.

Adding offline support to workflow's apps

We should leverage service workers to:

Milestone 1 - Cache React Layers

  • Cache static react screens
  • Cache API responses rendering screens
  • Storing offline entered data into index DB
  • Syncing offline entered data when user online on subsequent app launch
  • Force updating the react app when a new release is made - Using service workers.
  • Keep elements online dependent - eg: Login
  • Offline location handling
  • Add installable option for PWA
  • Documentation

Milestone 2 - Render enketo offline

  • Cache the enketo form when opened for the first time in online mode.
  • Cache and prefill form - Text
  • Cache and prefill form - Image - Send to minio? Save in local?
  • Cache submission
  • Sync response to remote when user online
  • Clear prefilled form on custom logic
  • Display messages when user offline / online - When offline show dialog - "Queued response"
  • Offline location handling
  • Explore background submission (Naively implemented for now)
  • Rendering of form without iframe
  • Documentation

Milestone 3 - Offline Support next.js frontend screens - FamilyId

  • Project Setup of Family ID (1h)
  • Use a service worker library like Workbox or Next PWA to simplify the setup. (4h)
  • Cache important assets and data for offline access. (2h)
  • Implement data synchronization between the client and server when the app is online after one time login. (1d)
    • Store data locally using browser storage mechanisms like IndexedDB or localStorage.
  • Web app manifest file (manifest.json) that defines the PWA's metadata. (30m)
    • Include properties like the app name, icons, background color, and display mode.
  • Submitting of offline feedback (4h-8h)
  • Optimize the app's performance using techniques like code splitting, lazy loading, and image optimization. (1d)
  • Documentation (4+8h)
  • Integrate push notification functionality using the Push API and a push service like Firebase Cloud Messaging (FCM). - P2

Milestone 4 - Documenting & contributing

  • Contributing back to enketo - Open issue, Discuss approach & on agreement Plan a PR back:
    • Submitting to custom backend - #572
    • Image handling - #573
    • Event callbacks from enketo input -#574
    • Config for UI and icons - #575
  • Discuss to enketo - Open issue and discuss approach only:
    • Background submissions - #576
    • [Abandoned] Enketo queue UI Handling of offline resubmission.
    • Icon on offline form - #575
  • Documentation improvements
    • Define a lens - For external contributors or internal samagra folks.
    • Make it generic and take inspiration from nextjs, reactjs docs.
    • Quick setup instructions (video optionally)
  • Offline Sync Handler
    • Improve documentation
    • Retry handling
    • Success callbacks
    • Chaining calls
    • Unit Tests suite - Retry, different input types, different methods, all functionalities.
    • [Abandoned] Optionally create a PWA out of the box

Milestone 5 - Download enketo offline upfront - Community driven

  • Download offline forms in ghost component on app launch ( Current Approach )
  • Forms should be loaded in parallel
  • Config based form downloading
  • Config based UI rendering

Move to docker compose for deployment + Clean up branches

Description

The readme steps do not work for installing the repo. Grunt fails and many other dependencies fail.
We should add support for docker deployment to the repo.
We should also follow trunk based development with main, develop and feature branches. All projects should fork the main repo instead of creating branches inside this repo. Currently default branch is not main. This should be fixed.

Improve Documentation to Easy First Time Setup

Description

Improving the Documentation to ease the process of first time setup is essential as the current README.md documentation does not outline the exact steps required for building the project.

Update existing documentation on installation to include exact steps for setup. Contributions to documentations are welcome.

Minio Extraction

Description

Right now Minio is part of the controller. There are certain abstractions that can improve the implementation

  1. NestJS Minio
  2. NestJS Minio Client

There could be others as well that I was not able to find. The idea is to build/reuse a cloud-agnostic S3-compatible storage provider library and use that to store the data.

Add Edit Response Button

Description

By incorporating a form retrieval feature, users can easily access their previously submitted forms and can rectify mistakes or update outdated information.

Steps followed and expected result

After submitting the form there is a button shows named “Edit Response”, by clicking this
button you can retrieve all data and it is shown on the portal which helps users to change
the required data once again.

Fix in UI of WorkFlow

If you open a jumping form then you can see in layout there are horizontal and vertical scroll bars which is not so good for UI.
In this issue we will fix it.

Screenshot from 2023-05-22 10-12-37

Support File Upload

Description

Upload all files to Minio and share the link of the file as part of formData. The file upload API will be part of the form-manager service. All files will be uploaded to https://cdn.samagra.io.

formData files would be identified as

{
	"selfie": {
		"type": "file",
		"data": "base64 string"
	},
	"name": "nameOfThePerson"
}

will be converted to

{
	"selfie": "https://cdn.samagra.io/pathOfTheFile"
	"name": "nameOfThePerson"
}

Add Contributions.md File

Description

In order to welcome contributions from the open source community, it is important to have a well defined contributions file to which people can refer and get started with contributions to the project.

Suggested Developer Experience (DX) Improvements

Description

  • Concurrently run all node scripts present in package.json via single command in order to enhance user experience
  • Configure Turborepo config file in order to enable faster builds and first time setup.
  • Move wrapper under examples and run during setup in order to help developers get familiarized via examples.

Remove .env and provide a sample.env

.env is used to store secrets and it can be unknowingly pushed to GitHub leaking prod secrets if present. Add a sample.env and use that to make .env in gitpod

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.