feat: add parseHeader util for restart task dialog
This commit is contained in:
@@ -531,3 +531,22 @@ export function diffConfig (current = {}, next = {}) {
|
||||
export function calcFormLabelWidth (locale) {
|
||||
return locale.startsWith('de') ? '28%' : '23%'
|
||||
}
|
||||
|
||||
export function parseHeader (header = '') {
|
||||
header = header.trim()
|
||||
let result = {}
|
||||
if (!header) {
|
||||
return result
|
||||
}
|
||||
|
||||
const headers = splitTextRows(header)
|
||||
headers.forEach((line) => {
|
||||
const index = line.indexOf(':')
|
||||
const name = line.substr(0, index)
|
||||
const value = line.substr(index + 1).trim()
|
||||
result[name] = value
|
||||
})
|
||||
result = changeKeysToCamelCase(result)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user