Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BI-1404 - No loading wheel ontology page #206

Merged
merged 4 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
20 changes: 20 additions & 0 deletions src/assets/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,26 @@ table tr.is-edited + .detail {
}
}

// adapted from https://github.com/jgthms/bulma/issues/847
.loading-indicator {
position: relative;
pointer-events: none;
opacity: 0.5;
&:after {
@include loader;
position: absolute;
top: calc(50% - 2.5em);
left: calc(50% - 2.5em);
width: 5em;
height: 5em;
border-width: 0.25em;
}
}

.table-min-height {
min-height: 100px;
}

.menu-scroll {
position: absolute;
height: 100%;
Expand Down
5 changes: 5 additions & 0 deletions src/components/ontology/OntologyTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
v-bind:pagination="traitsPagination"
v-bind:auto-handle-close-panel-event="false"
v-bind:side-panel-state="traitSidePanelState"
v-bind:loading="traitsLoading"
v-on:paginate="paginationController.updatePage($event)"
v-on:paginate-toggle-all="paginationController.toggleShowAll(traitsPagination.totalCount.valueOf())"
v-on:paginate-page-size="paginationController.updatePageSize(parseInt($event,10))"
Expand Down Expand Up @@ -301,6 +302,7 @@ export default class OntologyTable extends Vue {
private newTrait: Trait = new Trait();
private currentTraitEditable = false;
private loadingTraitEditable = true;
private traitsLoading = true;

// table column sorting
private nameSortLabel: string = OntologySortField.Name;
Expand Down Expand Up @@ -399,15 +401,18 @@ export default class OntologyTable extends Vue {
getTraits() {
// filter the terms pulled from the back-end
let filters: TraitFilter[] = [{ field: TraitField.STATUS, value: this.active}];
this.traitsLoading = true;

TraitService.getFilteredTraits(this.activeProgram!.id!, this.paginationController.currentCall, true, filters, this.ontologySort).then(([traits, metadata]) => {
if (this.paginationController.matchesCurrentRequest(metadata.pagination)){
this.traits = traits;
this.traitsPagination = metadata.pagination;
this.traitsLoading = false;
}
}).catch((error) => {
// Display error that traits cannot be loaded
this.$emit('show-error-notification', 'Error while trying to load traits');
this.traitsLoading = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two this.traitsLoading = false could be put into one finally statement.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed changes

throw error;
});
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/tables/SidePanelTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</div>
</WarningModal>

<div class="side-panel-table">
<div class="side-panel-table table-min-height" v-bind:class="{'loading-indicator': loading}">
<div class="columns is-mobile">
<div class="column pr-0">
<BaseTable
Expand Down Expand Up @@ -91,7 +91,7 @@
v-on:paginate-page-size="closePanelAndReEmit('paginate-page-size', $event)"/>

<template v-if="records.length === 0">
<slot name="emptyMessage" />
<slot v-if="this.loading !== true" name="emptyMessage" />
</template>
</div>

Expand Down Expand Up @@ -148,6 +148,8 @@
autoHandleClosePanelEvent!: boolean;
@Prop()
sidePanelState!: SidePanelTableEventBusHandler;
@Prop()
loading!: boolean;

private BreakpointEvent = BreakpointEvent;
private state = CollapseColumnsState.NORMAL_PANEL_CLOSED;
Expand Down