diff --git a/ui/eslint.config.js b/ui/eslint.config.js index 7b2c682e17c..fd06d7988b3 100644 --- a/ui/eslint.config.js +++ b/ui/eslint.config.js @@ -3,6 +3,8 @@ import pluginJs from "@eslint/js"; import tseslint from "typescript-eslint"; import pluginVue from "eslint-plugin-vue"; +const components = (folder) => `src/components/${folder}/**/*.vue`; + /** @type {import('eslint').Linter.Config[]} */ export default [ { @@ -12,8 +14,13 @@ export default [ {languageOptions: {globals: globals.browser}}, pluginJs.configs.recommended, ...tseslint.configs.recommended, - { - files: ["**/*.spec.js", "**/*.spec.ts", "vite.config.js", "vitest.config.js"], + { + files: [ + "**/*.spec.js", + "**/*.spec.ts", + "vite.config.js", + "vitest.config.js", + ], languageOptions: {globals: globals.node}, }, ...pluginVue.configs["flat/strongly-recommended"], @@ -66,7 +73,12 @@ export default [ }, ], "@typescript-eslint/no-this-alias": "off", - "@typescript-eslint/no-explicit-any": "off" - } - } + "@typescript-eslint/no-explicit-any": "off", + }, + }, + { + // Enforce the use of the + + diff --git a/ui/src/components/code/README.md b/ui/src/components/code/README.md new file mode 100644 index 00000000000..0f295a34f41 --- /dev/null +++ b/ui/src/components/code/README.md @@ -0,0 +1,5 @@ +### Guide on How to Handle the `NoCode` Editor + +> Code within `Vue` components must be written using the ` + + diff --git a/ui/src/components/code/components/Breadcrumbs.vue b/ui/src/components/code/components/Breadcrumbs.vue new file mode 100644 index 00000000000..51607ab3e8b --- /dev/null +++ b/ui/src/components/code/components/Breadcrumbs.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/ui/src/components/code/components/Save.vue b/ui/src/components/code/components/Save.vue new file mode 100644 index 00000000000..3976b81a67f --- /dev/null +++ b/ui/src/components/code/components/Save.vue @@ -0,0 +1,16 @@ + + + diff --git a/ui/src/components/code/components/collapse/Collapse.vue b/ui/src/components/code/components/collapse/Collapse.vue new file mode 100644 index 00000000000..e3ea22628f2 --- /dev/null +++ b/ui/src/components/code/components/collapse/Collapse.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/ui/src/components/code/components/collapse/Element.vue b/ui/src/components/code/components/collapse/Element.vue new file mode 100644 index 00000000000..c2d18317bbd --- /dev/null +++ b/ui/src/components/code/components/collapse/Element.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/ui/src/components/code/components/collapse/buttons/Creation.vue b/ui/src/components/code/components/collapse/buttons/Creation.vue new file mode 100644 index 00000000000..27d4ee2d6f3 --- /dev/null +++ b/ui/src/components/code/components/collapse/buttons/Creation.vue @@ -0,0 +1,28 @@ + + + diff --git a/ui/src/components/code/components/inputs/InputLabel.vue b/ui/src/components/code/components/inputs/InputLabel.vue new file mode 100644 index 00000000000..55149589078 --- /dev/null +++ b/ui/src/components/code/components/inputs/InputLabel.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/ui/src/components/code/components/inputs/InputSwitch.vue b/ui/src/components/code/components/inputs/InputSwitch.vue new file mode 100644 index 00000000000..8b47310b6a2 --- /dev/null +++ b/ui/src/components/code/components/inputs/InputSwitch.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/ui/src/components/code/components/inputs/InputText.vue b/ui/src/components/code/components/inputs/InputText.vue new file mode 100644 index 00000000000..0a51a2f85d8 --- /dev/null +++ b/ui/src/components/code/components/inputs/InputText.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/ui/src/components/code/segments/Editor.vue b/ui/src/components/code/segments/Editor.vue new file mode 100644 index 00000000000..5869bce2f47 --- /dev/null +++ b/ui/src/components/code/segments/Editor.vue @@ -0,0 +1,169 @@ + + + diff --git a/ui/src/components/code/segments/Task.vue b/ui/src/components/code/segments/Task.vue new file mode 100644 index 00000000000..52619b11339 --- /dev/null +++ b/ui/src/components/code/segments/Task.vue @@ -0,0 +1,118 @@ + + + diff --git a/ui/src/components/code/styles/code.scss b/ui/src/components/code/styles/code.scss new file mode 100644 index 00000000000..62323678d7b --- /dev/null +++ b/ui/src/components/code/styles/code.scss @@ -0,0 +1,39 @@ +// Coloring +$code-primary: var(--ks-content-link); +$code-gray-700: var(--bs-gray-700); +$code-card-color: var(--ks-background-card); +$code-border-color: var(--ks-border-primary); + +// Typography +$code-font-sm: var(--el-font-size-small); + +.no-code { + &::-webkit-scrollbar { + height: 5px; + width: 5px; + } + + &::-webkit-scrollbar-track { + background: $code-card-color + } + + &::-webkit-scrollbar-thumb { + background: $code-border-color; + border-radius: 0px; + } +} + +.label { + color: $code-gray-700; + font-size: $code-font-sm; +} + +.wrapper { + :deep(*) { + --el-disabled-text-color: #{$code-gray-700}; + + .el-input__inner { + font-size: $code-font-sm; + } + } +} \ No newline at end of file diff --git a/ui/src/components/code/utils/icons.ts b/ui/src/components/code/utils/icons.ts new file mode 100644 index 00000000000..79e2b4e7ecc --- /dev/null +++ b/ui/src/components/code/utils/icons.ts @@ -0,0 +1,5 @@ +import Plus from "vue-material-design-icons/Plus.vue"; +import ContentSave from "vue-material-design-icons/ContentSave.vue"; +import DeleteOutline from "vue-material-design-icons/DeleteOutline.vue"; + +export {Plus, ContentSave, DeleteOutline}; diff --git a/ui/src/components/code/utils/types.ts b/ui/src/components/code/utils/types.ts new file mode 100644 index 00000000000..0b2d55d9594 --- /dev/null +++ b/ui/src/components/code/utils/types.ts @@ -0,0 +1,75 @@ +import {defineComponent} from "vue"; +import type {RouteRecordName, RouteParams} from "vue-router"; + +export type Schemas = { + $ref?: string; + $schema?: string; + definitions?: { + [key: string]: object; + }; +}; + +export type Field = { + component: ReturnType; + value: any; + label: string; + required?: boolean; + disabled?: boolean; +}; + +export type LabelField = Omit & { + value: [string, string][]; +}; + +type InputField = Field & { + inputs: any[]; +}; + +type VariableField = Field & { + variables: any[]; +}; + +type Main = { + id: Field; + namespace: Field; + description: Field; +}; + +type ConcurrencyField = Field & { + root: string; + schema: object; +}; + +type General = { + retry: Field; + labels: LabelField; + inputs: InputField; + outputs: Field; + variables: VariableField; + concurrency: ConcurrencyField; + pluginDefaults: Field; + disabled: Field; +}; + +export type Fields = { + main: Main; + general: General; +}; + +export type Breadcrumb = { + label: string; + to: { + name: RouteRecordName; + params: RouteParams; + }; +}; + +export type CollapseItem = { + title: string; + elements?: Record[]; +}; + +export type Sections = { + main: CollapseItem[]; + segments: CollapseItem[]; +}; diff --git a/ui/src/components/executions/ExecutionRootTopBar.vue b/ui/src/components/executions/ExecutionRootTopBar.vue index 34030aa217b..1dd6dbfb4f2 100644 --- a/ui/src/components/executions/ExecutionRootTopBar.vue +++ b/ui/src/components/executions/ExecutionRootTopBar.vue @@ -78,7 +78,7 @@ name: "flows/update", params: { namespace: this.$route.params.namespace, id: this.$route.params.flowId, - tab: "editor", + tab: "edit", tenant: this.$route.params.tenant } }) diff --git a/ui/src/components/executions/Executions.vue b/ui/src/components/executions/Executions.vue index 217852466de..30e555ff1e0 100644 --- a/ui/src/components/executions/Executions.vue +++ b/ui/src/components/executions/Executions.vue @@ -590,9 +590,6 @@ isDisplayedTop() { return this.embed === false && this.filter }, - filterStorageKey() { - return storageKeys.EXECUTIONS_FILTERS - }, states() { return [ State.FAILED, State.SUCCESS, State.WARNING, State.CANCELLED,].map(value => { return { @@ -938,7 +935,7 @@ name: "flows/update", params: { namespace: this.flow.namespace, id: this.flow.id, - tab: "editor", + tab: "edit", tenant: this.$route.params.tenant } }) diff --git a/ui/src/components/filter/KestraFilter.vue b/ui/src/components/filter/KestraFilter.vue index 4d9a03e0219..29c2cefab7d 100644 --- a/ui/src/components/filter/KestraFilter.vue +++ b/ui/src/components/filter/KestraFilter.vue @@ -151,7 +151,7 @@ import KestraIcon from "../Kicon.vue"; import DateRange from "../layout/DateRange.vue"; - import {Magnify} from "./utils/icons.js"; + import {Magnify} from "./utils/icons"; import {useI18n} from "vue-i18n"; const {t} = useI18n({useScope: "global"}); @@ -189,7 +189,7 @@ const ITEMS_PREFIX = props.prefix ?? String(route.name); - import {useFilters} from "./composables/useFilters.js"; + import {useFilters} from "./composables/useFilters"; const {COMPARATORS, OPTIONS} = useFilters(ITEMS_PREFIX); const select = ref | null>(null); @@ -499,7 +499,7 @@ select.value?.focus(); }; - import {encodeParams, decodeParams} from "./utils/helpers.js"; + import {encodeParams, decodeParams} from "./utils/helpers"; const triggerSearch = () => { if (props.searchCallback) return; diff --git a/ui/src/components/filter/README.md b/ui/src/components/filter/README.md index 40727e0e4f9..47eef4a1edf 100644 --- a/ui/src/components/filter/README.md +++ b/ui/src/components/filter/README.md @@ -1,16 +1,19 @@ ### Guide on How to Handle `Filters` -When adding a completely new filter, follow these steps: +> Code within `Vue` components must be written using the ` + + diff --git a/ui/src/components/flows/MetadataVariables.vue b/ui/src/components/flows/MetadataVariables.vue index 031169cea41..d41bdec13bc 100644 --- a/ui/src/components/flows/MetadataVariables.vue +++ b/ui/src/components/flows/MetadataVariables.vue @@ -1,17 +1,20 @@ @@ -36,38 +41,47 @@ :full-height="false" :input="true" lang="text" - @update:model-value="updateIndex($event, selectedIndex, 'value')" + @update:model-value=" + updateIndex($event, selectedIndex, 'value') + " /> -
-
-
-
- +
+
+ +
+
+ + + + -
-
- - - - - -
+
-
- - Add - -
+
+
+ + Add +
@@ -87,20 +101,29 @@ components: {Editor, Drawer}, emits: ["update:modelValue"], props: { + modelValue: { + type: Object, + default: () => {}, + }, variables: { - type: Array, - default: () => [] - } + type: Object, + default: () => {}, + }, + label: {type: String, required: true}, + required: {type: Boolean, default: false}, + disabled: {type: Boolean, default: false}, }, created() { - this.newVariables = this.variables ? this.variables : this.newVariables + this.newVariables = this.variables + ? Object.entries(this.variables) + : this.newVariables; }, data() { return { - newVariables: ["",undefined], + newVariables: ["", undefined], selectedIndex: undefined, - isEditOpen: false - } + isEditOpen: false, + }; }, methods: { selectVariable(index) { @@ -109,7 +132,10 @@ }, update() { this.isEditOpen = false; - this.$emit("update:modelValue", this.newVariables); + this.$emit( + "update:modelValue", + Object.fromEntries(this.newVariables), + ); }, updateIndex(event, index, edited) { if (edited === "key") { @@ -123,8 +149,11 @@ }, addVariable() { this.newVariables.push(["", undefined]); - - } + }, }, }; + + diff --git a/ui/src/components/inputs/EditorView.vue b/ui/src/components/inputs/EditorView.vue index 3051da293a1..3424d2f57e7 100644 --- a/ui/src/components/inputs/EditorView.vue +++ b/ui/src/components/inputs/EditorView.vue @@ -68,6 +68,9 @@
+ + {{ isYamlEditorShown ? $t("no_code.labels.no_code") : $t("no_code.labels.yaml") }} + - -
-
- -

{{ $t("namespace_editor.empty.title") }}

-

{{ $t("namespace_editor.empty.message") }}

- -