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

插件提供的静态资源建议添加缓存标识 #3205

Closed
ruibaby opened this issue Feb 2, 2023 · 8 comments · Fixed by #3381
Closed

插件提供的静态资源建议添加缓存标识 #3205

ruibaby opened this issue Feb 2, 2023 · 8 comments · Fixed by #3381
Assignees
Labels
area/core Issues or PRs related to the Halo Core good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to a improvement. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Milestone

Comments

@ruibaby
Copy link
Member

ruibaby commented Feb 2, 2023

你当前使用的版本

2.2.0

描述一下此特性

目前在 #3074 中对静态资源做了缓存策略的处理,但目前发现插件如果包含了静态资源,升级之后无法及时更新。

比如插件的静态资源为 /plugins/PluginLinks/assets/console/main.js,在未来某个版本更新了这个资源,那么在用户升级插件的时候就无法获取到新的资源。

目前设想的解决方案:

  1. 添加版本的 path,如:/plugins/PluginLinks/1.1.0/assets/console/main.js
  2. 添加版本的参数,如:/plugins/PluginLinks/assets/console/main.js?version=1.1.0

/kind improvement
/area core

附加信息

No response

@f2c-ci-robot f2c-ci-robot bot added kind/improvement Categorizes issue or PR as related to a improvement. area/core Issues or PRs related to the Halo Core labels Feb 2, 2023
@ruibaby ruibaby added this to the 2.3.x milestone Feb 2, 2023
@JohnNiang
Copy link
Member

IMO,更倾向方案 2。这样既能缓存,也能在切换版本的时候忽略缓存。

@ruibaby
Copy link
Member Author

ruibaby commented Feb 2, 2023

@guqing 这个改动应该是不涉及到太多的业务,是否可以标记为 good-first-issue

@guqing
Copy link
Member

guqing commented Feb 2, 2023

在以下部分设置两个链接时追加一个参数即可

status.setEntry(jsBundlePath);
String cssBundlePath =
BundleResourceUtils.getCssBundlePath(haloPluginManager, pluginName);
status.setStylesheet(cssBundlePath);

/kind good-first-issue

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Feb 2, 2023

@guqing: The label(s) kind/good-first-issue cannot be applied, because the repository doesn't have them.

In response to this:

在以下部分设置两个链接时追加一个参数即可

status.setEntry(jsBundlePath);
String cssBundlePath =
BundleResourceUtils.getCssBundlePath(haloPluginManager, pluginName);
status.setStylesheet(cssBundlePath);

/kind good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@halo-dev halo-dev deleted a comment from f2c-ci-robot bot Feb 2, 2023
@guqing guqing added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Feb 2, 2023
@JohnNiang
Copy link
Member

/good-first-issue

@JohnNiang
Copy link
Member

Duplicate #3137

@ruibaby
Copy link
Member Author

ruibaby commented Feb 17, 2023

/assign @guqing

@ruibaby
Copy link
Member Author

ruibaby commented Feb 21, 2023

/unassign @guqing
/assign @LIlGG

@f2c-ci-robot f2c-ci-robot bot assigned LIlGG and unassigned guqing Feb 21, 2023
@ruibaby ruibaby added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Feb 22, 2023
JohnNiang pushed a commit that referenced this issue Feb 24, 2023
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.3.x

#### What this PR does / why we need it:
对插件的静态资源(js, css) 增加 version 版本号,用于解决插件静态资源缓存的问题。另外同时也对插件 Logo 增加了版本号标识。

#### Which issue(s) this PR fixes:
Fixes #3205 

#### Special notes for your reviewer:
验证 Console 端插件静态资源链接是否携带 `version={pluginVersion}` 。

特别的,对于 logo只会增加相对路径下的地址,绝对路径的地址将直接返回原始路径/值。

#### Does this PR introduce a user-facing change?

```release-note
为插件静态资源路径增加版本标识以解决缓存更新不及时的问题
```
@ruibaby ruibaby modified the milestones: 2.3.x, 2.3.0 Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to a improvement. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants