mirror of https://github.com/rancher/dashboard.git
fix harvester members
This commit is contained in:
parent
cc04321179
commit
840d1518f1
|
|
@ -0,0 +1,6 @@
|
|||
<script>
|
||||
import ExplorerMembers from '@shell/components/ExplorerMembers';
|
||||
export default { components: { ExplorerMembers } };
|
||||
</script>
|
||||
|
||||
<template><ExplorerMembers v-bind="$attrs" /></template>
|
||||
|
|
@ -10,6 +10,7 @@ import CreateHarvesterResource from '../pages/c/_cluster/_resource/create.vue';
|
|||
import ViewHarvesterResource from '../pages/c/_cluster/_resource/_id.vue';
|
||||
import ViewHarvesterNsResource from '../pages/c/_cluster/_resource/_namespace/_id.vue';
|
||||
import HarvesterAirgapUpdgrade from '../pages/c/_cluster/airgapupgrade/index.vue';
|
||||
import HarvesterMembers from '../pages/c/_cluster/members/index.vue';
|
||||
|
||||
const routes: RouteConfig[] = [
|
||||
{
|
||||
|
|
@ -32,6 +33,11 @@ const routes: RouteConfig[] = [
|
|||
path: `/:product/c/:cluster/airgapupgrade`,
|
||||
component: HarvesterAirgapUpdgrade,
|
||||
},
|
||||
{
|
||||
name: `${ PRODUCT_NAME }-c-cluster-members`,
|
||||
path: `/:product/c/:cluster/members`,
|
||||
component: HarvesterMembers,
|
||||
},
|
||||
{
|
||||
name: `${ PRODUCT_NAME }`,
|
||||
path: `/:product`,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,108 @@
|
|||
<script>
|
||||
import { MANAGEMENT, NORMAN, VIRTUAL_TYPES } from '@shell/config/types';
|
||||
import ResourceTable from '@shell/components/ResourceTable';
|
||||
import Loading from '@shell/components/Loading';
|
||||
import Masthead from '@shell/components/ResourceList/Masthead';
|
||||
import { AGE, ROLE, STATE, PRINCIPAL } from '@shell/config/table-headers';
|
||||
import { canViewClusterPermissionsEditor } from '@shell/components/form/Members/ClusterPermissionsEditor.vue';
|
||||
import Banner from '@components/Banner/Banner.vue';
|
||||
|
||||
/**
|
||||
* Explorer members page.
|
||||
* Route: /c/local/explorer/members
|
||||
*/
|
||||
export default {
|
||||
name: 'ExplorerMembers',
|
||||
|
||||
components: {
|
||||
Banner,
|
||||
Loading,
|
||||
Masthead,
|
||||
ResourceTable
|
||||
},
|
||||
|
||||
async fetch() {
|
||||
const clusterRoleTemplateBindingSchema = this.$store.getters[
|
||||
`rancher/schemaFor`
|
||||
](NORMAN.CLUSTER_ROLE_TEMPLATE_BINDING);
|
||||
|
||||
const hydration = [
|
||||
clusterRoleTemplateBindingSchema ? this.$store.dispatch(
|
||||
`rancher/findAll`,
|
||||
{ type: NORMAN.CLUSTER_ROLE_TEMPLATE_BINDING },
|
||||
{ root: true }
|
||||
) : [],
|
||||
clusterRoleTemplateBindingSchema ? this.$store.dispatch(`management/findAll`, { type: MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING }) : [],
|
||||
this.$store.dispatch('rancher/findAll', { type: NORMAN.PRINCIPAL }),
|
||||
this.$store.dispatch(`management/findAll`, { type: MANAGEMENT.USER }),
|
||||
this.$store.dispatch(`management/findAll`, { type: MANAGEMENT.ROLE_TEMPLATE })
|
||||
];
|
||||
const [clusterRoleTemplateBindings] = await Promise.all(hydration);
|
||||
const steveBindings = await Promise.all(
|
||||
clusterRoleTemplateBindings.map(b => b.steve)
|
||||
);
|
||||
|
||||
this.$set(this, 'clusterRoleTemplateBindings', steveBindings);
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
schema: this.$store.getters[`management/schemaFor`](
|
||||
MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING
|
||||
),
|
||||
headers: [STATE, PRINCIPAL, ROLE, AGE],
|
||||
createLocation: {
|
||||
name: 'c-cluster-product-resource-create',
|
||||
params: {
|
||||
product: this.$store.getters['currentProduct'].name,
|
||||
resource: MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING
|
||||
}
|
||||
},
|
||||
resource: MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING,
|
||||
clusterRoleTemplateBindings: [],
|
||||
VIRTUAL_TYPES
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
filteredClusterRoleTemplateBindings() {
|
||||
return this.clusterRoleTemplateBindings.filter(
|
||||
b => b.clusterName === this.$store.getters['currentCluster'].id
|
||||
);
|
||||
},
|
||||
canManageMembers() {
|
||||
return canViewClusterPermissionsEditor(this.$store);
|
||||
},
|
||||
isLocal() {
|
||||
return this.$store.getters['currentCluster'].isLocal;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Loading v-if="$fetchState.pending" />
|
||||
<div v-else>
|
||||
<Masthead
|
||||
:schema="schema"
|
||||
:resource="resource"
|
||||
:favorite-resource="VIRTUAL_TYPES.CLUSTER_MEMBERS"
|
||||
:create-location="createLocation"
|
||||
:create-button-label="t('members.createActionLabel')"
|
||||
/>
|
||||
<Banner
|
||||
v-if="isLocal"
|
||||
color="error"
|
||||
:label="t('members.localClusterWarning')"
|
||||
/>
|
||||
<ResourceTable
|
||||
:schema="schema"
|
||||
:headers="headers"
|
||||
:rows="filteredClusterRoleTemplateBindings"
|
||||
:groupable="false"
|
||||
:namespaced="false"
|
||||
sub-search="subSearch"
|
||||
:sub-fields="['nameDisplay']"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -1,96 +1,6 @@
|
|||
<script>
|
||||
import { MANAGEMENT, NORMAN, VIRTUAL_TYPES } from '@shell/config/types';
|
||||
import ResourceTable from '@shell/components/ResourceTable';
|
||||
import Loading from '@shell/components/Loading';
|
||||
import Masthead from '@shell/components/ResourceList/Masthead';
|
||||
import { AGE, ROLE, STATE, PRINCIPAL } from '@shell/config/table-headers';
|
||||
import { canViewClusterPermissionsEditor } from '@shell/components/form/Members/ClusterPermissionsEditor.vue';
|
||||
import Banner from '@components/Banner/Banner.vue';
|
||||
|
||||
/**
|
||||
* Explorer members page.
|
||||
* Route: /c/local/explorer/members
|
||||
*/
|
||||
export default {
|
||||
|
||||
name: 'ExplorerMembers',
|
||||
|
||||
components: {
|
||||
Banner, Loading, Masthead, ResourceTable
|
||||
},
|
||||
|
||||
async fetch() {
|
||||
const clusterRoleTemplateBindingSchema = this.$store.getters[`rancher/schemaFor`](NORMAN.CLUSTER_ROLE_TEMPLATE_BINDING);
|
||||
|
||||
const hydration = [
|
||||
clusterRoleTemplateBindingSchema ? this.$store.dispatch(`rancher/findAll`, { type: NORMAN.CLUSTER_ROLE_TEMPLATE_BINDING }, { root: true }) : [],
|
||||
clusterRoleTemplateBindingSchema ? this.$store.dispatch(`management/findAll`, { type: MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING }) : [],
|
||||
this.$store.dispatch('rancher/findAll', { type: NORMAN.PRINCIPAL }),
|
||||
this.$store.dispatch(`management/findAll`, { type: MANAGEMENT.USER }),
|
||||
this.$store.dispatch(`management/findAll`, { type: MANAGEMENT.ROLE_TEMPLATE }),
|
||||
];
|
||||
const [clusterRoleTemplateBindings] = await Promise.all(hydration);
|
||||
const steveBindings = await Promise.all(clusterRoleTemplateBindings.map(b => b.steve));
|
||||
|
||||
this.$set(this, 'clusterRoleTemplateBindings', steveBindings);
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
schema: this.$store.getters[`management/schemaFor`](MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING),
|
||||
headers: [
|
||||
STATE,
|
||||
PRINCIPAL,
|
||||
ROLE,
|
||||
AGE
|
||||
],
|
||||
createLocation: {
|
||||
name: 'c-cluster-product-resource-create',
|
||||
params: {
|
||||
product: this.$store.getters['currentProduct'].name,
|
||||
resource: MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING,
|
||||
}
|
||||
},
|
||||
resource: MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING,
|
||||
clusterRoleTemplateBindings: [],
|
||||
VIRTUAL_TYPES
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
filteredClusterRoleTemplateBindings() {
|
||||
return this.clusterRoleTemplateBindings
|
||||
.filter(b => b.clusterName === this.$store.getters['currentCluster'].id);
|
||||
},
|
||||
canManageMembers() {
|
||||
return canViewClusterPermissionsEditor(this.$store);
|
||||
},
|
||||
isLocal() {
|
||||
return this.$store.getters['currentCluster'].isLocal;
|
||||
}
|
||||
},
|
||||
};
|
||||
import ExplorerMembers from '@shell/components/ExplorerMembers';
|
||||
export default { components: { ExplorerMembers } };
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Loading v-if="$fetchState.pending" />
|
||||
<div v-else>
|
||||
<Masthead
|
||||
:schema="schema"
|
||||
:resource="resource"
|
||||
:favorite-resource="VIRTUAL_TYPES.CLUSTER_MEMBERS"
|
||||
:create-location="createLocation"
|
||||
:create-button-label="t('members.createActionLabel')"
|
||||
/>
|
||||
<Banner v-if="isLocal" color="error" :label="t('members.localClusterWarning')" />
|
||||
<ResourceTable
|
||||
:schema="schema"
|
||||
:headers="headers"
|
||||
:rows="filteredClusterRoleTemplateBindings"
|
||||
:groupable="false"
|
||||
:namespaced="false"
|
||||
sub-search="subSearch"
|
||||
:sub-fields="['nameDisplay']"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template><ExplorerMembers v-bind="$attrs" /></template>
|
||||
|
|
|
|||
|
|
@ -1375,23 +1375,21 @@ export default class Resource {
|
|||
|
||||
const dispatch = this.$dispatch('request', { opt, type: this.type });
|
||||
|
||||
return !alertOnError
|
||||
? dispatch
|
||||
: dispatch.catch((e) => {
|
||||
const title = this.t('resource.errors.update', { name: this.name });
|
||||
return !alertOnError ? dispatch : dispatch.catch((e) => {
|
||||
const title = this.t('resource.errors.update', { name: this.name });
|
||||
|
||||
console.error(title, e); // eslint-disable-line no-console
|
||||
console.error(title, e); // eslint-disable-line no-console
|
||||
|
||||
this.$dispatch(
|
||||
'growl/error',
|
||||
{
|
||||
title,
|
||||
message: e?.message,
|
||||
timeout: 5000
|
||||
},
|
||||
{ root: true }
|
||||
);
|
||||
});
|
||||
this.$dispatch(
|
||||
'growl/error',
|
||||
{
|
||||
title,
|
||||
message: e?.message,
|
||||
timeout: 5000
|
||||
},
|
||||
{ root: true }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
save() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue