feat: add parseHeader util for restart task dialog

This commit is contained in:
Dr_rOot
2019-06-14 23:22:36 +08:00
parent 97801fff32
commit 37b446b6f0
+19
View File
@@ -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
}