-
-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a tag on the announcements screen that shows if you're on a nig…
…htly when looking at the changelog. Added changelog to System tab in case users don't know about Announcements page.
- Loading branch information
1 parent
4f486f0
commit 95b3cbd
Showing
5 changed files
with
82 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
52 changes: 39 additions & 13 deletions
52
UI/Web/src/app/announcements/_components/changelog/changelog.component.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,55 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { UpdateVersionEvent } from 'src/app/_models/events/update-version-event'; | ||
import { ServerService } from 'src/app/_services/server.service'; | ||
import { LoadingComponent } from '../../../shared/loading/loading.component'; | ||
import { ReadMoreComponent } from '../../../shared/read-more/read-more.component'; | ||
import { NgFor, NgIf, DatePipe } from '@angular/common'; | ||
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, inject, OnInit} from '@angular/core'; | ||
import {UpdateVersionEvent} from 'src/app/_models/events/update-version-event'; | ||
import {ServerService} from 'src/app/_services/server.service'; | ||
import {LoadingComponent} from '../../../shared/loading/loading.component'; | ||
import {ReadMoreComponent} from '../../../shared/read-more/read-more.component'; | ||
import {DatePipe, NgFor, NgIf} from '@angular/common'; | ||
import {TranslocoDirective} from "@ngneat/transloco"; | ||
|
||
@Component({ | ||
selector: 'app-changelog', | ||
templateUrl: './changelog.component.html', | ||
styleUrls: ['./changelog.component.scss'], | ||
standalone: true, | ||
imports: [NgFor, NgIf, ReadMoreComponent, LoadingComponent, DatePipe, TranslocoDirective] | ||
selector: 'app-changelog', | ||
templateUrl: './changelog.component.html', | ||
styleUrls: ['./changelog.component.scss'], | ||
standalone: true, | ||
imports: [NgFor, NgIf, ReadMoreComponent, LoadingComponent, DatePipe, TranslocoDirective], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class ChangelogComponent implements OnInit { | ||
|
||
private readonly serverService = inject(ServerService); | ||
private readonly cdRef = inject(ChangeDetectorRef); | ||
updates: Array<UpdateVersionEvent> = []; | ||
isLoading: boolean = true; | ||
|
||
constructor(private serverService: ServerService) { } | ||
|
||
ngOnInit(): void { | ||
this.serverService.getChangelog().subscribe(updates => { | ||
this.updates = updates; | ||
this.isLoading = false; | ||
this.cdRef.markForCheck(); | ||
}); | ||
} | ||
|
||
isNightly(update: UpdateVersionEvent) { | ||
// Split the version numbers into arrays | ||
const updateVersionArr = update.updateVersion.split('.'); | ||
const currentVersionArr = update.currentVersion.split('.'); | ||
|
||
// Compare the first three parts of the version numbers | ||
for (let i = 0; i < 3; i++) { | ||
const updatePart = parseInt(updateVersionArr[i]); | ||
const currentPart = parseInt(currentVersionArr[i]); | ||
|
||
// If any part of the update version is less than the corresponding part of the current version, return true | ||
if (updatePart < currentPart) { | ||
return true; | ||
} | ||
// If any part of the update version is greater than the corresponding part of the current version, return false | ||
else if (updatePart > currentPart) { | ||
return false; | ||
} | ||
} | ||
|
||
// If all parts are equal, compare the length of the version numbers | ||
return updateVersionArr.length < currentVersionArr.length; | ||
} | ||
} |
This file contains 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