Skip to content

Commit

Permalink
Changed parcel to be a prop passed to the ParcelEditor component (#1351)
Browse files Browse the repository at this point in the history
* Added names to sequence adaptations

* Fixed some issues with the seq name tests

* Changed parcel to be a prop passed to the ParcelEditor component

* Set the parcelId inside of ExpansionRuns so the sequence editor preview will lint correctly

* Removed store reference from parcel in SequenceEditor
  • Loading branch information
cohansen authored Jun 26, 2024
1 parent 70f346c commit 17fe681
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/components/expansion/ExpansionRuns.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { base } from '$app/paths';
import type { ICellRendererParams } from 'ag-grid-community';
import { expansionRunsColumns } from '../../stores/expansion';
import { parcel, parcelId } from '../../stores/sequencing';
import type { User } from '../../types/app';
import type { DataGridColumnDef, DataGridRowSelection } from '../../types/data-grid';
import type { ActivityInstanceJoin, ExpandedSequence, ExpansionRun } from '../../types/expansion';
Expand Down Expand Up @@ -105,8 +106,11 @@
if (isSelected) {
selectedExpansionRun = clickedRun;
$parcelId = selectedExpansionRun.expansion_set.parcel_id;
} else if (selectedExpansionRun?.id === clickedRun.id) {
selectedExpansionRun = null;
$parcelId = null;
}
}
Expand Down Expand Up @@ -173,6 +177,7 @@
<CssGridGutter track={1} type="column" />

<SequenceEditor
parcel={$parcel}
sequenceDefinition={seqJsonToSequence(selectedSequence?.expanded_sequence, [], null) ?? 'No Sequence Selected'}
sequenceName={selectedSequence?.seq_id}
sequenceSeqJson={selectedSequence ? JSON.stringify(selectedSequence.expanded_sequence, null, 2) : undefined}
Expand Down
11 changes: 6 additions & 5 deletions src/components/sequencing/SequenceEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
getParsedCommandDictionary,
getParsedParameterDictionary,
parameterDictionaries as parameterDictionariesStore,
parcel,
parcelToParameterDictionaries,
userSequenceEditorColumns,
userSequenceEditorColumnsWithFormBuilder,
} from '../../stores/sequencing';
import type { User } from '../../types/app';
import type { Parcel } from '../../types/sequencing';
import { setupLanguageSupport } from '../../utilities/codemirror';
import effects from '../../utilities/effects';
import { seqJsonLinter } from '../../utilities/new-sequence-editor/seq-json-linter';
Expand All @@ -43,6 +43,7 @@
import SectionTitle from '../ui/SectionTitle.svelte';
import SelectedCommand from './form/SelectedCommand.svelte';
export let parcel: Parcel | null;
export let showCommandFormBuilder: boolean = false;
export let readOnly: boolean = false;
export let sequenceName: string = '';
Expand Down Expand Up @@ -73,8 +74,8 @@
let toggleSeqJsonPreview: boolean = false;
$: {
if ($parcel?.sequence_adaptation_id) {
loadSequenceAdaptation($parcel?.sequence_adaptation_id);
if (parcel?.sequence_adaptation_id) {
loadSequenceAdaptation(parcel?.sequence_adaptation_id);
}
}
Expand All @@ -93,8 +94,8 @@
}
$: {
const unparsedChannelDictionary = $channelDictionaries.find(cd => cd.id === $parcel?.channel_dictionary_id);
const unparsedCommandDictionary = $commandDictionaries.find(cd => cd.id === $parcel?.command_dictionary_id);
const unparsedChannelDictionary = $channelDictionaries.find(cd => cd.id === parcel?.channel_dictionary_id);
const unparsedCommandDictionary = $commandDictionaries.find(cd => cd.id === parcel?.command_dictionary_id);
const unparsedParameterDictionaries = $parameterDictionariesStore.filter(pd => {
const parameterDictionary = $parcelToParameterDictionaries.find(p => p.parameter_dictionary_id === pd.id);
Expand Down
1 change: 1 addition & 0 deletions src/components/sequencing/SequenceForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@
<CssGridGutter track={1} type="column" />

<SequenceEditor
parcel={$parcel}
showCommandFormBuilder={true}
sequenceDefinition={initialSequenceDefinition}
{sequenceName}
Expand Down
3 changes: 2 additions & 1 deletion src/components/sequencing/Sequences.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import type { ICellRendererParams } from 'ag-grid-community';
import { parcelId, parcels, userSequences, userSequencesColumns } from '../../stores/sequencing';
import { parcel, parcelId, parcels, userSequences, userSequencesColumns } from '../../stores/sequencing';
import type { User, UserId } from '../../types/app';
import type { DataGridColumnDef, DataGridRowSelection, RowId } from '../../types/data-grid';
import type { UserSequence } from '../../types/sequencing';
Expand Down Expand Up @@ -264,6 +264,7 @@
<CssGridGutter track={1} type="column" />

<SequenceEditor
parcel={$parcel}
showCommandFormBuilder={false}
sequenceDefinition={selectedSequence?.definition ?? ''}
sequenceName={selectedSequence?.name}
Expand Down

0 comments on commit 17fe681

Please sign in to comment.