Resource fetching missing projectid: "-1" parameter
- 主要语言
- Java
- 星标
- 3.1k
- 派生
- 1.4k
- 平均合并
- 6 天 19 小时
- 30 天内合并 PR
- 32
描述
### problem
When viewing a resource, for example an instance, that is currently in a project that differs from the currently selected or global project scope, it will attempt to fetch volumes yet none will return as it is only filtering on the ones that are owned by this user (not the project user).
### versions
The only relevant version is the UI and management server; replicated on 4.23.0.0. Also replicated this issue to the current HEAD of `main`.
### The steps to reproduce the bug
1. Create a project "test".
2. Create (for example) and instance under that project "instance-01".
3. (Optionally) add another volume to this instance.
4. Make sure you have no project enabled at the top of the page ("Default view").
5. Go to instances, turn on the project slider and select "instance-01" in the list.
6. Browse to the Volumes tab and notice that this list is empty.
### What to do about it?
Add the `{projectid: "-1"}` parameter to this API call. Unsure whether this happens to other resources (like NICs), I have not tested this.
```diff
diff --git a/ui/src/components/view/VolumesTab.vue b/ui/src/components/view/VolumesTab.vue
index b65933a643..e4679c02dc 100644
--- a/ui/src/components/view/VolumesTab.vue
+++ b/ui/src/components/view/VolumesTab.vue
@@ -141,7 +141,7 @@ export default {
}
},
getVolumes () {
- getAPI('listVolumes', { listall: true, listsystemvms: true, virtualmachineid: this.vm.id }).then(json => {
+ getAPI('listVolumes', { listall: true, listsystemvms: true, projectid: "-1", virtualmachineid: this.vm.id }).then(json => {
this.volumes = json.listvolumesresponse.volume
if (this.volumes) {
this.volumes.sort((a, b) => { return a.deviceid - b.deviceid })
```
贡献指南
调研方向
从 ui/src/components/view/VolumesTab.vue 中的 getVolumes 方法及其 listVolumes API 调用开始。确认请求包含 projectid: "-1",然后复现所列出的 project-scope 场景,并确认实例的 Volumes 选项卡在默认视图中显示其卷。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 活跃度
- 活跃
- 描述清晰度
- 描述清楚
- 新手友好度
- 88/100