diff --git a/src/components/CodeEditor/index.jsx b/src/components/CodeEditor/index.jsx
index adeac88f..0fe97a19 100644
--- a/src/components/CodeEditor/index.jsx
+++ b/src/components/CodeEditor/index.jsx
@@ -16,20 +16,28 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { getValue } from 'utils/yaml';
+import { isString } from 'lodash';
import styles from './index.less';
import AceEditor from './AceEditor';
+const parseHtml = (value) => {
+ if (isString(value) && value.includes('')) {
+ const reg = /<\/h1>[\r\n]([\s\S]*)
/;
+ const results = reg.exec(value);
+ if (results) {
+ return results[1];
+ }
+ }
+ return value;
+};
+
const getCodeValue = (value, mode) => {
- if (value instanceof String) {
- return value;
+ if (isString(value)) {
+ return parseHtml(value);
}
Object.keys(value).forEach((key) => {
- if (typeof value[key] === 'string' && value[key].indexOf('') !== -1) {
- const reg = /<\/h1>[\r\n]([\s\S]*)
/;
- const results = reg.exec(value[key]);
- if (results) {
- value[key] = results[1];
- }
+ if (isString(value[key])) {
+ value[key] = parseHtml(value[key]);
}
});
if (mode === 'json') {
diff --git a/src/locales/en.json b/src/locales/en.json
index 6fc27ba3..61a07d27 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -916,7 +916,6 @@
"Load Balancers": "Load Balancers",
"Load from local files": "Load from local files",
"LoadBalancers Instances": "LoadBalancers Instances",
- "Loading": "Loading",
"Local": "Local",
"Local Endpoint Group": "Local Endpoint Group",
"Local Endpoint Group ID": "Local Endpoint Group ID",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index de2b18c5..f812a89b 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -916,7 +916,6 @@
"Load Balancers": "负载均衡",
"Load from local files": "从本地文件读取",
"LoadBalancers Instances": "负载均衡",
- "Loading": "加载中",
"Local": "本端",
"Local Endpoint Group": "本端端点组",
"Local Endpoint Group ID": "本端端点组ID",
diff --git a/src/pages/compute/containers/Image/actions/Delete.jsx b/src/pages/compute/containers/Image/actions/Delete.jsx
index 57c6acb4..1755d442 100644
--- a/src/pages/compute/containers/Image/actions/Delete.jsx
+++ b/src/pages/compute/containers/Image/actions/Delete.jsx
@@ -44,8 +44,9 @@ export default class DeleteAction extends ConfirmAction {
return true;
}
return (
- (this.notDeleted(item) && this.notProtected(item) && isOwner(item)) ||
- this.isAdminPage
+ this.notDeleted(item) &&
+ this.notProtected(item) &&
+ (isOwner(item) || this.isAdminPage)
);
};
diff --git a/src/resources/instance.jsx b/src/resources/instance.jsx
index 586fc85f..5a1127e7 100644
--- a/src/resources/instance.jsx
+++ b/src/resources/instance.jsx
@@ -145,8 +145,11 @@ export const isLocked = (instance) => !!instance.locked;
export const lockRender = (value) => (value ? lockIcon : unlockIcon);
export const checkStatus = (statusList = [], instance) => {
- const { status } = instance;
- return statusList.indexOf(status.toLowerCase()) >= 0;
+ const { status, vm_state } = instance;
+ return (
+ statusList.includes(status.toLowerCase()) ||
+ (vm_state && statusList.includes(vm_state.toLowerCase()))
+ );
};
export const isNotLockedOrAdmin = (instance, isAdmin = false) => {