A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
feat: support quick-links plugin
shuaic2c7ea84d589
diff --git a/ui/src/components/SideNav/index.tsx b/ui/src/components/SideNav/index.tsxindex e3f04f8f..294389a0 100644--- a/ui/src/components/SideNav/index.tsx+++ b/ui/src/components/SideNav/index.tsx@@ -19,11 +19,14 @@import { FC } from 'react';import { Nav } from 'react-bootstrap';-import { NavLink, useLocation } from 'react-router-dom';+import { NavLink, useLocation, useNavigate } from 'react-router-dom';import { useTranslation } from 'react-i18next';import { loggedUserInfoStore, sideNavStore } from '@/stores';-import { Icon } from '@/components';+import { Icon, PluginRender } from '@/components';+import { PluginType } from '@/utils/pluginKit';+import request from '@/utils/request';+import './index.scss';const Index: FC = () => {@@ -31,6 +34,7 @@ const Index: FC = () => {const { pathname } = useLocation();const { user: userInfo } = loggedUserInfoStore();const { can_revision, revision } = sideNavStore();+ const navigate = useNavigate();return (<Nav variant="pills" className="flex-column" id="sideNav">@@ -62,6 +66,13 @@ const Index: FC = () => {<span>{t('header.nav.badges')}</span></NavLink>+ <PluginRender+ slug_name="quick_links"+ type={PluginType.Sidebar}+ request={request}+ navigate={navigate}+ />+{can_revision || userInfo?.role_id === 2 ? (<><div className="py-2 px-3 mt-3 small fw-bold">diff --git a/ui/src/plugins/index.ts b/ui/src/plugins/index.tsindex 7cbc4cd9..eac762ef 100644--- a/ui/src/plugins/index.ts+++ b/ui/src/plugins/index.ts@@ -1,22 +1,3 @@-/*- * Licensed to the Apache Software Foundation (ASF) under one- * or more contributor license agreements. See the NOTICE file- * distributed with this work for additional information- * regarding copyright ownership. The ASF licenses this file- * to you under the Apache License, Version 2.0 (the- * "License"); you may not use this file except in compliance- * with the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing,- * software distributed under the License is distributed on an- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY- * KIND, either express or implied. See the License for the- * specific language governing permissions and limitations- * under the License.- */-export default null;--// export { default as Demo } from './Demo';+const loadQuickLinks = () => import('quick-links').then(module => module.default);+export const quick_links = loadQuickLinks\ No newline at end of filediff --git a/ui/src/utils/pluginKit/interface.ts b/ui/src/utils/pluginKit/interface.tsindex d946ed6e..a1b641d8 100644--- a/ui/src/utils/pluginKit/interface.ts+++ b/ui/src/utils/pluginKit/interface.ts@@ -29,6 +29,7 @@ export enum PluginType {Route = 'route',Captcha = 'captcha',Render = 'render',+ Sidebar = 'sidebar',}export interface PluginInfo {