Skip to content
Snippets Groups Projects
Commit 0579800e authored by ml bonhomme's avatar ml bonhomme :bee: Committed by Erwan Rouchet
Browse files

Sort fields in user configuration form by title, not slug

parent 8586196a
No related branches found
No related tags found
1 merge request!1591Sort fields in user configuration form by title, not slug
......@@ -62,7 +62,7 @@
import { mapActions, mapState } from 'pinia'
import { defineComponent, PropType } from 'vue'
import { isPlainObject, isEmpty, isEqual, cloneDeep, sortBy, uniqueId } from 'lodash'
import { isPlainObject, isEmpty, isEqual, cloneDeep, uniqueId } from 'lodash'
import { ConfigurationValidationError } from '@/helpers'
import { useNotificationStore, useWorkerStore } from '@/stores'
......@@ -128,8 +128,16 @@ export default defineComponent({
if (!this.workerVersions[this.workerVersionId]) return null
const userconfig = this.workerVersions[this.workerVersionId].configuration?.user_configuration
if (isEmpty(userconfig)) return null
// Sort configuration parameters alphabetically by key
return Object.fromEntries(sortBy(Object.entries(userconfig), 0))
// Sort configuration parameters alphabetically by title
const fields = Object.entries(userconfig)
fields.sort(function (a, b) {
const titleA = a[1].title.toLowerCase()
const titleB = b[1].title.toLowerCase()
if (titleA < titleB) return -1
if (titleA > titleB) return 1
return 0
})
return Object.fromEntries(fields)
},
defaultConfiguration () {
if (!this.schema) return {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment