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

feat(mis): charge_record 表增加字段 user_id 及 metadata 以存储更多的信息 #1072

Merged
merged 20 commits into from
Jan 30, 2024

Conversation

tongchong
Copy link
Contributor

@tongchong tongchong commented Jan 17, 2024

一、charge_record 表增加字段 user_id 及 metadata

charge 接口增加可选入参 user_id
charge 接口增加可选入参 metadata

二、在各消费记录页面中增加以下内容

1.查询结果中的用户显示
2.按用户ID检索
3.增加可选导出用户ID功能
image
image
image

三、mis.yaml中增加jobChargeMetadata配置

# 自定义消费表单其他存储内容
jobChargeMetadata:
  # 可选。需要保存的作业的字段,字段参考src/entities/JobInfo
  savedFields: ["idJob", "account"]

  # 可选。定义显示出来的格式。如果不配置,直接显示上面保存的字段的信息
  displayFormats:
    # i18n格式,在不同语言下,把元数据按不同格式显示出来
    # 或字符串格式,直接显示字符串
    i18n:
      default: "账户 {{ account }} 的作业ID {{ idJob }} 的计费"
      en: "The billing for  jobId {{ idJob }} of Account {{ account }}"
      zh_cn: "账户 {{ account }} 的作业ID {{ idJob }} 的计费"

metadata前端展示效果

1.没有配置jobChargeMetadata中的saveFields,不展示相关信息

image

2.已配置jobChargeMetadata中的saveFields

(1).displayFormats的类型为i18n对象时

image
image

(2).displayFormats的类型为字符串时 (支持使用占位符 {{ 属性名 }})

image

(3).没有配置displayFormats时

image

3.特殊情况: 配置的jobChargeMetadata发生改动

之前保存的信息与当前displayFormats占位属性不一致,则之前没有保存过的占位属性显示为"-"
image

上述字段及接口的修改,测试时需要注意的地方为

  1. 同步成功作业扣费时
  2. 修改作业价格时
  3. 其他服务调用scow计费api时

Copy link

changeset-bot bot commented Jan 17, 2024

🦋 Changeset detected

Latest commit: 211897b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@scow/lib-config Patch
@scow/config Patch
@scow/mis-server Patch
@scow/mis-web Patch
@scow/grpc-api Minor
@scow/audit-server Patch
@scow/auth Patch
@scow/cli Patch
@scow/gateway Patch
@scow/portal-server Patch
@scow/portal-web Patch
@scow/test-adapter Patch
@scow/lib-hook Patch
@scow/lib-operation-log Patch
@scow/lib-server Patch
@scow/protos Patch
@scow/lib-scheduler-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (0ed3ffe) 68.47% compared to head (211897b) 68.42%.
Report is 1 commits behind head on master.

Files Patch % Lines
...s-server/src/migrations/Migration20240118021127.ts 52.63% 9 Missing ⚠️
apps/mis-server/src/services/charging.ts 83.33% 0 Missing and 1 partial ⚠️
apps/mis-server/src/services/export.ts 0.00% 0 Missing and 1 partial ⚠️
apps/mis-server/src/tasks/fetch.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1072      +/-   ##
==========================================
- Coverage   68.47%   68.42%   -0.06%     
==========================================
  Files         143      144       +1     
  Lines        4317     4348      +31     
  Branches      583      587       +4     
==========================================
+ Hits         2956     2975      +19     
- Misses       1238     1248      +10     
- Partials      123      125       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@piccaSun piccaSun marked this pull request as ready for review January 29, 2024 10:54
@pkuhpc-review-bot pkuhpc-review-bot bot added the Code-ReviewRequested Code Review Requested label Jan 29, 2024
protos/server/charging.proto Outdated Show resolved Hide resolved
apps/mis-web/src/utils/metadata.ts Outdated Show resolved Hide resolved
@pkuhpc-review-bot pkuhpc-review-bot bot added Code-ChangeRequested and removed Code-ReviewRequested Code Review Requested labels Jan 29, 2024
@pkuhpc-review-bot pkuhpc-review-bot bot added the E2E-ReviewRequested E2E Test requested label Jan 30, 2024
@lyl-available
Copy link
Contributor

数据量过大时会出现超时问题,后续可以优化一下
image

@piccaSun
Copy link
Contributor

piccaSun commented Jan 30, 2024

数据量过大时会出现超时问题,后续可以优化一下

这是测试环境外层nginx的限制,proxyReadTimeout: 60s 的默认值, nginx 最大等待响应时间是60s 只要是大数据查询暂时应该都会有这个问题
image

Copy link
Contributor

github-actions bot commented Jan 30, 2024

PR Preview Action v1.4.6
Preview removed because the pull request was closed.
2024-01-30 14:20 UTC

@pkuhpc-review-bot pkuhpc-review-bot bot added E2E-Approved E2E Test approved and removed E2E-ReviewRequested E2E Test requested labels Jan 30, 2024
@piccaSun piccaSun requested a review from ddadaal January 30, 2024 11:05
@pkuhpc-review-bot pkuhpc-review-bot bot added Code-ReviewRequested Code Review Requested and removed Code-ChangeRequested labels Jan 30, 2024
Copy link
Member

@ddadaal ddadaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

再写个changeset说明这个PR还给ChargeRecord的一些字段加上了索引

.changeset/nasty-garlics-help.md Outdated Show resolved Hide resolved
protos/server/export.proto Outdated Show resolved Hide resolved
protos/server/charging.proto Outdated Show resolved Hide resolved
protos/server/charging.proto Outdated Show resolved Hide resolved
@pkuhpc-review-bot pkuhpc-review-bot bot added Code-ChangeRequested and removed Code-ReviewRequested Code Review Requested labels Jan 30, 2024
@piccaSun
Copy link
Contributor

审核意见已修改,本地及62测试环境已对修改处测试通过,请再次确认

@piccaSun piccaSun requested a review from ddadaal January 30, 2024 14:17
@pkuhpc-review-bot pkuhpc-review-bot bot added Code-ReviewRequested Code Review Requested and removed Code-ChangeRequested labels Jan 30, 2024
@pkuhpc-review-bot pkuhpc-review-bot bot added Code-Approved Code Review approved ReadyForMerge Ready for merge and removed Code-ReviewRequested Code Review Requested labels Jan 30, 2024
@ddadaal ddadaal merged commit afc3350 into master Jan 30, 2024
11 checks passed
@ddadaal ddadaal deleted the feat-charge-record branch January 30, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code-Approved Code Review approved E2E-Approved E2E Test approved ReadyForMerge Ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants