image: list unique templates and isos in list view

Related: https://github.com/apache/cloudstack/issues/4041

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2020-04-22 16:20:39 +05:30
parent cec74abc00
commit c429e7e8d3

View File

@ -450,6 +450,12 @@ export default {
delete params.treeView
}
if (['listTemplates', 'listIsos'].includes(this.apiName) && !this.dataView) {
if (['Admin'].includes(this.$store.getters.userInfo.roletype)) {
params.templatefilter = 'all'
}
}
api(this.apiName, params).then(json => {
var responseName
var objectName
@ -472,6 +478,9 @@ export default {
if (!this.items || this.items.length === 0) {
this.items = []
}
if (['listTemplates', 'listIsos'].includes(this.apiName) && this.items.length > 1) {
this.items = [...new Map(this.items.map(x => [x.id, x])).values()]
}
if (this.treeView) {
this.treeData = this.generateTreeData(this.items)
} else {