stable
Clone or download
Part of story #28274: Auto select of parents No functional change expected on the artifact link field: - When "Parent" link type is selected, the link-selector dropdown shows the list of possible parents (sorted by project when in Team project context). - Typing in the link-selector filters the list of parents. - When another link type is selected, the link-selector dropdown is empty, you can type artifact ids to search them. - The "placeholder" for the link-selector changes when "Parent" or another link type is selected. Notes: The goal is to simplify the management of the currently selected link and the management of the link-selector dropdown. Previously, we had setup a memory adapter for the selected link type because it needed to be shared between the LinkFieldController and the AutoCompleter. Instead of this, we can pass the Host (LinkField) to the AutoCompleter, which can read the value there directly. LinkField is now the only place where the state of the current link type is maintained. In the same spirit, we can use a hybrids property to store the link-selector dropdown content. Since it has access to the LinkField, the AutoCompleter can just set it directly, and it will take care of updating the link-selector. This makes AutoCompleter completely separated from link-selector (except for types). In the same way, the controller now has no knowledge of the currently selected link type, it just provides the list of possible parents when asked. Please note that there is now a loop in the setters: set controller -> set current_link_type -> get controller In order to break that loop, we let the setter for controller finish its assignment (by letting it return) and later (through setTimeout) we assign current_link_type. As a result, the setCurrentLinkType will find the host.controller and all we be well. Change-Id: I422931e32244ebe9568eb47026f658e2cdc0b54b
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/tracker/scripts/lib/artifact-modal/package.json | +1 | −0 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/pnpm-lock.yaml | +2 | −0 | Go to diff View file |
D | plugins/tracker/scripts/lib/artifact-modal/src/adapters/Memory/SelectedLinkTypeStore.test.ts | +0 | −43 | Go to diff View file |
D | plugins/tracker/scripts/lib/artifact-modal/src/adapters/Memory/SelectedLinkTypeStore.ts | +0 | −33 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/ArtifactLinkSelectorAutoCompleter.test.ts | +23 | −34 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/ArtifactLinkSelectorAutoCompleter.ts | +16 | −22 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/LinkField.test.ts | +42 | −56 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/LinkField.ts | +29 | −24 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/LinkFieldController.test.ts | +55 | −109 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/LinkFieldController.ts | +17 | −32 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/LinkedArtifactTemplate.test.ts | +0 | −8 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/NewLinkTemplate.test.ts | +8 | −29 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/TypeSelectorTemplate.test.ts | +4 | −21 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/TypeSelectorTemplate.ts | +1 | −1 | Go to diff View file |
D | plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/link-field/RetrieveSelectedLinkType.ts | +0 | −24 | Go to diff View file |
D | plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/link-field/SetSelectedLinkType.ts | +0 | −24 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/src/tuleap-artifact-modal-controller.js | +0 | −5 | Go to diff View file |
M | plugins/tracker/scripts/lib/artifact-modal/tests/stubs/LinkSelectorStub.ts | +4 | −35 | Go to diff View file |
D | plugins/tracker/scripts/lib/artifact-modal/tests/stubs/RetrieveSelectedLinkTypeStub.ts | +0 | −43 | Go to diff View file |
D | plugins/tracker/scripts/lib/artifact-modal/tests/stubs/SetSelectedLinkTypeStub.ts | +0 | −26 | Go to diff View file |