-
Notifications
You must be signed in to change notification settings - Fork 1
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
[BI-563] Archive Individual Trait #70
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I didn't run it locally but the code looks good. I had a few questions and comments, but approving since I'll be out the rest of the week.
package.json
Outdated
@@ -73,7 +73,7 @@ | |||
"vue-cli-plugin-axios": "0.0.4", | |||
"vue-template-compiler": "^2.6.10" | |||
}, | |||
"devport": "8080", | |||
"devport": "8082", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to stay changed or can we change it back to 8080?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The webserver is running on 8082 because the brapi-server is running on 8080.
There are other PRs related to this pending review:
Breeding-Insight/bi-docker-stack#8,
Breeding-Insight/bi-api#67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The brapi server runs internally in the container as 8080 and externally as 8083, so I think the web could stay as 8080.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will change the port back.
@@ -70,6 +70,17 @@ | |||
<p class="has-text-weight-bold mt-3 mb-0">Description of collection method</p> | |||
<p>{{data.method.description}}</p> | |||
|
|||
<template v-if="archivable && !data.active"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this just be !data.active
? The data can be archived without the table providing archiving abilities. One route I can think of is if the status is set to inactive in the import (not sure if we support that yet).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the !data.active check is all that is required once the backend returns the active status as part of the trait data.
When the traits are pulled from the backend the trait data is looped over all defined key values when creating the trait objects for the frontend. Since the active property does not appear in the trait data, data.inactive will be undefined and !data.active will be true for all traits even though they are active. So the achivable check is in place to turn these sections off until the backend can support archiving. Once the backend part is working the archivable check can be removed.
class="button is-danger" | ||
v-on:click="modalDeleteHandler" | ||
> | ||
<strong>Yes, {{ focusTrait.active ? 'remove' : 'restore' }}</strong> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be Yes, archive
instead of Yes, remove
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used "remove" because it was already in place in the warning modal. The following is from commit ee46948:
`
Program-related data referencing this trait will not be affected by this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry the code didn't typeset well; try again...
Program-related data referencing this trait will not be affected by this change.
Yes, remove
Cancel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this works. Sorry for spamming your inbox. :-)
<WarningModal
v-bind:active.sync="deactivateActive"
v-bind:msg-title="'Remove trait from Program name?'"
v-on:deactivate="deactivateActive = false"
>
<section>
<p class="has-text-dark">
Program-related data referencing this trait will not be affected by this change.
</p>
</section>
<div class="columns">
<div class="column is-whole has-text-centered buttons">
<button v-on:click="modalDeleteHandler()" class="button is-danger"><strong>Yes, remove</strong></button>
<button v-on:click="deactivateActive = false" class="button">Cancel</button>
</div>
</div>
</WarningModal>
|
||
async modalDeleteHandler(){ | ||
try { | ||
const traitClone = JSON.parse(JSON.stringify(this.focusTrait)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never knew that was a way to clone! There is also the Trait.assign
function in the trait object if you want a trait class instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assign would probably work in this case, but I generally stay away from it because it can cause errors if a property of interest is deeply nested (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign).
Also, I remember seeing a comparison of computational effort required for the JSON parsing method for deep cloning versus using methods in underscore or other libraries, and JSON parsing came out on top, so I generally use it for cloning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. Just to clarify, the Trait.assign
is a custom function of ours that is implemented in our classes.
@@ -117,10 +134,13 @@ | |||
v-bind:edit-active="traitSidePanelState.editActive" | |||
v-bind:edit-btn-active="editFormBtnActive" | |||
v-bind:editable="true" | |||
v-bind:archivable="false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this false? I guess that's why I don't see an archive link in the detail pane?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just documenting what we talked about earlier:
The frontend logic works once the "active" trait is returned from the api. Mocking out flagging some traits as archived and others not while preventing the mocks to be overwritten by calls to the trait api was beyond the scope of this work and not really of great value. Without the archivable boolean flag stored per trait the feature can't function properly, so the archivable flag is set to false to turn the feature off until the backend is ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fix bi-api as part of this card so that we can test this feature? It looks like createTraits in TraitService needs to set the active field in the TraitEntity as it's writing null to the database currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For traceability, I fixed bi-api in the BI-732 PR that is currently open.
class="button is-danger" | ||
v-on:click="modalDeleteHandler" | ||
> | ||
<strong>Yes, {{ focusTrait.active ? 'remove' : 'restore' }}</strong> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -245,6 +267,30 @@ export default class TraitTable extends Vue { | |||
}); | |||
} | |||
|
|||
activateArchive(focusTrait: Trait){ | |||
if (focusTrait.active) { | |||
this.deactivateWarningTitle = `Remove "${focusTrait.traitName}" from ${this.activeProgram!.name!}?`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to previous comment, maybe this should also use archive terminology
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
e7f0418
to
81bfd7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From our discussion during sprint planning. Can we move the Archive
tag to another column or create a new card to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This scenario, as is written in the card, does not pass (unless I am misunderstanding)
Given: that there is more than one page of traits in the trait list
When: the user archives a trait that is not on the first page
Then: ensure that the page in view is reset to the first page
after archiving the trait on the second page, the view does not go back to the first page. BUT, do we really want it too? Don't we want to see it in the list as archived on the original page it was on? Or, I may be just misunderstanding...
c129b98
to
50e2c76
Compare
The Trait model was updated to include the "active" property and set it to true by default.
The Archiving features in the UI can be activated/deactivated by toggle the state of the archivable prop in TraitsListTable.
Archivable should be set to false until the "active" property is included in trait data from bi-api.
Given: The user has navigated to the "Trait Management" screen
And: the user has selected a trait to view
When: the user clicks "Archive" on the detail pane
Then: ensure that a confirmation dialog appears
Given: The user has clicked “Archive”
When: they confirm archiving the trait
Then: ensure that the trait detail pane is closed
And: ensure that the row shows an indicator that the trait is archived
And: ensure that a success notification is displayed at the top of the screen
Given: The user has clicked “Archive”
When: they decline archiving the trait
Then: ensure that the archive confirmation dialog closes
And: ensure that the trait is not archived
Given: The user has navigated to the "Trait Management" screen
When: the user has selected an archived trait to view
Then: ensure that the ‘Archived’ tag is displayed at the bottom of the detail pane
Given: that there is more than one page of traits in the trait list
When: the user archives a trait that is not on the first page
Then: ensure that the page in view is reset to the first page