Skip to content

Commit

Permalink
fix #554; fix #555; resolve #548; update docs for v1.9.0-beta3;
Browse files Browse the repository at this point in the history
  • Loading branch information
anobaka committed Sep 10, 2024
1 parent cad338c commit 81a313d
Show file tree
Hide file tree
Showing 10 changed files with 267 additions and 146 deletions.
13 changes: 10 additions & 3 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
## [1.9.0-beta3](https://cdn-public.anobaka.com/app/bakabase/inside-world/1.9.0-beta3/installer/Bakabase.InsideWorld.zip) (2024-09-06)
## [1.9.0-beta3](https://cdn-public.anobaka.com/app/bakabase/inside-world/1.9.0-beta3/installer/Bakabase.InsideWorld.zip) (2024-09-10)

### Features

* 在配置媒体库路径信息时,允许将正则表达式应用至资源文件(夹)名 ([#547](https://github.com/anobaka/InsideWorld/issues/547))
* 选择属性框调整为三个维度:内置、预置和自定义,允许将增强目标绑定至预置属性 ([#546](https://github.com/anobaka/InsideWorld/issues/546))
* 打开属性选择框时,如果没有已选属性,则默认切换至未选择列表 ([#545](https://github.com/anobaka/InsideWorld/issues/545))
* 选择属性框调整为三个维度:内置、预置和自定义,允许将增强目标绑定至预置属性 ([#546](https://github.com/anobaka/InsideWorld/issues/546))
* 在配置媒体库路径信息时,允许将正则表达式应用至资源文件(夹)名 ([#547](https://github.com/anobaka/InsideWorld/issues/547))
* 增加根据分类和增强器删除增强记录的功能 ([#548](https://github.com/anobaka/InsideWorld/issues/548))
* 在增强器增强目标中配置默认预置属性,在自动绑定属性启用时尝试匹配预置属性 ([#550](https://github.com/anobaka/InsideWorld/issues/550))
* 增加属性转换测试功能 ([#552](https://github.com/anobaka/InsideWorld/issues/552))

### Bug Fixes

* 手动编辑动态增强目标时,增强名称没有实时更新 ([#544](https://github.com/anobaka/InsideWorld/issues/544))
* 属性转换时使用了错误的目标属性Descriptor ([#551](https://github.com/anobaka/InsideWorld/issues/551))
* 基础数据反序列化时未移除转义符 ([#553](https://github.com/anobaka/InsideWorld/issues/553))
* 关闭资源详情窗口后资源封面显示异常 ([#554](https://github.com/anobaka/InsideWorld/issues/554))
* 删除筛选条件会导致搜索关键字也被清空 ([#555](https://github.com/anobaka/InsideWorld/issues/555))

## [1.9.0-beta2](https://cdn-public.anobaka.com/app/bakabase/inside-world/1.9.0-beta2/installer/Bakabase.InsideWorld.zip) (2024-09-05)

Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Inside World 是一款离线媒体管理库,用于本地媒体快速处理、
| 版本 | 发布时间 | 下载地址 | 更新说明 |
| ------------- | ------------- | ------------- | ------------- |
| [v2.0.0](https://github.com/anobaka/InsideWorld/milestone/51) | 2024 ETA | / | / |
| [v1.9.0-beta3](./CHANGELOG.md) | 2024-09-06 | [下载](https://cdn-public.anobaka.com/app/bakabase/inside-world-dev-test/1.9.0-beta3/installer/Bakabase.zip) | [1.9.0以前的版本升级前必看](/guide/v190/v1.9.0) |
| [v1.9.0-beta3](./CHANGELOG.md) | 2024-09-10 | [下载](https://cdn-public.anobaka.com/app/bakabase/inside-world-dev-test/1.9.0-beta3/installer/Bakabase.zip) | [1.9.0以前的版本升级前必看](/guide/v190/v1.9.0) |
| [v1.9.0-beta2](./CHANGELOG.md) | 2024-09-05 | [下载](https://cdn-public.anobaka.com/app/bakabase/inside-world-dev-test/1.9.0-beta2/installer/Bakabase.zip) | [1.9.0以前的版本升级前必看](/guide/v190/v1.9.0) |
| [v1.9.0-beta](./CHANGELOG.md) | 2024-08-28 | [下载](https://cdn-public.anobaka.com/app/bakabase/inside-world-dev-test/1.9.0-beta/installer/Bakabase.zip) | [1.9.0以前的版本升级前必看](/guide/v190/v1.9.0) |
| [v1.8.2](./CHANGELOG.md) | 2024-08-26 | [下载](https://cdn-public.anobaka.com/app/bakabase/inside-world/1.8.2/installer/Bakabase.InsideWorld.zip) | / |
Expand Down
13 changes: 11 additions & 2 deletions src/Bakabase.Service/Controllers/EnhancementController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public async Task<BaseResponse> CreateEnhancementForResourceByEnhancer(int resou

[HttpDelete("~/media-library/{mediaLibraryId:int}/enhancement")]
[SwaggerOperation(OperationId = "DeleteByEnhancementsMediaLibrary")]
public async Task<BaseResponse> RemoveMediaLibraryEnhancementRecords(int mediaLibraryId)
public async Task<BaseResponse> DeleteMediaLibraryEnhancementRecords(int mediaLibraryId)
{
var resourceIds = (await resourceService.GetAll(t => t.MediaLibraryId == mediaLibraryId))
.Select(t => t.Id).ToArray();
Expand All @@ -119,13 +119,22 @@ public async Task<BaseResponse> RemoveMediaLibraryEnhancementRecords(int mediaLi

[HttpDelete("~/category/{categoryId:int}/enhancement")]
[SwaggerOperation(OperationId = "DeleteEnhancementsByCategory")]
public async Task<BaseResponse> RemoveCategoryEnhancementRecords(int categoryId)
public async Task<BaseResponse> DeleteCategoryEnhancementRecords(int categoryId)
{
var resourceIds = (await resourceService.GetAll(t => t.CategoryId == categoryId))
.Select(t => t.Id).ToArray();
await enhancementService.RemoveAll(t => resourceIds.Contains(t.ResourceId), true);
await enhancementRecordService.DeleteAll(t => resourceIds.Contains(t.ResourceId));
return BaseResponseBuilder.Ok;
}

[HttpDelete("~/enhancer/{enhancerId:int}/enhancement")]
[SwaggerOperation(OperationId = "DeleteEnhancementsByEnhancer")]
public async Task<BaseResponse> DeleteEnhancerEnhancementRecords(int enhancerId)
{
await enhancementService.RemoveAll(t => t.EnhancerId == enhancerId, true);
await enhancementRecordService.DeleteAll(t => t.EnhancerId == enhancerId);
return BaseResponseBuilder.Ok;
}
}
}
264 changes: 152 additions & 112 deletions src/ClientApp/src/components/EnhancerSelectorV2/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useContext, useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { ExclamationCircleOutlined } from '@ant-design/icons';
import { MoreOutlined } from '@ant-design/icons';
import type { CategoryEnhancerFullOptions } from './components/CategoryEnhancerOptionsDialog/models';
import { Button, Checkbox, Chip, Divider, Link, Modal, Tooltip } from '@/components/bakaui';
import { Button, Checkbox, Chip, Divider, Link, Listbox, ListboxItem, Modal, Popover, Tooltip } from '@/components/bakaui';
import { createPortalOfComponent } from '@/components/utils';
import BApi from '@/sdk/BApi';
import type { EnhancerDescriptor } from '@/components/EnhancerSelectorV2/models';
Expand All @@ -15,19 +15,25 @@ import type { DestroyableProps } from '@/components/bakaui/types';
import TargetNotSetupTip from '@/components/Enhancer/components/TargetNotSetupTip';
import { EnhancerTargetNotSetupTip } from '@/components/Enhancer';

interface IProps extends DestroyableProps{
interface IProps extends DestroyableProps {
categoryId: number;
onClose?: () => any;
}

type Category = {
id: number;
name: string;
};

const EnhancerSelector = ({
categoryId,
onDestroyed,
onClose,
}: IProps) => {
onClose,
}: IProps) => {
const { t } = useTranslation();
const { createPortal } = useBakabaseContext();
const [enhancers, setEnhancers] = useState<EnhancerDescriptor[]>([]);
const [category, setCategory] = useState<Category>();
const [categoryEnhancerOptionsList, setCategoryEnhancerOptionsList] = useState<CategoryEnhancerFullOptions[]>([]);

const init = async () => {
Expand All @@ -40,6 +46,7 @@ const EnhancerSelector = ({
// @ts-ignore
await BApi.category.getCategory(categoryId, { additionalItems: CategoryAdditionalItem.EnhancerOptions | CategoryAdditionalItem.CustomProperties }).then(r => {
const data = r.data || {};
setCategory({ id: data.id!, name: data.name! });
setCategoryEnhancerOptionsList(data.enhancerOptions?.map(eo => (eo as CategoryEnhancerFullOptions)) || []);
});
};
Expand Down Expand Up @@ -86,124 +93,157 @@ const EnhancerSelector = ({
style={{ gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 300px)' }}
>
{enhancers.map(e => {
const ceo = categoryEnhancerOptionsList.find(x => x.enhancerId == e.id);
return (
<div
key={e.id}
className={'max-w-[280px] border-1 rounded-lg pl-3 pr-3 pt-2 pb-2 flex flex-col'}
style={{ borderColor: 'rgba(255, 255, 255, 0.3)' }}
>
<div className={'text-medium font-bold'}>
{e.name}
const ceo = categoryEnhancerOptionsList.find(x => x.enhancerId == e.id);
return (
<div
key={e.id}
className={'max-w-[280px] border-1 rounded-lg pl-3 pr-3 pt-2 pb-2 flex flex-col'}
style={{ borderColor: 'rgba(255, 255, 255, 0.3)' }}
>
<div className={'text-medium font-bold'}>
{e.name}
</div>
{e.description && (
<div className={'opacity-60 grow'}>
{e.description}
</div>
{e.description && (
<div className={'opacity-60 grow'}>
{e.description}
</div>
)}
<Divider />
<div className={'mt-2 mb-2 grow'}>
<div className={' italic'}>
{t('This enhancer can produce the following property values')}
</div>
<div className={'flex flex-wrap gap-x-3 gap-y-1 mt-1'}>
{e.targets.map(target => {
return (
<Tooltip
key={target.id}
content={(
)}
<Divider />
<div className={'mt-2 mb-2 grow'}>
<div className={' italic'}>
{t('This enhancer can produce the following property values')}
</div>
<div className={'flex flex-wrap gap-x-3 gap-y-1 mt-1'}>
{e.targets.map(target => {
return (
<Tooltip
key={target.id}
content={(
<div>
<div>{target.description}</div>
<div>
<div>{target.description}</div>
<div>
{t('The value type of this target is')}
{t('The value type of this target is')}
&nbsp;
<span className={'font-bold'}>
<StandardValueIcon valueType={target.valueType} className={'text-small'} />
&nbsp;
<span className={'font-bold'}>
<StandardValueIcon valueType={target.valueType} className={'text-small'} />
&nbsp;
{t(`StandardValueType.${StandardValueType[target.valueType]}`)}
</span>
</div>
{t(`StandardValueType.${StandardValueType[target.valueType]}`)}
</span>
</div>
)}
>
<div
className={'flex items-center gap-1'}
style={{
// color: 'var(--bakaui-primary)'
}}
>
<StandardValueIcon valueType={target.valueType} className={'text-small'} />
<span className={'break-all'}>
{target.name}
</span>
</div>
</Tooltip>
);
})}
</div>
)}
>
<div
className={'flex items-center gap-1'}
style={{
// color: 'var(--bakaui-primary)'
}}
>
<StandardValueIcon valueType={target.valueType} className={'text-small'} />
<span className={'break-all'}>
{target.name}
</span>
</div>
</Tooltip>
);
})}
</div>
<Divider />
<div className={'flex items-center justify-between gap-1 mt-1'}>
<div className="flex items-center gap-1 mt-1">
{/* <Button */}
{/* size={'sm'} */}
{/* variant={'light'} */}
{/* color={'primary'} */}
{/* onClick={() => { */}
{/* createPortal(Modal, { */}
{/* defaultVisible: true, */}
{/* title: t('Enhance manually'), */}
{/* children: ( */}
{/* <div> */}
{/* {t('This may take a very long time to complete. Are you sure you want to continue?')} */}
{/* </div> */}
{/* ), */}
{/* onOk: async () => { */}
</div>
<Divider />
<div className={'flex items-center justify-between gap-1 mt-1'}>
<div className="flex items-center gap-1 mt-1">
<Popover
trigger={(
<Button
isIconOnly
size={'sm'}
variant={'light'}
>
<MoreOutlined />
</Button>
)}
placement={'top'}
>
<Listbox
aria-label="Delete enhancement records"
onAction={(key) => {
let title: string;
let callApi: (() => Promise<any>) | undefined;

{/* }, */}
{/* }); */}
{/* }} */}
{/* > */}
{/* {t('Enhance now')} */}
{/* </Button> */}
</div>
<div className="flex items-center gap-1 mt-1">
<EnhancerTargetNotSetupTip
enhancer={e}
options={ceo}
/>
<Button
size={'sm'}
variant={'light'}
color={'primary'}
onClick={() => {
createPortal(CategoryEnhancerOptionsDialog, {
enhancer: e,
categoryId,
onDestroyed: init,
});
}}
>
{t('Setup')}
</Button>
<Checkbox
size={'sm'}
isSelected={ceo?.active}
onValueChange={(c) => {
BApi.category.patchCategoryEnhancerOptions(categoryId, e.id, {
active: c,
}).then(() => {
patchCategoryEnhancerOptions(e.id, { active: c });
switch (key) {
case 'Category':
title = t('Delete all enhancement records of this enhancer for category {{categoryName}}', { categoryName: category!.name });
callApi = async () => await BApi.category.deleteEnhancementsByCategory(category!.id);
break;
case 'All':
title = t('Delete all enhancement records of this enhancer');
callApi = async () => await BApi.enhancer.deleteEnhancementsByEnhancer(e.id);
break;
default:
return;
}

createPortal(Modal, {
defaultVisible: true,
title,
onOk: callApi,
});
}}
>
{t('Enable')}
</Checkbox>
</div>
<ListboxItem
key={'Category'}
color={'danger'}
className={'text-danger'}
>
{t('Delete all enhancement records of this enhancer for category {{categoryName}}', { categoryName: category?.name })}
</ListboxItem>
<ListboxItem
key={'All'}
color={'danger'}
className={'text-danger'}
>
{t('Delete all enhancement records of this enhancer')}
</ListboxItem>
</Listbox>
</Popover>
</div>
<div className="flex items-center gap-1 mt-1">
<EnhancerTargetNotSetupTip
enhancer={e}
options={ceo}
/>
<Button
size={'sm'}
variant={'light'}
color={'primary'}
onClick={() => {
createPortal(CategoryEnhancerOptionsDialog, {
enhancer: e,
categoryId,
onDestroyed: init,
});
}}
>
{t('Setup')}
</Button>
<Checkbox
size={'sm'}
isSelected={ceo?.active}
onValueChange={(c) => {
BApi.category.patchCategoryEnhancerOptions(categoryId, e.id, {
active: c,
}).then(() => {
patchCategoryEnhancerOptions(e.id, { active: c });
});
}}
>
{t('Enable')}
</Checkbox>
</div>
</div>
);
})}
</div>
);
})}
</div>
</Modal>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const ResourceCover = React.forwardRef((props: Props, ref) => {
}
if (refresh) {
for (let i = 0; i < urls.length; i++) {
urls[i] += `&v=${uuidv4()}`;
urls[i] += urls[i].includes('?') ? `&v=${uuidv4()}` : `?v=${uuidv4()}`;
}
}
setUrls(urls);
Expand Down
4 changes: 3 additions & 1 deletion src/ClientApp/src/localization/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -1395,5 +1395,7 @@
"Check type conversion overview": "查看类型转换概览",
"Type conversion overview": "类型转换总览",
"Type to be converted": "待转换类型",
"Value to be converted": "待转换值"
"Value to be converted": "待转换值",
"Delete all enhancement records of this enhancer for category {{categoryName}}": "删除分类 {{categoryName}} 下所有当前增强器的增强记录",
"Delete all enhancement records of this enhancer": "删除当前增强器的所有增强记录"
}
Loading

0 comments on commit 81a313d

Please sign in to comment.