diff --git a/src/assets/scss/main.scss b/src/assets/scss/main.scss index 779db39db..9aef6710a 100644 --- a/src/assets/scss/main.scss +++ b/src/assets/scss/main.scss @@ -740,4 +740,17 @@ th.activesort.sortcolumn, th.sortcolumn:hover { stroke: gray; } } -} \ No newline at end of file +} + +// Some css to only overlay on tbody for tables instead of entire table like b-table +div.b-table.loading-active tbody { + opacity: 0.25; + z-index: 1; + pointer-events: none; +} +.loading-overlay { + &, .loading-background { + pointer-events: none; + background: rgba(255, 255, 255, 0); + } +} diff --git a/src/breeding-insight/utils/CallStack.ts b/src/breeding-insight/utils/CallStack.ts new file mode 100644 index 000000000..ec7423056 --- /dev/null +++ b/src/breeding-insight/utils/CallStack.ts @@ -0,0 +1,42 @@ +/* + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {v4 as uuidv4} from "uuid"; + +/* +Handles a call stack for a single endpoint. When multiple calls are made +over a period of time, this class will record the most recent call and only +return the response from that call. + */ +export class CallStack { + call: (options: any) => Promise; + currentCallId: string; + + constructor(call: (options: any) => Promise) { + this.call = call; + } + + makeCall(options: any): { call: Promise; callId: string; } { + const callId = uuidv4(); + this.currentCallId = callId; + return {call: this.call(options), callId}; + } + + isCurrentCall(callId: string) { + return this.currentCallId === callId; + } +} \ No newline at end of file diff --git a/src/components/tables/expandableTable/ExpandableTable.vue b/src/components/tables/expandableTable/ExpandableTable.vue index 4712aec6d..b4a25dac2 100644 --- a/src/components/tables/expandableTable/ExpandableTable.vue +++ b/src/components/tables/expandableTable/ExpandableTable.vue @@ -18,6 +18,7 @@