Skip to content

Commit

Permalink
Merge pull request #125 from Breeding-Insight/feature/BI-997-BI-1061
Browse files Browse the repository at this point in the history
[BI-997 BI-1061]-2 Update Trait Import (clean redo)
  • Loading branch information
HMS17 authored Sep 17, 2021
2 parents 1efcf61 + f45fc75 commit c844a2a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/breeding-insight/service/TraitUploadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class TraitUploadService {

static errorContactingServer: string = "Unknown error when contacting server. Please try again.";
static errorUnknown: string = "Unable to determine reason for failure upload. Please check file and try again.";
static forbiddenUploadingFile: string = "You do not have permission to upload traits";
static forbiddenUploadingFile: string = "You do not have permission to upload ontology terms";

static async deleteTraits(programId: string): Promise<void|Error> {
try {
Expand Down Expand Up @@ -114,7 +114,7 @@ export class TraitUploadService {
await TraitUploadDAO.confirmUpload(programId, traitUploadId);
return;
} catch (error) {
throw 'Error saving traits';
throw 'Error saving ontology terms';
}
}

Expand Down
15 changes: 10 additions & 5 deletions src/components/trait/TraitsImportTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,22 @@
-->
<template v-slot:columns="data">
<TableColumn name="name" v-bind:label="'Name'">
{{ data.traitName }}
{{ data.observationVariableName }}
</TableColumn>
<TableColumn name="level" v-bind:label="'Level'" v-bind:visible="!collapseColumns">
{{ data.programObservationLevel.name }}
<TableColumn name="trait" v-bind:label="'Trait'" v-bind:visible="!collapseColumns">
{{ StringFormatters.toStartCase(data.traitDescription) }}
</TableColumn>
<TableColumn name="method" v-bind:label="'Method'" v-bind:visible="!collapseColumns">
{{ StringFormatters.toStartCase(data.method.methodClass) }}
{{ data.method.description + " " + StringFormatters.toStartCase(data.method.methodClass) }}
</TableColumn>
<TableColumn name="scale" v-bind:label="'Scale'" v-bind:visible="!collapseColumns">
<TableColumn name="scaleClass" v-bind:label="'Scale Class'" v-bind:visible="!collapseColumns">
{{ TraitStringFormatters.getScaleTypeString(data.scale) }}
</TableColumn>
<TableColumn name="unit" v-bind:label="'Unit'" v-bind:visible="!traitSidePanelState.collapseColumns">
<template v-if="data.scale.dataType==='NUMERICAL'">
{{ data.scale.scaleName }}
</template>
</TableColumn>
</template>

<!--
Expand Down
12 changes: 6 additions & 6 deletions src/views/trait/TraitsImport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
>
<section>
<p class="has-text-dark" :class="this.$modalTextClass">
No traits will be added, and the import in progress will be completely removed.
No ontology terms will be added, and the import in progress will be completely removed.
</p>
</section>
<div class="columns">
Expand All @@ -46,8 +46,8 @@
</WarningModal>

<template v-if="state === ImportState.CHOOSE_FILE || state === ImportState.FILE_CHOSEN">
<h1 class="title" v-if="showTitle">Import Traits</h1>
<ImportInfoTemplateMessageBox v-bind:import-type-name="'Trait'"
<h1 class="title" v-if="showTitle">Import Ontology</h1>
<ImportInfoTemplateMessageBox v-bind:import-type-name="'Ontology'"
v-bind:template-url="'https://cornell.box.com/shared/static/u9vuob3vvu2cgwyoe26b2722u41b8f6o.xls'"
class="mb-5">
<strong>Before You Import...</strong>
Expand All @@ -67,7 +67,7 @@

<template v-if="state === ImportState.LOADING || state === ImportState.CURATE">
<template v-if="tableLoaded">
<h1 class="title">Curate and Confirm New Traits</h1>
<h1 class="title">Confirm New Ontology Term</h1>
<ConfirmImportMessageBox v-bind:num-traits="numTraits"
v-on:abort="showAbortModal = true"
v-on:confirm="importService.send(ImportEvent.CONFIRMED)"
Expand Down Expand Up @@ -322,15 +322,15 @@ export default class TraitsImport extends ProgramsBase {
await TraitUploadService.confirmUpload(this.activeProgram!.id!, upload!.id!);

// show all program traits
this.$emit('show-success-notification', `Imported traits have been added to ${name}.`);
this.$emit('show-success-notification', `Imported ontology terms have been added to ${name}.`);
this.$router.push({
name: 'traits-list',
params: {
programId: this.activeProgram!.id!
},
});
} catch(err) {
const note = err.message ? err.message : `Error: Imported traits were not added to ${name}.`;
const note = err.message ? err.message : `Error: Imported ontology terms were not added to ${name}.`;
this.$emit('show-error-notification', `${note}`);
Vue.$log.error(err);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/components/tables/SidePanelTable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function setup() {
const scale = new Scale('Test Scale', 'Number', undefined, 3, 0, 999);
const level = new ProgramObservationLevel('Plant');
const range = [...Array(200).keys()];
traits = range.map((i:number) => new Trait(i.toString(), `Trait${i}`, undefined, level, undefined, undefined, undefined, method, scale));
traits = range.map((i:number) => new Trait(i.toString(), `Trait${i}`, `Trait${i}`, level, undefined, undefined, undefined, method, scale));

const response = DaoUtils.formatBiResponse(traits);

Expand Down

0 comments on commit c844a2a

Please sign in to comment.