fix: Add error status for volume and polyfill allSettled
1. Add error status for update status in volume 2. Add allSettled polyfill Change-Id: I4d2cb54b3f4d57ce40806978c20191c101e864c0
This commit is contained in:
parent
cc897b08b7
commit
1ab6cf9b34
@ -20,7 +20,7 @@ import Confirm from 'components/Confirm';
|
||||
import PropTypes from 'prop-types';
|
||||
import Notify from 'components/Notify';
|
||||
import classnames from 'classnames';
|
||||
import { firstUpperCase } from 'utils/index';
|
||||
import { firstUpperCase, allSettled } from 'utils';
|
||||
import styles from './index.less';
|
||||
|
||||
function getDefaultMsg(action, data) {
|
||||
@ -323,7 +323,7 @@ class ActionButton extends Component {
|
||||
const promises = data.map((it, index) =>
|
||||
onSubmit(it, containerProps, isBatch, index, data)
|
||||
);
|
||||
const results = Promise.allSettled(promises);
|
||||
const results = allSettled(promises);
|
||||
results.then((res) => {
|
||||
const failedDatas = res
|
||||
.map((it, idx) => {
|
||||
|
@ -483,7 +483,7 @@
|
||||
"Disk Info": "Disk Info",
|
||||
"Disk Tag": "Disk Tag",
|
||||
"Disk size is limited by the min disk of flavor, image, etc.": "Disk size is limited by the min disk of flavor, image, etc.",
|
||||
"Do not reset the normally mounted volume to the \"available\" or \"maintenance\" status. The reset state does not remove the volume from the instance. If you need to remove the volume from the instance, please go to the console of the corresponding project and use the \"detach\" operation.": "Do not reset the normally mounted volume to the \"available\" or \"maintenance\" status. The reset state does not remove the volume from the instance. If you need to remove the volume from the instance, please go to the console of the corresponding project and use the \"detach\" operation.",
|
||||
"Do not reset the normally mounted volume to the \"available\"、\"maintenance\" or \"error\" status. The reset state does not remove the volume from the instance. If you need to remove the volume from the instance, please go to the console of the corresponding project and use the \"detach\" operation.": "Do not reset the normally mounted volume to the \"available\"、\"maintenance\" or \"error\" status. The reset state does not remove the volume from the instance. If you need to remove the volume from the instance, please go to the console of the corresponding project and use the \"detach\" operation.",
|
||||
"Do not set with a backend": "Do not set with a backend",
|
||||
"Docker": "Docker",
|
||||
"Domain": "Domain",
|
||||
|
@ -483,7 +483,7 @@
|
||||
"Disk Info": "硬盘信息",
|
||||
"Disk Tag": "硬盘标签",
|
||||
"Disk size is limited by the min disk of flavor, image, etc.": "根磁盘大小受云主机类型、镜像等的最小磁盘限制。",
|
||||
"Do not reset the normally mounted volume to the \"available\" or \"maintenance\" status. The reset state does not remove the volume from the instance. If you need to remove the volume from the instance, please go to the console of the corresponding project and use the \"detach\" operation.": "请勿将正常的挂载中的云硬盘重置为“可用”或“维护”状态。重置状态并不会将云硬盘从云主机上卸载下来。如果您需要将云硬盘从云主机上移除,请进入相应项目的控制台使用“解绑”操作。",
|
||||
"Do not reset the normally mounted volume to the \"available\"、\"maintenance\" or \"error\" status. The reset state does not remove the volume from the instance. If you need to remove the volume from the instance, please go to the console of the corresponding project and use the \"detach\" operation.": "请勿将正常的挂载中的云硬盘重置为“可用”、“维护”或”错误“状态。重置状态并不会将云硬盘从云主机上卸载下来。如果您需要将云硬盘从云主机上移除,请进入相应项目的控制台使用“解绑”操作。",
|
||||
"Do not set with a backend": "不设置后端",
|
||||
"Docker": "Docker",
|
||||
"Domain": "域",
|
||||
|
@ -35,6 +35,7 @@ import {
|
||||
canImageCreateInstance,
|
||||
} from 'resources/image';
|
||||
import { volumeTypeSelectProps } from 'resources/volume-type';
|
||||
import { allSettled } from 'utils';
|
||||
import styles from './index.less';
|
||||
|
||||
@inject('rootStore')
|
||||
@ -568,7 +569,7 @@ export default class Create extends FormAction {
|
||||
if (count === 1) {
|
||||
return this.volumeStore.create(volume);
|
||||
}
|
||||
return Promise.allSettled(
|
||||
return allSettled(
|
||||
new Array(count).fill(count).map((_, index) => {
|
||||
const body = {
|
||||
...volume,
|
||||
|
@ -42,7 +42,7 @@ export default class UpdateStatus extends ModalAction {
|
||||
|
||||
get tips() {
|
||||
return t(
|
||||
'Do not reset the normally mounted volume to the "available" or "maintenance" status. The reset state does not remove the volume from the instance. If you need to remove the volume from the instance, please go to the console of the corresponding project and use the "detach" operation.'
|
||||
'Do not reset the normally mounted volume to the "available"、"maintenance" or "error" status. The reset state does not remove the volume from the instance. If you need to remove the volume from the instance, please go to the console of the corresponding project and use the "detach" operation.'
|
||||
);
|
||||
}
|
||||
|
||||
@ -50,6 +50,7 @@ export default class UpdateStatus extends ModalAction {
|
||||
const statusList = [
|
||||
{ value: 'available', label: t('Available') },
|
||||
{ value: 'maintenance', label: t('Maintained') },
|
||||
{ value: 'error', label: t('Error') },
|
||||
];
|
||||
return [
|
||||
{
|
||||
|
@ -271,3 +271,16 @@ export const unescapeHtml = (message) => {
|
||||
};
|
||||
|
||||
export const isAdminPage = (url) => url && url.indexOf('admin') >= 0;
|
||||
|
||||
export const allSettled = (promises) => {
|
||||
if (!Promise.allSettled) {
|
||||
return Promise.all(
|
||||
promises.map((promise) =>
|
||||
promise
|
||||
.then((value) => ({ status: 'fulfilled', value }))
|
||||
.catch((reason) => ({ status: 'rejected', reason }))
|
||||
)
|
||||
);
|
||||
}
|
||||
return Promise.allSettled(promises);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user