Skip to content

Commit

Permalink
fix: service support set description field (#206)
Browse files Browse the repository at this point in the history
* fix: service support set description field

* fix: undefined string bug

* fix: update title display
  • Loading branch information
BoBoooooo authored Sep 9, 2024
1 parent ea96872 commit 79f9a8c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions apps/playground/src/helpers/mock-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,16 @@ export default defineServices({
add: {
url: 'https://nei.hz.netease.com/api/apimock-v2/c45109399a1d33d83e32a59984b25b00/api/users',
method: 'post',
description: '新增用户'
},
update: {
url: 'https://nei.hz.netease.com/api/apimock-v2/c45109399a1d33d83e32a59984b25b00/api/users',
method: 'post',
description: '更新用户'
},
delete: {
url: 'https://nei.hz.netease.com/api/apimock-v2/c45109399a1d33d83e32a59984b25b00/api/users?id=1',
description: '删除用户'
},
});
`;
Expand Down
15 changes: 9 additions & 6 deletions packages/context/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,15 @@ export const useWorkspaceData = () => {
key: prefix,
selectable: false,
showAddButton: true,
children: Object.keys(file.serviceFunctions || {}).map((key) => ({
title: key,
key: [prefix, key].join('.'),
type: 'function',
showRemoveButton: true,
})),
children: Object.entries(file.serviceFunctions || {}).map(([key, value]) => {
const title = value.description ? `${key}(${value.description})` : key;
return {
title,
key: [prefix, key].join('.'),
type: 'function',
showRemoveButton: true,
};
}),
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export function AddServiceForm({
>
<Input placeholder="请输入数据服务调用名称" disabled={disabled || isModifyMode} />
</Form.Item>
{/* 备注 */}
<Form.Item label="备注" name="description">
<Input placeholder="请输入备注信息" />
</Form.Item>
<Form.Item label="路径" name="url" rules={[{ required: true, type: 'url' }]}>
<Input placeholder="请输入数据服务调用名称" disabled={disabled || isModifyMode} />
</Form.Item>
Expand Down

0 comments on commit 79f9a8c

Please sign in to comment.