mirror of https://github.com/rancher/dashboard.git
Fleet: Labels refactoring
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
parent
573406b341
commit
b6973366fc
|
|
@ -109,6 +109,7 @@ export const CATALOG = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FLEET = {
|
export const FLEET = {
|
||||||
|
REPO_NAME: 'fleet.cattle.io/repo-name',
|
||||||
CLUSTER_DISPLAY_NAME: 'management.cattle.io/cluster-display-name',
|
CLUSTER_DISPLAY_NAME: 'management.cattle.io/cluster-display-name',
|
||||||
CLUSTER_NAME: 'management.cattle.io/cluster-name',
|
CLUSTER_NAME: 'management.cattle.io/cluster-name',
|
||||||
BUNDLE_ID: 'fleet.cattle.io/bundle-id',
|
BUNDLE_ID: 'fleet.cattle.io/bundle-id',
|
||||||
|
|
@ -116,7 +117,9 @@ export const FLEET = {
|
||||||
BUNDLE_NAMESPACE: 'fleet.cattle.io/bundle-namespace',
|
BUNDLE_NAMESPACE: 'fleet.cattle.io/bundle-namespace',
|
||||||
MANAGED: 'fleet.cattle.io/managed',
|
MANAGED: 'fleet.cattle.io/managed',
|
||||||
CLUSTER_NAMESPACE: 'fleet.cattle.io/cluster-namespace',
|
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' };
|
export const RBAC = { PRODUCT: 'management.cattle.io/ui-product' };
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import SteveModel from '@shell/plugins/steve/steve-class';
|
||||||
import typeHelper from '@shell/utils/type-helpers';
|
import typeHelper from '@shell/utils/type-helpers';
|
||||||
import { addObject, addObjects, findBy } from '@shell/utils/array';
|
import { addObject, addObjects, findBy } from '@shell/utils/array';
|
||||||
import { FLEET, MANAGEMENT } 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';
|
import { convertSelectorObj, matching } from '@shell/utils/selector';
|
||||||
|
|
||||||
export default class FleetBundle extends SteveModel {
|
export default class FleetBundle extends SteveModel {
|
||||||
|
|
@ -21,7 +22,7 @@ export default class FleetBundle extends SteveModel {
|
||||||
get repoName() {
|
get repoName() {
|
||||||
const labels = this.metadata?.labels || {};
|
const labels = this.metadata?.labels || {};
|
||||||
|
|
||||||
return labels['fleet.cattle.io/repo-name'];
|
return labels[FLEET_ANNOTATIONS.REPO_NAME];
|
||||||
}
|
}
|
||||||
|
|
||||||
get targetClusters() {
|
get targetClusters() {
|
||||||
|
|
@ -129,7 +130,7 @@ export default class FleetBundle extends SteveModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
get authorId() {
|
get authorId() {
|
||||||
return this.metadata.labels['fleet.cattle.io/created-by-user-id'];
|
return this.metadata.labels[FLEET_ANNOTATIONS.CREATED_BY_USER_ID];
|
||||||
}
|
}
|
||||||
|
|
||||||
get author() {
|
get author() {
|
||||||
|
|
@ -141,7 +142,7 @@ export default class FleetBundle extends SteveModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
get createdBy() {
|
get createdBy() {
|
||||||
const displayName = this.metadata.labels['fleet.cattle.io/created-by-display-name'];
|
const displayName = this.metadata.labels[FLEET_ANNOTATIONS.CREATED_BY_USER_NAME];
|
||||||
|
|
||||||
if (!displayName) {
|
if (!displayName) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -352,11 +352,11 @@ export default class GitRepo extends SteveModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
get bundles() {
|
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() {
|
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() {
|
get allBundlesStatuses() {
|
||||||
|
|
@ -481,7 +481,7 @@ export default class GitRepo extends SteveModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
get authorId() {
|
get authorId() {
|
||||||
return this.metadata.labels['fleet.cattle.io/created-by-user-id'];
|
return this.metadata.labels[FLEET_ANNOTATIONS.CREATED_BY_USER_ID];
|
||||||
}
|
}
|
||||||
|
|
||||||
get author() {
|
get author() {
|
||||||
|
|
@ -493,7 +493,7 @@ export default class GitRepo extends SteveModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
get createdBy() {
|
get createdBy() {
|
||||||
const displayName = this.metadata.labels['fleet.cattle.io/created-by-display-name'];
|
const displayName = this.metadata.labels[FLEET_ANNOTATIONS.CREATED_BY_USER_NAME];
|
||||||
|
|
||||||
if (!displayName) {
|
if (!displayName) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue