mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-15 22:21:43 +00:00
fix: resource page detail title link (#459)
* fix: resource page detail title link Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: extract harvester type in a map Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: put in config/harvester-map.js Signed-off-by: Andy Lee <andy.lee@suse.com> --------- Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
parent
2e03ac3cf7
commit
795e5d178f
@ -1,3 +1,5 @@
|
|||||||
|
import { HCI } from '../types';
|
||||||
|
|
||||||
// TODO: delete this not used variable
|
// TODO: delete this not used variable
|
||||||
export const MemoryUnit = [{
|
export const MemoryUnit = [{
|
||||||
label: 'Mi',
|
label: 'Mi',
|
||||||
@ -81,3 +83,14 @@ export const CSI_SECRETS = {
|
|||||||
CSI_NODE_STAGE_SECRET_NAME: 'csi.storage.k8s.io/node-stage-secret-name',
|
CSI_NODE_STAGE_SECRET_NAME: 'csi.storage.k8s.io/node-stage-secret-name',
|
||||||
CSI_NODE_STAGE_SECRET_NAMESPACE: 'csi.storage.k8s.io/node-stage-secret-namespace',
|
CSI_NODE_STAGE_SECRET_NAMESPACE: 'csi.storage.k8s.io/node-stage-secret-namespace',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Some harvester CRD type is not equal to model file name, define the mapping here
|
||||||
|
export const HARVESTER_CRD_MAP = {
|
||||||
|
node: HCI.HOST,
|
||||||
|
configmap: HCI.CLOUD_TEMPLATE,
|
||||||
|
persistentvolumeclaim: HCI.VOLUME,
|
||||||
|
'snapshot.storage.k8s.io.volumesnapshot': HCI.SNAPSHOT,
|
||||||
|
// specific groupable table detail page
|
||||||
|
'network.harvesterhci.io.vlanconfig': HCI.CLUSTER_NETWORK,
|
||||||
|
'kubeovn.io.subnet': HCI.VPC
|
||||||
|
};
|
||||||
|
|||||||
@ -1,17 +1,19 @@
|
|||||||
import SteveModel from '@shell/plugins/steve/steve-class';
|
import SteveModel from '@shell/plugins/steve/steve-class';
|
||||||
import { VIEW_IN_API, DEV } from '@shell/store/prefs';
|
import { VIEW_IN_API, DEV } from '@shell/store/prefs';
|
||||||
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester';
|
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester';
|
||||||
|
import { HARVESTER_CRD_MAP } from '../config/harvester-map';
|
||||||
|
|
||||||
export default class HarvesterResource extends SteveModel {
|
export default class HarvesterResource extends SteveModel {
|
||||||
get listLocation() {
|
get listLocation() {
|
||||||
const name = this.harvesterResourcesInExplorer ? 'c-cluster-product-resource' : `${ HARVESTER_PRODUCT }-c-cluster-resource`;
|
const name = this.harvesterResourcesInExplorer ? 'c-cluster-product-resource' : `${ HARVESTER_PRODUCT }-c-cluster-resource`;
|
||||||
|
const resource = HARVESTER_CRD_MAP[this.type] || this.type;
|
||||||
|
|
||||||
return this.$rootGetters['type-map/optionsFor'](this.type).customRoute || {
|
return this.$rootGetters['type-map/optionsFor'](this.type).customRoute || {
|
||||||
name,
|
name,
|
||||||
params: {
|
params: {
|
||||||
product: this.$rootGetters['productId'],
|
product: this.$rootGetters['productId'],
|
||||||
cluster: this.$rootGetters['clusterId'],
|
cluster: this.$rootGetters['clusterId'],
|
||||||
resource: this.type,
|
resource
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// This file is Cloud Configuration Templates page model
|
||||||
import { clone } from '@shell/utils/object';
|
import { clone } from '@shell/utils/object';
|
||||||
import { HCI } from '../../types';
|
import { HCI } from '../../types';
|
||||||
import HarvesterResource from '../harvester';
|
import HarvesterResource from '../harvester';
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export default class HarvesterNetworkAttachmentDef extends NetworkAttachmentDef
|
|||||||
params: {
|
params: {
|
||||||
product: HARVESTER_PRODUCT,
|
product: HARVESTER_PRODUCT,
|
||||||
cluster: this.$rootGetters['clusterId'],
|
cluster: this.$rootGetters['clusterId'],
|
||||||
resource: this.type,
|
resource: HCI.NETWORK_ATTACHMENT,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,19 @@ export default class HciClusterflow extends HarvesterFlow {
|
|||||||
return this.$rootGetters['harvester/all'](LOGGING.CLUSTER_OUTPUT) || [];
|
return this.$rootGetters['harvester/all'](LOGGING.CLUSTER_OUTPUT) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get listLocation() {
|
||||||
|
const listLocation = clone(super.listLocation);
|
||||||
|
|
||||||
|
listLocation.name = this.harvesterResourcesInExplorer ? 'c-cluster-product-resource' : `${ HARVESTER_PRODUCT }-c-cluster-resource`;
|
||||||
|
listLocation.params.resource = HCI.CLUSTER_FLOW;
|
||||||
|
|
||||||
|
return listLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
get harvesterResourcesInExplorer() {
|
||||||
|
return this.$rootGetters['productId'] !== HARVESTER_PRODUCT;
|
||||||
|
}
|
||||||
|
|
||||||
get _detailLocation() {
|
get _detailLocation() {
|
||||||
const schema = this.$getters['schemaFor'](this.type);
|
const schema = this.$getters['schemaFor'](this.type);
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,19 @@ export default class HciClusteroutput extends LogOutput {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get listLocation() {
|
||||||
|
const listLocation = clone(super.listLocation);
|
||||||
|
|
||||||
|
listLocation.name = this.harvesterResourcesInExplorer ? 'c-cluster-product-resource' : `${ HARVESTER_PRODUCT }-c-cluster-resource`;
|
||||||
|
listLocation.params.resource = HCI.CLUSTER_OUTPUT;
|
||||||
|
|
||||||
|
return listLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
get harvesterResourcesInExplorer() {
|
||||||
|
return this.$rootGetters['productId'] !== HARVESTER_PRODUCT;
|
||||||
|
}
|
||||||
|
|
||||||
get detailLocation() {
|
get detailLocation() {
|
||||||
const detailLocation = clone(this._detailLocation);
|
const detailLocation = clone(this._detailLocation);
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,19 @@ export default class HarvesterLogFlow extends Flow {
|
|||||||
return this.$rootGetters['harvester/all'](LOGGING.CLUSTER_OUTPUT) || [];
|
return this.$rootGetters['harvester/all'](LOGGING.CLUSTER_OUTPUT) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get listLocation() {
|
||||||
|
const listLocation = clone(super.listLocation);
|
||||||
|
|
||||||
|
listLocation.name = this.harvesterResourcesInExplorer ? 'c-cluster-product-resource' : `${ HARVESTER_PRODUCT }-c-cluster-resource`;
|
||||||
|
listLocation.params.resource = HCI.FLOW;
|
||||||
|
|
||||||
|
return listLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
get harvesterResourcesInExplorer() {
|
||||||
|
return this.$rootGetters['productId'] !== HARVESTER_PRODUCT;
|
||||||
|
}
|
||||||
|
|
||||||
get _detailLocation() {
|
get _detailLocation() {
|
||||||
const schema = this.$getters['schemaFor'](this.type);
|
const schema = this.$getters['schemaFor'](this.type);
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,19 @@ export default class HarvesterLogOutput extends LogOutput {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get listLocation() {
|
||||||
|
const listLocation = clone(super.listLocation);
|
||||||
|
|
||||||
|
listLocation.name = this.harvesterResourcesInExplorer ? 'c-cluster-product-resource' : `${ HARVESTER_PRODUCT }-c-cluster-resource`;
|
||||||
|
listLocation.params.resource = HCI.OUTPUT;
|
||||||
|
|
||||||
|
return listLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
get harvesterResourcesInExplorer() {
|
||||||
|
return this.$rootGetters['productId'] !== HARVESTER_PRODUCT;
|
||||||
|
}
|
||||||
|
|
||||||
get detailLocation() {
|
get detailLocation() {
|
||||||
const detailLocation = clone(this._detailLocation);
|
const detailLocation = clone(this._detailLocation);
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,19 @@ export default class HciAlertmanagerConfig extends SteveModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get listLocation() {
|
||||||
|
const listLocation = clone(super.listLocation);
|
||||||
|
|
||||||
|
listLocation.name = this.harvesterResourcesInExplorer ? 'c-cluster-product-resource' : `${ HARVESTER_PRODUCT }-c-cluster-resource`;
|
||||||
|
listLocation.params.resource = HCI.ALERTMANAGERCONFIG;
|
||||||
|
|
||||||
|
return listLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
get harvesterResourcesInExplorer() {
|
||||||
|
return this.$rootGetters['productId'] !== HARVESTER_PRODUCT;
|
||||||
|
}
|
||||||
|
|
||||||
get doneOverride() {
|
get doneOverride() {
|
||||||
const detailLocation = clone(this._detailLocation);
|
const detailLocation = clone(this._detailLocation);
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,19 @@ import Secret from '@shell/models/secret';
|
|||||||
import { NAMESPACE } from '@shell/config/types';
|
import { NAMESPACE } from '@shell/config/types';
|
||||||
|
|
||||||
export default class HciSecret extends Secret {
|
export default class HciSecret extends Secret {
|
||||||
|
get listLocation() {
|
||||||
|
const listLocation = clone(super.listLocation);
|
||||||
|
|
||||||
|
listLocation.name = this.harvesterResourcesInExplorer ? 'c-cluster-product-resource' : `${ HARVESTER_PRODUCT }-c-cluster-resource`;
|
||||||
|
listLocation.params.resource = HCI.SECRET;
|
||||||
|
|
||||||
|
return listLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
get harvesterResourcesInExplorer() {
|
||||||
|
return this.$rootGetters['productId'] !== HARVESTER_PRODUCT;
|
||||||
|
}
|
||||||
|
|
||||||
get _detailLocation() {
|
get _detailLocation() {
|
||||||
const schema = this.$getters['schemaFor'](this.type);
|
const schema = this.$getters['schemaFor'](this.type);
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,19 @@ import { isInternalStorageClass } from '../../utils/storage-class';
|
|||||||
export const LVM_DRIVER = 'lvm.driver.harvesterhci.io';
|
export const LVM_DRIVER = 'lvm.driver.harvesterhci.io';
|
||||||
|
|
||||||
export default class HciStorageClass extends StorageClass {
|
export default class HciStorageClass extends StorageClass {
|
||||||
|
get listLocation() {
|
||||||
|
const listLocation = clone(super.listLocation);
|
||||||
|
|
||||||
|
listLocation.name = this.harvesterResourcesInExplorer ? 'c-cluster-product-resource' : `${ HARVESTER_PRODUCT }-c-cluster-resource`;
|
||||||
|
listLocation.params.resource = HCI.STORAGE;
|
||||||
|
|
||||||
|
return listLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
get harvesterResourcesInExplorer() {
|
||||||
|
return this.$rootGetters['productId'] !== HARVESTER_PRODUCT;
|
||||||
|
}
|
||||||
|
|
||||||
get detailLocation() {
|
get detailLocation() {
|
||||||
const detailLocation = clone(this._detailLocation);
|
const detailLocation = clone(this._detailLocation);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user