Skip to content

Commit 918961c

Browse files
authored
Merge pull request #19827 from jmchilton/user_feedback_apply_rules
More user feedback in FormRulesEdit (for Apply Rules tool)
2 parents 7ff91d8 + eec8f6a commit 918961c

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

client/src/components/Form/Elements/FormRulesEdit.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
import { library } from "@fortawesome/fontawesome-svg-core";
33
import { faEdit } from "@fortawesome/free-solid-svg-icons";
44
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
5+
import { BAlert } from "bootstrap-vue";
6+
import LoadingSpan from "components/LoadingSpan";
57
import RuleCollectionBuilder from "components/RuleCollectionBuilder";
68
import RulesDisplay from "components/RulesDisplay/RulesDisplay";
79
import { computed, ref } from "vue";
810
911
import { fetchCollectionDetails } from "@/api/datasetCollections";
12+
import { errorMessageAsString } from "@/utils/simple-error";
1013
1114
library.add(faEdit);
1215
@@ -22,6 +25,8 @@ const props = defineProps({
2225
2326
const modal = ref(null);
2427
const elements = ref(null);
28+
const loading = ref(false);
29+
const loadError = ref();
2530
2631
const initialRules = {
2732
rules: [],
@@ -33,12 +38,17 @@ const displayRules = computed(() => props.value ?? initialRules);
3338
async function onEdit() {
3439
if (props.target) {
3540
try {
41+
loading.value = true;
42+
loadError.value = undefined;
3643
const collectionDetails = await fetchCollectionDetails({ id: props.target.id });
3744
elements.value = collectionDetails;
3845
modal.value.show();
3946
} catch (e) {
47+
loadError.value = errorMessageAsString(e);
4048
console.error(e);
4149
console.log("problem fetching collection");
50+
} finally {
51+
loading.value = false;
4252
}
4353
} else {
4454
modal.value.show();
@@ -64,7 +74,10 @@ function onCancel() {
6474
<FontAwesomeIcon icon="fa-edit" />
6575
<span>Edit</span>
6676
</b-button>
67-
77+
<LoadingSpan v-if="loading" message="Loading collection details"> </LoadingSpan>
78+
<BAlert v-if="loadError" show variant="danger" dismissible @dismissed="loadError = undefined">
79+
{{ loadError }}
80+
</BAlert>
6881
<b-modal ref="modal" modal-class="ui-form-rules-edit-modal" hide-footer>
6982
<template v-slot:modal-title>
7083
<h2 class="mb-0">Build Rules for Applying to Existing Collection</h2>

0 commit comments

Comments
 (0)