Skip to content
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

A card based projects list in Vue #839

Open
wants to merge 108 commits into
base: master
Choose a base branch
from

Conversation

alneberg
Copy link
Member

@alneberg alneberg commented Mar 14, 2024

Boom! This will be the firs launch of a url project_cards. This is a Trello-inspired board showing our active projects. It's coupled with a new version of the project page (not finished by far).

Main features:

  • Filter the board by Status, Type, Project Coordinator, Application, Library Construction Method and Lab Responsible.
  • Choose what type of fields to use for Columns
  • Sort columns
  • Search cards (simple substring match of document json)
  • New project page (the same as shown on an individual card)
  • Start creating a running not by pressing "Enter"
  • Switch to next/previous card in the list by pressing "j" or "k"
  • Copy project order portal title.
  • Hover over fields to view source and some explanation.

Placeholder code for websocket connection. This can be used in the future to propagate changes in projects without polling or refreshing the page.

Since the project page is still incomplete, this is only a preliminary launch. However, hopefully the project cards page is still useful for e.g. applications lab to have overview of their projects.

@alneberg alneberg removed the WIP Work in progress label Nov 14, 2024
@alneberg alneberg requested a review from aanil November 14, 2024 11:40
@alneberg alneberg marked this pull request as ready for review November 14, 2024 11:51
requests.get(user_url, headers=headers).content.rstrip().decode("ascii")
)
self.genstat_defaults = decoder.decode(json_user)
self.genstat_defaults = self.gs_users_db[genstat_defaults_doc_id]
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if there was a reason it was so roundabout before?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm, yeah. Special characters perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or a remnant from older python versions?

@@ -150,19 +158,28 @@ def project_summary_data(self, row):
row.value["contact"] = (
ord_det["owner"]["name"] + ": " + ord_det["owner"]["email"]
)
field_sources["contact"] = (
"LIMS (researcher.email) and Order Portal, formatted by Genomics Status (backend)"
Copy link
Member

Choose a reason for hiding this comment

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

I guess its one or the other? I don't think researcher.email is updated any longer

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe you can suggest a better source explanation? I'm a bit uncertain of the logics myself actually

elif "fields" in ord_det:
if row.value["contact"] == ord_det["fields"]["project_lab_email"]:
row.value["contact"] = (
ord_det["fields"]["project_lab_name"]
+ ": "
+ ord_det["fields"]["project_lab_email"]
)
field_sources["contact"] = (
Copy link
Member

Choose a reason for hiding this comment

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

Could we define it in a single place instead of in 3 places? Maybe with an if

Suggested change
field_sources["contact"] = (
if 'contact' in row.value:
field_sources["contact"] = (

Copy link
Member Author

Choose a reason for hiding this comment

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

I think my reasoning was to keep it close to where the value is set so that it is harder to forget to update it when a definition is changed. But maybe I can actually use these three different cases to show where it was actually taken from in each case?

@@ -173,6 +190,9 @@ def project_summary_data(self, row):
queued = row.value["queued"]
diff = now - dateutil.parser.parse(queued)
row.value["days_in_production"] = diff.days
field_sources["days_in_production"] = (
Copy link
Member

Choose a reason for hiding this comment

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

Same here, if it could be defined in a single place

@@ -477,8 +505,17 @@ def list_projects(self, filter_projects="all"):
final_projects[proj_id].get(end_date),
)

if len(projects_with_agreements[proj_id]) > 0:
final_projects[proj_id]["has_agreements"] = True
# Create slices of 200 projects each to get the agreements for
Copy link
Member

Choose a reason for hiding this comment

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

Why slices of 200? Does it take too much time otherwise?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. I think it's fairly arbitrary. 200 seems to work. Larger number could become too large return body and a smaller number results in more requests.

"_pipeline_": "Pipeline MultiQC",
}
for report_type in self.get_multiqc(project, read_file=False).keys():
report_name = type_to_name.get(report_type, report_type)
Copy link
Member

Choose a reason for hiding this comment

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

type_to_name.get(report_type, report_type) What does this get do?

}
},
methods: {
async fetchAllRunningNotes(partition_id) {
Copy link
Member

Choose a reason for hiding this comment

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

Is async required here? I'm not quire sure, but it seems like you use async with await?

/* Create a new text by replacing the word where the @ was found with the @user */
let new_text = text_before_cursor.substring(0, text_before_cursor.length - current_word.length) + '@' + user + ' ' + text_after_cursor.substring(current_word_after.length);
this.form_note_text = new_text;
this.user_suggestions = [];
Copy link
Member

Choose a reason for hiding this comment

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

This would leave the cursor in the textarea

Suggested change
this.user_suggestions = [];
this.user_suggestions = [];
form_note_text_field.focus();


if (current_word.startsWith('@')) {
current_word = current_word.substring(1).toLowerCase();
let user_suggestions = this.all_users.filter(user => user.startsWith(current_word));
Copy link
Member

Choose a reason for hiding this comment

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

This could return matches of surname too

Suggested change
let user_suggestions = this.all_users.filter(user => user.startsWith(current_word));
let user_suggestions = this.all_users.filter(user => user.includes(current_word));

Comment on lines +195 to +196
toggleFormCategory(category) {
if (this.form_categories.includes(category)) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
toggleFormCategory(category) {
if (this.form_categories.includes(category)) {
toggleFormCategory(event, category) {
event.preventDefault();
if (this.form_categories.includes(category)) {

Comment on lines +219 to +227
<button class="btn btn-sm btn-inf mr-2" value="Decision" data-toggle="tooltip" title="For when an executive decision has been made" @click="toggleFormCategory('Decision')">Decision <span class="fa fa-thumbs-up"></span></button>
<button class="btn btn-sm btn-succe mr-2" value="Lab" data-toggle="tooltip" title="For lab-related work" @click="toggleFormCategory('Lab')">Lab <span class="fa fa-flask"></span></button>
<button class="btn btn-sm btn-warn mr-2" value="Bioinformatics" data-toggle="tooltip" title="For all bioinformatics work" @click="toggleFormCategory('Bioinformatics')">Bioinformatics <span class="fa fa-laptop-code"></span></button>
<button class="btn btn-sm btn-usr mr-2" value="User Communication" data-toggle="tooltip" title="For notes influenced by user-contact" @click="toggleFormCategory('User Communication')">User Communication <span class="fa fa-people-arrows"></span></button>
<button class="btn btn-sm btn-dang mr-2" value="Administration" data-toggle="tooltip" title="For notes involving documentation" @click="toggleFormCategory('Administration')">Administration <span class="fa fa-folder-open"></span></button>
<button class="btn btn-sm btn-imp mr-2" value="Important" data-toggle="tooltip" title="For when a note needs to be highlighted" @click="toggleFormCategory('Important')">Important <span class="fa fa-exclamation-circle"></span></button>
<button class="btn btn-sm btn-devi mr-2" value="Deviation" data-toggle="tooltip" title="For notes about a deviation" @click="toggleFormCategory('Deviation')">Deviation <span class="fa fa-frown"></span></button>
<button class="btn btn-sm btn-inv mr-2" value="Invoice" data-toggle="tooltip" title="For notes about an invoice" @click="toggleFormCategory('Invoice')">Invoicing <span class="fa fa-file-invoice-dollar"></span></button>
<button class="btn btn-sm btn-sticky" value="Sticky" data-toggle="tooltip" title="For sticky notes" @click="toggleFormCategory('Sticky')">Sticky <span class="fa fa-note-sticky"></span></button>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<button class="btn btn-sm btn-inf mr-2" value="Decision" data-toggle="tooltip" title="For when an executive decision has been made" @click="toggleFormCategory('Decision')">Decision <span class="fa fa-thumbs-up"></span></button>
<button class="btn btn-sm btn-succe mr-2" value="Lab" data-toggle="tooltip" title="For lab-related work" @click="toggleFormCategory('Lab')">Lab <span class="fa fa-flask"></span></button>
<button class="btn btn-sm btn-warn mr-2" value="Bioinformatics" data-toggle="tooltip" title="For all bioinformatics work" @click="toggleFormCategory('Bioinformatics')">Bioinformatics <span class="fa fa-laptop-code"></span></button>
<button class="btn btn-sm btn-usr mr-2" value="User Communication" data-toggle="tooltip" title="For notes influenced by user-contact" @click="toggleFormCategory('User Communication')">User Communication <span class="fa fa-people-arrows"></span></button>
<button class="btn btn-sm btn-dang mr-2" value="Administration" data-toggle="tooltip" title="For notes involving documentation" @click="toggleFormCategory('Administration')">Administration <span class="fa fa-folder-open"></span></button>
<button class="btn btn-sm btn-imp mr-2" value="Important" data-toggle="tooltip" title="For when a note needs to be highlighted" @click="toggleFormCategory('Important')">Important <span class="fa fa-exclamation-circle"></span></button>
<button class="btn btn-sm btn-devi mr-2" value="Deviation" data-toggle="tooltip" title="For notes about a deviation" @click="toggleFormCategory('Deviation')">Deviation <span class="fa fa-frown"></span></button>
<button class="btn btn-sm btn-inv mr-2" value="Invoice" data-toggle="tooltip" title="For notes about an invoice" @click="toggleFormCategory('Invoice')">Invoicing <span class="fa fa-file-invoice-dollar"></span></button>
<button class="btn btn-sm btn-sticky" value="Sticky" data-toggle="tooltip" title="For sticky notes" @click="toggleFormCategory('Sticky')">Sticky <span class="fa fa-note-sticky"></span></button>
<button class="btn btn-sm btn-inf mr-2" value="Decision" data-toggle="tooltip" title="For when an executive decision has been made" @click="toggleFormCategory($event, 'Decision')">Decision <span class="fa fa-thumbs-up"></span></button>
<button class="btn btn-sm btn-succe mr-2" value="Lab" data-toggle="tooltip" title="For lab-related work" @click="toggleFormCategory($event, 'Lab')">Lab <span class="fa fa-flask"></span></button>
<button class="btn btn-sm btn-warn mr-2" value="Bioinformatics" data-toggle="tooltip" title="For all bioinformatics work" @click="toggleFormCategory($event, 'Bioinformatics')">Bioinformatics <span class="fa fa-laptop-code"></span></button>
<button class="btn btn-sm btn-usr mr-2" value="User Communication" data-toggle="tooltip" title="For notes influenced by user-contact" @click="toggleFormCategory($event, 'User Communication')">User Communication <span class="fa fa-people-arrows"></span></button>
<button class="btn btn-sm btn-dang mr-2" value="Administration" data-toggle="tooltip" title="For notes involving documentation" @click="toggleFormCategory($event, 'Administration')">Administration <span class="fa fa-folder-open"></span></button>
<button class="btn btn-sm btn-imp mr-2" value="Important" data-toggle="tooltip" title="For when a note needs to be highlighted" @click="toggleFormCategory($event, 'Important')">Important <span class="fa fa-exclamation-circle"></span></button>
<button class="btn btn-sm btn-devi mr-2" value="Deviation" data-toggle="tooltip" title="For notes about a deviation" @click="toggleFormCategory($event, 'Deviation')">Deviation <span class="fa fa-frown"></span></button>
<button class="btn btn-sm btn-inv mr-2" value="Invoice" data-toggle="tooltip" title="For notes about an invoice" @click="toggleFormCategory($event, 'Invoice')">Invoicing <span class="fa fa-file-invoice-dollar"></span></button>
<button class="btn btn-sm btn-sticky" value="Sticky" data-toggle="tooltip" title="For sticky notes" @click="toggleFormCategory($event, 'Sticky')">Sticky <span class="fa fa-note-sticky"></span></button>

Copy link
Member

Choose a reason for hiding this comment

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

Clicking on the button reloads the page otherwise.

</div>
<div class="row">
<div class="col-md-6 text-right">
<button type="button" class="btn btn-link" data-toggle="modal" data-target="#markdown_help">Markdown Help</button>
Copy link
Member

Choose a reason for hiding this comment

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

This modal is not loaded

</template>
</div>
<div class="card-body bi-project-note-text">
<div class="running-note-body text-muted" v-html="formatted_note"/>
Copy link
Member

Choose a reason for hiding this comment

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

Any reason running note text is set totext-muted?

copy_to_clipboard(event, text) {
// Copy text to clipboard
navigator.clipboard.writeText(text).then(function() {
console.log('Async: Copying to clipboard was successful!');
Copy link
Member

@aanil aanil Nov 19, 2024

Choose a reason for hiding this comment

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

Do we need to print it to console? 😄 Since its shown in the tooltip, I mean

} else if (this.project_data['status'] == 'Reception Control') {
return 'bg-warning'
} else if (this.project_data['status'] == 'Pending') {
return 'bg-light text-dark'
Copy link
Member

Choose a reason for hiding this comment

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

I feel bg-light is a bit too light, its hardly visible

await sleep(1000);
}
axios
.post('/api/v1/latest_sticky_run_note', post_body)
Copy link
Member

Choose a reason for hiding this comment

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

If we are just fetching running notes, shouldn't this be get?

URL: /api/v1/latest_sticky_run_note)
"""

def post(self):
Copy link
Member

Choose a reason for hiding this comment

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

If we are only fetching data, this should be get

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants