Skip to content

Commit

Permalink
Update FHIR server settings modal and list questionnaires component
Browse files Browse the repository at this point in the history
  • Loading branch information
alopezo committed Jan 17, 2024
1 parent bc7efe5 commit 8c6fe5a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h2>FHIR Server Connection</h2>
</mat-form-field>

<div class="button-container">
<button mat-flat-button color="accent" type="submit" [disabled]="!settingsForm.valid">Save</button>
<button mat-flat-button color="accent" type="submit" [disabled]="!settingsForm.valid">Open FHIR Repository</button>
<button mat-flat-button color="primary" mat-dialog-close>Close</button>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
<span class="list-subtext">Version: {{ questionnaire.meta.versionId }}</span>
<span [ngClass]="['status-pill', questionnaire.status]">{{ questionnaire.status | uppercase }}</span>
</span>

<button mat-icon-button color="accent" (click)="selectQuestionnaire(questionnaire)" class="action-button"
*ngIf="config.select" matTooltip="Load Questionnaire">
<mat-icon>cloud_download</mat-icon>
</button>
<button mat-icon-button color="accent" (click)="selectQuestionnaire(questionnaire)" class="action-button"
*ngIf="config.select" matTooltip="Load Questionnaire">
<mat-icon>cloud_download</mat-icon>
Expand All @@ -23,6 +26,10 @@
*ngIf="config.preview" matTooltip="Open resource in new tab">
<mat-icon>open_in_new</mat-icon>
</button>
<button mat-icon-button color="accent" (click)="saveQuestionnaire(questionnaire)" class="action-button"
matTooltip="Download Questionnaire">
<mat-icon>cloud_download</mat-icon>
</button>
<button mat-icon-button color="accent" (click)="deleteQuestionnaire(questionnaire)" class="action-button"
matTooltip="Delete Questionnaire">
<mat-icon>delete</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MatSnackBar } from '@angular/material/snack-bar';
import { Subject, combineLatest, debounceTime, distinctUntilChanged } from 'rxjs';
import { SnackAlertComponent } from 'src/app/alerts/snack-alert';
import { FhirService } from 'src/app/services/fhir.service';
import * as saveAs from 'file-saver';

@Component({
selector: 'app-list-questionnaires',
Expand Down Expand Up @@ -118,4 +119,10 @@ export class ListQuestionnairesComponent implements OnInit, OnChanges {
let url = this.selectedFhirServer + '/Questionnaire/' + questionnaire.id;
window.open(url, '_blank');
}

saveQuestionnaire(questionnaire: any) {
var blob = new Blob([JSON.stringify(questionnaire, null, 2)], {type: "text/plain;charset=utf-8"});
saveAs(blob, `${questionnaire.title}-v${questionnaire.meta.versionId}.json`);
}

}

0 comments on commit 8c6fe5a

Please sign in to comment.