[Animbus]fix: Fix danger button style in batch actions
1. Fix danger button style in table batch actions 2. Update reboot vm button to danger 3. Update resize vm button to danger Change-Id: Ibabc1259e4914042214842acecde4c16f7e6d19e
This commit is contained in:
parent
6b34ad1b05
commit
39259b4fbd
@ -64,6 +64,7 @@ export class ActionButton extends Component {
|
|||||||
isAllowed: PropTypes.bool,
|
isAllowed: PropTypes.bool,
|
||||||
needHide: PropTypes.bool,
|
needHide: PropTypes.bool,
|
||||||
buttonType: PropTypes.string,
|
buttonType: PropTypes.string,
|
||||||
|
isDanger: PropTypes.bool,
|
||||||
items: PropTypes.array,
|
items: PropTypes.array,
|
||||||
isBatch: PropTypes.bool,
|
isBatch: PropTypes.bool,
|
||||||
path: PropTypes.string,
|
path: PropTypes.string,
|
||||||
@ -83,6 +84,7 @@ export class ActionButton extends Component {
|
|||||||
confirm: false,
|
confirm: false,
|
||||||
needHide: true,
|
needHide: true,
|
||||||
buttonType: 'link',
|
buttonType: 'link',
|
||||||
|
isDanger: false,
|
||||||
isLink: false,
|
isLink: false,
|
||||||
items: [],
|
items: [],
|
||||||
isBatch: false,
|
isBatch: false,
|
||||||
@ -493,7 +495,7 @@ export class ActionButton extends Component {
|
|||||||
name,
|
name,
|
||||||
id,
|
id,
|
||||||
title,
|
title,
|
||||||
danger,
|
isDanger,
|
||||||
style,
|
style,
|
||||||
maxLength,
|
maxLength,
|
||||||
isFirstAction,
|
isFirstAction,
|
||||||
@ -509,7 +511,7 @@ export class ActionButton extends Component {
|
|||||||
const button = (
|
const button = (
|
||||||
<Button
|
<Button
|
||||||
type={buttonType}
|
type={buttonType}
|
||||||
danger={danger}
|
danger={isDanger}
|
||||||
onClick={this.onClick}
|
onClick={this.onClick}
|
||||||
key={id}
|
key={id}
|
||||||
disabled={!isAllowed}
|
disabled={!isAllowed}
|
||||||
|
@ -62,7 +62,7 @@ function DropdownActionButton({
|
|||||||
const newConf = updateConf(it, selectedItems);
|
const newConf = updateConf(it, selectedItems);
|
||||||
const { isDanger, name } = newConf;
|
const { isDanger, name } = newConf;
|
||||||
newConf.onFinishAction = onFinishAction;
|
newConf.onFinishAction = onFinishAction;
|
||||||
newConf.danger = !!isDanger;
|
newConf.isDanger = !!isDanger;
|
||||||
if (!selectedItems.length) {
|
if (!selectedItems.length) {
|
||||||
return (
|
return (
|
||||||
<Menu.Item key={key} disabled style={{ textAlign: 'center' }}>
|
<Menu.Item key={key} disabled style={{ textAlign: 'center' }}>
|
||||||
@ -126,13 +126,14 @@ export default function TableBatchButtons(props) {
|
|||||||
showedActions = actionList;
|
showedActions = actionList;
|
||||||
}
|
}
|
||||||
batchButtons = showedActions.map((it) => {
|
batchButtons = showedActions.map((it) => {
|
||||||
|
const { isDanger = false, buttonType = 'default' } = it;
|
||||||
if (!selectedItems || selectedItems.length === 0) {
|
if (!selectedItems || selectedItems.length === 0) {
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={t('Please select {name} first', { name: resourceName })}
|
title={t('Please select {name} first', { name: resourceName })}
|
||||||
key={`tooltip-${generateId()}`}
|
key={`tooltip-${generateId()}`}
|
||||||
>
|
>
|
||||||
<Button type="default" disabled>
|
<Button type={buttonType} disabled danger={isDanger}>
|
||||||
{it.buttonText || it.title}
|
{it.buttonText || it.title}
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
@ -32,7 +32,7 @@ function getActionConf(action) {
|
|||||||
name: buttonText || title,
|
name: buttonText || title,
|
||||||
actionType,
|
actionType,
|
||||||
action,
|
action,
|
||||||
danger: isDanger,
|
isDanger,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,10 @@ export default class RebootAction extends ConfirmAction {
|
|||||||
return t('reboot instance');
|
return t('reboot instance');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isDanger() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
get passiveAction() {
|
get passiveAction() {
|
||||||
return t('be rebooted');
|
return t('be rebooted');
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@ export class Resize extends ModalAction {
|
|||||||
|
|
||||||
static title = t('Resize');
|
static title = t('Resize');
|
||||||
|
|
||||||
|
static isDanger = true;
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.store = globalFlavorStore;
|
this.store = globalFlavorStore;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ export class ResizeOnline extends ModalAction {
|
|||||||
|
|
||||||
static title = t('Online Resize');
|
static title = t('Online Resize');
|
||||||
|
|
||||||
|
static isDanger = true;
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.store = globalFlavorStore;
|
this.store = globalFlavorStore;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user