Skip to content

Commit

Permalink
GMS-179 Initial commit to branch that might contain missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-szrnka committed Dec 11, 2024
1 parent 35414e1 commit 93ab535
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
value="{{ data.lastRotated | momentPipe:'yyyy.MM.DD. HH:mm:ss'}}">
</mat-form-field>
}
<button [disabled]="form.status ==='INVALID' || validationState !== 'VALID'" mat-button color="primary" (click)="save()">{{ 'buttons.save' |
<button [disabled]="form.status ==='INVALID' || (validationState !== 'VALID' && validationState !== 'UNDEFINED')" mat-button color="primary" (click)="save()">{{ 'buttons.save' |
translate }}</button>
</mat-card-content>
</mat-card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ describe('SecretDetailComponent', () => {
configureTestBed();

// act
component.valueDisplayed = true;
component.data = secretInput;
component.validateSecretLength();

Expand All @@ -376,6 +377,7 @@ describe('SecretDetailComponent', () => {
configureTestBed();

// act
component.valueDisplayed = true;
component.validateSecretLength();

// assert
Expand All @@ -389,6 +391,7 @@ describe('SecretDetailComponent', () => {
configureTestBed();

// act
component.valueDisplayed = true;
component.validateSecretLength();

// assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class SecretDetailComponent extends BaseDetailComponent<Secret, SecretSer
allApiKeysAllowed: true
};

// interval config
valueDisplayed = false;
private keyPressTimeout: any;
validationState: ValidationState = ValidationState.UNDEFINED;

Expand Down Expand Up @@ -105,6 +105,8 @@ export class SecretDetailComponent extends BaseDetailComponent<Secret, SecretSer

this.refreshSelectableRoles();
});
this.valueDisplayed = this.data.id === undefined;
this.validateSecretLength();
}

override dataLoadingCallback(data: Secret): void {
Expand Down Expand Up @@ -146,13 +148,15 @@ export class SecretDetailComponent extends BaseDetailComponent<Secret, SecretSer
showValue() {
this.service.getValue(this.data.id).subscribe(value => {
this.data.value = value;
this.valueDisplayed = true;

if (this.data.type !== 'MULTIPLE_CREDENTIAL') {
return;
}

this.multipleCredential = this.parseValue(this.data.value);
this.refreshTable();
this.validateSecretLength();
});
}

Expand Down Expand Up @@ -246,7 +250,12 @@ export class SecretDetailComponent extends BaseDetailComponent<Secret, SecretSer
}

validateSecretLength() {
if (this.valueDisplayed === false) {
return;
}

this.transformMultipleCredentials();

if (this.data.value.length === 0 || this.data.keystoreId === undefined || this.data.keystoreAliasId === undefined) {
this.validationState = ValidationState.INVALID_INPUT;
return;
Expand Down

0 comments on commit 93ab535

Please sign in to comment.