diff --git a/src/components/CodeEditor/index.jsx b/src/components/CodeEditor/index.jsx
index 4192f162..47c479d9 100644
--- a/src/components/CodeEditor/index.jsx
+++ b/src/components/CodeEditor/index.jsx
@@ -25,10 +25,11 @@ const parseValue = (value) => {
return value;
}
if (value.includes('')) {
- const reg = /<\/h1>[\r\n]([\s\S]*)
/;
+ const reg = /<\/h1>[\r\n]([\s\S]*)<\/body>/;
const results = reg.exec(value);
if (results) {
- return results[1];
+ const newValue = results[1].replace(/
/g, '');
+ return newValue;
}
}
try {
diff --git a/src/pages/compute/containers/Image/actions/Edit.jsx b/src/pages/compute/containers/Image/actions/Edit.jsx
index b41a37d0..8aabf5b5 100644
--- a/src/pages/compute/containers/Image/actions/Edit.jsx
+++ b/src/pages/compute/containers/Image/actions/Edit.jsx
@@ -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',