diff --git a/src/client/client/constants.js b/src/client/client/constants.js index b92757dd..07dc6681 100644 --- a/src/client/client/constants.js +++ b/src/client/client/constants.js @@ -88,6 +88,7 @@ export const swiftEndpoint = () => getOriginEndpoint('swift'); export const cinderEndpoint = () => getOriginEndpoint('cinder'); export const manilaEndpoint = () => getOriginEndpoint('manilav2'); export const zunEndpoint = () => getOriginEndpoint('zun'); +export const masakariEndpoint = () => getOriginEndpoint('masakari'); export const apiVersionMaps = { nova: { diff --git a/src/layouts/admin-menu.jsx b/src/layouts/admin-menu.jsx index f8fd164f..1e0bc5f2 100644 --- a/src/layouts/admin-menu.jsx +++ b/src/layouts/admin-menu.jsx @@ -980,7 +980,7 @@ const renderMenu = (t) => { name: t('Instance-HA'), key: 'masakari', icon: , - // endpoints: 'masakari', + endpoints: 'masakari', children: [ { path: '/ha/segments-admin', diff --git a/src/pages/ha/containers/Hosts/index.jsx b/src/pages/ha/containers/Hosts/index.jsx index 07aa986b..7b13f5f1 100644 --- a/src/pages/ha/containers/Hosts/index.jsx +++ b/src/pages/ha/containers/Hosts/index.jsx @@ -13,9 +13,10 @@ import React from 'react'; import { observer, inject } from 'mobx-react'; import Base from 'containers/List'; -import actionConfigs from './actions'; import globalHostStore, { HostStore } from 'src/stores/masakari/hosts'; import { Link } from 'react-router-dom'; +import { masakariEndpoint } from 'client/client/constants'; +import actionConfigs from './actions'; export class Hosts extends Base { init() { @@ -23,6 +24,14 @@ export class Hosts extends Base { this.downloadStore = new HostStore(); } + get endpoint() { + return masakariEndpoint(); + } + + get checkEndpoint() { + return true; + } + get policy() { if (this.isAdminPage) { return 'os_compute_api:servers:index:get_all_tenants'; @@ -66,11 +75,11 @@ export class Hosts extends Base { }, ...(this.isAdminPage ? [ - { - label: t('Project Name'), - name: 'project_name', - }, - ] + { + label: t('Project Name'), + name: 'project_name', + }, + ] : []), ]; } @@ -80,9 +89,13 @@ export class Hosts 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'), @@ -93,7 +106,7 @@ export class Hosts extends Base { title: t('Reserved'), dataIndex: 'reserved', isHideable: true, - valueRender: 'yesNo' + valueRender: 'yesNo', }, { title: t('Type'), @@ -103,24 +116,31 @@ export class Hosts 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} + + ); + }, + }, ]; - } export default inject('rootStore')(observer(Hosts)); diff --git a/src/pages/ha/containers/Notifications/index.jsx b/src/pages/ha/containers/Notifications/index.jsx index 10b7e8d0..be4d95b5 100644 --- a/src/pages/ha/containers/Notifications/index.jsx +++ b/src/pages/ha/containers/Notifications/index.jsx @@ -13,8 +13,11 @@ import React from 'react'; import { observer, inject } from 'mobx-react'; import Base from 'containers/List'; -import globalNotificationStore, { NotificationStore } from 'stores/masakari/notifications'; +import globalNotificationStore, { + NotificationStore, +} from 'stores/masakari/notifications'; import { Link } from 'react-router-dom'; +import { masakariEndpoint } from 'client/client/constants'; export class Notifications extends Base { init() { @@ -37,6 +40,14 @@ export class Notifications extends Base { return 'updated_at'; } + get endpoint() { + return masakariEndpoint(); + } + + get checkEndpoint() { + return true; + } + get searchFilters() { return [ { @@ -47,7 +58,7 @@ export class Notifications extends Base { label: t('UUID'), name: 'notification_uuid', }, - ] + ]; } getColumns = () => [ @@ -55,10 +66,12 @@ export class Notifications extends Base { title: t('UUID'), dataIndex: 'notification_uuid', render: (value) => { - const path = this.getRoutePath("masakariNotificationDetail", {id: value}); - return {value} + const path = this.getRoutePath('masakariNotificationDetail', { + id: value, + }); + return {value}; }, - isHideable: true + isHideable: true, }, { title: t('Host'), @@ -73,13 +86,18 @@ export class Notifications extends Base { { title: t('Status'), dataIndex: 'status', - isHideable: true + isHideable: true, }, { title: t('Payload'), dataIndex: 'payload', isHideable: true, - render: (value) => Object.keys(value).map(it =>
{it}: {value[it]}
) + render: (value) => + Object.keys(value).map((it) => ( +
+ {it}: {value[it]} +
+ )), }, ]; } diff --git a/src/pages/ha/containers/Segments/Detail/index.jsx b/src/pages/ha/containers/Segments/Detail/index.jsx index 619e4949..b698bd42 100644 --- a/src/pages/ha/containers/Segments/Detail/index.jsx +++ b/src/pages/ha/containers/Segments/Detail/index.jsx @@ -12,14 +12,14 @@ import { inject, observer } from 'mobx-react'; import Base from 'containers/TabDetail'; -import { SegmentStore } from 'src/stores/masakari/segments'; +import { SegmentStore } from 'stores/masakari/segments'; import BaseDetail from './BaseDetail'; import actionConfigs from '../actions'; import HostDetail from '../../Hosts'; export class SegmentsDetail extends Base { init() { - this.store = new SegmentStore; + this.store = new SegmentStore(); } get name() { diff --git a/src/pages/ha/containers/Segments/index.jsx b/src/pages/ha/containers/Segments/index.jsx index e3b9ed2d..18683670 100644 --- a/src/pages/ha/containers/Segments/index.jsx +++ b/src/pages/ha/containers/Segments/index.jsx @@ -12,8 +12,9 @@ import { observer, inject } from 'mobx-react'; import Base from 'containers/List'; -import actionConfigs from './actions'; import globalSegmentStore, { SegmentStore } from 'stores/masakari/segments'; +import { masakariEndpoint } from 'client/client/constants'; +import actionConfigs from './actions'; export class Segments extends Base { init() { @@ -28,6 +29,14 @@ export class Segments extends Base { return 'os_compute_api:servers:index'; } + get endpoint() { + return masakariEndpoint(); + } + + get checkEndpoint() { + return true; + } + get name() { return t('segments'); } @@ -52,11 +61,11 @@ export class Segments extends Base { }, ...(this.isAdminPage ? [ - { - label: t('Project Name'), - name: 'project_name', - }, - ] + { + label: t('Project Name'), + name: 'project_name', + }, + ] : []), ]; } @@ -89,8 +98,8 @@ export class Segments extends Base { { title: t('Description'), dataIndex: 'description', - isHideable: true - } + isHideable: true, + }, ]; } diff --git a/src/pages/ha/routes/index.js b/src/pages/ha/routes/index.js index 5fe1bd78..64e16a1e 100644 --- a/src/pages/ha/routes/index.js +++ b/src/pages/ha/routes/index.js @@ -27,13 +27,32 @@ export default [ component: BaseLayout, routes: [ { path: `${PATH}/segments-admin`, component: Segments, exact: true }, - { path: `${PATH}/segments-admin`, component: Segments, exact: true }, - { path: `${PATH}/segments-admin/create-step-admin`, component: StepCreate, exact: true }, - { path: `${PATH}/segments-admin/detail/:id`, component: SegmentsDetail, exact: true }, + { + path: `${PATH}/segments-admin/create-step-admin`, + component: StepCreate, + exact: true, + }, + { + path: `${PATH}/segments-admin/detail/:id`, + component: SegmentsDetail, + exact: true, + }, { path: `${PATH}/hosts-admin`, component: Hosts, exact: true }, - { path: `${PATH}/hosts-admin/detail/:id`, component: HostsDetail, exact: true, }, - { path: `${PATH}/notifications-admin`, component: Notifications, exact: true }, - { path: `${PATH}/notifications-admin/detail/:id`, component: NotificationsDetail, exact: true }, + { + path: `${PATH}/hosts-admin/detail/:id`, + component: HostsDetail, + exact: true, + }, + { + path: `${PATH}/notifications-admin`, + component: Notifications, + exact: true, + }, + { + path: `${PATH}/notifications-admin/detail/:id`, + component: NotificationsDetail, + exact: true, + }, { path: '*', component: E404 }, ], },