Add onError for some logo return 404

We need to set a default logo for some logo may not exsit
This commit is contained in:
Mia ZHOU 2018-08-03 17:51:57 +08:00
parent 7649cc5f1b
commit 4c8976da71
3 changed files with 10 additions and 10 deletions

View File

@ -319,8 +319,7 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
if (!data.value.deleted) {
count++;
this.filterLabelInfo.push(data.value);
}
if (data.value.deleted) {
} else {
this.deletedLabelCount++;
delLabel += data.value.name + ',';
}

View File

@ -54,8 +54,10 @@
<clr-dg-column>{{'HELM_CHART.CREATED' | translate }}</clr-dg-column>
<clr-dg-row *ngFor="let v of chartVersions" [clrDgItem]="v">
<clr-dg-cell>
<span class="list-img"><img [src]="getImgLink(v)"/></span>
<a href="javascript:void(0)" (click)="onVersionClick(v)">{{ v.version }}</a>
<span class="list-img">
<img [src]="v.icon ?v.icon:chartDefaultIcon" (error)="getDefaultIcon(v);" />
</span>
<a href="#" (click)="onVersionClick(v)">{{ v.version }}</a>
</clr-dg-cell>
<clr-dg-cell>{{ v.engine }}</clr-dg-cell>
<clr-dg-cell>{{ getMaintainerString(v.maintainers) }}</clr-dg-cell>

View File

@ -51,9 +51,11 @@ export class ChartVersionComponent implements OnInit {
@Input() roleName: string;
@Input() hasSignedIn: boolean;
@Input() hasProjectAdminRole: boolean;
@Input() chartDefaultIcon: string = DefaultHelmIcon;
@Output() versionClickEvt = new EventEmitter<string>();
@Output() backEvt = new EventEmitter<any>();
lastFilteredVersionName: string;
chartVersions: HelmChartVersion[] = [];
versionsCopy: HelmChartVersion[] = [];
@ -288,11 +290,8 @@ export class ChartVersionComponent implements OnInit {
}
}
getImgLink(v: HelmChartVersion) {
if (v.icon) {
return v.icon;
} else {
return DefaultHelmIcon;
}
getDefaultIcon(v: HelmChartVersion) {
v.icon = this.chartDefaultIcon;
}
}