feat: hide masakari menu
Hide masakari menu when no masakari service is available Change-Id: If8857cd57012b809b20d10dcd8026c9fa30ae649
This commit is contained in:
parent
36483416f2
commit
813ee6a330
@ -88,6 +88,7 @@ export const swiftEndpoint = () => getOriginEndpoint('swift');
|
|||||||
export const cinderEndpoint = () => getOriginEndpoint('cinder');
|
export const cinderEndpoint = () => getOriginEndpoint('cinder');
|
||||||
export const manilaEndpoint = () => getOriginEndpoint('manilav2');
|
export const manilaEndpoint = () => getOriginEndpoint('manilav2');
|
||||||
export const zunEndpoint = () => getOriginEndpoint('zun');
|
export const zunEndpoint = () => getOriginEndpoint('zun');
|
||||||
|
export const masakariEndpoint = () => getOriginEndpoint('masakari');
|
||||||
|
|
||||||
export const apiVersionMaps = {
|
export const apiVersionMaps = {
|
||||||
nova: {
|
nova: {
|
||||||
|
@ -980,7 +980,7 @@ const renderMenu = (t) => {
|
|||||||
name: t('Instance-HA'),
|
name: t('Instance-HA'),
|
||||||
key: 'masakari',
|
key: 'masakari',
|
||||||
icon: <DeploymentUnitOutlined />,
|
icon: <DeploymentUnitOutlined />,
|
||||||
// endpoints: 'masakari',
|
endpoints: 'masakari',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/ha/segments-admin',
|
path: '/ha/segments-admin',
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { observer, inject } from 'mobx-react';
|
import { observer, inject } from 'mobx-react';
|
||||||
import Base from 'containers/List';
|
import Base from 'containers/List';
|
||||||
import actionConfigs from './actions';
|
|
||||||
import globalHostStore, { HostStore } from 'src/stores/masakari/hosts';
|
import globalHostStore, { HostStore } from 'src/stores/masakari/hosts';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import { masakariEndpoint } from 'client/client/constants';
|
||||||
|
import actionConfigs from './actions';
|
||||||
|
|
||||||
export class Hosts extends Base {
|
export class Hosts extends Base {
|
||||||
init() {
|
init() {
|
||||||
@ -23,6 +24,14 @@ export class Hosts extends Base {
|
|||||||
this.downloadStore = new HostStore();
|
this.downloadStore = new HostStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get endpoint() {
|
||||||
|
return masakariEndpoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
get checkEndpoint() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
get policy() {
|
get policy() {
|
||||||
if (this.isAdminPage) {
|
if (this.isAdminPage) {
|
||||||
return 'os_compute_api:servers:index:get_all_tenants';
|
return 'os_compute_api:servers:index:get_all_tenants';
|
||||||
@ -80,9 +89,13 @@ export class Hosts extends Base {
|
|||||||
title: t('Name'),
|
title: t('Name'),
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
render: (value, row) => {
|
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 <Link to={path}>{value}</Link>;
|
return <Link to={path}>{value}</Link>;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('UUID'),
|
title: t('UUID'),
|
||||||
@ -93,7 +106,7 @@ export class Hosts extends Base {
|
|||||||
title: t('Reserved'),
|
title: t('Reserved'),
|
||||||
dataIndex: 'reserved',
|
dataIndex: 'reserved',
|
||||||
isHideable: true,
|
isHideable: true,
|
||||||
valueRender: 'yesNo'
|
valueRender: 'yesNo',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Type'),
|
title: t('Type'),
|
||||||
@ -103,24 +116,31 @@ export class Hosts extends Base {
|
|||||||
{
|
{
|
||||||
title: t('Control Attribute'),
|
title: t('Control Attribute'),
|
||||||
dataIndex: 'control_attributes',
|
dataIndex: 'control_attributes',
|
||||||
isHideable: true
|
isHideable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('On Maintenance'),
|
title: t('On Maintenance'),
|
||||||
dataIndex: 'on_maintenance',
|
dataIndex: 'on_maintenance',
|
||||||
isHideable: true,
|
isHideable: true,
|
||||||
valueRender: 'yesNo'
|
valueRender: 'yesNo',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Failover Segment'),
|
title: t('Failover Segment'),
|
||||||
dataIndex: 'failover_segment',
|
dataIndex: 'failover_segment',
|
||||||
isHideable: true,
|
isHideable: true,
|
||||||
render: (value, row) => {
|
render: (value, row) => {
|
||||||
return <Link to={this.getRoutePath('masakariSegmentDetail', { id: row.failover_segment_id })}>{row.failover_segment.name}</Link>
|
return (
|
||||||
}
|
<Link
|
||||||
}
|
to={this.getRoutePath('masakariSegmentDetail', {
|
||||||
|
id: row.failover_segment_id,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{row.failover_segment.name}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default inject('rootStore')(observer(Hosts));
|
export default inject('rootStore')(observer(Hosts));
|
||||||
|
@ -13,8 +13,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { observer, inject } from 'mobx-react';
|
import { observer, inject } from 'mobx-react';
|
||||||
import Base from 'containers/List';
|
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 { Link } from 'react-router-dom';
|
||||||
|
import { masakariEndpoint } from 'client/client/constants';
|
||||||
|
|
||||||
export class Notifications extends Base {
|
export class Notifications extends Base {
|
||||||
init() {
|
init() {
|
||||||
@ -37,6 +40,14 @@ export class Notifications extends Base {
|
|||||||
return 'updated_at';
|
return 'updated_at';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get endpoint() {
|
||||||
|
return masakariEndpoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
get checkEndpoint() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
get searchFilters() {
|
get searchFilters() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@ -47,7 +58,7 @@ export class Notifications extends Base {
|
|||||||
label: t('UUID'),
|
label: t('UUID'),
|
||||||
name: 'notification_uuid',
|
name: 'notification_uuid',
|
||||||
},
|
},
|
||||||
]
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getColumns = () => [
|
getColumns = () => [
|
||||||
@ -55,10 +66,12 @@ export class Notifications extends Base {
|
|||||||
title: t('UUID'),
|
title: t('UUID'),
|
||||||
dataIndex: 'notification_uuid',
|
dataIndex: 'notification_uuid',
|
||||||
render: (value) => {
|
render: (value) => {
|
||||||
const path = this.getRoutePath("masakariNotificationDetail", {id: value});
|
const path = this.getRoutePath('masakariNotificationDetail', {
|
||||||
return <Link to={path}>{value}</Link>
|
id: value,
|
||||||
|
});
|
||||||
|
return <Link to={path}>{value}</Link>;
|
||||||
},
|
},
|
||||||
isHideable: true
|
isHideable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Host'),
|
title: t('Host'),
|
||||||
@ -73,13 +86,18 @@ export class Notifications extends Base {
|
|||||||
{
|
{
|
||||||
title: t('Status'),
|
title: t('Status'),
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
isHideable: true
|
isHideable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Payload'),
|
title: t('Payload'),
|
||||||
dataIndex: 'payload',
|
dataIndex: 'payload',
|
||||||
isHideable: true,
|
isHideable: true,
|
||||||
render: (value) => Object.keys(value).map(it =><React.Fragment><div>{it}: {value[it]}</div></React.Fragment>)
|
render: (value) =>
|
||||||
|
Object.keys(value).map((it) => (
|
||||||
|
<div key={it}>
|
||||||
|
{it}: {value[it]}
|
||||||
|
</div>
|
||||||
|
)),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,14 @@
|
|||||||
|
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import Base from 'containers/TabDetail';
|
import Base from 'containers/TabDetail';
|
||||||
import { SegmentStore } from 'src/stores/masakari/segments';
|
import { SegmentStore } from 'stores/masakari/segments';
|
||||||
import BaseDetail from './BaseDetail';
|
import BaseDetail from './BaseDetail';
|
||||||
import actionConfigs from '../actions';
|
import actionConfigs from '../actions';
|
||||||
import HostDetail from '../../Hosts';
|
import HostDetail from '../../Hosts';
|
||||||
|
|
||||||
export class SegmentsDetail extends Base {
|
export class SegmentsDetail extends Base {
|
||||||
init() {
|
init() {
|
||||||
this.store = new SegmentStore;
|
this.store = new SegmentStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
|
@ -12,8 +12,9 @@
|
|||||||
|
|
||||||
import { observer, inject } from 'mobx-react';
|
import { observer, inject } from 'mobx-react';
|
||||||
import Base from 'containers/List';
|
import Base from 'containers/List';
|
||||||
import actionConfigs from './actions';
|
|
||||||
import globalSegmentStore, { SegmentStore } from 'stores/masakari/segments';
|
import globalSegmentStore, { SegmentStore } from 'stores/masakari/segments';
|
||||||
|
import { masakariEndpoint } from 'client/client/constants';
|
||||||
|
import actionConfigs from './actions';
|
||||||
|
|
||||||
export class Segments extends Base {
|
export class Segments extends Base {
|
||||||
init() {
|
init() {
|
||||||
@ -28,6 +29,14 @@ export class Segments extends Base {
|
|||||||
return 'os_compute_api:servers:index';
|
return 'os_compute_api:servers:index';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get endpoint() {
|
||||||
|
return masakariEndpoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
get checkEndpoint() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return t('segments');
|
return t('segments');
|
||||||
}
|
}
|
||||||
@ -89,8 +98,8 @@ export class Segments extends Base {
|
|||||||
{
|
{
|
||||||
title: t('Description'),
|
title: t('Description'),
|
||||||
dataIndex: 'description',
|
dataIndex: 'description',
|
||||||
isHideable: true
|
isHideable: true,
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,13 +27,32 @@ export default [
|
|||||||
component: BaseLayout,
|
component: BaseLayout,
|
||||||
routes: [
|
routes: [
|
||||||
{ path: `${PATH}/segments-admin`, component: Segments, exact: true },
|
{ 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/create-step-admin`,
|
||||||
{ path: `${PATH}/segments-admin/detail/:id`, component: SegmentsDetail, exact: true },
|
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`, component: Hosts, exact: true },
|
||||||
{ path: `${PATH}/hosts-admin/detail/:id`, component: HostsDetail, exact: true, },
|
{
|
||||||
{ path: `${PATH}/notifications-admin`, component: Notifications, exact: true },
|
path: `${PATH}/hosts-admin/detail/:id`,
|
||||||
{ path: `${PATH}/notifications-admin/detail/:id`, component: NotificationsDetail, exact: true },
|
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 },
|
{ path: '*', component: E404 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user