From e8cfa2349596a834905a78f435436241dda5e2a2 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 3 Nov 2022 17:06:41 -0400 Subject: [PATCH 0001/1034] First steps separating webpack builds, extracting toolshed. These are never deployed on the same host and the caching of shared objects is not useful, and this allows us to trim lots from the toolshed builds. --- client/webpack.config.js | 99 +++++++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 37 deletions(-) diff --git a/client/webpack.config.js b/client/webpack.config.js index 3961aeefcb59..aa6fe5218acf 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -27,17 +27,11 @@ const modulesExcludedFromLibs = [ const buildDate = new Date(); -module.exports = (env = {}, argv = {}) => { - // environment name based on -d, -p, webpack flag +const baseConfig = (env = {}, argv = {}) => { const targetEnv = process.env.NODE_ENV == "production" || argv.mode == "production" ? "production" : "development"; - const buildconfig = { + const buildConfig = { mode: targetEnv, - entry: { - analysis: ["polyfills", "bundleEntries", "entry/analysis"], - generic: ["polyfills", "bundleEntries", "entry/generic"], - toolshed: ["polyfills", "bundleToolshed", "entry/generic"], - }, output: { path: path.join(__dirname, "../", "/static/dist"), filename: "[name].bundled.js", @@ -225,40 +219,71 @@ module.exports = (env = {}, argv = {}) => { }), }), ], - devServer: { - client: { - overlay: { - errors: true, - warnings: false, - }, - webSocketURL: { - port: process.env.GITPOD_WORKSPACE_ID ? 443 : undefined, - }, + }; + + if (process.env.GXY_BUILD_SOURCEMAPS || buildConfig.mode == "development") { + buildConfig.devtool = "eval-cheap-source-map"; + } + + return buildConfig; +}; + +const analysisConfig = (env = {}, argv = {}) => { + // environment name based on -d, -p, webpack flag + const buildConfig = baseConfig(env, argv); + + buildConfig.entry = { + analysis: ["polyfills", "bundleEntries", "entry/analysis"], + generic: ["polyfills", "bundleEntries", "entry/generic"], + }; + + buildConfig.devServer = { + client: { + overlay: { + errors: true, + warnings: false, }, - allowedHosts: process.env.GITPOD_WORKSPACE_ID ? "all" : "auto", - devMiddleware: { - publicPath: "/static/dist", + webSocketURL: { + port: process.env.GITPOD_WORKSPACE_ID ? 443 : undefined, }, - hot: true, - port: 8081, - host: "0.0.0.0", - // proxy *everything* to the galaxy server. - // someday, when we have a fully API-driven independent client, this - // can be a more limited set -- e.g. `/api`, `/auth` - proxy: { - "**": { - target: process.env.GALAXY_URL || "http://localhost:8080", - secure: process.env.CHANGE_ORIGIN ? !process.env.CHANGE_ORIGIN : true, - changeOrigin: !!process.env.CHANGE_ORIGIN, - logLevel: "debug", - }, + }, + allowedHosts: process.env.GITPOD_WORKSPACE_ID ? "all" : "auto", + devMiddleware: { + publicPath: "/static/dist", + }, + hot: true, + port: 8081, + host: "0.0.0.0", + // proxy *everything* to the galaxy server. + // someday, when we have a fully API-driven independent client, this + // can be a more limited set -- e.g. `/api`, `/auth` + proxy: { + "**": { + target: process.env.GALAXY_URL || "http://localhost:8080", + secure: process.env.CHANGE_ORIGIN ? !process.env.CHANGE_ORIGIN : true, + changeOrigin: !!process.env.CHANGE_ORIGIN, + logLevel: "debug", }, }, }; - if (process.env.GXY_BUILD_SOURCEMAPS || buildconfig.mode == "development") { - buildconfig.devtool = "eval-cheap-source-map"; - } + return buildConfig; +}; - return buildconfig; +const toolshedConfig = (env = {}, argv = {}) => { + // environment name based on -d, -p, webpack flag + + const buildConfig = baseConfig(env, argv); + + buildConfig.entry = { + toolshed: ["polyfills", "bundleToolshed", "entry/generic"], + }; + buildConfig.optimization = { + minimize: true, + minimizer: [`...`, new CssMinimizerPlugin()], + }; + + return buildConfig; }; + +module.exports = [analysisConfig, toolshedConfig]; From fa9c3e4c95fc615bc94e06afbe4ee6dcbf09c20d Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 3 Nov 2022 17:23:24 -0400 Subject: [PATCH 0002/1034] Allow parallel builds, enh specificity for optimizatino rules since we'll do toolshed differently. --- client/webpack.config.js | 42 +++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/client/webpack.config.js b/client/webpack.config.js index aa6fe5218acf..cd3f7b811622 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -58,26 +58,6 @@ const baseConfig = (env = {}, argv = {}) => { config$: path.join(scriptsBase, "config", targetEnv) + ".js", }, }, - optimization: { - splitChunks: { - cacheGroups: { - styles: { - name: "base", - chunks: "all", - test: (m) => m.constructor.name == "CssModule", - priority: -5, - }, - libs: { - name: "libs", - test: new RegExp(`node_modules[\\/](?!(${modulesExcludedFromLibs})[\\/])|galaxy/scripts/libs`), - chunks: "all", - priority: -10, - }, - }, - }, - minimize: true, - minimizer: [`...`, new CssMinimizerPlugin()], - }, module: { rules: [ { @@ -237,6 +217,27 @@ const analysisConfig = (env = {}, argv = {}) => { generic: ["polyfills", "bundleEntries", "entry/generic"], }; + buildConfig.optimization = { + splitChunks: { + cacheGroups: { + styles: { + name: "base", + chunks: "all", + test: (m) => m.constructor.name == "CssModule", + priority: -5, + }, + libs: { + name: "libs", + test: new RegExp(`node_modules[\\/](?!(${modulesExcludedFromLibs})[\\/])|galaxy/scripts/libs`), + chunks: "all", + priority: -10, + }, + }, + }, + minimize: true, + minimizer: [`...`, new CssMinimizerPlugin()], + }; + buildConfig.devServer = { client: { overlay: { @@ -287,3 +288,4 @@ const toolshedConfig = (env = {}, argv = {}) => { }; module.exports = [analysisConfig, toolshedConfig]; +module.exports.parallelism = 2; From 345ec1b4244d94066d9aa3ff7beb4a9f9b3d109a Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 3 Nov 2022 17:58:46 -0400 Subject: [PATCH 0003/1034] optimization tweaks for toolshed entry --- client/webpack.config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/webpack.config.js b/client/webpack.config.js index cd3f7b811622..d30f0a68860c 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -280,8 +280,10 @@ const toolshedConfig = (env = {}, argv = {}) => { toolshed: ["polyfills", "bundleToolshed", "entry/generic"], }; buildConfig.optimization = { - minimize: true, - minimizer: [`...`, new CssMinimizerPlugin()], + splitChunks: { + // include all types of chunks + chunks: "all", + }, }; return buildConfig; From 998cd562c161160f1ac969adfffe56da4fda6815 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Mon, 16 Jan 2023 15:05:43 +0000 Subject: [PATCH 0004/1034] Update cellxgene interactive tool to 1.1.1 Call is the same on 1.1.1, at least as it is used here. Will try to add some options here as well (to specify gene symbols field and others). --- tools/interactive/interactivetool_cellxgene.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/interactive/interactivetool_cellxgene.xml b/tools/interactive/interactivetool_cellxgene.xml index e9069afcb0af..06f39d7110d1 100644 --- a/tools/interactive/interactivetool_cellxgene.xml +++ b/tools/interactive/interactivetool_cellxgene.xml @@ -1,6 +1,6 @@ - + - quay.io/biocontainers/cellxgene:0.16.2--py_0 + quay.io/biocontainers/cellxgene:1.1.1--pyhdfd78af_0 From b860465f9c248171a87f742c04332dd6a3754534 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Mon, 16 Jan 2023 17:28:43 +0000 Subject: [PATCH 0005/1034] Handling of files not indexed by gene symbols and output recovery --- .../interactive/interactivetool_cellxgene.xml | 51 +++++++++++++++++-- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/tools/interactive/interactivetool_cellxgene.xml b/tools/interactive/interactivetool_cellxgene.xml index 06f39d7110d1..584423b59251 100644 --- a/tools/interactive/interactivetool_cellxgene.xml +++ b/tools/interactive/interactivetool_cellxgene.xml @@ -1,6 +1,9 @@ + - quay.io/biocontainers/cellxgene:1.1.1--pyhdfd78af_0 + + quay.io/biocontainers/cellxgene:1.1.1--pyhdfd78af_0 @@ -10,16 +13,54 @@ + + + - + + - + + + + From acd862c6329438d0281016b4e9907fce6f390d36 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Mon, 16 Jan 2023 17:29:22 +0000 Subject: [PATCH 0006/1034] Clean up --- tools/interactive/interactivetool_cellxgene.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/interactive/interactivetool_cellxgene.xml b/tools/interactive/interactivetool_cellxgene.xml index 584423b59251..e1983198ba33 100644 --- a/tools/interactive/interactivetool_cellxgene.xml +++ b/tools/interactive/interactivetool_cellxgene.xml @@ -1,8 +1,5 @@ - - quay.io/biocontainers/cellxgene:1.1.1--pyhdfd78af_0 From acc34f6d2110d09858f5ff843f4c8d623a0617d9 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Tue, 7 Mar 2023 08:59:43 +0000 Subject: [PATCH 0007/1034] Adds help --- .../interactive/interactivetool_cellxgene.xml | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tools/interactive/interactivetool_cellxgene.xml b/tools/interactive/interactivetool_cellxgene.xml index e1983198ba33..590ea03374d9 100644 --- a/tools/interactive/interactivetool_cellxgene.xml +++ b/tools/interactive/interactivetool_cellxgene.xml @@ -61,7 +61,26 @@ adata.write_h5ad(output, compression="gzip") - - Interactive tool for visualising AnnData. - + From e9e8f9be27b02815fc3ddbbe6211aa58593c1488 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Tue, 7 Mar 2023 12:03:34 +0000 Subject: [PATCH 0008/1034] Change name and tutorial link --- ...ool_cellxgene.xml => interactivetool_cellxgene_1.1.1.xml} | 5 +++++ 1 file changed, 5 insertions(+) rename tools/interactive/{interactivetool_cellxgene.xml => interactivetool_cellxgene_1.1.1.xml} (95%) diff --git a/tools/interactive/interactivetool_cellxgene.xml b/tools/interactive/interactivetool_cellxgene_1.1.1.xml similarity index 95% rename from tools/interactive/interactivetool_cellxgene.xml rename to tools/interactive/interactivetool_cellxgene_1.1.1.xml index 590ea03374d9..2fec1b7865ac 100644 --- a/tools/interactive/interactivetool_cellxgene.xml +++ b/tools/interactive/interactivetool_cellxgene_1.1.1.xml @@ -82,5 +82,10 @@ Outputs If you create gene sets or differential experession sets, this will be available as a collection of files under "Cellxgene user annotations and gene sets" at the end of the execution (when you stop the interactive environment). + +Tutorials +--------- + +You can find cellxgene tuorials `here `_ . ]]> From 999322b35438b1dd5d6d6a70e3d9b6f43b2cd1d4 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Tue, 7 Mar 2023 12:05:10 +0000 Subject: [PATCH 0009/1034] Adds previous version as separate file --- .../interactivetool_cellxgene_0.16.2.xml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tools/interactive/interactivetool_cellxgene_0.16.2.xml diff --git a/tools/interactive/interactivetool_cellxgene_0.16.2.xml b/tools/interactive/interactivetool_cellxgene_0.16.2.xml new file mode 100644 index 000000000000..e9069afcb0af --- /dev/null +++ b/tools/interactive/interactivetool_cellxgene_0.16.2.xml @@ -0,0 +1,29 @@ + + + quay.io/biocontainers/cellxgene:0.16.2--py_0 + + + + 80 + + + + + + + + + + + + + + Interactive tool for visualising AnnData. + + From 6fe3db1db7abd4a2a1b921755f9fa7b1434405b1 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Tue, 7 Mar 2023 12:06:55 +0000 Subject: [PATCH 0010/1034] Update tool_conf.xml.sample --- lib/galaxy/config/sample/tool_conf.xml.sample | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/config/sample/tool_conf.xml.sample b/lib/galaxy/config/sample/tool_conf.xml.sample index b713c208d1a6..401d10a838a6 100644 --- a/lib/galaxy/config/sample/tool_conf.xml.sample +++ b/lib/galaxy/config/sample/tool_conf.xml.sample @@ -133,7 +133,8 @@ - + + From 703751b65c7b3a8c2656dea896a5ea3b4f69b8a7 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Wed, 8 Mar 2023 13:17:11 +0000 Subject: [PATCH 0011/1034] Avoid errors automatically detected by galaxy due to stderr output --- tools/interactive/interactivetool_cellxgene_1.1.1.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/interactive/interactivetool_cellxgene_1.1.1.xml b/tools/interactive/interactivetool_cellxgene_1.1.1.xml index 2fec1b7865ac..08edd9273b4d 100644 --- a/tools/interactive/interactivetool_cellxgene_1.1.1.xml +++ b/tools/interactive/interactivetool_cellxgene_1.1.1.xml @@ -7,6 +7,13 @@ 80 + + + Date: Mon, 27 Mar 2023 15:06:15 +0100 Subject: [PATCH 0012/1034] Layer and optionally make var field unique. --- .../interactivetool_cellxgene_1.1.1.xml | 60 +++++++++++++------ 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/tools/interactive/interactivetool_cellxgene_1.1.1.xml b/tools/interactive/interactivetool_cellxgene_1.1.1.xml index 08edd9273b4d..14bbcfc97bd3 100644 --- a/tools/interactive/interactivetool_cellxgene_1.1.1.xml +++ b/tools/interactive/interactivetool_cellxgene_1.1.1.xml @@ -15,19 +15,22 @@ /> @@ -44,21 +47,31 @@ def rn(df, field, suffix = '-duplicate-'): adata = ad.read_h5ad(sys.argv[1]) output = sys.argv[2] gene_symbol_field = sys.argv[3] -if gene_symbol_field not in adata.var.keys(): - sys.exit(f"Field {gene_symbol_field} set as var_name does not exist in the var object. AnnData object will be used as it was given") +make_unique = (sys.argv[4].lower() == "true") +layer = sys.argv[5] -adata.var = rn(adata.var, gene_symbol_field, suffix = "_d") +if gene_symbol_field and make_unique: + if gene_symbol_field not in adata.var.keys(): + sys.exit(f"Field {gene_symbol_field} set as var_name does not exist in the var object. AnnData object will be used as it was given") + + adata.var = rn(adata.var, gene_symbol_field, suffix = "_d") + adata.var["extra_gene_id"] = adata.var.index + adata.var = adata.var.set_index(f"{gene_symbol_field}_u") -adata.var["extra_gene_id"] = adata.var.index -adata.var = adata.var.set_index(f"{gene_symbol_field}_u") +if layer: + if layer not in adata.layers.keys(): + sys.exit(f"Layer {layer} is not present in AnnData, only available layers are: {', '.join(adata.layers.keys())}") + else: + adata.X = adata.layers[layer] - -adata.write_h5ad(output, compression="gzip") +adata.write_h5ad(output) ]]> - + + + @@ -80,9 +93,20 @@ Selecting the Var name ---------------------- It can happen that the main index for the var element of AnnData is not the gene symbol field, in which case search by genes will probably be by identifier. -You can choose a different field (which contains the gene symbols) so that +You can choose a different field and celxgene will use this. If in addition you choose "Make unique", the AnnData is modified (in a new copy) so that that field is made unique and -it is indexed by it. Then cellxgene will allow searches by genes in that field. +it is indexed by it. Making it unique entails though loading the object into memory, +modifying and writing it back, which can delay the execution of cellxgene. + +Then cellxgene will allow searches by genes in that field. + +Selecting the layer +------------------- + +It can happen that the AnnData object contains multiple layers, for example +one with the raw counts and another with the normalised counts. You can select +which layer to use as the matrix for cellxgene. By default cellxgene will use the X slot, but +that slot might not contain the matrix that you want to visualise. Outputs ------- From 1741fa45ee1840603e06ede10367614e0f6f9a13 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Tue, 28 Mar 2023 10:19:54 +0100 Subject: [PATCH 0013/1034] Some tabs to spaces --- tools/interactive/interactivetool_cellxgene_1.1.1.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/interactive/interactivetool_cellxgene_1.1.1.xml b/tools/interactive/interactivetool_cellxgene_1.1.1.xml index 14bbcfc97bd3..c8c6c4cb72bc 100644 --- a/tools/interactive/interactivetool_cellxgene_1.1.1.xml +++ b/tools/interactive/interactivetool_cellxgene_1.1.1.xml @@ -17,21 +17,21 @@ From dbce56f6fd31f17c116707e02839518e1ef50df7 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Fri, 9 Jun 2023 09:16:11 -0400 Subject: [PATCH 0014/1034] rebasing with dev --- .../src/components/DataDialog/DataDialog.vue | 1 + .../components/Form/Elements/FormDialog.vue | 74 +++++++++++++++++++ client/src/components/Form/FormElement.vue | 17 +++++ 3 files changed, 92 insertions(+) create mode 100644 client/src/components/Form/Elements/FormDialog.vue diff --git a/client/src/components/DataDialog/DataDialog.vue b/client/src/components/DataDialog/DataDialog.vue index 6ace81eecc13..90a7e92803db 100644 --- a/client/src/components/DataDialog/DataDialog.vue +++ b/client/src/components/DataDialog/DataDialog.vue @@ -142,6 +142,7 @@ export default { }; this.openGlobalUploadModal(propsData); this.modalShow = false; + this.$emit("onUpload"); }, /** Called when selection is complete, values are formatted and parsed to external callback **/ onOk() { diff --git a/client/src/components/Form/Elements/FormDialog.vue b/client/src/components/Form/Elements/FormDialog.vue new file mode 100644 index 000000000000..3c5dc24c791f --- /dev/null +++ b/client/src/components/Form/Elements/FormDialog.vue @@ -0,0 +1,74 @@ + + + diff --git a/client/src/components/Form/FormElement.vue b/client/src/components/Form/FormElement.vue index e21728d5c055..c533de112e49 100644 --- a/client/src/components/Form/FormElement.vue +++ b/client/src/components/Form/FormElement.vue @@ -12,6 +12,7 @@ import FormBoolean from "./Elements/FormBoolean.vue"; import FormColor from "./Elements/FormColor.vue"; import FormDirectory from "./Elements/FormDirectory.vue"; import FormDrilldown from "./Elements/FormDrilldown/FormDrilldown.vue"; +<<<<<<< HEAD import FormHidden from "./Elements/FormHidden.vue"; import FormInput from "./Elements/FormInput.vue"; import FormNumber from "./Elements/FormNumber.vue"; @@ -22,6 +23,17 @@ import FormSelection from "./Elements/FormSelection.vue"; import FormTags from "./Elements/FormTags.vue"; import FormText from "./Elements/FormText.vue"; import FormUpload from "./Elements/FormUpload.vue"; +======= +import FormDialog from "./Elements/FormDialog.vue"; +import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; +import { ref, computed, useAttrs } from "vue"; +import { library } from "@fortawesome/fontawesome-svg-core"; +import { faExclamation, faTimes, faArrowsAltH } from "@fortawesome/free-solid-svg-icons"; +import { faCaretSquareDown, faCaretSquareUp } from "@fortawesome/free-regular-svg-icons"; + +import type { ComputedRef } from "vue"; +import type { FormParameterTypes, FormParameterAttributes, FormParameterValue } from "./parameterTypes"; +>>>>>>> d24eb2b32d (first pass at converting FormDialog) interface FormElementProps { id?: string; @@ -278,6 +290,11 @@ const isOptional = computed(() => !isRequired.value && attrs.value["optional"] ! v-model="currentValue" :options="attrs.options" :multiple="attrs.multiple" /> + From 7cee1cc10528f4d7a69e77b6cbf06199209995ee Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Mon, 12 Jun 2023 16:23:03 -0400 Subject: [PATCH 0015/1034] selection updates the input box --- .../components/Form/Elements/FormDialog.vue | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/client/src/components/Form/Elements/FormDialog.vue b/client/src/components/Form/Elements/FormDialog.vue index 3c5dc24c791f..50bcb307b3fe 100644 --- a/client/src/components/Form/Elements/FormDialog.vue +++ b/client/src/components/Form/Elements/FormDialog.vue @@ -3,7 +3,7 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { library } from "@fortawesome/fontawesome-svg-core"; import { faFolderOpen } from "@fortawesome/free-solid-svg-icons"; import DataDialog from "../../DataDialog/DataDialog.vue"; -import { computed, onMounted } from "vue"; +import { onMounted } from "vue"; import { getCurrentGalaxyHistory } from "../../../utils/data"; import { reactive } from "vue"; @@ -12,63 +12,59 @@ library.add(faFolderOpen); interface DataDialogProps { id: string; multiple: boolean; - value?: string; + value?: Array; } const props = withDefaults(defineProps(), { - value: "", multiple: false, }); const title = "Browse Datasets"; -let historyID: string = ""; +const historyID: string = ""; const localHistoryId = reactive({ value: historyID, }); -onMounted(() => { +onMounted(() => { getCurrentGalaxyHistory().then((historyId) => { - console.log("historyId", historyId); - //set historyID to historyId localHistoryId.value = historyId; }); -}) +}); -let initialODD = false; +const initialODD = false; const openDataDialog = reactive({ value: initialODD, }); +const dataSelected = reactive({ + value: [""] +}); + const emit = defineEmits<{ - (e: "input", value: Object): void; + (e: "input", value: Array): void; }>(); -const currentValue = computed({ - get() { - return Object(props.value); - }, - set(newValue) { - emit("input", newValue); - }, -}); + +function onData(result: Array) { + openDataDialog.value = false + dataSelected.value = result; + emit("input", result); +} + From 1745b0b885705c459c3ff20b447fce7b0f25df8f Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Mon, 12 Jun 2023 23:15:40 -0400 Subject: [PATCH 0016/1034] adding toBoolean method to turn multiple prop into a boolean instead of string --- client/src/components/Form/FormElement.vue | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/client/src/components/Form/FormElement.vue b/client/src/components/Form/FormElement.vue index c533de112e49..6049dee235c1 100644 --- a/client/src/components/Form/FormElement.vue +++ b/client/src/components/Form/FormElement.vue @@ -134,6 +134,21 @@ function onConnect() { } } +function toBoolean(value: string){ + //convert string to boolean or return null + if (typeof value === "string") { + if (value.toLowerCase() === "true") { + return true; + } else if (value.toLowerCase() === "false") { + return false; + } else { + return null; + } + } else { + return value; + } +} + const isHidden = computed(() => attrs.value["hidden"]); const elementId = computed(() => `form-element-${props.id}`); const hasAlert = computed(() => Boolean(props.error || props.warning)); @@ -294,7 +309,7 @@ const isOptional = computed(() => !isRequired.value && attrs.value["optional"] ! v-else-if="props.type == 'data_dialog'" :id="id" v-model="currentValue" - :multiple="attrs.multiple"/> + :multiple="toBoolean(attrs.multiple)"/> From 236f029f491121fab87025eb5e43b0a75111b460 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Mon, 12 Jun 2023 23:16:24 -0400 Subject: [PATCH 0017/1034] modifying FormDialog to accomodate strings or arrays of strings depending on whether multiple is true --- client/src/components/Form/Elements/FormDialog.vue | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/client/src/components/Form/Elements/FormDialog.vue b/client/src/components/Form/Elements/FormDialog.vue index 50bcb307b3fe..beb0efeba5a3 100644 --- a/client/src/components/Form/Elements/FormDialog.vue +++ b/client/src/components/Form/Elements/FormDialog.vue @@ -12,7 +12,7 @@ library.add(faFolderOpen); interface DataDialogProps { id: string; multiple: boolean; - value?: Array; + value?: Array | string; } const props = withDefaults(defineProps(), { @@ -37,20 +37,18 @@ const openDataDialog = reactive({ }); const dataSelected = reactive({ - value: [""] + value: props.value, }); const emit = defineEmits<{ - (e: "input", value: Array): void; + (e: "input", value: Array | string): void; }>(); - -function onData(result: Array) { - openDataDialog.value = false +function onData(result: Array | string) { + openDataDialog.value = false; dataSelected.value = result; emit("input", result); } -