mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
just using model in the html
This commit is contained in:
committed by
Aiden McClelland
parent
41d2c49bd6
commit
44af3fe781
@@ -8,10 +8,10 @@
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-spinner *ngIf="!releaseNotes; else loaded" class="center" name="lines" color="warning"></ion-spinner>
|
||||
<ion-spinner *ngIf="!releaseNotesModel.releaseNotes; else loaded" class="center" name="lines" color="warning"></ion-spinner>
|
||||
|
||||
<ng-template #loaded>
|
||||
<div *ngFor="let note of releaseNotes | keyvalue : asIsOrder">
|
||||
<div *ngFor="let note of releaseNotesModel.releaseNotes | keyvalue : asIsOrder">
|
||||
<ion-button (click)="setSelected(note.key)" expand="full" color="light" style="height: 50px;" >
|
||||
<p style="position: absolute; left: 10px;">{{note.key | displayEmver}}</p>
|
||||
</ion-button>
|
||||
|
||||
@@ -11,20 +11,17 @@ import { ReleaseNoteModel } from './release-notes.model'
|
||||
export class ReleaseNotes {
|
||||
error = ''
|
||||
pkgId: string
|
||||
releaseNotes: { [version: string]: string}
|
||||
selected: string
|
||||
|
||||
constructor (
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly apiService: ApiService,
|
||||
private releaseNoteModel: ReleaseNoteModel,
|
||||
) {
|
||||
this.releaseNotes = releaseNoteModel.releaseNotes
|
||||
}
|
||||
public releaseNotesModel: ReleaseNoteModel,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
|
||||
if (!this.releaseNotes) {
|
||||
if (!this.releaseNotesModel.releaseNotes) {
|
||||
this.getReleaseNotes()
|
||||
}
|
||||
}
|
||||
@@ -32,7 +29,7 @@ export class ReleaseNotes {
|
||||
async getReleaseNotes (version?: string): Promise<void> {
|
||||
try {
|
||||
const pkg = await this.apiService.getAvailableShow({ id: this.pkgId, version })
|
||||
this.releaseNotes = pkg['release-notes']
|
||||
this.releaseNotesModel.releaseNotes = pkg['release-notes']
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
this.error = e.message
|
||||
|
||||
Reference in New Issue
Block a user