Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ const SchemaDropdown: FC<Props> = ({ value, onChange, showDownload = true }) =>
value: `${schema.namespace}/${schema.name}`,
}));

const defaultSchema = 'databio/pep-2.1.0';
const valueForSelect = options.find((option) => option.value === value);

return (
<div className="d-flex flex-row align-items-center gap-1 w-100">
<Select
options={options}
defaultValue={{label: defaultSchema, value: defaultSchema}}
value={valueForSelect}
onChange={(newValue: SingleValue<{ label: string; value: string }>) => {
onChange(newValue?.value || '');
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/layout/nav/nav-desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,22 @@ export const NavDesktop = () => {
</div>
</li>
<li className="text-body mx-2 my-0 nav-item h5 pt-1">
<a className="nav-link" href="/browse">
<a className="nav-link d-flex align-items-center" href="/browse">
<i className="bi bi-globe2 me-1 text-base align-top"></i>Browse
</a>
</li>
<li className="text-body mx-2 my-0 nav-item h5 pt-1">
<a className="nav-link" href="/validate">
<a className="nav-link d-flex align-items-center" href="/validate">
<i className="bi bi-check2-circle me-1 text-base align-top"></i>Validation
</a>
</li>
<li className="text-body mx-2 my-0 nav-item h5 pt-1">
<a className="nav-link" href="https://pep.databio.org/pephub">
<a className="nav-link d-flex align-items-center" href="https://pep.databio.org/pephub">
<i className="bi bi-file-earmark-text me-1 text-base align-top"></i>Docs
</a>
</li>
<li className="text-body mx-2 my-0 nav-item h5 pt-1">
<a className="nav-link" href="https://github.com/pepkit/pephub" target="_blank">
<a className="nav-link d-flex align-items-center" href="https://github.com/pepkit/pephub" target="_blank">
<i className="me-1 bi bi-github text-base align-top"></i>
GitHub
</a>
Expand Down
7 changes: 7 additions & 0 deletions web/src/components/project/project-interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ export const ProjectInterface = (props: Props) => {
// throw new Error(errorMessage);
// }

// console.log(samplesParsed)
// I added a print here to show that right before the sample table gets submitted with any column
// reordering you might have done (copy a column to a different index, then delete original column),
// the parsed sample table actually has the rearranged columns. Something in the API or database is
// probably keeping the original column header order if it detects no changes in the column header
// values themselves

submit({
config: values.config,
samples: samplesParsed,
Expand Down
27 changes: 26 additions & 1 deletion web/src/components/tables/sample-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,32 @@ export const SampleTable = (props: Props) => {
manualRowMove={true}
licenseKey="non-commercial-and-evaluation"
manualColumnResize
afterPaste={(coords) => {}}
beforeCopy={(data, coords) => {
if (ph_id_col === -1 || ph_id_col < coords[0].startCol || ph_id_col > coords[0].endCol) {
return;
}

const relative_ph_id_col = ph_id_col - coords[0].startCol;

if (relative_ph_id_col >=0 && relative_ph_id_col < data[0].length) {
for (let i = 0; i < data.length; i++) {
data[i].splice(relative_ph_id_col, 1);
}
}
}}
beforePaste={(data) => {
const paste_ph_id_col = data[0].indexOf('ph_id');

if (paste_ph_id_col === -1) {
return;
}

if (paste_ph_id_col >=0 && paste_ph_id_col < data[0].length) {
for (let i = 0; i < data.length; i++) {
data[i].splice(paste_ph_id_col, 1);
}
}
}}
afterChange={(changes) => {
if (changes && onChange) {
changes.forEach((change) => {
Expand Down
Loading