Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/web/src/app/cluster/details/cluster/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ <h4>IPv6</h4>
</km-tab>
@if (cluster.spec.opaIntegration?.enabled) {
<km-tab label="OPA Constraints">
<ng-template #tabLabel>
<ng-template>
OPA Constraints
<i class="km-icon-warning km-pointer-warning km-opa-warning"
[matTooltip]="OPA_DEPRECATED_MESSAGE"></i>
Expand All @@ -624,7 +624,7 @@ <h4>IPv6</h4>
}
@if (cluster.spec.opaIntegration?.enabled) {
<km-tab label="OPA Gatekeeper Config">
<ng-template #tabLabel>
<ng-template>
OPA Gatekeeper Config
<i class="km-icon-warning km-pointer km-opa-warning"
[matTooltip]="OPA_DEPRECATED_MESSAGE"></i>
Expand Down
14 changes: 13 additions & 1 deletion modules/web/src/app/node-data/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,19 @@ export class NodeDataComponent extends BaseFormValidator implements OnInit, OnDe
super();
}

@ViewChild('quotaWidgetContainer', {read: ViewContainerRef}) set quotaWidgetContainer(ref: ViewContainerRef) {
@ViewChild('quotaWidgetContainerDialog', {read: ViewContainerRef}) set quotaWidgetContainerDialog(
ref: ViewContainerRef
) {
this._initQuotaWidget(ref);
}

@ViewChild('quotaWidgetContainerNonDialog', {read: ViewContainerRef}) set quotaWidgetContainerNonDialog(
ref: ViewContainerRef
) {
this._initQuotaWidget(ref);
}

private _initQuotaWidget(ref: ViewContainerRef): void {
if (ref && this.isEnterpriseEdition && !this.quotaWidgetComponentRef) {
this.quotaWidgetComponentRef = ref.createComponent(QuotaWidgetComponent).instance;
this.quotaWidgetComponentRef.projectId = this.projectId;
Expand Down
4 changes: 2 additions & 2 deletions modules/web/src/app/node-data/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

@if (isEnterpriseEdition && isDialogView()) {
<div class="quota-widget">
<ng-template #quotaWidgetContainer />
<ng-template #quotaWidgetContainerDialog />
</div>
}

Expand Down Expand Up @@ -255,7 +255,7 @@

@if (displayQuotaInWizard && isEnterpriseEdition && !isDialogView()) {
<div class="additional-margin">
<ng-template #quotaWidgetContainer />
<ng-template #quotaWidgetContainerNonDialog />
</div>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ import {Component, Input, TemplateRef, ViewChild, ContentChild} from '@angular/c
export class TabComponent {
@Input() label: string;
@ViewChild(TemplateRef) template: TemplateRef<any>;
@ContentChild('tabLabel') labelTemplate: TemplateRef<any>;
@ContentChild(TemplateRef) labelTemplate: TemplateRef<any>;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for Reviewer:

Why I did changed from "string" to TemplateRef

  • @ ContentChild('tabLabel') uses a fixed template name as a shared contract between parent and child, so every <km-tab> must define #tabLabel, which can lead to duplicate names in the same template when multiple siblings exist.

  • @ ContentChild(TemplateRef) has no naming contract and simply picks up the projected template per instance, so each <km-tab> resolves its own content independently with no collisions.

}