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: make attachment list item operations extendable #4689

Merged

Conversation

ruibaby
Copy link
Member

@ruibaby ruibaby commented Oct 8, 2023

What type of PR is this?

/area console
/kind feature
/milestone 2.10.x

What this PR does / why we need it:

附件管理列表项的操作按钮支持被插件扩展。

image

Which issue(s) this PR fixes:

Fixes #4667

Special notes for your reviewer:

需要测试附件的关于列表的已有功能是否正常。

如果需要测试扩展点是否有效,可以使用此插件测试:plugin-s3-1.5.0-SNAPSHOT.jar.zip

export default definePlugin({
  components: {},
  routes: [],
  extensionPoints: {
    "plugin:self:tabs:create": (): PluginTab[] => {
      return [
        {
          id: "s3-link",
          label: "关联S3文件",
          component: markRaw(HomeView),
          permissions: [],
        },
      ];
    },
+    "attachment:list-item:operation:create": (attachment: Ref<Attachment>) => {
+      return [
+        {
+          priority: 21,
+          component: markRaw(VDropdownDivider),
+        },
+        {
+          priority: 22,
+          component: markRaw(VDropdownItem),
+          props: {
+            type: "danger",
+          },
+          label: "解除 S3 关联",
+          permissions: ["system:attachments:manage"],
+          action: () => {
+            console.log(attachment);
+          },
+        },
+      ];
+    },
  },
});

Does this PR introduce a user-facing change?

Console 附件管理列表项的操作按钮支持被插件扩展。

Signed-off-by: Ryan Wang <i@ryanc.cc>
@f2c-ci-robot f2c-ci-robot bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Oct 8, 2023
@f2c-ci-robot f2c-ci-robot bot added this to the 2.10.x milestone Oct 8, 2023
@f2c-ci-robot f2c-ci-robot bot added the area/console Issues or PRs related to the Halo Console label Oct 8, 2023
@f2c-ci-robot f2c-ci-robot bot requested review from Aanko and guqing October 8, 2023 07:07
@f2c-ci-robot f2c-ci-robot bot added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 8, 2023
@ruibaby
Copy link
Member Author

ruibaby commented Oct 8, 2023

cc @longjuan

@codecov
Copy link

codecov bot commented Oct 8, 2023

Codecov Report

Merging #4689 (1a6de5f) into main (d443c3e) will not change coverage.
Report is 4 commits behind head on main.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main    #4689   +/-   ##
=========================================
  Coverage     61.73%   61.73%           
  Complexity     2781     2781           
=========================================
  Files           402      402           
  Lines         14584    14584           
  Branches       1011     1011           
=========================================
  Hits           9003     9003           
  Misses         5092     5092           
  Partials        489      489           

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Oct 8, 2023
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

/approve

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 8, 2023
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

/approve

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 8, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot merged commit da02165 into halo-dev:main Oct 8, 2023
2 checks passed
@ruibaby ruibaby modified the milestones: 2.10.x, 2.10.0 Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/console Issues or PRs related to the Halo Console kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

期望增加对第三方存储仅删除附件记录而不实际删除文件的功能
2 participants