Skip to content

Commit

Permalink
delete errorMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
u7861723 committed Oct 25, 2024
1 parent 0db073c commit 6167e76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ <h5 class="modal-title">
<div class="col-12">
<div class="form-group">
<label><b>Name for copied session*</b></label>
<input id="copy-session-name" type="text" class="form-control" [(ngModel)]="newFeedbackSessionName" (ngModelChange)="onNameChange()" [maxlength]="FEEDBACK_SESSION_NAME_MAX_LENGTH"
<input id="copy-session-name" type="text" class="form-control" [(ngModel)]="newFeedbackSessionName" [maxlength]="FEEDBACK_SESSION_NAME_MAX_LENGTH"
required #newSessionName="ngModel">
<div *ngIf="errorMessage" class="text-danger">
{{ errorMessage }}
</div>
<div [hidden]="newSessionName.valid || (newSessionName.pristine && newSessionName.untouched)" class="invalid-field">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i>
The field "Name for copied session" should not be empty.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { Course } from '../../../types/api-output';
import { FEEDBACK_SESSION_NAME_MAX_LENGTH } from '../../../types/field-validator';
import { StatusMessageService } from '../../../services/status-message.service';

Check failure on line 5 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

`../../../services/status-message.service` import should occur before import of `../../../types/api-output`

Check failure on line 5 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

`../../../services/status-message.service` import should occur before import of `../../../types/api-output`

/**
* Copy current session modal.
Expand All @@ -25,25 +26,19 @@ export class CopySessionModalComponent {
newFeedbackSessionName: string = '';
copyToCourseSet: Set<string> = new Set<string>();

errorMessage: string = '';

Check failure on line 29 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

More than 1 blank line not allowed

Check failure on line 29 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

More than 1 blank line not allowed
constructor(public activeModal: NgbActiveModal) {}
constructor(public activeModal: NgbActiveModal,private statusMessageService: StatusMessageService) {}

Check failure on line 30 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

A space is required after ','

Check failure on line 30 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

A space is required after ','

onNameChange(): void {
this.errorMessage = '';
}

Check failure on line 32 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

More than 1 blank line not allowed

Check failure on line 32 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

More than 1 blank line not allowed
/**
* Fires the copy event.
*/
copy(): void {
if (this.newFeedbackSessionName.trim().length === 0) {
this.errorMessage = 'The field "Name for copied session" should not be whitespace.';
this.statusMessageService.showErrorToast('The field "Name for copied session" should not be whitespace.')

Check failure on line 38 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing semicolon

Check failure on line 38 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing semicolon
return;
}

this.errorMessage = '';

this.activeModal.close({
newFeedbackSessionName: this.newFeedbackSessionName,
sessionToCopyCourseId: this.sessionToCopyCourseId,
Expand Down

0 comments on commit 6167e76

Please sign in to comment.