feat: console add instance ephemeral
This commit is contained in:
parent
7bf60c18e7
commit
feb466864e
@ -56,7 +56,7 @@ class EditInstanceDialog extends React.Component {
|
||||
|
||||
onConfirm() {
|
||||
const { serviceName, clusterName, getInstanceList, openLoading, closeLoading } = this.props;
|
||||
const { ip, port, weight, enabled, metadataText } = this.state.editInstance;
|
||||
const { ip, port, ephemeral, weight, enabled, metadataText } = this.state.editInstance;
|
||||
request({
|
||||
method: 'PUT',
|
||||
url: 'v1/ns/instance',
|
||||
@ -65,6 +65,7 @@ class EditInstanceDialog extends React.Component {
|
||||
clusterName,
|
||||
ip,
|
||||
port,
|
||||
ephemeral,
|
||||
weight,
|
||||
enable: enabled,
|
||||
metadata: replaceEnter(METADATA_SEPARATOR)(metadataText),
|
||||
@ -79,6 +80,7 @@ class EditInstanceDialog extends React.Component {
|
||||
this.hide();
|
||||
getInstanceList();
|
||||
},
|
||||
error: e => Message.error(e.responseText || 'error'),
|
||||
complete: () => closeLoading(),
|
||||
});
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { request } from '../../../globalLib';
|
||||
import { Button, ConfigProvider, Pagination, Table } from '@alifd/next';
|
||||
import { Button, ConfigProvider, Message, Pagination, Table } from '@alifd/next';
|
||||
import { HEALTHY_COLOR_MAPPING } from './constant';
|
||||
import EditInstanceDialog from './EditInstanceDialog';
|
||||
|
||||
@ -75,10 +75,8 @@ class InstanceTable extends React.Component {
|
||||
|
||||
switchState(index, record) {
|
||||
const { instance } = this.state;
|
||||
const { ip, port, weight, enabled, metadata } = record;
|
||||
const { ip, port, ephemeral, weight, enabled, metadata } = record;
|
||||
const { clusterName, serviceName } = this.props;
|
||||
const newVal = Object.assign({}, instance);
|
||||
newVal.list[index].enabled = !enabled;
|
||||
request({
|
||||
method: 'PUT',
|
||||
url: 'v1/ns/instance',
|
||||
@ -87,13 +85,19 @@ class InstanceTable extends React.Component {
|
||||
clusterName,
|
||||
ip,
|
||||
port,
|
||||
ephemeral,
|
||||
weight,
|
||||
enable: !enabled,
|
||||
metadata: JSON.stringify(metadata),
|
||||
},
|
||||
dataType: 'text',
|
||||
beforeSend: () => this.openLoading(),
|
||||
success: () => this.setState({ instance: newVal }),
|
||||
success: () => {
|
||||
const newVal = Object.assign({}, instance);
|
||||
newVal.list[index].enabled = !enabled;
|
||||
this.setState({ instance: newVal });
|
||||
},
|
||||
error: e => Message.error(e.responseText || 'error'),
|
||||
complete: () => this.closeLoading(),
|
||||
});
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user