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

fix the sidebar icon problem in addon page #145

Merged
merged 3 commits into from
May 12, 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
33 changes: 33 additions & 0 deletions shell/app/modules/workBench/pages/addons/sidebar-menu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) 2021 Terminus, Inc.
//
// This program is free software: you can use, redistribute, and/or modify
// it under the terms of the GNU Affero General Public License, version 3
// or later ("AGPL"), as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import { Icon as CustomIcon } from 'common';
import { Config } from '@icon-park/react';
import i18n from 'i18n';
import React from 'react';

export const getSideMenu = ({ rootPath }: { rootPath: string }) => {
const sideMenu = [
{
href: `${rootPath}/overview`,
icon: <CustomIcon type='overview' />,
text: i18n.t('workBench:addon info'),
},
{
href: `${rootPath}/settings`,
icon: <Config />,
text: i18n.t('workBench:addon setting'),
},
];
return sideMenu;
};
18 changes: 2 additions & 16 deletions shell/app/modules/workBench/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,8 @@ import i18n from 'i18n';
import { getTranslateAddonList } from 'app/locales/utils';
import { reduce } from 'lodash';
import { CategoryName } from 'addonPlatform/pages/common/configs';
import { getSideMenu } from '../pages/addons/sidebar-menu';

const getSiderMenu = ({ rootPath }: { rootPath: string }) => {
const siderMenu = [
{
href: `${rootPath}/overview`,
icon: 'overview',
text: i18n.t('workBench:addon info'),
},
{
href: `${rootPath}/settings`,
icon: 'setting',
text: i18n.t('workBench:addon setting'),
},
];
return siderMenu;
};

interface IState {
addonCategory: {
Expand Down Expand Up @@ -72,7 +58,7 @@ const workBenchStore = createFlatStore({
const { logoUrl, name, addonName } = ret;
const prefixPath = `/${orgName}/workBench/addonsManage/${projectId}`;
const rootPath = `${prefixPath}/${insId}`;
const menu = getSiderMenu({ rootPath }) as any[];
const menu = getSideMenu({ rootPath }) as any[];
if (['log-analytics'].includes(addonName)) {
menu.splice(1, 0, {
key: 'console',
Expand Down