mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Re-use api type for export-on-complete config
Changes made: 1. ExportOnCompleteWizard.vue: - Replaced ExportOnCompleteConfig with WriteStoreToPayload from @/api/schema - Renamed format to model_store_format throughout - Added ModelStoreFormat type for proper typing of the ref 2. OnCompleteActions.vue: - Imported WriteStoreToPayload from the wizard - Removed local ExportConfig interface - Updated all references from format to model_store_format 3. WorkflowRunFormSimple.vue: - Imported WriteStoreToPayload from the wizard - Replaced inline type definition with WriteStoreToPayload
This commit is contained in:
@@ -3,6 +3,7 @@ import { BButton, BCard, BCardGroup, BCardTitle, BFormCheckbox, BFormGroup, BFor
|
||||
import { computed, ref } from "vue";
|
||||
|
||||
import type { FilterFileSourcesOptions } from "@/api/remoteFiles";
|
||||
import type { components } from "@/api/schema";
|
||||
import { useWizard } from "@/components/Common/Wizard/useWizard";
|
||||
import { borderVariant } from "@/components/Common/Wizard/utils";
|
||||
import { useFileSources } from "@/composables/fileSources";
|
||||
@@ -15,13 +16,8 @@ import FileSourceNameSpan from "@/components/FileSources/FileSourceNameSpan.vue"
|
||||
|
||||
const { renderMarkdown } = useMarkdown({ openLinksInNewPage: true });
|
||||
|
||||
export interface ExportOnCompleteConfig {
|
||||
target_uri: string;
|
||||
format: string;
|
||||
include_files: boolean;
|
||||
include_hidden: boolean;
|
||||
include_deleted: boolean;
|
||||
}
|
||||
export type WriteStoreToPayload = components["schemas"]["WriteStoreToPayload"];
|
||||
type ModelStoreFormat = components["schemas"]["ModelStoreFormat"];
|
||||
|
||||
interface ExportFormat {
|
||||
id: string;
|
||||
@@ -30,7 +26,7 @@ interface ExportFormat {
|
||||
}
|
||||
|
||||
interface Props {
|
||||
initialConfig?: Partial<ExportOnCompleteConfig> & { fileName?: string; directory?: string };
|
||||
initialConfig?: Partial<WriteStoreToPayload> & { fileName?: string; directory?: string };
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
@@ -38,7 +34,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "configured", config: ExportOnCompleteConfig): void;
|
||||
(e: "configured", config: WriteStoreToPayload): void;
|
||||
(e: "cancel"): void;
|
||||
}>();
|
||||
|
||||
@@ -48,7 +44,7 @@ const { hasWritable: hasWritableFileSources } = useFileSources(defaultExportFilt
|
||||
// Internal state for the wizard UI
|
||||
const directory = ref(props.initialConfig.directory || "");
|
||||
const fileName = ref(props.initialConfig.fileName || "galaxy-workflow-export");
|
||||
const format = ref(props.initialConfig.format || "rocrate.zip");
|
||||
const modelStoreFormat = ref<ModelStoreFormat>(props.initialConfig.model_store_format || "rocrate.zip");
|
||||
const includeFiles = ref(props.initialConfig.include_files ?? true);
|
||||
const includeHidden = ref(props.initialConfig.include_hidden ?? false);
|
||||
const includeDeleted = ref(props.initialConfig.include_deleted ?? false);
|
||||
@@ -70,7 +66,7 @@ This is a simple format suitable for backup and transfer.`,
|
||||
},
|
||||
];
|
||||
|
||||
const selectedFormat = computed(() => exportFormats.find((f) => f.id === format.value) || exportFormats[0]);
|
||||
const selectedFormat = computed(() => exportFormats.find((f) => f.id === modelStoreFormat.value) || exportFormats[0]);
|
||||
|
||||
const directoryDescription = computed(() => localize("Select a 'repository' to export the workflow results to."));
|
||||
const nameDescription = computed(() => localize("Give the exported file a name."));
|
||||
@@ -99,11 +95,11 @@ const wizard = useWizard({
|
||||
function onSubmit() {
|
||||
// Construct full target_uri from directory + filename + format
|
||||
const dir = directory.value.endsWith("/") ? directory.value : `${directory.value}/`;
|
||||
const fullTargetUri = `${dir}${fileName.value}.${format.value}`;
|
||||
const fullTargetUri = `${dir}${fileName.value}.${modelStoreFormat.value}`;
|
||||
|
||||
emit("configured", {
|
||||
target_uri: fullTargetUri,
|
||||
format: format.value,
|
||||
model_store_format: modelStoreFormat.value,
|
||||
include_files: includeFiles.value,
|
||||
include_hidden: includeHidden.value,
|
||||
include_deleted: includeDeleted.value,
|
||||
@@ -130,8 +126,8 @@ function onCancel() {
|
||||
:key="fmt.id"
|
||||
:data-export-format="fmt.id"
|
||||
class="wizard-selection-card"
|
||||
:border-variant="borderVariant(format === fmt.id)"
|
||||
@click="format = fmt.id">
|
||||
:border-variant="borderVariant(modelStoreFormat === fmt.id)"
|
||||
@click="modelStoreFormat = fmt.id as ModelStoreFormat">
|
||||
<BCardTitle>
|
||||
<b>{{ fmt.title }}</b>
|
||||
</BCardTitle>
|
||||
@@ -167,7 +163,7 @@ function onCancel() {
|
||||
placeholder="Name"
|
||||
required
|
||||
data-test-id="export-file-name-input" />
|
||||
<span class="ml-2 text-muted">.{{ format }}</span>
|
||||
<span class="ml-2 text-muted">.{{ modelStoreFormat }}</span>
|
||||
</div>
|
||||
</BFormGroup>
|
||||
</template>
|
||||
@@ -198,7 +194,7 @@ function onCancel() {
|
||||
<FileSourceNameSpan v-if="directory" :uri="directory" class="text-primary" />
|
||||
<span v-else class="text-muted">Not selected</span>
|
||||
</div>
|
||||
<div v-if="fileName"><strong>File name:</strong> {{ fileName }}.{{ format }}</div>
|
||||
<div v-if="fileName"><strong>File name:</strong> {{ fileName }}.{{ modelStoreFormat }}</div>
|
||||
<div>
|
||||
<strong>Options:</strong>
|
||||
<span v-if="includeFiles">Include files</span>
|
||||
|
||||
@@ -5,21 +5,13 @@ import { computed, reactive, ref, watch } from "vue";
|
||||
import { useConfig } from "@/composables/config";
|
||||
import { useFileSources } from "@/composables/fileSources";
|
||||
|
||||
import ExportOnCompleteWizard from "./ExportOnCompleteWizard.vue";
|
||||
import ExportOnCompleteWizard, { type WriteStoreToPayload } from "./ExportOnCompleteWizard.vue";
|
||||
import FileSourceNameSpan from "@/components/FileSources/FileSourceNameSpan.vue";
|
||||
import FormCard from "@/components/Form/FormCard.vue";
|
||||
|
||||
interface ExportConfig {
|
||||
target_uri: string;
|
||||
format: string;
|
||||
include_files: boolean;
|
||||
include_hidden: boolean;
|
||||
include_deleted: boolean;
|
||||
}
|
||||
|
||||
interface OnCompleteAction {
|
||||
send_notification?: Record<string, never>;
|
||||
export_to_file_source?: ExportConfig;
|
||||
export_to_file_source?: WriteStoreToPayload;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
@@ -45,11 +37,11 @@ const state = reactive({
|
||||
exportEnabled: false,
|
||||
exportConfig: {
|
||||
target_uri: "",
|
||||
format: "rocrate.zip",
|
||||
model_store_format: "rocrate.zip",
|
||||
include_files: true,
|
||||
include_hidden: false,
|
||||
include_deleted: false,
|
||||
} as ExportConfig,
|
||||
} as WriteStoreToPayload,
|
||||
});
|
||||
|
||||
// Initialize state from value prop (Vue 2 style v-model)
|
||||
@@ -88,7 +80,7 @@ function emitOnComplete() {
|
||||
emit("input", actions);
|
||||
}
|
||||
|
||||
function onExportConfigured(config: ExportConfig) {
|
||||
function onExportConfigured(config: WriteStoreToPayload) {
|
||||
state.exportConfig = config;
|
||||
state.exportEnabled = true;
|
||||
showExportWizard.value = false;
|
||||
@@ -102,7 +94,7 @@ function clearExport() {
|
||||
state.exportEnabled = false;
|
||||
state.exportConfig = {
|
||||
target_uri: "",
|
||||
format: "rocrate.zip",
|
||||
model_store_format: "rocrate.zip",
|
||||
include_files: true,
|
||||
include_hidden: false,
|
||||
include_deleted: false,
|
||||
@@ -152,7 +144,7 @@ const exportSummary = computed(() => {
|
||||
<FileSourceNameSpan :uri="exportSummary.target_uri" class="text-primary" />
|
||||
<br />
|
||||
<small class="text-muted">
|
||||
Format: {{ exportSummary.format }}
|
||||
Format: {{ exportSummary.model_store_format }}
|
||||
<span v-if="exportSummary.include_files">, with files</span>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@ import { invokeWorkflow } from "./services";
|
||||
|
||||
import WorkflowAnnotation from "../WorkflowAnnotation.vue";
|
||||
import WorkflowNavigationTitle from "../WorkflowNavigationTitle.vue";
|
||||
import ExportOnCompleteWizard from "./ExportOnCompleteWizard.vue";
|
||||
import ExportOnCompleteWizard, { type WriteStoreToPayload } from "./ExportOnCompleteWizard.vue";
|
||||
import WorkflowHelpDisplay from "./WorkflowHelpDisplay.vue";
|
||||
import WorkflowRunGraph from "./WorkflowRunGraph.vue";
|
||||
import WorkflowStorageConfiguration from "./WorkflowStorageConfiguration.vue";
|
||||
@@ -88,13 +88,7 @@ const checkInputMatching = ref(props.requestState !== undefined);
|
||||
const sendNotificationOnComplete = ref(false);
|
||||
const showExportWizard = ref(false);
|
||||
const exportCheckboxKey = ref(0);
|
||||
const exportOnCompleteConfig = ref<{
|
||||
target_uri: string;
|
||||
format: string;
|
||||
include_files: boolean;
|
||||
include_hidden: boolean;
|
||||
include_deleted: boolean;
|
||||
} | null>(null);
|
||||
const exportOnCompleteConfig = ref<WriteStoreToPayload | null>(null);
|
||||
|
||||
const { hasWritable: hasWritableFileSources } = useFileSources({ exclude: ["rdm"] });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user