Skip to content

Commit

Permalink
Implement many PR comments around Vue stuff and docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed May 14, 2024
1 parent fe96cc1 commit b4698c1
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 54 deletions.
18 changes: 8 additions & 10 deletions client/src/components/ConfigTemplates/EditSecretsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ async function update(secretName: string, secretValue: string) {
<template>
<FormCard :title="title">
<template v-slot:body>
<div>
<div v-for="secret in template.secrets" :key="secret.name">
<VaultSecret
:label="secret.label || secret.name"
:name="secret.name"
:help="secret.help || ''"
:is-set="true"
@update="update">
</VaultSecret>
</div>
<div v-for="secret in template.secrets" :key="secret.name">
<VaultSecret
:label="secret.label || secret.name"
:name="secret.name"
:help="secret.help || ''"
:is-set="true"
@update="update">
</VaultSecret>
</div>
</template>
</FormCard>
Expand Down
6 changes: 4 additions & 2 deletions client/src/components/ConfigTemplates/InstanceDropdown.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import "./icons";
import { library } from "@fortawesome/fontawesome-svg-core";
import { faCaretDown } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BLink } from "bootstrap-vue";
import { useRouter } from "vue-router/composables";
Expand All @@ -13,6 +13,8 @@ interface Props {
isUpgradable: boolean;
}
library.add(faCaretDown);
const title = "";
const router = useRouter();
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/ConfigTemplates/InstanceForm.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { shallowMount } from "@vue/test-utils";
import { getLocalVue } from "tests/jest/helpers";

import { FormEntry } from "./formUtil";

import InstanceForm from "./InstanceForm.vue";

const localVue = getLocalVue(true);

const inputs: any[] = [];
const inputs: FormEntry[] = [];
const SUBMIT_TITLE = "Submit the form!";

describe("InstanceForm", () => {
it("should render a loading message and not submit button if inputs is null", async () => {
const wrapper = shallowMount(InstanceForm, {
propsData: {
title: "MY FORM",
loading: true,
inputs: null,
submitTitle: SUBMIT_TITLE,
},
Expand All @@ -28,7 +29,6 @@ describe("InstanceForm", () => {
const wrapper = shallowMount(InstanceForm, {
propsData: {
title: "MY FORM",
loading: false,
inputs: inputs,
submitTitle: SUBMIT_TITLE,
},
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/ConfigTemplates/InstanceForm.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script setup lang="ts">
import { BButton } from "bootstrap-vue";
import { FormEntry } from "./formUtil";
import FormCard from "@/components/Form/FormCard.vue";
import FormDisplay from "@/components/Form/FormDisplay.vue";
import LoadingSpan from "@/components/LoadingSpan.vue";
interface Props {
title: string;
inputs: any | null; // not fully reactive so make sure these are ready to go when loading is false
inputs: FormEntry[] | null; // not fully reactive so make sure these are ready to go when loading is false
submitTitle: string;
loadingMessage: string;
}
Expand Down
10 changes: 6 additions & 4 deletions client/src/components/ConfigTemplates/ManageIndexHeader.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<script setup lang="ts">
import "./icons";
import { library } from "@fortawesome/fontawesome-svg-core";
import { faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BAlert, BButton, BCol, BRow } from "bootstrap-vue";
import { useRouter } from "vue-router/composables";
import _l from "@/utils/localization";
import localize from "@/utils/localization";
library.add(faPlus);
interface Props {
message: String | null | undefined;
Expand All @@ -27,7 +29,7 @@ const router = useRouter();
<BCol>
<BButton :id="createButtonId" class="m-1 float-right" @click="router.push(createRoute)">
<FontAwesomeIcon icon="plus" />
{{ _l("Create") }}
{{ localize("Create") }}
</BButton>
</BCol>
</BRow>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ConfigTemplates/VaultSecret.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ async function onOk() {
</template>

<style lang="scss" scoped>
@import "../Form/form-elements.scss";
@import "../Form/_form-elements.scss";
</style>
23 changes: 16 additions & 7 deletions client/src/components/ConfigTemplates/formUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ import type {
} from "@/api/configTemplates";
import { markup } from "@/components/ObjectStore/configurationMarkdown";

export function metadataFormEntryName(what: string) {
export interface FormEntry {
name: string;
label?: string;
optional?: boolean;
help?: string | null;
type: string;
value?: any;
}

export function metadataFormEntryName(what: string): FormEntry {
return {
name: "_meta_name",
label: "Name",
Expand All @@ -19,7 +28,7 @@ export function metadataFormEntryName(what: string) {
};
}

export function metadataFormEntryDescription(what: string) {
export function metadataFormEntryDescription(what: string): FormEntry {
return {
name: "_meta_description",
label: "Description",
Expand All @@ -29,7 +38,7 @@ export function metadataFormEntryDescription(what: string) {
};
}

export function templateVariableFormEntry(variable: TemplateVariable, variableValue: VariableValueType) {
export function templateVariableFormEntry(variable: TemplateVariable, variableValue: VariableValueType): FormEntry {
const common_fields = {
name: variable.name,
label: variable.label ?? variable.name,
Expand Down Expand Up @@ -69,7 +78,7 @@ export function templateVariableFormEntry(variable: TemplateVariable, variableVa
}
}

export function templateSecretFormEntry(secret: TemplateSecret) {
export function templateSecretFormEntry(secret: TemplateSecret): FormEntry {
return {
name: secret.name,
label: secret.label ?? secret.name,
Expand All @@ -79,7 +88,7 @@ export function templateSecretFormEntry(secret: TemplateSecret) {
};
}

export function editTemplateForm(template: TemplateSummary, what: string, instance: Instance) {
export function editTemplateForm(template: TemplateSummary, what: string, instance: Instance): FormEntry[] {
const form = [];
const nameInput = metadataFormEntryName(what);
form.push({ value: instance.name ?? "", ...nameInput });
Expand Down Expand Up @@ -114,7 +123,7 @@ export function editFormDataToPayload(template: TemplateSummary, formData: any)
return payload;
}

export function createTemplateForm(template: TemplateSummary, what: string) {
export function createTemplateForm(template: TemplateSummary, what: string): FormEntry[] {
const form = [];
const variables = template.variables ?? [];
const secrets = template.secrets ?? [];
Expand Down Expand Up @@ -196,7 +205,7 @@ export function formDataTypedGet(variableDefinition: TemplateVariable, formData:
}
}

export function upgradeForm(template: TemplateSummary, instance: Instance): Array<any> {
export function upgradeForm(template: TemplateSummary, instance: Instance): FormEntry[] {
const form = [];
const variables = template.variables ?? [];
const secrets = template.secrets ?? [];
Expand Down
5 changes: 0 additions & 5 deletions client/src/components/ConfigTemplates/icons.ts

This file was deleted.

2 changes: 0 additions & 2 deletions client/src/components/FileSources/Instances/ManageIndex.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import "@/components/ConfigTemplates/icons";
import { BTable } from "bootstrap-vue";
import { computed } from "vue";
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Form/FormElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -312,5 +312,5 @@ const isOptional = computed(() => !isRequired.value && attrs.value["optional"] !
</template>

<style lang="scss" scoped>
@import "./form-elements.scss";
@import "./_form-elements.scss";
</style>
2 changes: 0 additions & 2 deletions client/src/components/ObjectStore/Instances/ManageIndex.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import "@/components/ConfigTemplates/icons";
import { BTable } from "bootstrap-vue";
import { computed } from "vue";
Expand Down
31 changes: 15 additions & 16 deletions doc/source/admin/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Galaxy has countless ways for users to connect with things that might be considered their "data" - file sources (aka "remote files"), object stores (aka "storage locations"), data libraries, the upload API, visualizations, display applications, custom tools, etc...

This document is going to discuss two of these (file sources and object stores) that are most important Galaxy administrators and how to build Galaxy configuration that allow administrators to let users tie into various pieces of infrastructure.
This document is going to discuss two of these (file sources and object stores) that are most important Galaxy administrators and how to build Galaxy configurations that allow administrators to let users tie into various pieces of infrastructure (local and publicly available).

```{contents} Table of Contents
:depth: 4
Expand Down Expand Up @@ -46,9 +46,8 @@ A minimal object store template might look something like:

This is the most basic sort of object store template that just makes disk paths available to users
for storing data. Paths can be built up from the user supplied variables, user details, supplied
environment variables, etc.. The simple example used to demonstrate these concepts just uses
a user supplied project name and the user's username to produce a unique path for each user
defined object store.
environment variables, etc.. The simple example just uses a user supplied project name and the
user's username to produce a unique path for each user defined object store.

```{literalinclude} ../../../lib/galaxy/objectstore/templates/examples/simple_example.yml
:language: yaml
Expand Down Expand Up @@ -222,11 +221,11 @@ store configuration).

### Ready To Use Production Object Store Templates

The templates have been tested by a Galaxy developer and are sufficiently generic that
they may make sense for a variety of Galaxy instances, address a variety of potential use
cases, and do not have need any additional tailoring, parameterization, or other
customization. These assume your Galaxy instance has a Vault configured and you're
comfortable with it storing your user's secrets.
The templates are sufficiently generic that they may make sense for a variety of
Galaxy instances, address a variety of potential use cases, and do not need any
additional tailoring, parameterization, or other customization. These assume your
Galaxy instance has [a Vault configured](https://docs.galaxyproject.org/en/master/admin/special_topics/vault.html)
and you're comfortable with it storing your user's secrets.

#### Allow Users to Define Azure Blob Storage as Object Stores

Expand Down Expand Up @@ -345,11 +344,11 @@ configuration).

### Ready To Use Production File Source Templates

The templates have been tested by a Galaxy developer and are sufficiently generic that
they may make sense for a variety of Galaxy instances, address a variety of potential use
cases, and do not have need any additional tailoring, parameterization, or other
customization. These assume your Galaxy instance has a Vault configured and you're
comfortable with it storing your user's secrets.
The templates are sufficiently generic that they may make sense for a variety of
Galaxy instances, address a variety of potential use cases, and do not need any
additional tailoring, parameterization, or other customization. These (mostly) assume
your Galaxy instance has [a Vault configured](https://docs.galaxyproject.org/en/master/admin/special_topics/vault.html)
and you are comfortable with it storing your user's secrets.

#### Allow Users to Define Generic FTP Servers as File Sources

Expand Down Expand Up @@ -407,7 +406,7 @@ by Ansible at deploy time, the file could start with:
```

In this case, variables wrapped by ``[%`` and ``%]`` are expanded by Ansible and use the Ansible
environment and ``{`` and ``}`` are reserved for Galaxy templating.
environment and ``{{`` and ``}}`` are reserved for Galaxy templating.

Alternatively, Galaxy can be configured to use a custom template on a per-configuration
object basis by setting the ``template_start`` and/or ``template_end`` variables.
Expand Down Expand Up @@ -484,7 +483,7 @@ use the Galaxy user's username to generate unique paths.
### ``ensure_path_component``

This [Jinja filter](https://jinja.palletsprojects.com/en/3.0.x/templates/#filters)
will fail template evaluation if the value it is applies to is not
will fail template evaluation if the value it is applied to is not
a simple directory name. If it contain ``..`` or ``/`` or in some other way might
be used to attempt path exploitation of cause odd path-related bugs. This is
useful when producing paths for ``disk`` object stores or ``posix`` file sources.
Expand Down
Empty file.

0 comments on commit b4698c1

Please sign in to comment.