Make the app name configurable even after the project is built (#731)

### What problem does this PR solve?

Make the app name configurable even after the project is built #730 

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-05-11 16:03:07 +08:00
committed by GitHub
parent 33eaf6fa2e
commit 91b4a18c47
12 changed files with 104 additions and 83 deletions

View File

@ -44,6 +44,7 @@ const ActionCell = ({
setSelectedRowKeys,
);
const extension = getExtension(record.name);
const isKnowledgeBase = record.source_type === 'knowledgebase';
const onDownloadDocument = () => {
downloadFile({
@ -67,36 +68,42 @@ const ActionCell = ({
return (
<Space size={0}>
<Tooltip title={t('addToKnowledge')}>
<Button
type="text"
className={styles.iconButton}
onClick={onShowConnectToKnowledgeModal}
>
<LinkOutlined size={20} />
</Button>
</Tooltip>
{isKnowledgeBase || (
<Tooltip title={t('addToKnowledge')}>
<Button
type="text"
className={styles.iconButton}
onClick={onShowConnectToKnowledgeModal}
>
<LinkOutlined size={20} />
</Button>
</Tooltip>
)}
<Tooltip title={t('rename', { keyPrefix: 'common' })}>
<Button
type="text"
disabled={beingUsed}
onClick={onShowRenameModal}
className={styles.iconButton}
>
<EditOutlined size={20} />
</Button>
</Tooltip>
<Tooltip title={t('delete', { keyPrefix: 'common' })}>
<Button
type="text"
disabled={beingUsed}
onClick={handleRemoveFile}
className={styles.iconButton}
>
<DeleteOutlined size={20} />
</Button>
</Tooltip>
{isKnowledgeBase || (
<Tooltip title={t('rename', { keyPrefix: 'common' })}>
<Button
type="text"
disabled={beingUsed}
onClick={onShowRenameModal}
className={styles.iconButton}
>
<EditOutlined size={20} />
</Button>
</Tooltip>
)}
{isKnowledgeBase || (
<Tooltip title={t('delete', { keyPrefix: 'common' })}>
<Button
type="text"
disabled={beingUsed}
onClick={handleRemoveFile}
className={styles.iconButton}
>
<DeleteOutlined size={20} />
</Button>
</Tooltip>
)}
{record.type !== 'folder' && (
<Tooltip title={t('download', { keyPrefix: 'common' })}>
<Button

View File

@ -1,7 +1,8 @@
import { useTranslate } from '@/hooks/commonHooks';
import { useFetchKnowledgeList } from '@/hooks/knowledgeHook';
import { IModalProps } from '@/interfaces/common';
import { Form, Modal, Select, SelectProps } from 'antd';
import { filterOptionsByInput } from '@/utils/commonUtil';
import { Form, Modal, Select } from 'antd';
import { useEffect } from 'react';
const ConnectToKnowledgeModal = ({
@ -15,7 +16,7 @@ const ConnectToKnowledgeModal = ({
const { list, fetchList } = useFetchKnowledgeList();
const { t } = useTranslate('fileManager');
const options: SelectProps['options'] = list?.map((item) => ({
const options = list?.map((item) => ({
label: item.name,
value: item.id,
}));
@ -46,9 +47,12 @@ const ConnectToKnowledgeModal = ({
<Select
mode="multiple"
allowClear
showSearch
style={{ width: '100%' }}
placeholder={t('pleaseSelect')}
options={options}
optionFilterProp="children"
filterOption={filterOptionsByInput}
/>
</Form.Item>
</Form>

View File

@ -46,6 +46,7 @@ const FileToolbar = ({
const { handleInputChange, searchString } = useHandleSearchChange();
const breadcrumbItems = useSelectBreadcrumbItems();
const { handleBreadcrumbClick } = useHandleBreadcrumbClick();
const isKnowledgeBase = breadcrumbItems.at(-1)?.title === '.knowledgebase';
const itemRender: BreadcrumbProps['itemRender'] = (
currentRoute,
@ -128,19 +129,21 @@ const FileToolbar = ({
<div className={styles.filter}>
<Breadcrumb items={breadcrumbItems} itemRender={itemRender} />
<Space>
<Dropdown
menu={{ items }}
placement="bottom"
arrow={false}
disabled={disabled}
>
<Button>
<Space>
<b> {t('bulk')}</b>
<DownOutlined />
</Space>
</Button>
</Dropdown>
{isKnowledgeBase || (
<Dropdown
menu={{ items }}
placement="bottom"
arrow={false}
disabled={disabled}
>
<Button>
<Space>
<b> {t('bulk')}</b>
<DownOutlined />
</Space>
</Button>
</Dropdown>
)}
<Input
placeholder={t('searchFiles')}
value={searchString}
@ -150,11 +153,13 @@ const FileToolbar = ({
prefix={<SearchOutlined />}
/>
<Dropdown menu={{ items: actionItems }} trigger={['click']}>
<Button type="primary" icon={<PlusOutlined />}>
{t('addFile')}
</Button>
</Dropdown>
{isKnowledgeBase || (
<Dropdown menu={{ items: actionItems }} trigger={['click']}>
<Button type="primary" icon={<PlusOutlined />}>
{t('addFile')}
</Button>
</Dropdown>
)}
</Space>
</div>
);