Project

General

Profile

Actions

Feature #2698

closed

Select the value if the required select box has only one value

Added by Alena Peterová about 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
High
Assignee:
Vít Švanda
Category:
Frontend
Target version:
Start date:
03/02/2021
Due date:
% Done:

100%

Estimated time:
8.00 h
Owner:

Description

If a select box has only one possible value, and the value is required, choose the value by default.

Use case:
  • A local administrator has rights to manage users in only one organization. When creating a new user, the admin shouldn't select the organization at all, it should be automatically selected.
  • Other places were it's usual to have only one value - mapping for the synchronization etc.

Related issues

Related to IdStory Identity Manager - Defect #2841: When we can assign only one role, the modal window is stuckClosedVít Švanda05/31/2021

Actions
Actions #2

Updated by Alena Peterová about 3 years ago

  • Target version set to 11.0.0
Actions #3

Updated by Radek Tomiška about 3 years ago

  • Assignee changed from Radek Tomiška to Vít Švanda
  • Estimated time set to 8.00 h
Actions #4

Updated by Vít Švanda about 3 years ago

  • Status changed from New to In Progress
Actions #5

Updated by Vít Švanda about 3 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Vít Švanda to Radek Tomiška
  • % Done changed from 0 to 90

Implemented new attribute for select box component "useFirstIfOne".
Use the first searched value if exists only one and if selected value is empty. By default is attribute undefined and in that state is selected first result only if select box is required.

Commit: https://github.com/bcvsolutions/CzechIdMng/commit/ac119003f94d347b99f30bfabce21cc2b57517ae

Actions #7

Updated by Radek Tomiška almost 3 years ago

  • Status changed from Needs feedback to In Progress
  • Assignee changed from Radek Tomiška to Vít Švanda

I did test and code review.

Review notes
- Feature works on default identity contract detail, when work position is required (by form projection), awesome. But selected value cannot be cleared => selected value is returned after clear action again.
- Feature didn't work in form projection for required work position.
- Feature could work in EnumSelectBox the same way. It make sense mainly, when EnumSelectBox has dynamic options.

Actions #8

Updated by Vít Švanda almost 3 years ago

Thanks for feedback. I fixed problem on projection detail. It was about "null vs undefined". Same problem was also for "useFirst", I fixed it too.

Commit: https://github.com/bcvsolutions/CzechIdMng/commit/88564ab4b0ca637225f716c71db748453aa05371

Actions #9

Updated by Vít Švanda almost 3 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Vít Švanda to Radek Tomiška
  • I implemented disable a clear button if only one item is available and no filter (input) is used and if a select box is required.
  • Empty item (no selection) is hidden too.
  • I didn't implement this feature for enum component, may be in feature in new ticket.

Commit: https://github.com/bcvsolutions/CzechIdMng/commit/5f8413f1ab0c1bc021faad328d78071dc828da5d

Actions #10

Updated by Radek Tomiška almost 3 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Radek Tomiška to Vít Švanda
  • % Done changed from 90 to 100

I did test and code review, feature works in projection now and clerable button (and option) is hidden by default. Code is nice too, thx!

Note: I found just one trivial issue - when record is selected by tree modal window, then clearable button is shown again (empty option is not shown correctly). It's rare UC, so I'm closing this ticket.

Actions #11

Updated by Vít Švanda almost 3 years ago

  • Status changed from Resolved to In Progress
Actions #12

Updated by Vít Švanda almost 3 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Vít Švanda to Radek Tomiška

Fixed problem with case, where a selectbox is rquired and user filtering items by selectbox input. If only one remains, then the selectbox select last one, but component is still unvalid.

Solution is not use this feature, if input filtering is uses.

Commit: https://github.com/bcvsolutions/CzechIdMng/commit/0976cc2279771ef08314dd8eb16c0126dbb060ba

Actions #13

Updated by Radek Tomiška almost 3 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Radek Tomiška to Vít Švanda

I did test nad code review, it works and code is nice, thx!

Actions #14

Updated by Radek Tomiška almost 3 years ago

  • Status changed from Resolved to Closed
Actions #15

Updated by Radek Tomiška almost 3 years ago

  • Related to Defect #2841: When we can assign only one role, the modal window is stuck added
Actions

Also available in: Atom PDF