Skip to content

Commit 952b2a9

Browse files
use consistent allowGeneratedTours prop; reuse ERROR_STATES
Co-authored-by: Aysam Guerler <aysam.guerler@gmail.com>
1 parent e9710be commit 952b2a9

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

client/src/components/Tool/Buttons/ToolTourGeneratorItem.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { BDropdownItem } from "bootstrap-vue";
55
import { storeToRefs } from "pinia";
66
import { computed, ref, watch } from "vue";
77
8+
import { ERROR_STATES } from "@/api/jobs";
89
import { generateTour, type TourDetails } from "@/api/tours";
910
import { Toast } from "@/composables/toast";
1011
import { useHistoryItemsStore } from "@/stores/historyItemsStore";
@@ -14,8 +15,6 @@ import { errorMessageAsString } from "@/utils/simple-error";
1415
1516
import LoadingSpan from "@/components/LoadingSpan.vue";
1617
17-
const INVALID_UPLOAD_STATES = ["discarded", "failed", "error"];
18-
1918
const props = defineProps<{
2019
toolId: string;
2120
toolVersion: string;
@@ -73,7 +72,7 @@ const allStatesOk = computed(() => {
7372
7473
/** Checks if any of the states are invalid. */
7574
const anyStateInvalid = computed(() => {
76-
return states.value.some((state) => state && INVALID_UPLOAD_STATES.includes(state));
75+
return states.value.some((state) => state && ERROR_STATES.includes(state));
7776
});
7877
7978
const waitedForItemsOk = computed<boolean>(() => localTourData.value !== null && allStatesOk.value);

client/src/components/Tool/ToolCard.vue

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ const props = defineProps({
7070
type: String,
7171
default: null,
7272
},
73-
/** Whether there will be a `FormDisplay` rendered in the default slot with all tool inputs.
74-
* For now, this is used to determine if tool generated tours can be offered. */
75-
hasCompleteInputs: {
73+
/** If tool generated tours can be offered. */
74+
allowGeneratedTours: {
7675
type: Boolean,
7776
default: false,
7877
},
@@ -126,8 +125,8 @@ function onUpdatePreferredObjectStoreId(selectedToolPreferredObjectStoreId) {
126125
127126
const showHelpForum = computed(() => isConfigLoaded.value && config.value.enable_help_forum_tool_panel_integration);
128127
129-
const allowGeneratedTours = computed(() =>
130-
Boolean(props.hasCompleteInputs && isConfigLoaded.value && config.value.enable_tool_generated_tours),
128+
const canGenerateTours = computed(() =>
129+
Boolean(props.allowGeneratedTours && isConfigLoaded.value && config.value.enable_tool_generated_tours),
131130
);
132131
</script>
133132
@@ -147,7 +146,7 @@ const allowGeneratedTours = computed(() =>
147146
@onChangeVersion="onChangeVersion" />
148147
<ToolOptionsButton
149148
:id="props.id"
150-
:allow-generated-tours="allowGeneratedTours"
149+
:allow-generated-tours="canGenerateTours"
151150
:tool-uuid="props.toolUuid"
152151
:sharable-url="props.options.sharable_url"
153152
:version="props.version"

client/src/components/Tool/ToolForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
:disabled="disabled || showExecuting"
3737
:allow-object-store-selection="config.object_store_allows_id_selection"
3838
:preferred-object-store-id="preferredObjectStoreId"
39-
has-complete-inputs
39+
allow-generated-tours
4040
itemscope="itemscope"
4141
itemtype="https://schema.org/CreativeWork"
4242
@updatePreferredObjectStoreId="onUpdatePreferredObjectStoreId"

0 commit comments

Comments
 (0)