Merge "fix: fix code editor and edit image"

This commit is contained in:
Zuul 2022-08-16 10:55:19 +00:00 committed by Gerrit Code Review
commit 07d6a51bf2
2 changed files with 16 additions and 8 deletions

View File

@ -25,10 +25,11 @@ const parseValue = (value) => {
return value;
}
if (value.includes('<html>')) {
const reg = /<\/h1>[\r\n]([\s\S]*)<br \/><br \/>/;
const reg = /<\/h1>[\r\n]([\s\S]*)<\/body>/;
const results = reg.exec(value);
if (results) {
return results[1];
const newValue = results[1].replace(/<br \/>/g, '');
return newValue;
}
}
try {

View File

@ -209,22 +209,26 @@ export class Edit extends ModalAction {
newValues.min_ram = min_ram * 1024;
}
if (hw_cpu_policy !== NoSetValue) {
newValues.hw_cpu_policy = hw_cpu_policy || this.item.hw_cpu_policy;
newValues.hw_cpu_policy =
hw_cpu_policy || this.item.originData.hw_cpu_policy;
}
if (hw_cpu_thread_policy !== NoSetValue) {
newValues.hw_cpu_thread_policy =
hw_cpu_thread_policy || this.item.hw_cpu_thread_policy;
hw_cpu_thread_policy || this.item.originData.hw_cpu_thread_policy;
}
const changeValues = [];
Object.keys(newValues).forEach((key) => {
if (has(this.item, key) && get(this.item, key) !== newValues[key]) {
if (
has(this.item.originData, key) &&
get(this.item.originData, key) !== newValues[key]
) {
const item = {
op: 'replace',
path: `/${key}`,
value: newValues[key],
};
changeValues.push(item);
} else if (!has(this.item, key) && newValues[key]) {
} else if (!has(this.item.originData, key) && newValues[key]) {
const item = {
op: 'add',
path: `/${key}`,
@ -233,13 +237,16 @@ export class Edit extends ModalAction {
changeValues.push(item);
}
});
if (this.item.hw_cpu_policy && hw_cpu_policy === NoSetValue) {
if (this.item.originData.hw_cpu_policy && hw_cpu_policy === NoSetValue) {
changeValues.push({
op: 'remove',
path: '/hw_cpu_policy',
});
}
if (this.item.hw_cpu_thread_policy && hw_cpu_thread_policy === NoSetValue) {
if (
this.item.originData.hw_cpu_thread_policy &&
hw_cpu_thread_policy === NoSetValue
) {
changeValues.push({
op: 'remove',
path: '/hw_cpu_thread_policy',