Skip to content

Commit

Permalink
Volumes and plugins navigation fixes, generally
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Nov 22, 2024
1 parent 642e33a commit 8563e4b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/24542.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Fix an issue where volumes weren't navigable
```
8 changes: 8 additions & 0 deletions ui/app/adapters/volume.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ import classic from 'ember-classic-decorator';

@classic
export default class VolumeAdapter extends WatchableNamespaceIDs {
// Over in serializers/volume.js, we prepend csi/ as part of the hash ID for request resolution reasons.
// However, this is not part of the actual ID stored in the database and we should treat it like a regular, unescaped
// path segment.
urlForFindRecord() {
let url = super.urlForFindRecord(...arguments);
return url.replace('csi%2F', 'csi/');
}

queryParamsToAttrs = {
type: 'type',
plugin_id: 'plugin.id',
Expand Down
10 changes: 4 additions & 6 deletions ui/app/controllers/csi/volumes/volume.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ export default class VolumeController extends Controller {

get breadcrumbs() {
const volume = this.volume;
if (!volume) {
return [];
}
return [
{
label: 'Volumes',
args: [
'csi.volumes',
qpBuilder({
volumeNamespace: volume.get('namespace.name') || 'default',
}),
],
args: ['csi.volumes'],
},
{
label: volume.name,
Expand Down
2 changes: 1 addition & 1 deletion ui/app/helpers/lazy-click.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Helper from '@ember/component/helper';
* that should be handled instead.
*/
export function lazyClick([onClick, event]) {
if (!['a', 'button'].includes(event?.target.tagName.toLowerCase())) {
if (!['a', 'button'].includes(event?.target?.tagName.toLowerCase())) {
onClick(event);
}
}
Expand Down
7 changes: 6 additions & 1 deletion ui/app/templates/csi/plugins/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
</t.head>
<t.body @key="model.id" as |row|>
<tr class="is-interactive" data-test-plugin-row {{on "click" (action "gotoPlugin" row.model)}}>
<td data-test-plugin-id>
<td data-test-plugin-id
{{keyboard-shortcut
enumerated=true
action=(action "gotoPlugin" row.model)
}}
>
<LinkTo @route="csi.plugins.plugin" @model={{row.model.plainId}} class="is-primary">{{row.model.plainId}}</LinkTo>
</td>
<td data-test-plugin-controller-health>
Expand Down
4 changes: 2 additions & 2 deletions ui/app/templates/csi/volumes/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
{{on "click" (action "gotoVolume" row.model)}}
>
<td data-test-volume-name
{{keyboard-shortcut
{{keyboard-shortcut
enumerated=true
action=(action "gotoVolume" row.model)
}}
Expand Down Expand Up @@ -180,4 +180,4 @@
{{/if}}
</div>
{{/if}}
</section>
</section>

0 comments on commit 8563e4b

Please sign in to comment.