diff --git a/src/components/CodeEditor/index.jsx b/src/components/CodeEditor/index.jsx
index 0fe97a19..4192f162 100644
--- a/src/components/CodeEditor/index.jsx
+++ b/src/components/CodeEditor/index.jsx
@@ -20,24 +20,32 @@ import { isString } from 'lodash';
import styles from './index.less';
import AceEditor from './AceEditor';
-const parseHtml = (value) => {
- if (isString(value) && value.includes('')) {
+const parseValue = (value) => {
+ if (!isString(value)) {
+ return value;
+ }
+ if (value.includes('')) {
const reg = /<\/h1>[\r\n]([\s\S]*)
/;
const results = reg.exec(value);
if (results) {
return results[1];
}
}
- return value;
+ try {
+ const result = JSON.parse(value);
+ return result;
+ } catch (e) {
+ return value;
+ }
};
const getCodeValue = (value, mode) => {
if (isString(value)) {
- return parseHtml(value);
+ return parseValue(value);
}
Object.keys(value).forEach((key) => {
if (isString(value[key])) {
- value[key] = parseHtml(value[key]);
+ value[key] = parseValue(value[key]);
}
});
if (mode === 'json') {
diff --git a/src/pages/compute/containers/BareMetalNode/actions/Inspect.jsx b/src/pages/compute/containers/BareMetalNode/actions/Inspect.jsx
index 328779dc..f46f8073 100644
--- a/src/pages/compute/containers/BareMetalNode/actions/Inspect.jsx
+++ b/src/pages/compute/containers/BareMetalNode/actions/Inspect.jsx
@@ -33,7 +33,8 @@ export default class Inspect extends ConfirmAction {
getItemId = (data) => data.uuid;
- allowedCheckFunc = (item) => item.provision_state === 'manageable';
+ allowedCheckFunc = (item) =>
+ item.provision_state === 'manageable' && item.driver !== 'ipmi';
confirmContext = (data) => {
const name = this.getName(data);