Skip to content

Added a new type of UIComponent to allow for backward compatibility of UQI forms#6749

Closed
ayushpahwa wants to merge 5 commits intoreleasefrom
feature/6746-backward-compatibility-for-UQI-plugins
Closed

Added a new type of UIComponent to allow for backward compatibility of UQI forms#6749
ayushpahwa wants to merge 5 commits intoreleasefrom
feature/6746-backward-compatibility-for-UQI-plugins

Conversation

@ayushpahwa
Copy link
Contributor

@ayushpahwa ayushpahwa commented Aug 19, 2021

Description

With the new UQI system coming in place, this PR is to ensure these changes do not hurt the existing system. This requires a change in the server to update the uiComponent field for a plugin to UQIDbEditorForm. Respectively, for the frontend, this value is used to switch between the new method to render or the way to handle currently working forms. The prop type has been edited for the classes to accommodate the new variable.

Fixes #6746

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Manual testing

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Test coverage results 🧪

🔴 Total coverage has decreased
// Code coverage diff between base branch:release and head branch: feature/6746-backward-compatibility-for-UQI-plugins 
Status File % Stmts % Branch % Funcs % Lines
🔴 total 54.92 (-0.01) 36.93 (-0.01) 33.22 (0) 55.51 (-0.01)
🟢 app/client/src/api/PluginApi.ts 86.67 (6.67) 100 (0) 50 (16.67) 85.71 (7.93)
🔴 app/client/src/pages/Editor/QueryEditor/index.tsx 29.9 (-2.28) 10.26 (-1.86) 7.14 (-0.55) 31.46 (-2.72)
🔴 app/client/src/utils/autocomplete/TernServer.ts 50.47 (-0.24) 37.72 (-0.88) 36.21 (0) 55.08 (-0.27)

Comment on lines +203 to +217
const allPlugins = getPlugins(state);
// Adding uiComponent field to switch form type to UQI or allow for backward compatibility
const plugin = allPlugins.find((plugin) =>
!!formData ? plugin.id === formData.pluginId : false,
);
// Defaults to old value, new value can be DBEditorForm or UQIDBEditorForm
let uiComponent = UIComponentTypes.DbEditorForm;
if (plugin) {
uiComponent = plugin.uiComponent;
}

if (uiComponent === UIComponentTypes.UQIDbEditorForm) {
initFormEvaluations;
}

Copy link
Member

Choose a reason for hiding this comment

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

Extract as a new selector

@ayushpahwa ayushpahwa enabled auto-merge (squash) August 23, 2021 08:10
@ayushpahwa
Copy link
Contributor Author

Too many mismatches due to differences from release. Fixed with #6792

@ayushpahwa ayushpahwa closed this Aug 24, 2021
auto-merge was automatically disabled August 24, 2021 10:10

Pull request was closed

@mohanarpit mohanarpit deleted the feature/6746-backward-compatibility-for-UQI-plugins branch October 8, 2022 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UQI: Add backward compatibility to allow the new plugins to work with the old ones

3 participants