Skip to content

Commit

Permalink
Merge pull request #334 from richard-cox/fix-dead-namespace-link
Browse files Browse the repository at this point in the history
Redirect namespace links in masthead to namespace list with filter
  • Loading branch information
richard-cox authored Sep 4, 2023
2 parents f3aac70 + f3da84d commit 39aee3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions dashboard/pkg/epinio/list/namespaces.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export default {
:groupable="false"
:schema="schema"
key-field="_key"
:useQueryParamsForSimpleFiltering="true"
v-on="$listeners"
/>
<div
Expand Down
12 changes: 8 additions & 4 deletions dashboard/pkg/epinio/models/epinio-namespaced-resource.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { EPINIO_TYPES } from '../types';
import { createEpinioRoute } from '../utils/custom-routing';
import EpinioResource from './epinio-resource';

Expand Down Expand Up @@ -75,11 +76,14 @@ export default class EpinioMetaResource extends EpinioResource {
}

get namespaceLocation() {
return createEpinioRoute(`c-cluster-resource-id`, {
// This should normally redirect the user to the namespace details page.
// However none exists in epinio, so go to the list view with a filter for the name.
// This could result in false positives (namespaces: a, aa, aaa would all show up if user when to view namespace with name `a`)
// but is better than a dead end
return createEpinioRoute(`c-cluster-resource`, {
cluster: this.$rootGetters['clusterId'],
resource: this.schema?.id,
id: this.meta.namespace,
});
resource: EPINIO_TYPES.NAMESPACE,
}, { query: { q: this.meta.namespace } });
}

async forceFetch() {
Expand Down

0 comments on commit 39aee3b

Please sign in to comment.