Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed msp online bugs #2336

Merged
merged 2 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions shell/app/config-page/components/top-n/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ const CP_TopN: React.FC<CP_DATA_RANK.Props> = (props) => {
<EmptyHoder relative />
) : (
items?.map((item) => {
const { name, value, total, unit, id } = item;
const percent = (value / total) * 100;
const { name, value, unit, id, percent } = item;
return (
<div
key={id}
Expand Down
40 changes: 20 additions & 20 deletions shell/app/config-page/components/top-n/top-n.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,35 +54,35 @@ const mockData: Array<MockSpec<CP_DATA_RANK.Spec>> = [
id: '', // serviceId
name: '服务名称A', // serviceName
value: 300,
total: 300,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称b',
value: 80,
total: 200,
percent: 80,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称c',
value: 77,
total: 200,
percent: 70,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称d',
value: 50,
total: 200,
percent: 40,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称很长的服务服务名称很长的服务服务名称很长的服务服务名称很长的服务',
value: 25,
total: 200,
percent: 10,
unit: 'reqs/s',
},
],
Expand All @@ -95,35 +95,35 @@ const mockData: Array<MockSpec<CP_DATA_RANK.Spec>> = [
id: '', // serviceId
name: '服务名称A',
value: 100,
total: 200,
percent: 11,
daskyrk marked this conversation as resolved.
Show resolved Hide resolved
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称b',
value: 80,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称c',
value: 77,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称d',
value: 50,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称很长的服务服务名称很长的服务服务名称很长的服务服务名称很长的服务',
value: 25,
total: 200,
percent: 100,
unit: 'reqs/s',
},
],
Expand All @@ -136,35 +136,35 @@ const mockData: Array<MockSpec<CP_DATA_RANK.Spec>> = [
id: '', // serviceId
name: '服务名称A',
value: 100,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称b',
value: 80,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称c',
value: 77,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称d',
value: 50,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称很长的服务服务名称很长的服务服务名称很长的服务服务名称很长的服务',
value: 25,
total: 200,
percent: 100,
unit: 'reqs/s',
},
],
Expand All @@ -177,35 +177,35 @@ const mockData: Array<MockSpec<CP_DATA_RANK.Spec>> = [
id: '', // serviceId
name: '服务名称A',
value: 100,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称b',
value: 80,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称c',
value: 77,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称d',
value: 50,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
id: '', // serviceId
name: '服务名称很长的服务服务名称很长的服务服务名称很长的服务服务名称很长的服务',
value: 25,
total: 200,
percent: 100,
unit: 'reqs/s',
},
],
Expand Down
2 changes: 1 addition & 1 deletion shell/app/config-page/components/top-n/top-n.spec.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare namespace CP_DATA_RANK {
id: string;
name: string;
value: number;
total: number;
percent: number;
unit?: string;

[key: string]: any;
Expand Down
40 changes: 20 additions & 20 deletions shell/app/config-page/mock/data-rank.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,31 @@ export const mockData = {
id: '', // serviceId
name: '服务名称A', // serviceName
value: 300,
total: 300,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称b',
value: 80,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称c',
value: 77,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称d',
value: 50,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称很长的服务服务名称很长的服务服务名称很长的服务服务名称很长的服务',
value: 25,
total: 200,
percent: 100,
unit: 'reqs/s',
},
],
Expand All @@ -82,31 +82,31 @@ export const mockData = {
{
name: '服务名称A',
value: 100,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称b',
value: 80,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称c',
value: 77,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称d',
value: 50,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称很长的服务服务名称很长的服务服务名称很长的服务服务名称很长的服务',
value: 25,
total: 200,
percent: 100,
unit: 'reqs/s',
},
],
Expand All @@ -119,31 +119,31 @@ export const mockData = {
{
name: '服务名称A',
value: 100,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称b',
value: 80,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称c',
value: 77,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称d',
value: 50,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称很长的服务服务名称很长的服务服务名称很长的服务服务名称很长的服务',
value: 25,
total: 200,
percent: 100,
unit: 'reqs/s',
},
],
Expand All @@ -156,31 +156,31 @@ export const mockData = {
{
name: '服务名称A',
value: 100,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称b',
value: 80,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称c',
value: 77,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称d',
value: 50,
total: 200,
percent: 100,
unit: 'reqs/s',
},
{
name: '服务名称很长的服务服务名称很长的服务服务名称很长的服务服务名称很长的服务',
value: 25,
total: 200,
percent: 100,
unit: 'reqs/s',
},
],
Expand Down
15 changes: 8 additions & 7 deletions shell/app/modules/msp/env-overview/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ const getEnvOverViewRouter = (): RouteConfigItem => {
path: ':terminusKey',
tabs,
pageName: i18n.t('msp:service overview'),
breadcrumbName: i18n.t('msp:service monitor'),
breadcrumbName: i18n.t('msp:service overview'),
alwaysShowTabKey: 'service-list',
routes: [
{
tabs,
alwaysShowTabKey: 'topology',
layout: { fullHeight: true, noWrapper: true },
getComp: (cb) => cb(import('msp/env-overview/topology/pages/topology')),
},
{
path: 'topology',
tabs,
Expand All @@ -54,6 +48,13 @@ const getEnvOverViewRouter = (): RouteConfigItem => {
],
},
serviceListRouter(tabs),
{
getComp: (cb: RouterGetComp) => cb(import('msp/env-overview/service-list/pages')),
layout: {
fullHeight: true,
noWrapper: true,
},
},
],
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,14 @@ const OverView = () => {
const topologyList = React.useMemo(() => {
const currentNode = topologyData.nodes?.find((t) => t.serviceId === serviceId);
if (currentNode) {
const temp = topologyData.nodes.filter((item) => item.parents.some((t) => t.serviceId === serviceId)) ?? [];
const temp =
topologyData.nodes.filter(
(item) => item.serviceId !== serviceId && item.parents.some((t) => t.serviceId === serviceId),
) ?? [];
const nodes = temp.map((item) => {
return {
...item,
parents: item.parents.filter((t) => t.serviceId === serviceId),
parents: item.parents?.filter((t) => t.serviceId === serviceId),
};
});
return { nodes: uniqBy([...nodes, currentNode, ...(currentNode?.parents || [])], 'id') };
Expand Down Expand Up @@ -214,7 +217,7 @@ const OverView = () => {
<div className="h-12 flex justify-start items-center px-4 bg-lotion text-default font-medium">
{i18n.t('msp:service request overview')}
</div>
<div className="mx-5 mb-20 mt-3">
<div className="mx-5 mb-4 mt-3">
<Row gutter={8}>
{chartConfig.map((item) => {
const currentOption = {
Expand Down
Loading