Merge "fix: Fix delete image error display"

This commit is contained in:
Zuul 2021-08-27 10:07:57 +00:00 committed by Gerrit Code Review
commit 28e1db10b2
5 changed files with 24 additions and 14 deletions

View File

@ -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 getCodeValue = (value, mode) => {
if (value instanceof String) {
const parseHtml = (value) => {
if (isString(value) && value.includes('<html>')) {
const reg = /<\/h1>[\r\n]([\s\S]*)<br \/><br \/>/;
const results = reg.exec(value);
if (results) {
return results[1];
}
}
return value;
};
const getCodeValue = (value, mode) => {
if (isString(value)) {
return parseHtml(value);
}
Object.keys(value).forEach((key) => {
if (typeof value[key] === 'string' && value[key].indexOf('<html>') !== -1) {
const reg = /<\/h1>[\r\n]([\s\S]*)<br \/><br \/>/;
const results = reg.exec(value[key]);
if (results) {
value[key] = results[1];
}
if (isString(value[key])) {
value[key] = parseHtml(value[key]);
}
});
if (mode === 'json') {

View File

@ -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",

View File

@ -916,7 +916,6 @@
"Load Balancers": "负载均衡",
"Load from local files": "从本地文件读取",
"LoadBalancers Instances": "负载均衡",
"Loading": "加载中",
"Local": "本端",
"Local Endpoint Group": "本端端点组",
"Local Endpoint Group ID": "本端端点组ID",

View File

@ -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)
);
};

View File

@ -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) => {