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

Improve configurability of single-param column refinement #39

Open
GerwinBosch opened this issue Jun 20, 2022 · 2 comments
Open

Improve configurability of single-param column refinement #39

GerwinBosch opened this issue Jun 20, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@GerwinBosch
Copy link
Collaborator

In netwerk-digitaal-erfgoed/LDWizard-Core#51 a new column refinement option was added. The functionality works great, however, the rendering of the input is "hard-coded".

Suggestion:

  • Add a inputConfiguration property to the ColumnRefinement typings
  • Make it never for the other type of refinements
  • For the single-param refinement add (at least) the following configurations
    • Label
    • Hint
  • Apply the configurations in the Transformationselector

Possible other configurable options

  • Input-type
  • Validation
  • Placeholder
  • Default value
@GerwinBosch GerwinBosch added the enhancement New feature or request label Jun 20, 2022
@wouterbeek
Copy link
Collaborator

IIUC this refinement option allows specific values to be translated to specific other values, something like a translation table.

What I do not understand is how this step is configured in the LD Wizard GUI. For example:

true/false values in a column, and you want to generate a specific URI when true.

would require something like:

From To
true IRI-A
false IRI-B
other? IRI-C

There is no current GUI component that can do this.

@wouterbeek wouterbeek changed the title Feature: Improve configurability of single-param Column refinement Improve configurability of single-param column refinement Sep 19, 2022
@GerwinBosch
Copy link
Collaborator Author

GerwinBosch commented Sep 21, 2022

@wouterbeek I think the refinement you are suggestion can already be implemented, the Single Column Refinement takes a value from the data and converts it to an IRI based on a function. This issue is about the Single Column Param Refinement which allows a transformation based on a single text-input. However, in the current version this input is not configurable (e.g. it will always say "Prefix"). So this ticket is about making it more configurable.

With the configuration below, you should get the refinement you describe

import WizardConfig from "./WizardConfig";
export const wizardConfig: WizardConfig = {
columnRefinements: [
  {
    label: "Boolean conversion",
    description: "Changes boolean...",
    type: "single",
    transformation: (data:string) => {
      if(data === "true") return "IRI-A"
      if(data === "false") return "IRI-B"
      return "IRI-C"
    }
  }
]
};
export default wizardConfig;

For this issue, however, would give you the refinement that needs to improve

import WizardConfig from "./WizardConfig";
export const wizardConfig: WizardConfig = {
columnRefinements: [
  {
    label: "prepend",
    description: "Changes boolean...",
    type: "single-param",
    transformation: (data:string, inputValue:string) => {
      return `${inputValue}/${data}`
    }
  }
]
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants