diff --git a/src/client/masakari/index.js b/src/client/masakari/index.js
index 11153da3..36a2c10a 100644
--- a/src/client/masakari/index.js
+++ b/src/client/masakari/index.js
@@ -42,4 +42,3 @@ export class MasakariClient extends Base {
const masakariClient = new MasakariClient();
export default masakariClient;
-
diff --git a/src/core/i18n.js b/src/core/i18n.js
index 83b3d866..849f0b19 100644
--- a/src/core/i18n.js
+++ b/src/core/i18n.js
@@ -174,24 +174,24 @@ const init = () => {
});
} else if (lang === 'tr-tr') {
moment.locale('tr', {
- months: 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split(
- '_'
- ),
+ months:
+ 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split(
+ '_'
+ ),
monthsShort: 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'),
weekdays: 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split(
'_'
),
weekdaysShort: 'Paz_Pzt_Sal_Çar_Per_Cum_Cmt'.split('_'),
weekdaysMin: 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'),
- meridiem: function (hours, minutes, isLower) {
+ meridiem(hours, minutes, isLower) {
if (hours < 12) {
return isLower ? 'öö' : 'ÖÖ';
- } else {
- return isLower ? 'ös' : 'ÖS';
}
+ return isLower ? 'ös' : 'ÖS';
},
meridiemParse: /öö|ÖÖ|ös|ÖS/,
- isPM: function (input) {
+ isPM(input) {
return input === 'ös' || input === 'ÖS';
},
longDateFormat: {
@@ -251,24 +251,25 @@ const init = () => {
});
} else if (lang === 'ru') {
moment.locale('ru', {
- months: 'Январь_Февраль_Март_Апрель_Май_Июнь_Июль_Август_Сентябрь_Октябрь_Ноябрь_Декабрь'.split(
- '_'
- ),
+ months:
+ 'Январь_Февраль_Март_Апрель_Май_Июнь_Июль_Август_Сентябрь_Октябрь_Ноябрь_Декабрь'.split(
+ '_'
+ ),
monthsShort: 'Янв_Фев_Мрт_Апр_Май_Июн_Июл_Авг_Сен_Окт_Нбр_Дек'.split('_'),
- weekdays: 'Воскресенье_Понедельник_Вторник_Среда_Четверг_Пятница_Суббота'.split(
- '_'
- ),
+ weekdays:
+ 'Воскресенье_Понедельник_Вторник_Среда_Четверг_Пятница_Суббота'.split(
+ '_'
+ ),
weekdaysShort: 'Пон_Втор_Сред_Четв_Пятн_Субб_Воскр'.split('_'),
weekdaysMin: 'Пн_Вт_Ср_Чт_Пт_Сб_Вс'.split('_'),
- meridiem: function (hours, minutes, isLower) {
+ meridiem(hours, minutes, isLower) {
if (hours < 12) {
return isLower ? 'ночи' : 'Ночи';
- } else {
- return isLower ? 'дня' : 'Дня';
}
+ return isLower ? 'дня' : 'Дня';
},
meridiemParse: /ночи|Ночи|дня|Дня/,
- isPM: function (input) {
+ isPM(input) {
return input === 'дня' || input === 'Дня';
},
longDateFormat: {
diff --git a/src/pages/basic/routes/index.js b/src/pages/basic/routes/index.js
index 5efa288f..556d0c22 100644
--- a/src/pages/basic/routes/index.js
+++ b/src/pages/basic/routes/index.js
@@ -51,13 +51,13 @@ const Share = lazy(() =>
import(/* webpackChunkName: "share" */ 'pages/share/App')
);
const ContainerInfra = lazy(() =>
-import(/* webpackChunkName: "container-infra" */ 'pages/container-infra/App')
+ import(/* webpackChunkName: "container-infra" */ 'pages/container-infra/App')
);
const ContainerService = lazy(() =>
-import(/* webpackChunkName: "Container" */ 'pages/container-service/App')
+ import(/* webpackChunkName: "Container" */ 'pages/container-service/App')
);
const E404 = lazy(() =>
-import(/* webpackChunkName: "E404" */ 'pages/base/containers/404')
+ import(/* webpackChunkName: "E404" */ 'pages/base/containers/404')
);
const InstanceHA = lazy(() =>
import(/* webpackChunkName: "Inctance-HA" */ 'pages/ha/App')
diff --git a/src/pages/compute/containers/Instance/Detail/BaseDetail/index.jsx b/src/pages/compute/containers/Instance/Detail/BaseDetail/index.jsx
index 0888baaa..3fc1011a 100644
--- a/src/pages/compute/containers/Instance/Detail/BaseDetail/index.jsx
+++ b/src/pages/compute/containers/Instance/Detail/BaseDetail/index.jsx
@@ -176,11 +176,19 @@ export class BaseDetail extends Base {
get keypairCard() {
const keypair = this.detailData.key_name;
const url = this.getRoutePath('keypairDetail', { id: keypair });
- const content = keypair ? (this.isAdminPage ?
{keypair}
: {keypair}) : '-';
+ const content = keypair ? (
+ this.isAdminPage ? (
+ {keypair}
+ ) : (
+ {keypair}
+ )
+ ) : (
+ '-'
+ );
const options = [
{
label: t('Name'),
- content: content,
+ content,
},
];
return {
diff --git a/src/pages/compute/containers/Instance/Detail/Log/index.jsx b/src/pages/compute/containers/Instance/Detail/Log/index.jsx
index e88a2513..eca64c84 100644
--- a/src/pages/compute/containers/Instance/Detail/Log/index.jsx
+++ b/src/pages/compute/containers/Instance/Detail/Log/index.jsx
@@ -15,7 +15,10 @@ export default function Log(props) {
const getLogs = async (tailSize) => {
setLoading(true);
- const data = await globalInstanceLogStore.fetchLogs(props.detail.id, tailSize);
+ const data = await globalInstanceLogStore.fetchLogs(
+ props.detail.id,
+ tailSize
+ );
setLogs(data.output);
setLoading(false);
};
@@ -45,10 +48,7 @@ export default function Log(props) {
return (
);
-}
\ No newline at end of file
+}
diff --git a/src/pages/container-service/containers/Containers/Detail/Console.jsx b/src/pages/container-service/containers/Containers/Detail/Console.jsx
index b04d5601..cf458111 100644
--- a/src/pages/container-service/containers/Containers/Detail/Console.jsx
+++ b/src/pages/container-service/containers/Containers/Detail/Console.jsx
@@ -10,37 +10,37 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import React, { useEffect } from "react";
+import React, { useEffect } from 'react';
import globalContainersStore from 'src/stores/zun/containers';
export default function Console(props) {
-
useEffect(() => {
globalContainersStore.attach(props.detail.uuid).then((res) => {
- const head = document.head;
+ const { head } = document;
- const xtermCssLink = document.createElement("link");
- xtermCssLink.rel = "stylesheet";
- xtermCssLink.href = "https://cdn.jsdelivr.net/npm/xterm@4.19.0/css/xterm.css";
+ const xtermCssLink = document.createElement('link');
+ xtermCssLink.rel = 'stylesheet';
+ xtermCssLink.href =
+ 'https://cdn.jsdelivr.net/npm/xterm@4.19.0/css/xterm.css';
head.appendChild(xtermCssLink);
-
- const xtermScript = document.createElement("script");
- xtermScript.src = "https://cdnjs.cloudflare.com/ajax/libs/xterm/3.14.5/xterm.min.js";
+ const xtermScript = document.createElement('script');
+ xtermScript.src =
+ 'https://cdnjs.cloudflare.com/ajax/libs/xterm/3.14.5/xterm.min.js';
xtermScript.onload = () => {
const term = new window.Terminal({
cursorBlink: true,
});
- term.write(" >$ ");
+ term.write(' >$ ');
term.open(document.getElementById('terminal'));
- let socket = new WebSocket(res, ['binary', 'base64']);
+ const socket = new WebSocket(res, ['binary', 'base64']);
term.on('data', function (data) {
socket.send(str2ab(data));
});
socket.onmessage = function (e) {
if (e.data instanceof Blob) {
- let f = new FileReader();
+ const f = new FileReader();
f.onload = function () {
term.write(f.result);
};
@@ -50,8 +50,8 @@ export default function Console(props) {
}
};
function str2ab(str) {
- let buf = new ArrayBuffer(str.length); // 2 bytes for each char
- let bufView = new Uint8Array(buf);
+ const buf = new ArrayBuffer(str.length); // 2 bytes for each char
+ const bufView = new Uint8Array(buf);
for (let i = 0, strLen = str.length; i < strLen; i++) {
bufView[i] = str.charCodeAt(i);
}
@@ -65,14 +65,11 @@ export default function Console(props) {
head.removeChild(xtermScript);
};
});
-
}, []);
return (
+
+
);
-
}
diff --git a/src/pages/ha/containers/Hosts/Detail/BaseDetail.jsx b/src/pages/ha/containers/Hosts/Detail/BaseDetail.jsx
index 4e997a35..3ccfeee5 100644
--- a/src/pages/ha/containers/Hosts/Detail/BaseDetail.jsx
+++ b/src/pages/ha/containers/Hosts/Detail/BaseDetail.jsx
@@ -31,18 +31,26 @@ export class BaseDetail extends Base {
label: t('Failover Segment'),
dataIndex: 'failover_segment_id',
render: (value, row) => {
- return {row.failover_segment.name}
- }
+ return (
+
+ {row.failover_segment.name}
+
+ );
+ },
},
{
label: t('Reserved'),
dataIndex: 'reserved',
- valueRender: 'yesNo'
+ valueRender: 'yesNo',
},
{
label: t('On Maintenance'),
dataIndex: 'on_maintenance',
- valueRender: 'yesNo'
+ valueRender: 'yesNo',
},
{
label: t('Type'),
diff --git a/src/pages/ha/containers/Hosts/Detail/index.jsx b/src/pages/ha/containers/Hosts/Detail/index.jsx
index 2653b87a..0e2f8ae8 100644
--- a/src/pages/ha/containers/Hosts/Detail/index.jsx
+++ b/src/pages/ha/containers/Hosts/Detail/index.jsx
@@ -55,7 +55,7 @@ export class HostsDetail extends Base {
const hostId = parse(this.routing.location.search.slice(1));
return {
id: params.id,
- uuid: hostId.uuid
+ uuid: hostId.uuid,
};
};
diff --git a/src/pages/ha/containers/Hosts/actions/Delete.jsx b/src/pages/ha/containers/Hosts/actions/Delete.jsx
index 835766f8..02842c6a 100644
--- a/src/pages/ha/containers/Hosts/actions/Delete.jsx
+++ b/src/pages/ha/containers/Hosts/actions/Delete.jsx
@@ -48,6 +48,9 @@ export default class Delete extends ConfirmAction {
onSubmit = (item) => {
const { uuid, failover_segment_id } = item || this.item;
- return globalHostStore.delete({ segment_id: failover_segment_id, host_id: uuid });
+ return globalHostStore.delete({
+ segment_id: failover_segment_id,
+ host_id: uuid,
+ });
};
}
diff --git a/src/pages/ha/containers/Hosts/actions/Update.jsx b/src/pages/ha/containers/Hosts/actions/Update.jsx
index 44012849..58a5d0f3 100644
--- a/src/pages/ha/containers/Hosts/actions/Update.jsx
+++ b/src/pages/ha/containers/Hosts/actions/Update.jsx
@@ -11,7 +11,7 @@
// limitations under the License.
import { inject, observer } from 'mobx-react';
-import { ModalAction } from "src/containers/Action";
+import { ModalAction } from 'src/containers/Action';
import globalHostStore from 'src/stores/masakari/hosts';
export class Update extends ModalAction {
@@ -33,7 +33,7 @@ export class Update extends ModalAction {
get defaultValue() {
return {
- ...this.item
+ ...this.item,
};
}
@@ -44,40 +44,42 @@ export class Update extends ModalAction {
label: t('Host Name'),
type: 'input',
disabled: true,
- required: true
+ required: true,
},
{
name: 'reserved',
label: t('Reserved'),
type: 'switch',
checkedText: '',
- uncheckedText: ''
+ uncheckedText: '',
},
{
name: 'type',
label: t('Type'),
type: 'input',
- required: true
+ required: true,
},
{
name: 'control_attributes',
label: t('Control Attribute'),
type: 'input',
- required: true
+ required: true,
},
{
name: 'on_maintenance',
label: t('On Maintenance'),
type: 'switch',
checkedText: '',
- uncheckedText: ''
- }
- ]
+ uncheckedText: '',
+ },
+ ];
}
onSubmit = (values) => {
- return this.store.update(this.item.failover_segment_id, this.item.uuid, { 'host': values });
- }
+ return this.store.update(this.item.failover_segment_id, this.item.uuid, {
+ host: values,
+ });
+ };
}
-export default inject('rootStore')(observer(Update));
\ No newline at end of file
+export default inject('rootStore')(observer(Update));
diff --git a/src/pages/ha/containers/Hosts/actions/index.jsx b/src/pages/ha/containers/Hosts/actions/index.jsx
index b397b58d..56e01dbc 100644
--- a/src/pages/ha/containers/Hosts/actions/index.jsx
+++ b/src/pages/ha/containers/Hosts/actions/index.jsx
@@ -22,7 +22,7 @@ const actionConfigs = {
},
],
},
- batchActions: [Delete]
+ batchActions: [Delete],
};
export default actionConfigs;
diff --git a/src/pages/ha/containers/Notifications/Detail/BaseDetail.jsx b/src/pages/ha/containers/Notifications/Detail/BaseDetail.jsx
index 3f9c2c07..6f2da170 100644
--- a/src/pages/ha/containers/Notifications/Detail/BaseDetail.jsx
+++ b/src/pages/ha/containers/Notifications/Detail/BaseDetail.jsx
@@ -28,22 +28,22 @@ export class BaseDetail extends Base {
{
label: t('Host'),
dataIndex: 'source_host_uuid',
- copyable: true
+ copyable: true,
},
{
label: t('Generated Time'),
dataIndex: 'generated_time',
- valueRender: 'toLocalTime'
+ valueRender: 'toLocalTime',
},
{
label: t('Created At'),
dataIndex: 'created_at',
- valueRender: 'toLocalTime'
+ valueRender: 'toLocalTime',
},
{
label: t('Updated At'),
dataIndex: 'updated_at',
- valueRender: 'toLocalTime'
+ valueRender: 'toLocalTime',
},
];
@@ -57,23 +57,23 @@ export class BaseDetail extends Base {
const options = [
{
label: t('Event'),
- dataIndex: 'event'
+ dataIndex: 'event',
},
{
label: t('Instance UUID'),
- dataIndex: 'instance_uuid'
+ dataIndex: 'instance_uuid',
},
{
label: t('VIR Domain Event'),
- dataIndex: 'vir_domain_event'
- }
+ dataIndex: 'vir_domain_event',
+ },
];
return {
title: t('Payload'),
sourceData: this.detailData.payload,
- options
- }
+ options,
+ };
}
}
diff --git a/src/pages/ha/containers/Notifications/Detail/index.jsx b/src/pages/ha/containers/Notifications/Detail/index.jsx
index e2b1aa8f..2b34e3aa 100644
--- a/src/pages/ha/containers/Notifications/Detail/index.jsx
+++ b/src/pages/ha/containers/Notifications/Detail/index.jsx
@@ -12,8 +12,8 @@
import { inject, observer } from 'mobx-react';
import Base from 'containers/TabDetail';
-import BaseDetail from './BaseDetail';
import globalNotificationStore from 'stores/masakari/notifications';
+import BaseDetail from './BaseDetail';
export class NotificationsDetail extends Base {
init() {
diff --git a/src/pages/ha/containers/Segments/Detail/BaseDetail.jsx b/src/pages/ha/containers/Segments/Detail/BaseDetail.jsx
index 6352eb8f..f5f3782f 100644
--- a/src/pages/ha/containers/Segments/Detail/BaseDetail.jsx
+++ b/src/pages/ha/containers/Segments/Detail/BaseDetail.jsx
@@ -32,7 +32,7 @@ export class BaseDetail extends Base {
{
label: t('Enabled'),
dataIndex: 'enabled',
- valueRender: 'yesNo'
+ valueRender: 'yesNo',
},
{
label: t('Created At'),
diff --git a/src/pages/ha/containers/Segments/Detail/HostDetail.jsx b/src/pages/ha/containers/Segments/Detail/HostDetail.jsx
index 46228aea..581333dd 100644
--- a/src/pages/ha/containers/Segments/Detail/HostDetail.jsx
+++ b/src/pages/ha/containers/Segments/Detail/HostDetail.jsx
@@ -36,9 +36,13 @@ export class HostDetail extends Base {
title: t('Name'),
dataIndex: 'name',
render: (value, row) => {
- const path = this.getRoutePath('masakariHostDetail', { id: row.failover_segment_id }, { uuid: row.uuid });
+ const path = this.getRoutePath(
+ 'masakariHostDetail',
+ { id: row.failover_segment_id },
+ { uuid: row.uuid }
+ );
return {value};
- }
+ },
},
{
title: t('UUID'),
@@ -49,7 +53,7 @@ export class HostDetail extends Base {
title: t('Reserved'),
dataIndex: 'reserved',
isHideable: true,
- valueRender: 'yesNo'
+ valueRender: 'yesNo',
},
{
title: t('Type'),
@@ -59,27 +63,33 @@ export class HostDetail extends Base {
{
title: t('Control Attribute'),
dataIndex: 'control_attributes',
- isHideable: true
+ isHideable: true,
},
{
title: t('On Maintenance'),
dataIndex: 'on_maintenance',
isHideable: true,
- valueRender: 'yesNo'
- }
- ,
+ valueRender: 'yesNo',
+ },
{
title: t('Failover Segment'),
dataIndex: 'failover_segment',
isHideable: true,
render: (value, row) => {
- return {row.failover_segment.name}
- }
- }
+ return (
+
+ {row.failover_segment.name}
+
+ );
+ },
+ },
];
return columns;
};
-
}
export default inject('rootStore')(observer(HostDetail));
diff --git a/src/pages/ha/containers/Segments/actions/AddHost.jsx b/src/pages/ha/containers/Segments/actions/AddHost.jsx
index 8d52ad02..d0969b67 100644
--- a/src/pages/ha/containers/Segments/actions/AddHost.jsx
+++ b/src/pages/ha/containers/Segments/actions/AddHost.jsx
@@ -11,7 +11,7 @@
// limitations under the License.
import { inject, observer } from 'mobx-react';
-import { ModalAction } from "src/containers/Action";
+import { ModalAction } from 'src/containers/Action';
import globalHostStore from 'src/stores/masakari/hosts';
import globalComputeHostStore from 'src/stores/nova/compute-host';
@@ -19,7 +19,7 @@ export class AddHost extends ModalAction {
init() {
this.store = globalHostStore;
this.state = {
- host: []
+ host: [],
};
this.getHostList();
}
@@ -37,17 +37,18 @@ export class AddHost extends ModalAction {
static allowed = () => Promise.resolve(true);
async getHostList() {
- const response = await globalComputeHostStore.fetchList({ binary: 'nova-compute' });
+ const response = await globalComputeHostStore.fetchList({
+ binary: 'nova-compute',
+ });
const hostList = await globalHostStore.fetchList();
let flag = false;
if (hostList.length < 1) {
this.setState({
- host: response
+ host: response,
});
- }
- else {
- response.forEach(newHost => {
+ } else {
+ response.forEach((newHost) => {
for (let i = 0; i < hostList.length; i++) {
if (hostList[i].name === newHost.host) {
flag = true;
@@ -55,7 +56,7 @@ export class AddHost extends ModalAction {
}
if (!flag) {
this.setState({
- host: [...this.state.host, newHost]
+ host: [...this.state.host, newHost],
});
}
flag = false;
@@ -74,7 +75,7 @@ export class AddHost extends ModalAction {
return {
segment_name: this.item.name,
reserved: false,
- on_maintenance: false
+ on_maintenance: false,
};
}
@@ -84,48 +85,48 @@ export class AddHost extends ModalAction {
name: 'segment_name',
label: t('Segment Name'),
type: 'input',
- disabled: true
+ disabled: true,
},
{
name: 'name',
label: t('Host Name'),
type: 'select',
options: this.getHostName,
- required: true
+ required: true,
},
{
name: 'reserved',
label: t('Reserved'),
type: 'switch',
checkedText: '',
- uncheckedText: ''
+ uncheckedText: '',
},
{
name: 'type',
label: t('Type'),
type: 'input',
- required: true
+ required: true,
},
{
name: 'control_attributes',
label: t('Control Attributes'),
type: 'input',
- required: true
+ required: true,
},
{
name: 'on_maintenance',
label: t('On Maintenance'),
type: 'switch',
checkedText: '',
- uncheckedText: ''
+ uncheckedText: '',
},
- ]
+ ];
}
onSubmit = (values) => {
const { segment_name, ...submitData } = values;
- return this.store.create(this.item.uuid, { 'host': { ...submitData } });
- }
+ return this.store.create(this.item.uuid, { host: { ...submitData } });
+ };
}
-export default inject('rootStore')(observer(AddHost));
\ No newline at end of file
+export default inject('rootStore')(observer(AddHost));
diff --git a/src/pages/ha/containers/Segments/actions/Delete.jsx b/src/pages/ha/containers/Segments/actions/Delete.jsx
index dfa8b1af..835673c4 100644
--- a/src/pages/ha/containers/Segments/actions/Delete.jsx
+++ b/src/pages/ha/containers/Segments/actions/Delete.jsx
@@ -48,7 +48,7 @@ export default class Delete extends ConfirmAction {
onSubmit = (item) => {
const { uuid } = item || this.item;
- let id = uuid;
+ const id = uuid;
return globalSegmentStore.delete({ id });
};
}
diff --git a/src/pages/ha/containers/Segments/actions/StepCreate/StepHost.jsx b/src/pages/ha/containers/Segments/actions/StepCreate/StepHost.jsx
index 6e89c275..4076adf4 100644
--- a/src/pages/ha/containers/Segments/actions/StepCreate/StepHost.jsx
+++ b/src/pages/ha/containers/Segments/actions/StepCreate/StepHost.jsx
@@ -23,7 +23,7 @@ export class StepHost extends Base {
this.state = {
host: [],
hostLoading: true,
- ...this.state
+ ...this.state,
};
this.getHostList();
@@ -44,18 +44,18 @@ export class StepHost extends Base {
allowed = () => Promise.resolve();
async getHostList() {
-
- const response = await globalComputeHostStore.fetchList({ binary: 'nova-compute' });
+ const response = await globalComputeHostStore.fetchList({
+ binary: 'nova-compute',
+ });
const hostList = await globalHostStore.fetchList();
let flag = false;
if (hostList.length < 1) {
this.setState({
- host: response
+ host: response,
});
- }
- else {
- response.forEach(newHost => {
+ } else {
+ response.forEach((newHost) => {
for (let i = 0; i < hostList.length; i++) {
if (hostList[i].name === newHost.host) {
flag = true;
@@ -69,9 +69,9 @@ export class StepHost extends Base {
}
const hostMap = Object.fromEntries(
- this.state.host.map(host => [host.id, host])
- )
- this.setState({ hostMap: hostMap, hostLoading: false });
+ this.state.host.map((host) => [host.id, host])
+ );
+ this.setState({ hostMap, hostLoading: false });
}
get getHostName() {
@@ -88,7 +88,7 @@ export class StepHost extends Base {
{
title: t('Updated'),
dataIndex: 'updated_at',
- valueRender: 'toLocalTime'
+ valueRender: 'toLocalTime',
},
{
name: 'reserved',
@@ -99,14 +99,14 @@ export class StepHost extends Base {
{
- this.setState(prevState => {
- const host = prevState.hostMap
- host[row.id].reserved = checked
- return { hostMap: host }
- })
+ this.setState((prevState) => {
+ const host = prevState.hostMap;
+ host[row.id].reserved = checked;
+ return { hostMap: host };
+ });
}}
/>
- )
+ ),
},
{
name: 'type',
@@ -115,18 +115,18 @@ export class StepHost extends Base {
required: true,
render: (type, row) => (
{
- const { value } = e.target
- this.setState(prevState => {
- const host = prevState.hostMap
- host[row.id].type = value
- return { hostMap: host }
- })
+ const { value } = e.target;
+ this.setState((prevState) => {
+ const host = prevState.hostMap;
+ host[row.id].type = value;
+ return { hostMap: host };
+ });
}}
/>
- )
+ ),
},
{
name: 'control_attributes',
@@ -135,17 +135,17 @@ export class StepHost extends Base {
render: (control_attribute, row) => (
{
- const { value } = e.target
- this.setState(prevState => {
- const host = prevState.hostMap
- host[row.id].control_attributes = value
- return { hostMap: host }
- })
+ const { value } = e.target;
+ this.setState((prevState) => {
+ const host = prevState.hostMap;
+ host[row.id].control_attributes = value;
+ return { hostMap: host };
+ });
}}
/>
- )
+ ),
},
{
name: 'on_maintenance',
@@ -155,16 +155,16 @@ export class StepHost extends Base {
{
- this.setState(prevState => {
- const host = prevState.hostMap
- host[row.id].on_maintenance = checked
- return { hostMap: host }
- })
+ this.setState((prevState) => {
+ const host = prevState.hostMap;
+ host[row.id].on_maintenance = checked;
+ return { hostMap: host };
+ });
}}
/>
- )
- }
- ]
+ ),
+ },
+ ];
return [
{
@@ -174,15 +174,15 @@ export class StepHost extends Base {
required: true,
data: this.state.host,
isMulti: true,
- onRow: () => { },
- columns: columns,
+ onRow: () => {},
+ columns,
isLoading: this.state.hostLoading,
filterParams: [
{ label: t('Name'), name: 'host' },
{ label: t('Zone'), name: 'zone' },
- ]
- }
- ]
+ ],
+ },
+ ];
}
}
diff --git a/src/pages/ha/containers/Segments/actions/StepCreate/StepSegment.jsx b/src/pages/ha/containers/Segments/actions/StepCreate/StepSegment.jsx
index 758bd2d8..f7741921 100644
--- a/src/pages/ha/containers/Segments/actions/StepCreate/StepSegment.jsx
+++ b/src/pages/ha/containers/Segments/actions/StepCreate/StepSegment.jsx
@@ -14,7 +14,6 @@ import { inject, observer } from 'mobx-react';
import Base from 'components/Form';
export class StepSegment extends Base {
-
get title() {
return 'StepSegment';
}
@@ -42,7 +41,7 @@ export class StepSegment extends Base {
name: 'segment_name',
label: t('Segment Name'),
type: 'input',
- required: true
+ required: true,
},
{
name: 'recovery_method',
@@ -54,20 +53,20 @@ export class StepSegment extends Base {
{ label: t('reserved_host'), value: 'reserved_host' },
{ label: t('rh_priority'), value: 'rh_priority' },
],
- required: true
+ required: true,
},
{
name: 'service_type',
label: t('Service Type'),
type: 'input',
required: true,
- disabled: true
+ disabled: true,
},
{
name: 'description',
label: t('Description'),
type: 'textarea',
- rows: 4
+ rows: 4,
},
];
}
diff --git a/src/pages/ha/containers/Segments/actions/StepCreate/index.jsx b/src/pages/ha/containers/Segments/actions/StepCreate/index.jsx
index 652a24dd..64379dc4 100644
--- a/src/pages/ha/containers/Segments/actions/StepCreate/index.jsx
+++ b/src/pages/ha/containers/Segments/actions/StepCreate/index.jsx
@@ -12,9 +12,7 @@
import { inject, observer } from 'mobx-react';
import { StepAction } from 'containers/Action';
-import StepSegment from './StepSegment';
import globalSegmentStore from 'src/stores/masakari/segments';
-import StepHost from './StepHost';
import React from 'react';
import { Button, Modal } from 'antd';
import { toJS } from 'mobx';
@@ -22,6 +20,8 @@ import { QuestionCircleFilled } from '@ant-design/icons';
import stylesConfirm from 'src/components/Confirm/index.less';
import globalHostStore from 'src/stores/masakari/hosts';
import Notify from 'src/components/Notify';
+import StepHost from './StepHost';
+import StepSegment from './StepSegment';
export class StepCreate extends StepAction {
static id = 'instance-ha-create';
@@ -54,28 +54,46 @@ export class StepCreate extends StepAction {
}
next() {
- this.currentRef.current.wrappedInstance.checkFormInput((values) => {
- this.updateData(values);
+ this.currentRef.current.wrappedInstance.checkFormInput(
+ (values) => {
+ this.updateData(values);
- if (this.state.current === 0) {
- this.setState({ btnIsLoading: true })
- const { segment_name, recovery_method, service_type, description } = this.state.data;
+ if (this.state.current === 0) {
+ this.setState({ btnIsLoading: true });
+ const { segment_name, recovery_method, service_type, description } =
+ this.state.data;
- globalSegmentStore.create({ segment: { name: segment_name, recovery_method, service_type, description } }).then(item => {
- this.setState({ extra: toJS({ createdSegmentId: item.segment.uuid }) }, () => {
- this.setState((prev) => ({ current: prev.current + 1 }));
- })
- }, (err) => {
- this.responseError = err;
- const { response: { data: responseData } = {} } = err;
- Notify.errorWithDetail(responseData, this.errorText);
+ globalSegmentStore
+ .create({
+ segment: {
+ name: segment_name,
+ recovery_method,
+ service_type,
+ description,
+ },
+ })
+ .then(
+ (item) => {
+ this.setState(
+ { extra: toJS({ createdSegmentId: item.segment.uuid }) },
+ () => {
+ this.setState((prev) => ({ current: prev.current + 1 }));
+ }
+ );
+ },
+ (err) => {
+ this.responseError = err;
+ const { response: { data: responseData } = {} } = err;
+ Notify.errorWithDetail(responseData, this.errorText);
+ }
+ )
+ .finally(() => {
+ this.setState({ btnIsLoading: false });
+ });
}
- ).finally(() => {
- this.setState({ btnIsLoading: false })
- });
- }
-
- }, () => this.setState({ btnIsLoading: false }));
+ },
+ () => this.setState({ btnIsLoading: false })
+ );
}
getNextBtn() {
@@ -85,7 +103,11 @@ export class StepCreate extends StepAction {
}
const { title } = this.steps[current + 1];
return (
-