Skip to content

Commit

Permalink
Merge pull request #669 from DiamondLightSource/revert-648-improvemen…
Browse files Browse the repository at this point in the history
…t/LIMS-759/show-multipin-sublocations

Revert "LIMS-759: Show multipin samples and their sublocations"
  • Loading branch information
NKatti2011 authored Sep 20, 2023
2 parents 6178a92 + 3ed619b commit feca5b6
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 57 deletions.
2 changes: 1 addition & 1 deletion api/src/Page/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ function _samples()
$order = $cols[$this->arg('sort_by')] . ' ' . $dir;
}

$rows = $this->db->paginate("SELECT distinct b.blsampleid, b.crystalid, b.screencomponentgroupid, ssp.blsampleid as parentsampleid, ssp.name as parentsample, b.blsubsampleid, count(distinct si.blsampleimageid) as inspections, CONCAT(p.proposalcode,p.proposalnumber) as prop, b.code, b.location, b.sublocation, pr.acronym, pr.proteinid, cr.spacegroup,b.comments,b.name,s.shippingname as shipment,s.shippingid,d.dewarid,d.code as dewar, c.code as container, c.containerid, c.samplechangerlocation as sclocation, count(distinct IF(dc.overlap != 0,dc.datacollectionid,NULL)) as sc, count(distinct IF(dc.overlap = 0 AND dc.axisrange = 0,dc.datacollectionid,NULL)) as gr, count(distinct IF(dc.overlap = 0 AND dc.axisrange > 0,dc.datacollectionid,NULL)) as dc, count(distinct IF(dcg.experimenttype LIKE 'XRF map', dc.datacollectionid, NULL)) as xm, count(distinct IF(dcg.experimenttype LIKE 'XRF spectrum', dc.datacollectionid, NULL)) as xs, count(distinct IF(dcg.experimenttype LIKE 'Energy scan', dc.datacollectionid, NULL)) as es, count(distinct so.screeningid) as ai, count(distinct app.autoprocprogramid) as ap, count(distinct r.robotactionid) as r, round(min(st.rankingresolution),2) as scresolution, max(ssw.completeness) as sccompleteness, round(min(apss.resolutionlimithigh),2) as dcresolution, round(max(apss.completeness),1) as dccompleteness, dp.anomalousscatterer, dp.requiredresolution, cr.cell_a, cr.cell_b, cr.cell_c, cr.cell_alpha, cr.cell_beta, cr.cell_gamma, b.packingfraction, b.dimension1, b.dimension2, b.dimension3, b.shape, cr.color, cr.theoreticaldensity, cr.name as crystal, pr.name as protein, b.looptype, dp.centringmethod, dp.experimentkind, cq.containerqueueid, TO_CHAR(cq.createdtimestamp, 'DD-MM-YYYY HH24:MI') as queuedtimestamp
$rows = $this->db->paginate("SELECT distinct b.blsampleid, b.crystalid, b.screencomponentgroupid, ssp.blsampleid as parentsampleid, ssp.name as parentsample, b.blsubsampleid, count(distinct si.blsampleimageid) as inspections, CONCAT(p.proposalcode,p.proposalnumber) as prop, b.code, b.location, pr.acronym, pr.proteinid, cr.spacegroup,b.comments,b.name,s.shippingname as shipment,s.shippingid,d.dewarid,d.code as dewar, c.code as container, c.containerid, c.samplechangerlocation as sclocation, count(distinct IF(dc.overlap != 0,dc.datacollectionid,NULL)) as sc, count(distinct IF(dc.overlap = 0 AND dc.axisrange = 0,dc.datacollectionid,NULL)) as gr, count(distinct IF(dc.overlap = 0 AND dc.axisrange > 0,dc.datacollectionid,NULL)) as dc, count(distinct IF(dcg.experimenttype LIKE 'XRF map', dc.datacollectionid, NULL)) as xm, count(distinct IF(dcg.experimenttype LIKE 'XRF spectrum', dc.datacollectionid, NULL)) as xs, count(distinct IF(dcg.experimenttype LIKE 'Energy scan', dc.datacollectionid, NULL)) as es, count(distinct so.screeningid) as ai, count(distinct app.autoprocprogramid) as ap, count(distinct r.robotactionid) as r, round(min(st.rankingresolution),2) as scresolution, max(ssw.completeness) as sccompleteness, round(min(apss.resolutionlimithigh),2) as dcresolution, round(max(apss.completeness),1) as dccompleteness, dp.anomalousscatterer, dp.requiredresolution, cr.cell_a, cr.cell_b, cr.cell_c, cr.cell_alpha, cr.cell_beta, cr.cell_gamma, b.packingfraction, b.dimension1, b.dimension2, b.dimension3, b.shape, cr.color, cr.theoreticaldensity, cr.name as crystal, pr.name as protein, b.looptype, dp.centringmethod, dp.experimentkind, cq.containerqueueid, TO_CHAR(cq.createdtimestamp, 'DD-MM-YYYY HH24:MI') as queuedtimestamp
, $cseq $sseq string_agg(cpr.name) as componentnames, string_agg(cpr.density) as componentdensities
,string_agg(cpr.proteinid) as componentids, string_agg(cpr.acronym) as componentacronyms, string_agg(cpr.global) as componentglobals, string_agg(chc.abundance) as componentamounts, string_agg(ct.symbol) as componenttypesymbols, b.volume, pct.symbol,ROUND(cr.abundance,3) as abundance, TO_CHAR(b.recordtimestamp, 'DD-MM-YYYY') as recordtimestamp, dp.radiationsensitivity, dp.energy, dp.userpath, dp.strategyoption, dp.minimalresolution as minimumresolution
,count(distinct dc.dataCollectionId) as dcc
Expand Down
25 changes: 8 additions & 17 deletions client/src/js/app/store/modules/store.samples.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const INITIAL_SAMPLE_STATE = {
SAMPLEGROUP: '',
INITIALSAMPLEGROUP: '',
STATUS: '',
SUBLOCATION: null,
}

// Use Location as idAttribute for this table
Expand Down Expand Up @@ -96,35 +95,26 @@ const samplesModule = {
setSample(state, { data, index }) {
if (index < state.samples.length) state.samples.splice(index, 1, data)
},
// For each sample put it in the correct place, based on location & sublocation, in the capacity array
// For each sample put it in the correct place, based on location, in the capacity array
setAllSamples(state, {capacity, samples}) {

const state_samples = Array.from({ length: capacity*10 }, (_, i) => new LocationSample({
const state_samples = Array.from({ length: capacity }, (_, i) => new LocationSample({
BLSAMPLEID: null,
LOCATION: (parseInt(i/10) + 1).toString(),
INDEX: i,
LOCATION: (i + 1).toString(),
PROTEINID: -1,
CRYSTALID: -1,
new: true
}))

if (samples) {
for (let sample of samples) {
const index = 10*(Number(sample.LOCATION)-1)+Number(sample.SUBLOCATION)
sample.INDEX = index
if (index < capacity*10) {
const index = Number(sample.LOCATION)-1
if (index < capacity) {
state_samples[index] = sample
}
}
}
state.samplesCollection.reset(state_samples)
state.samples = state.samplesCollection.toJSON().filter(function(e, i, a) {
if (e.BLSAMPLEID) { return true }
for (var j of a) {
if (j.BLSAMPLEID && j.LOCATION === e.LOCATION) { return false }
}
return true
})
state.samples = state.samplesCollection.toJSON().filter(() => { return true })
},
clearSample(state, index) {
if (index < state.samples.length) state.samples.splice(index, 1, {
Expand Down Expand Up @@ -166,7 +156,7 @@ const samplesModule = {
// Convert our samples json to a backbone collection
state.samples.map(s => {
s.CONTAINERID = containerId
let locationIndex = +s.INDEX
let locationIndex = +(s.LOCATION - 1)
let proteinId = +s.PROTEINID
if (proteinId > 0 && s.NAME !== '') {
state.samplesCollection.at(locationIndex).set(s)
Expand All @@ -184,6 +174,7 @@ const samplesModule = {
const oldSamplesCollection = new Samples()

state.samples.forEach(sample => {
// const locationIndex = +sample['LOCATION'] - 1
if (sample['PROTEINID'] && sample['NAME'] && sample['BLSAMPLEID']) {
oldSamplesCollection.add(sample)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,6 @@ export default {
title: 'Loc',
className: 'location-column'
},
{
key: 'SUBLOCATION',
title: 'Sub',
className: 'sublocation-column'
},
{
key: 'ACRONYM',
title: 'Protein Acronym',
Expand Down Expand Up @@ -547,4 +542,4 @@ export default {
.min-height-8 {
min-height: 32px;
}
</style>
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export default {
editRow(row) {
this.editingSample = row;
this.editingSample.CONTAINERID = this.containerId;
this.$emit('update-editing-row', row.INDEX)
this.$emit('update-editing-row', row.LOCATION)
},
formatSelectData(selectData, data, property) {
const matchedSelectData = selectData.find(select => select.value === data[property])
Expand Down
19 changes: 6 additions & 13 deletions client/src/js/modules/types/mx/samples/sample-table-row.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,17 @@
{{ sample.LOCATION || sampleIndex + 1 }}
</div>

<div class="sublocation-column tw-text-center tw-py-1">
{{ sample.SUBLOCATION }}
</div>

<validation-provider
v-slot="{ errors }"
class="tw-px-2 protein-column tw-py-1"
tag="div"
:rules="sample['NAME'] && (!containerId || editingRow === sample['INDEX']) ? 'required' : ''"
:rules="sample['NAME'] && (!containerId || editingRow === sample['LOCATION']) ? 'required' : ''"
:name="`Sample ${sampleIndex + 1} Protein`"
:vid="`sample ${sampleIndex + 1} protein`"
>
<combo-box
v-model="PROTEINID"
:is-disabled="!canEditRow(sample['INDEX'], editingRow) || isContainerProcessing || sampleHasDataCollection"
:is-disabled="!canEditRow(sample['LOCATION'], editingRow) || isContainerProcessing || sampleHasDataCollection"
:data="proteinsOptionsList"
class="tw-w-full protein-select"
dataTestId="add-container-protein-select"
Expand Down Expand Up @@ -54,12 +50,12 @@
v-slot="{ errors }"
tag="div"
class="name-column tw-py-1 tw-px-2"
:rules="sample['PROTEINID'] > -1 && (!containerId || editingRow === sample['INDEX']) ? 'required|alpha_dash|max:25|' : ''"
:rules="sample['PROTEINID'] > -1 && (!containerId || editingRow === sample['LOCATION']) ? 'required|alpha_dash|max:25|' : ''"
:name="`Sample ${sampleIndex + 1} Name`"
:vid="`sample ${sampleIndex + 1} name`"
>
<base-input-text
:disabled="!canEditRow(sample['INDEX'], editingRow) || isContainerProcessing || sampleHasDataCollection"
:disabled="!canEditRow(sample['LOCATION'], editingRow) || isContainerProcessing || sampleHasDataCollection"
v-model.trim="NAME"
input-class="tw-w-full tw-h-8"
:error-message="errors[0]"
Expand All @@ -79,7 +75,7 @@
<template #default="{ errors, inputChanged }">
<combo-box
v-model="SAMPLEGROUP"
:is-disabled="!canEditRow(sample['INDEX'], editingRow) || sampleGroupInputDisabled"
:is-disabled="!canEditRow(sample['LOCATION'], editingRow) || sampleGroupInputDisabled"
:data="sampleGroups"
text-field="text"
value-field="value"
Expand All @@ -106,7 +102,7 @@

<div class="actions-column tw-py-1 tw-text-right">
<span v-if="containerId">
<span v-if="editingRow === sample['INDEX']">
<span v-if="editingRow === sample['LOCATION']">
<a
class="button tw-cursor-pointer "
@click="$emit('save-sample', sampleIndex)"
Expand Down Expand Up @@ -218,9 +214,6 @@ export default {
.location-column {
width: 30px;
}
.sublocation-column {
width: 30px;
}
.protein-column {
width: 15%;
}
Expand Down
38 changes: 19 additions & 19 deletions client/src/js/modules/types/mx/samples/tabbed-columns-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<template #default="{ errors, inputChanged }">
<base-input-select
v-model="ANOMALOUSSCATTERER"
:is-disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:is-disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
:options="anomalousOptionsList"
input-class="tw-w-full tw-h-8"
option-value-key="value"
Expand All @@ -36,7 +36,7 @@
<template #default="{ errors, inputChanged }">
<base-input-text
v-model="CODE"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
input-class="tw-w-full tw-h-8"
@value-changed="inputChanged"
/>
Expand All @@ -52,7 +52,7 @@
<template #default="{ errors, inputChanged }">
<base-input-text
v-model="COMMENTS"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
input-class="tw-w-full tw-h-8"
@value-changed="inputChanged"
dataTestId="add-container-sample-comment"
Expand Down Expand Up @@ -89,7 +89,7 @@
<template #default="{ errors, inputChanged }">
<base-input-text
v-model="USERPATH"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
input-class="tw-w-full tw-h-8"
:error-message="errors[0]"
:quiet="true"
Expand All @@ -108,7 +108,7 @@
<template #default="{errors, inputChanged}">
<base-input-select
v-model="SPACEGROUP"
:is-disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:is-disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
:options="spaceGroupList"
option-value-key="value"
option-text-key="text"
Expand All @@ -134,7 +134,7 @@
<template #default="{errors, inputChanged}">
<base-input-text
v-model="CELL_A"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
placeholder-text="A"
:quiet="true"
type="number"
Expand All @@ -157,7 +157,7 @@
<template #default="{ errors, inputChanged }">
<base-input-text
v-model="CELL_B"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
placeholder-text="B"
:quiet="true"
type="number"
Expand All @@ -180,7 +180,7 @@
<template #default="{errors, inputChanged}">
<base-input-text
v-model="CELL_C"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
placeholder-text="C"
input-class="tw-w-12 tw-h-8 tabbed-sample-column"
type="number"
Expand All @@ -206,7 +206,7 @@
<template #default="{errors, inputChanged}">
<base-input-text
v-model="CELL_ALPHA"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
placeholder-text="α"
input-class="tw-w-12 tw-h-8 tabbed-sample-column"
:quiet="true"
Expand All @@ -229,7 +229,7 @@
<template #default="{ errors, inputChanged }">
<base-input-text
v-model="CELL_BETA"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
placeholder-text="β"
input-class="tw-w-12 tw-h-8 tabbed-sample-column"
type="number"
Expand All @@ -252,7 +252,7 @@
<template #default="{errors, inputChanged}">
<base-input-text
v-model="CELL_GAMMA"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
placeholder-text="γ"
input-class="tw-w-12 tw-h-8 tabbed-sample-column"
type="number"
Expand Down Expand Up @@ -282,7 +282,7 @@
<template #default="{errors, inputChanged }">
<base-input-select
v-model="CENTRINGMETHOD"
:is-disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:is-disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
:options="centringMethodList"
option-value-key="value"
option-text-key="text"
Expand All @@ -305,7 +305,7 @@
<template #default="{errors, inputChanged}">
<base-input-select
v-model="EXPERIMENTKIND"
:is-disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:is-disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
:options="experimentKindList"
input-class="tw-w-full tw-h-8"
option-value-key="value"
Expand All @@ -328,7 +328,7 @@
<template #default="{errors, inputChanged }">
<base-input-text
v-model="ENERGY"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
input-class="tw-w-full tw-h-8 tabbed-sample-column"
type="number"
:step="1"
Expand All @@ -350,7 +350,7 @@
<template #default="{ errors, inputChanged }">
<base-input-select
v-model="ANOMALOUSSCATTERER"
:is-disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:is-disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
:options="anomalousOptionsList"
option-value-key="value"
input-class="tw-w-full tw-h-8"
Expand All @@ -372,7 +372,7 @@
<template #default="{ errors, inputChanged }">
<base-input-select
v-model="SCREENINGMETHOD"
:is-disabled="!canEditRow(sample['INDEX'], currentEditingRow)"
:is-disabled="!canEditRow(sample['LOCATION'], currentEditingRow)"
:options="screeningMethodList"
option-value-key="value"
option-text-key="text"
Expand All @@ -395,7 +395,7 @@
<template #default="{ errors, inputChanged}">
<base-input-text
v-model="REQUIREDRESOLUTION"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow) || sample['SCREENINGMETHOD'] !== 'none'"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow) || sample['SCREENINGMETHOD'] !== 'none'"
type="number"
:step="1"
input-class="tw-w-full tw-h-8 tabbed-sample-column"
Expand All @@ -417,7 +417,7 @@
<template #default="{ errors, inputChanged }">
<base-input-text
v-model="MINIMUMRESOLUTION"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow) || sample['SCREENINGMETHOD'] !== 'all'"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow) || sample['SCREENINGMETHOD'] !== 'all'"
type="number"
:step="1"
input-class="tw-w-full tw-h-8 tabbed-sample-column"
Expand All @@ -439,7 +439,7 @@
<template #default="{ errors, inputChanged}">
<base-input-text
v-model="SCREENINGCOLLECTVALUE"
:disabled="!canEditRow(sample['INDEX'], currentEditingRow) || sample['SCREENINGMETHOD'] !== 'best'"
:disabled="!canEditRow(sample['LOCATION'], currentEditingRow) || sample['SCREENINGMETHOD'] !== 'best'"
type="number"
:step="1"
input-class="tw-w-full tw-h-8 tabbed-sample-column"
Expand Down

0 comments on commit feca5b6

Please sign in to comment.