Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [DHIS2-15475] Form Field Plugins #3502

Merged
merged 5 commits into from
Jan 26, 2024

Conversation

eirikhaugstulen
Copy link
Contributor

@eirikhaugstulen eirikhaugstulen commented Jan 10, 2024

This PR adds the experimental support of Form Field Plugins.

How to test this feature:

Hosted version

I have uploaded and configured everything that you need to test this out in a separate plugins instance. It will be used by many other things as well, but for now, it's mostly these PR's.
Find the Capture - Plugins app and inspect as you will.

Instance: https://dev.im.dhis2.org/tracker-plugins

Go directly to plugin form

Test locally

There are some small steps that you need to do before testing this PR out.

  • Clone the tracker-plugin repo on my GH-account and run it on port 3001 (plugin will be at 3002)
    • You can also build the plugin and upload it through App management (Good if you get CORS-errors)
  • Set up the plugin configuration in DataStore Management
    • Namespace: capture
    • Key: dataEntryForms
    • Input your form configuration (see Form Configuration for a detailed breakdown)
  • Open the capture app

Form configuration (example):

The form configuration array defines the way your form looks and functions. Each object in this array defines one section, with each section containing a set of Tracked Entity Attributes or Plugins. This configuration will display the Civil Registry Plugin in the Child Programme context.

{
  "IpHINAT79UW": [
    {
      "id": "test",
      "name": "Section 1",
      "elements": [
        {
          "id": "w75KJ2mc4zz",
          "type": "TrackedEntityAttribute"
        },
        {
          "id": "zDhUuAYrxNC",
          "type": "TrackedEntityAttribute"
        }
      ]
    },
    {
      "id": "plugin",
      "name": "Section 2",
      "elements": [
        {
          "id": "plugin",
          "name": "civil_registry",
          "pluginSource": "http://localhost:3002/plugin.html",
          "type": "plugin",
          "fieldMap": [
            {
              "IdFromApp": "w75KJ2mc4zz",
              "IdFromPlugin": "firstName",
              "objectType": "TrackedEntityAttribute"
            },
            {
              "IdFromApp": "zDhUuAYrxNC",
              "IdFromPlugin": "lastName",
              "objectType": "TrackedEntityAttribute"
            },
            {
              "IdFromApp": "yx2MCEAfU8N",
              "IdFromPlugin": "TestAttribute",
              "objectType": "Attribute"
            },
            {
              "IdFromApp": "cejWyOfXge6",
              "IdFromPlugin": "gender",
              "objectType": "TrackedEntityAttribute"
            }
          ]
        }
      ]
    }
  ]
}

@eirikhaugstulen eirikhaugstulen marked this pull request as ready for review January 10, 2024 15:57
@eirikhaugstulen eirikhaugstulen requested a review from a team as a code owner January 10, 2024 15:57
Copy link

github-actions bot commented Jan 21, 2024

Copy link

@geethaalwan geethaalwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully on 2.41 version

@eirikhaugstulen eirikhaugstulen merged commit 2ccb87b into master Jan 26, 2024
36 of 37 checks passed
@eirikhaugstulen eirikhaugstulen deleted the eh/feat/DHIS2-15475-SwitchToPluginComponent branch January 26, 2024 09:02
dhis2-bot added a commit that referenced this pull request Jan 26, 2024
# [100.53.0](v100.52.0...v100.53.0) (2024-01-26)

### Features

* [DHIS2-15475] Form Field Plugins ([#3502](#3502)) ([2ccb87b](2ccb87b))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 100.53.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants