From 3c3e64752a9430aab4301a74f8143579da7a8623 Mon Sep 17 00:00:00 2001 From: Seena Nair <55585488+seenanair@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:54:20 +0100 Subject: [PATCH 01/33] update(index): Add Pool XP tube panel to application.js --- .../javascript/pool-xp-tube-panel/index.js | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 app/frontend/javascript/pool-xp-tube-panel/index.js diff --git a/app/frontend/javascript/pool-xp-tube-panel/index.js b/app/frontend/javascript/pool-xp-tube-panel/index.js new file mode 100644 index 000000000..2131a4077 --- /dev/null +++ b/app/frontend/javascript/pool-xp-tube-panel/index.js @@ -0,0 +1,68 @@ +/* eslint no-console: 0 */ + +import Vue from 'vue' +import { BootstrapVue, BootstrapVueIcons } from 'bootstrap-vue' +import 'bootstrap/dist/css/bootstrap.css' +import 'bootstrap-vue/dist/bootstrap-vue.css' +import cookieJar from '@/javascript/shared/cookieJar.js' +import PoolXPTubeSubmitPanel from './components/PoolXPTubeSubmitPanel.vue' + +Vue.use(BootstrapVue) +Vue.use(BootstrapVueIcons) +document.addEventListener('DOMContentLoaded', async () => { + /* + * As we add more components to this page we should + * consider switching to proper components and custom tags. + * Ran into a problems as I tried to do this at this stage: + * 1 - Vue needs to compile the template (ie. our HTML) on the fly + # which means we import a different version of vue above. + # import Vue from 'vue/dist/vue.esm' + # This is slower, and generally recommended against. + # 2 - Things didn't appear to be as straight forward as I + # had hoped. I *think* this was because I began wrestling + # vue's expectations with regards to single page applications + # 3 - Vue does NOT like our existing templates. The script tags + # seem to upset it. + # In general it looks like this is something we should consider + # once the majority of our components are vue based. + */ + const assetElem = document.getElementById('pool-xp-tube-submit-panel') + const missingUserIdError = ` + Unfortunately Limber can't find your user id, which is required to add custom metadata. + Click log out and swipe in again to resolve this. + If this problem occurs repeatedly, let us know. + ` + + if (assetElem) { + /* The labware-custom-metadata element isn't on all pages. So only initialize our + * Vue app if we actually find it */ + const userId = cookieJar(document.cookie).user_id + const sequencescapeApiUrl = assetElem.dataset.sequencescapeApi + const sequencescapeUrl = assetElem.dataset.sequencescapeUrl + + // UserId is required to make custom metadata, but will not be present in + // older session cookies. To avoid errors or confusion, we render + // a very basic vue component (essentially just an error message) + // if userId is missing + + console.log("*********INSIDE TUBE PANEL SUBMIT FORM*********") + if (userId) { + new Vue({ + el: '#pool-xp-tube-submit-panel', + render(h) { + + let barcode = this.$el.dataset.barcode + + return h(PoolXPTubeSubmitPanel, { + props: { barcode, userId, sequencescapeApiUrl, sequencescapeUrl }, + }) + }, + }) + } else { + new Vue({ + el: '#pool-xp-tube-submit-panel', + render: (h) => h('div', missingUserIdError), + }) + } + } +}) From 5c360accd8321051cdc7bb948d2243710bb07f06 Mon Sep 17 00:00:00 2001 From: Seena Nair <55585488+seenanair@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:55:06 +0100 Subject: [PATCH 02/33] wip: Adds new panel for Pool XP tubes --- .../components/PoolXPTubeSubmitPanel.vue | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue diff --git a/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue b/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue new file mode 100644 index 000000000..d18b7b0db --- /dev/null +++ b/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue @@ -0,0 +1,127 @@ + + + + + From 4ff8a2f0f231009b3ea775dae4221d4cc50fdb2f Mon Sep 17 00:00:00 2001 From: Seena Nair <55585488+seenanair@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:55:53 +0100 Subject: [PATCH 03/33] wip: adds submit panel for pool-xp-tube in sidebar --- app/views/tubes/sidebars/_default.html.erb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/views/tubes/sidebars/_default.html.erb b/app/views/tubes/sidebars/_default.html.erb index de8408cff..cd3afde0a 100644 --- a/app/views/tubes/sidebars/_default.html.erb +++ b/app/views/tubes/sidebars/_default.html.erb @@ -31,8 +31,15 @@ <% else %> <%= simple_state_change_form(@presenter) %> <% end %> +
+
<% end %> + <%= card title: 'Adding a Comment' do %>
<% end %> From 3242dcb3aedb537005ca8c3fbd36fcb7619e661c Mon Sep 17 00:00:00 2001 From: Seena Nair <55585488+seenanair@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:56:23 +0100 Subject: [PATCH 04/33] update(application): Add Pool XP tube panel to application.js --- app/frontend/entrypoints/application.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/frontend/entrypoints/application.js b/app/frontend/entrypoints/application.js index dfc9cb98e..7ff10c266 100644 --- a/app/frontend/entrypoints/application.js +++ b/app/frontend/entrypoints/application.js @@ -54,6 +54,7 @@ import '@/javascript/multi-stamp/index.js' import '@/javascript/qc-information/index.js' import '@/javascript/tubes-to-rack/index.js' import '@/javascript/validate-paired-tubes/index.js' +import '@/javascript/pool-xp-tube-panel/index.js' // Load simple javascript files import '@/javascript/plain-javascript/page-reloader.js' From 66ffa2b4c3ec92e752079bcdd5517466883dbd24 Mon Sep 17 00:00:00 2001 From: Seena Nair <55585488+seenanair@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:29:46 +0100 Subject: [PATCH 05/33] refactor(PoolXPTubeSubmitPanel): updates for polling, state management, styles --- .../components/PoolXPTubeSubmitPanel.vue | 223 +++++++++++++++--- 1 file changed, 185 insertions(+), 38 deletions(-) diff --git a/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue b/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue index d18b7b0db..9444614c6 100644 --- a/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue +++ b/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue @@ -1,25 +1,64 @@ diff --git a/app/frontend/javascript/icons/ReadyIcon.vue b/app/frontend/javascript/icons/ReadyIcon.vue new file mode 100644 index 000000000..b886f1351 --- /dev/null +++ b/app/frontend/javascript/icons/ReadyIcon.vue @@ -0,0 +1,26 @@ + + + diff --git a/app/frontend/javascript/icons/SuccessIcon.vue b/app/frontend/javascript/icons/SuccessIcon.vue new file mode 100644 index 000000000..5542d526e --- /dev/null +++ b/app/frontend/javascript/icons/SuccessIcon.vue @@ -0,0 +1,19 @@ + + + diff --git a/app/frontend/javascript/icons/TubeSearchIcon.vue b/app/frontend/javascript/icons/TubeSearchIcon.vue new file mode 100644 index 000000000..3282b8d8b --- /dev/null +++ b/app/frontend/javascript/icons/TubeSearchIcon.vue @@ -0,0 +1,19 @@ + + + From d559628cca28c0dfcce33ae78dbcd7854bf3d5d1 Mon Sep 17 00:00:00 2001 From: Seena Nair <55585488+seenanair@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:38:40 +0100 Subject: [PATCH 08/33] feature: Adds icons and new states --- .../components/PoolXPTubeSubmitPanel.vue | 261 ++++++++++-------- 1 file changed, 147 insertions(+), 114 deletions(-) diff --git a/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue b/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue index 9444614c6..669291803 100644 --- a/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue +++ b/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue @@ -1,66 +1,115 @@ + \ No newline at end of file From 7594f09928f4c5e117a4ee9f135d8af88a0c5138 Mon Sep 17 00:00:00 2001 From: Seena Nair <55585488+seenanair@users.noreply.github.com> Date: Thu, 17 Oct 2024 16:06:02 +0100 Subject: [PATCH 15/33] refactor(PoolXPTubeSubmitPanel): improvements --- .../components/PoolXPTubeSubmitPanel.vue | 197 +++++++++++------- 1 file changed, 123 insertions(+), 74 deletions(-) diff --git a/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue b/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue index 669291803..380f6f122 100644 --- a/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue +++ b/app/frontend/javascript/pool-xp-tube-panel/components/PoolXPTubeSubmitPanel.vue @@ -1,18 +1,18 @@