Skip to content

Introduce possibility of mandatory non-deletable key values#1708

Open
solita-sabinaf wants to merge 5 commits into
entur:masterfrom
solita-sabinaf:DPO-3784/fixed_key_values_set
Open

Introduce possibility of mandatory non-deletable key values#1708
solita-sabinaf wants to merge 5 commits into
entur:masterfrom
solita-sabinaf:DPO-3784/fixed_key_values_set

Conversation

@solita-sabinaf
Copy link
Copy Markdown
Collaborator

@solita-sabinaf solita-sabinaf commented Apr 23, 2026

Summary

We would like to have some keys in key values that are already present in UI so that user doesn't need to type them, and that cannot be deleted

Screenshot 2026-04-23 at 11 37 29

Unit tests

Tested with and without mandatory keys specified in the bootstrap.json

Use this to test:

"mandatoryKeyValuesSet": {
    "stopPlace": {
      "rail": ["uicCode", "ersad.PRMTSICompliantStation", "ersad.AccessibleStation"],
      "bus": ["service_level"]
    },
    "quay": {
      "all": ["digiroad_rubbish_disposal_equipment"],
      "tram": ["digiroad_id"],
      "bus": ["digiroad_id"]
    }
  }

Comment thread src/components/Dialogs/KeyValuesDialog.tsx
Comment thread src/components/Dialogs/KeyValuesDialog.tsx
@testower testower requested a review from a-limyr April 23, 2026 08:41
@solita-sabinaf solita-sabinaf force-pushed the DPO-3784/fixed_key_values_set branch from 52c2549 to 562fce1 Compare April 27, 2026 16:34
@@ -0,0 +1,294 @@
/*
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The diff looked better on a commit level :/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's ok, the benefit is now the file history can be tracked across the rename.

@sfatali
Copy link
Copy Markdown

sfatali commented Apr 28, 2026

Ping @a-limyr, this is ready for review

Copy link
Copy Markdown
Contributor

@a-limyr a-limyr left a comment

Choose a reason for hiding this comment

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

Looks good, found two minor things. Good job!

const keyValuesOrigin = useSelector(
(state: any) => state.user.keyValuesOrigin?.type,
);
disabled = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably an old bug, but this line will result in always showing the edit, delete and create new buttons even when not logged in.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thank you, that's a great catch! That was something I added and forgot to clear away. Along the way removed the const keyValuesOrigin as it wasn't used anywhere


const handleUpdateValues = (key: string, values: string[]) => {
setIsEditingOpen(false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For new keyValues there is run two dispatches, one for create and then on for update. I would suggest adding a return statement after create to avoid that.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point 👍

@testower testower requested a review from a-limyr May 7, 2026 08:35
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.

4 participants