Skip to content

Commit

Permalink
Merge pull request #333 from phyloref/simplify-specifier
Browse files Browse the repository at this point in the history
The Specifier component has some complex logic that allows users to modify the properties of a specifier in multiple ways, but this can lead to the specifier being overwritten just be opening it (#263). This PR sets about restructuring this component so that you can no longer modify the specifier just by opening it -- you have to explicitly modify something to trigger a modification action. (This is the minimum we need to close #263).

Now, we can't just remove all of this code, because the way in which Vue Store's data model works, we can't just plug the UI directly into the data object -- we have to call `$store.commit('setSpecifierProps', {specifier, props})` or `$store.commit('replaceTUnitForPhylogenyNode', {...})` to commit the results. So instead we need a model like this:
1. When the component is loaded, we load all of its values into a bunch of local variables, which model fields in the UI (so changing the UI immediately changes these fields). This is handled in the method `loadSpecifier()`.
2. We watch all of these variables; if any of them change, we immediately update the underlying data object with the appropriate variables depending on the specifier type. This is handled in the method `updateSpecifier()`.

Additionally, this PR:
* Removes `Apomorphy` as an option for the specifier dropdown (closes #331).
* Changes the "Expand" button on the specifier to the clearer "Edit" (this still changes to "Collapse" when the editor is expanded).
* Fields that could previously be edited has now been made readonly.
* Renames the "Verbatim specifier" field to the clearer "Specifier label".

Closes #320: we don't include any special support for UUIDs, but we do now note that they can be used. They appear as collection IDs.
  • Loading branch information
gaurav authored Jan 15, 2025
2 parents f397d02 + 58ecccb commit 3823112
Show file tree
Hide file tree
Showing 4 changed files with 375 additions and 265 deletions.
2 changes: 1 addition & 1 deletion src/components/phyloref/PhylorefView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ export default {
},
computedPhylorefType() {
// Return the type of phyloreference based on internal/external specifier structure.
return this.$store.getters.getPhylorefType(this.selectedPhyloref);
return this.$store.getters.getPhylorefTypeDescription(this.selectedPhyloref);
},
phylorefURI() {
// Get the base URI of this phyloreference.
Expand Down
4 changes: 2 additions & 2 deletions src/components/phyx/PhyxView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
{{ getPhylorefLabel(phyloref) }}
</a>
</td>
<td>{{ $store.getters.getPhylorefType(phyloref) }}</td>
<td>{{ $store.getters.getPhylorefTypeDescription(phyloref) }}</td>
<td>{{ (phyloref.internalSpecifiers || []).length }}</td>
<td>{{ (phyloref.externalSpecifiers || []).length }}</td>
<td v-for="(phylogeny, phylogenyIndex) of phylogenies">
Expand Down Expand Up @@ -498,7 +498,7 @@ export default {
return [
this.$store.getters.getPhylorefId(phyloref),
wrappedPhyloref.label,
this.$store.getters.getPhylorefType(phyloref),
this.$store.getters.getPhylorefTypeDescription(phyloref),
// Write out the clade definition.
phyloref.definition || "",
// Write out the internal specifier labels
Expand Down
Loading

0 comments on commit 3823112

Please sign in to comment.