mirror of https://github.com/rancher/dashboard.git
Merge pull request #13306 from torchiaf/13189-fleet-created-by-label
Fleet: Created By label
This commit is contained in:
commit
9e3b7b1b4e
|
|
@ -2,7 +2,8 @@ export const gitRepoCreateRequest = {
|
|||
type: 'fleet.cattle.io.gitrepo',
|
||||
metadata: {
|
||||
namespace: 'fleet-default',
|
||||
name: 'fleet-e2e-test-gitrepo'
|
||||
name: 'fleet-e2e-test-gitrepo',
|
||||
labels: {},
|
||||
},
|
||||
spec: {
|
||||
repo: 'https://github.com/rancher/fleet-test-data.git',
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ const fakeProvClusterId = 'some-fake-cluster-id';
|
|||
const fakeMgmtClusterId = 'some-fake-mgmt-id';
|
||||
|
||||
describe('Git Repo', { testIsolation: 'off', tags: ['@fleet', '@adminUser'] }, () => {
|
||||
let adminUsername = '';
|
||||
let adminUserId = '';
|
||||
|
||||
describe('Create', () => {
|
||||
const listPage = new FleetGitRepoListPagePo();
|
||||
const gitRepoCreatePage = new GitRepoCreatePo('_');
|
||||
|
|
@ -36,6 +39,11 @@ describe('Git Repo', { testIsolation: 'off', tags: ['@fleet', '@adminUser'] }, (
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.getRancherResource('v3', 'users?me=true').then((resp: Cypress.Response<any>) => {
|
||||
adminUserId = resp.body.data[0].id.trim();
|
||||
adminUsername = resp.body.data[0].username.trim();
|
||||
});
|
||||
|
||||
cy.createE2EResourceName('git-repo').as('gitRepo');
|
||||
});
|
||||
|
||||
|
|
@ -91,7 +99,10 @@ describe('Git Repo', { testIsolation: 'off', tags: ['@fleet', '@adminUser'] }, (
|
|||
return cy.wait('@interceptGitRepo');
|
||||
})
|
||||
.then(({ request, response }) => {
|
||||
gitRepoCreateRequest.metadata.labels['fleet.cattle.io/created-by-display-name'] = adminUsername;
|
||||
gitRepoCreateRequest.metadata.labels['fleet.cattle.io/created-by-user-id'] = adminUserId;
|
||||
gitRepoCreateRequest.spec.helmSecretName = secretName;
|
||||
|
||||
expect(response.statusCode).to.eq(201);
|
||||
expect(request.body).to.deep.eq(gitRepoCreateRequest);
|
||||
|
||||
|
|
|
|||
|
|
@ -5068,6 +5068,7 @@ resourceDetail:
|
|||
view: "{subtype} {name}"
|
||||
masthead:
|
||||
age: Age
|
||||
createdBy: Created by
|
||||
restartCount: Pod Restarts
|
||||
defaultBannerMessage:
|
||||
error: This resource is currently in an error state, but there isn't a detailed message available.
|
||||
|
|
|
|||
|
|
@ -504,10 +504,32 @@ export default {
|
|||
{{ namespace }}
|
||||
</span>
|
||||
</span>
|
||||
<span v-if="parent.showAge">{{ t("resourceDetail.masthead.age") }}: <LiveDate
|
||||
class="live-date"
|
||||
:value="value.creationTimestamp"
|
||||
/></span>
|
||||
<span v-if="parent.showAge">
|
||||
{{ t("resourceDetail.masthead.age") }}:
|
||||
<LiveDate
|
||||
class="live-date"
|
||||
:value="value.creationTimestamp"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
v-if="value.showCreatedBy"
|
||||
data-testid="masthead-subheader-createdBy"
|
||||
>
|
||||
{{ t("resourceDetail.masthead.createdBy") }}:
|
||||
<router-link
|
||||
v-if="value.createdBy.location"
|
||||
:to="value.createdBy.location"
|
||||
data-testid="masthead-subheader-createdBy-link"
|
||||
>
|
||||
{{ value.createdBy.displayName }}
|
||||
</router-link>
|
||||
<span
|
||||
v-else
|
||||
data-testid="masthead-subheader-createdBy_plain-text"
|
||||
>
|
||||
{{ value.createdBy.displayName }}
|
||||
</span>
|
||||
</span>
|
||||
<span v-if="value.showPodRestarts">{{ t("resourceDetail.masthead.restartCount") }}:<span class="live-data"> {{ value.restartCount }}</span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
import { mount, RouterLinkStub } from '@vue/test-utils';
|
||||
import { _VIEW } from '@shell/config/query-params';
|
||||
import Masthead from '@shell/components/ResourceDetail/Masthead.vue';
|
||||
|
||||
const mockedStore = () => {
|
||||
return {
|
||||
getters: {
|
||||
currentStore: () => 'current_store',
|
||||
currentProduct: { inStore: 'cluster' },
|
||||
isExplorer: false,
|
||||
currentCluster: {},
|
||||
'type-map/labelFor': jest.fn(),
|
||||
'type-map/optionsFor': jest.fn(),
|
||||
'current_store/schemaFor': jest.fn(),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const requiredSetup = () => {
|
||||
return {
|
||||
stubs: {
|
||||
'router-link': RouterLinkStub,
|
||||
LiveDate: true
|
||||
},
|
||||
mocks: { $store: mockedStore() }
|
||||
};
|
||||
};
|
||||
|
||||
describe('component: Masthead', () => {
|
||||
it.each([
|
||||
['hidden', '', false, { displayName: 'admin', location: { id: 'resource-id' } }, false, false],
|
||||
['plain-text', 'admin', true, { displayName: 'admin', location: null }, false, true],
|
||||
['link', 'foo', true, { displayName: 'foo', location: { id: 'resource-id' } }, true, false],
|
||||
])('"Created By" should be %p, with text: %p', (
|
||||
_,
|
||||
text,
|
||||
showCreatedBy,
|
||||
createdBy,
|
||||
showLink,
|
||||
showPlainText,
|
||||
) => {
|
||||
const wrapper = mount(Masthead, {
|
||||
props: {
|
||||
mode: _VIEW,
|
||||
value: {
|
||||
showCreatedBy,
|
||||
createdBy,
|
||||
},
|
||||
},
|
||||
global: { ...requiredSetup() }
|
||||
});
|
||||
|
||||
const container = wrapper.find('[data-testid="masthead-subheader-createdBy"]');
|
||||
const link = wrapper.find('[data-testid="masthead-subheader-createdBy-link"]');
|
||||
const plainText = wrapper.find('[data-testid="masthead-subheader-createdBy_plain-text"]');
|
||||
|
||||
expect(link.exists()).toBe(showLink);
|
||||
expect(plainText.exists()).toBe(showPlainText);
|
||||
expect(showLink || showPlainText ? container.element.textContent : '').toContain(text);
|
||||
});
|
||||
});
|
||||
|
|
@ -73,8 +73,12 @@ export default {
|
|||
return this.value.metadata.name;
|
||||
},
|
||||
|
||||
repoNamespace() {
|
||||
return this.value.metadata.namespace;
|
||||
},
|
||||
|
||||
bundleCounts() {
|
||||
const resources = this.bundles.filter((item) => item.repoName === this.repoName);
|
||||
const resources = this.bundles.filter((item) => item.namespace === this.repoNamespace && item.repoName === this.repoName);
|
||||
|
||||
if (!resources.length) {
|
||||
return [];
|
||||
|
|
@ -89,7 +93,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
const k = status?.summary.ready > 0 && status?.summary.desiredReady === status.summary.ready;
|
||||
const k = status?.summary?.ready > 0 && status?.summary.desiredReady === status?.summary?.ready;
|
||||
|
||||
if (k) {
|
||||
out.ready.count += 1;
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ const mockedBundlesInRepo = [{
|
|||
apiVersion: 'fleet.cattle.io/v1alpha1',
|
||||
kind: 'Bundle',
|
||||
repoName: REPO_NAME,
|
||||
namespace: 'fleet-default',
|
||||
metadata: {
|
||||
labels: {
|
||||
'fleet.cattle.io/commit': '3640888439d1b7b6a53dbeee291a533eea2632ab',
|
||||
'fleet.cattle.io/repo-name': REPO_NAME
|
||||
},
|
||||
|
||||
name: `${ REPO_NAME }-${ CLUSTER_NAME }-1234`,
|
||||
namespace: 'fleet-default',
|
||||
state: {
|
||||
|
|
@ -54,12 +54,12 @@ const mockedBundlesInRepo = [{
|
|||
apiVersion: 'fleet.cattle.io/v1alpha1',
|
||||
kind: 'Bundle',
|
||||
repoName: REPO_NAME,
|
||||
namespace: 'fleet-default',
|
||||
metadata: {
|
||||
labels: {
|
||||
'fleet.cattle.io/commit': '3640888439d1b7b6a53dbeee291a533eea2632ab',
|
||||
'fleet.cattle.io/repo-name': REPO_NAME
|
||||
},
|
||||
|
||||
name: `${ REPO_NAME }-${ CLUSTER_NAME }-5678`,
|
||||
namespace: 'fleet-default',
|
||||
state: {
|
||||
|
|
@ -95,14 +95,54 @@ const mockedBundlesOutOfRepo = [{
|
|||
apiVersion: 'fleet.cattle.io/v1alpha1',
|
||||
kind: 'Bundle',
|
||||
repoName: REPO_NAME_VARIANT,
|
||||
namespace: 'custom-namespace',
|
||||
metadata: {
|
||||
labels: {
|
||||
'fleet.cattle.io/commit': '3640888439d1b7b6a53dbeee291a533eea2632ab',
|
||||
'fleet.cattle.io/repo-name': REPO_NAME_VARIANT
|
||||
},
|
||||
|
||||
name: `${ REPO_NAME_VARIANT }-${ CLUSTER_NAME }-1234`,
|
||||
namespace: 'fleet-default',
|
||||
namespace: 'custom-namespace',
|
||||
state: {
|
||||
error: false,
|
||||
message: 'Resource is Ready',
|
||||
name: 'active',
|
||||
transitioning: false
|
||||
},
|
||||
},
|
||||
spec: {
|
||||
correctDrift: { },
|
||||
forceSyncGeneration: 2,
|
||||
ignore: { },
|
||||
namespace: 'custom-namespace-name',
|
||||
resources: [
|
||||
{
|
||||
content: 'apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: configmap-test\n annotations:\n {}\n# key: string\n labels:\n {}\n# key: string\ndata:\n key1: val1\n key2: val2\n key3: val3',
|
||||
name: 'test-configmap.yaml'
|
||||
}
|
||||
],
|
||||
targets: [
|
||||
{
|
||||
clusterName: 'nb-cluster0-28',
|
||||
namespace: 'custom-namespace-name'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
id: `fleet-default/${ REPO_NAME }-${ CLUSTER_NAME }-1234`,
|
||||
type: 'fleet.cattle.io.bundle',
|
||||
apiVersion: 'fleet.cattle.io/v1alpha1',
|
||||
kind: 'Bundle',
|
||||
repoName: REPO_NAME,
|
||||
namespace: 'custom-namespace',
|
||||
metadata: {
|
||||
labels: {
|
||||
'fleet.cattle.io/commit': '3640888439d1b7b6a53dbeee291a533eea2632ab',
|
||||
'fleet.cattle.io/repo-name': REPO_NAME
|
||||
},
|
||||
name: `${ REPO_NAME }-${ CLUSTER_NAME }-1234`,
|
||||
namespace: 'custom-namespace',
|
||||
state: {
|
||||
error: false,
|
||||
message: 'Resource is Ready',
|
||||
|
|
@ -135,14 +175,14 @@ const mockedBundlesOutOfRepo = [{
|
|||
apiVersion: 'fleet.cattle.io/v1alpha1',
|
||||
kind: 'Bundle',
|
||||
repoName: REPO_NAME_VARIANT,
|
||||
namespace: 'custom-namespace',
|
||||
metadata: {
|
||||
labels: {
|
||||
'fleet.cattle.io/commit': '3640888439d1b7b6a53dbeee291a533eea2632ab',
|
||||
'fleet.cattle.io/repo-name': REPO_NAME_VARIANT
|
||||
},
|
||||
|
||||
name: `${ REPO_NAME_VARIANT }-${ CLUSTER_NAME }-5678`,
|
||||
namespace: 'fleet-default',
|
||||
namespace: 'custom-namespace',
|
||||
state: {
|
||||
error: false,
|
||||
message: 'Resource is Ready',
|
||||
|
|
@ -176,7 +216,6 @@ const mockRepo = {
|
|||
apiVersion: 'fleet.cattle.io/v1alpha1',
|
||||
kind: 'GitRepo',
|
||||
metadata: {
|
||||
|
||||
name: `${ REPO_NAME }`,
|
||||
namespace: 'fleet-default',
|
||||
state: {
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ export const CATALOG = {
|
|||
};
|
||||
|
||||
export const FLEET = {
|
||||
REPO_NAME: 'fleet.cattle.io/repo-name',
|
||||
CLUSTER_DISPLAY_NAME: 'management.cattle.io/cluster-display-name',
|
||||
CLUSTER_NAME: 'management.cattle.io/cluster-name',
|
||||
BUNDLE_ID: 'fleet.cattle.io/bundle-id',
|
||||
|
|
@ -116,7 +117,9 @@ export const FLEET = {
|
|||
BUNDLE_NAMESPACE: 'fleet.cattle.io/bundle-namespace',
|
||||
MANAGED: 'fleet.cattle.io/managed',
|
||||
CLUSTER_NAMESPACE: 'fleet.cattle.io/cluster-namespace',
|
||||
CLUSTER: 'fleet.cattle.io/cluster'
|
||||
CLUSTER: 'fleet.cattle.io/cluster',
|
||||
CREATED_BY_USER_ID: 'fleet.cattle.io/created-by-user-id',
|
||||
CREATED_BY_USER_NAME: 'fleet.cattle.io/created-by-display-name',
|
||||
};
|
||||
|
||||
export const RBAC = { PRODUCT: 'management.cattle.io/ui-product' };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<script>
|
||||
import { MANAGEMENT } from '@shell/config/types';
|
||||
import FleetBundleResources from '@shell/components/fleet/FleetBundleResources.vue';
|
||||
import FleetUtils from '@shell/utils/fleet';
|
||||
|
||||
|
|
@ -13,6 +14,12 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
async fetch() {
|
||||
if (this.value.authorId && this.$store.getters['management/schemaFor'](MANAGEMENT.USER)) {
|
||||
await this.$store.dispatch(`management/findAll`, { type: MANAGEMENT.USER }, { root: true });
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
bundleResources() {
|
||||
return FleetUtils.resourcesFromBundleStatus(this.value?.status);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import FleetSummary from '@shell/components/fleet/FleetSummary';
|
|||
import { Banner } from '@components/Banner';
|
||||
import FleetResources from '@shell/components/fleet/FleetResources';
|
||||
import Tab from '@shell/components/Tabbed/Tab';
|
||||
import { FLEET } from '@shell/config/types';
|
||||
import { FLEET, MANAGEMENT } from '@shell/config/types';
|
||||
import { isHarvesterCluster } from '@shell/utils/cluster';
|
||||
import FleetBundles from '@shell/components/fleet/FleetBundles.vue';
|
||||
import { checkSchemasForFindAllHash } from '@shell/utils/auth';
|
||||
|
|
@ -91,6 +91,10 @@ export default {
|
|||
}
|
||||
}, this.$store);
|
||||
|
||||
if (this.value.authorId && this.$store.getters['management/schemaFor'](MANAGEMENT.USER)) {
|
||||
await this.$store.dispatch(`management/findAll`, { type: MANAGEMENT.USER }, { root: true });
|
||||
}
|
||||
|
||||
this.allBundles = allDispatches.allBundles || [];
|
||||
this.allFleetClusters = allDispatches.allFleetClusters || [];
|
||||
},
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ export default {
|
|||
created() {
|
||||
this.registerBeforeHook(this.cleanTLS, 'cleanTLS');
|
||||
this.registerBeforeHook(this.doCreateSecrets, `registerAuthSecrets${ new Date().getTime() }`, 99);
|
||||
this.registerBeforeHook(this.updateBeforeSave);
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
@ -569,11 +570,14 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
onSave() {
|
||||
updateBeforeSave() {
|
||||
this.value.spec['correctDrift'] = { enabled: this.correctDriftEnabled };
|
||||
|
||||
this.save();
|
||||
}
|
||||
if (this.mode === _CREATE) {
|
||||
this.value.metadata.labels[FLEET_LABELS.CREATED_BY_USER_ID] = this.value.currentUser.id;
|
||||
this.value.metadata.labels[FLEET_LABELS.CREATED_BY_USER_NAME] = this.value.currentUser.username;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -594,7 +598,7 @@ export default {
|
|||
class="wizard"
|
||||
@cancel="done"
|
||||
@error="e=>errors = e"
|
||||
@finish="onSave"
|
||||
@finish="save"
|
||||
>
|
||||
<template #noticeBanner>
|
||||
<Banner
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ import { escapeHtml, ucFirst } from '@shell/utils/string';
|
|||
import SteveModel from '@shell/plugins/steve/steve-class';
|
||||
import typeHelper from '@shell/utils/type-helpers';
|
||||
import { addObject, addObjects, findBy } from '@shell/utils/array';
|
||||
import { FLEET } from '@shell/config/types';
|
||||
import { FLEET, MANAGEMENT } from '@shell/config/types';
|
||||
import { FLEET as FLEET_ANNOTATIONS } from '@shell/config/labels-annotations';
|
||||
import { convertSelectorObj, matching } from '@shell/utils/selector';
|
||||
|
||||
export default class FleetBundle extends SteveModel {
|
||||
|
|
@ -21,7 +22,7 @@ export default class FleetBundle extends SteveModel {
|
|||
get repoName() {
|
||||
const labels = this.metadata?.labels || {};
|
||||
|
||||
return labels['fleet.cattle.io/repo-name'];
|
||||
return labels[FLEET_ANNOTATIONS.REPO_NAME];
|
||||
}
|
||||
|
||||
get targetClusters() {
|
||||
|
|
@ -127,4 +128,41 @@ export default class FleetBundle extends SteveModel {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
get authorId() {
|
||||
return this.metadata?.labels?.[FLEET_ANNOTATIONS.CREATED_BY_USER_ID];
|
||||
}
|
||||
|
||||
get author() {
|
||||
if (this.authorId) {
|
||||
return this.$rootGetters['management/byId'](MANAGEMENT.USER, this.authorId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
get createdBy() {
|
||||
const displayName = this.metadata?.labels?.[FLEET_ANNOTATIONS.CREATED_BY_USER_NAME];
|
||||
|
||||
if (!displayName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
displayName,
|
||||
location: !this.author ? null : {
|
||||
name: 'c-cluster-product-resource-id',
|
||||
params: {
|
||||
cluster: '_',
|
||||
product: 'auth',
|
||||
resource: MANAGEMENT.USER,
|
||||
id: this.author.id,
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
get showCreatedBy() {
|
||||
return !!this.createdBy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { convert, matching, convertSelectorObj } from '@shell/utils/selector';
|
|||
import jsyaml from 'js-yaml';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import { escapeHtml } from '@shell/utils/string';
|
||||
import { FLEET } from '@shell/config/types';
|
||||
import { FLEET, MANAGEMENT } from '@shell/config/types';
|
||||
import { FLEET as FLEET_ANNOTATIONS } from '@shell/config/labels-annotations';
|
||||
import { addObject, addObjects, findBy, insertAt } from '@shell/utils/array';
|
||||
import { set } from '@shell/utils/object';
|
||||
|
|
@ -42,6 +42,10 @@ function normalizeStateCounts(data) {
|
|||
}
|
||||
|
||||
export default class GitRepo extends SteveModel {
|
||||
get currentUser() {
|
||||
return this.$rootGetters['auth/v3User'] || {};
|
||||
}
|
||||
|
||||
applyDefaults() {
|
||||
const spec = this.spec || {};
|
||||
const meta = this.metadata || {};
|
||||
|
|
@ -131,6 +135,18 @@ export default class GitRepo extends SteveModel {
|
|||
this.save();
|
||||
}
|
||||
|
||||
goToClone() {
|
||||
if (this.metadata?.labels?.[FLEET_ANNOTATIONS.CREATED_BY_USER_ID]) {
|
||||
delete this.metadata.labels[FLEET_ANNOTATIONS.CREATED_BY_USER_ID];
|
||||
}
|
||||
|
||||
if (this.metadata?.labels?.[FLEET_ANNOTATIONS.CREATED_BY_USER_NAME]) {
|
||||
delete this.metadata.labels[FLEET_ANNOTATIONS.CREATED_BY_USER_NAME];
|
||||
}
|
||||
|
||||
super.goToClone();
|
||||
}
|
||||
|
||||
forceUpdate() {
|
||||
const now = this.spec.forceSyncGeneration || 1;
|
||||
|
||||
|
|
@ -352,16 +368,21 @@ export default class GitRepo extends SteveModel {
|
|||
}
|
||||
|
||||
get bundles() {
|
||||
return this.$getters['matching'](FLEET.BUNDLE, { 'fleet.cattle.io/repo-name': this.name }, this.namespace);
|
||||
return this.$getters['matching'](FLEET.BUNDLE, { [FLEET_ANNOTATIONS.REPO_NAME]: this.name }, this.namespace);
|
||||
}
|
||||
|
||||
get bundleDeployments() {
|
||||
return this.$getters['matching'](FLEET.BUNDLE_DEPLOYMENT, { 'fleet.cattle.io/repo-name': this.name });
|
||||
return this.$getters['matching'](FLEET.BUNDLE_DEPLOYMENT, { [FLEET_ANNOTATIONS.REPO_NAME]: this.name });
|
||||
}
|
||||
|
||||
get allBundlesStatuses() {
|
||||
return this.bundles.reduce((acc, bundle) => {
|
||||
if (isEmpty(bundle.status?.summary)) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
const { nonReadyResources, ...summary } = bundle.status?.summary;
|
||||
|
||||
const bdCounts = normalizeStateCounts(summary);
|
||||
const state = primaryDisplayStatusFromCount(bdCounts.states);
|
||||
|
||||
|
|
@ -479,4 +500,41 @@ export default class GitRepo extends SteveModel {
|
|||
get clustersList() {
|
||||
return this.$getters['all'](FLEET.CLUSTER);
|
||||
}
|
||||
|
||||
get authorId() {
|
||||
return this.metadata?.labels?.[FLEET_ANNOTATIONS.CREATED_BY_USER_ID];
|
||||
}
|
||||
|
||||
get author() {
|
||||
if (this.authorId) {
|
||||
return this.$rootGetters['management/byId'](MANAGEMENT.USER, this.authorId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
get createdBy() {
|
||||
const displayName = this.metadata?.labels?.[FLEET_ANNOTATIONS.CREATED_BY_USER_NAME];
|
||||
|
||||
if (!displayName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
displayName,
|
||||
location: !this.author ? null : {
|
||||
name: 'c-cluster-product-resource-id',
|
||||
params: {
|
||||
cluster: '_',
|
||||
product: 'auth',
|
||||
resource: MANAGEMENT.USER,
|
||||
id: this.author.id,
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
get showCreatedBy() {
|
||||
return !!this.createdBy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue