This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, EventEmitter, Input, Output, Self} from '@angular/core'; | |
import {ControlValueAccessor, NgControl} from "@angular/forms"; | |
import {OptionWithLabel} from "./option-with-label.interface"; | |
@Component({ | |
selector: 'app-select-control', | |
templateUrl: './select-control.component.html', | |
styleUrls: ['./select-control.component.scss'] | |
}) | |
export class SelectControlComponent<T> implements ControlValueAccessor { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input [ngModel]="viewModel" (click)="inputClicked()" (focus)="inputFocused()" (blur)="inputBlurred()"> | |
<div *ngIf="optionsVisible" class="options"> | |
<div *ngFor="let option of options" (click)="optionClicked(option)" class="option-item" | |
[ngClass]="{active:option===selectedOption}"> | |
{{option.label}} | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {SelectControlComponent} from './select-control.component'; | |
describe('SelectControlComponent', () => { | |
let component: SelectControlComponent<unknown>; | |
beforeEach(async () => { | |
component = new SelectControlComponent<unknown>({} as any) | |
}); | |
it('should create the component and have default inits', () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {SelectControlComponent} from './select-control.component'; | |
import {ComponentFixture, TestBed} from "@angular/core/testing"; | |
import {Component, DebugElement} from "@angular/core"; | |
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule} from "@angular/forms"; | |
import {OptionWithLabel} from "./option-with-label.interface"; | |
import {By} from "@angular/platform-browser"; | |
@Component({ | |
template: ` | |
<form [formGroup]="form"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring: | |
application: | |
name: leader-app | |
cloud: | |
kubernetes: | |
leader: | |
config-map-name: leader | |
management: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.mseemann.poc.k8sleaderelection; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.context.event.EventListener; | |
import org.springframework.integration.leader.event.OnGrantedEvent; | |
import org.springframework.integration.leader.event.OnRevokedEvent; | |
import org.springframework.stereotype.Component; | |
@Slf4j | |
@Component |
OlderNewer