Skip to content

Commit

Permalink
Add Fast Farmer version card
Browse files Browse the repository at this point in the history
  • Loading branch information
felixbrucker committed Nov 11, 2023
1 parent 4ea9d49 commit 3623e77
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/app/api/types/pool/client-version.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface ClientVersion {
clientName: string
clientVersion: string
clientName: string|null
clientVersion: string|null
localName1: string|null
localVersion1: string|null
localName2: string|null
Expand Down
7 changes: 7 additions & 0 deletions src/app/client-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export const clientVersions = {
minimum: '1.4.0',
recommendedMinimum: '1.9.1',
},
fastFarmer: {
minimum: '1.0.0',
recommendedMinimum: '1.0.1',
current: '1.0.1',
recent: '1.0.0',
outdated: '0.0.0',
},
gigahorse: {
minimum: 10,
recommendedMinimum: 20,
Expand Down
9 changes: 8 additions & 1 deletion src/app/harvester-card/harvester-card.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,20 @@ <h5 *ngIf="(isLoading | async) === false" [ngClass]="averageProofTimeInSecondsCo
<h5>{{lastAcceptedPartialAt}}</h5>
</div>
</div>
<div class="col-6 col-sm-6 col-md-4 col-lg-3 col-xl col-xxl col-xxxl col-xxxxl col-xxxxxl p-1">
<div class="col-6 col-sm-6 col-md-4 col-lg-3 col-xl col-xxl col-xxxl col-xxxxl col-xxxxxl p-1" *ngIf="hasChiaVersion">
<app-version-info
versionName="Chia Version"
[versionString]="fullChiaVersionString"
[versionUpdateInfo]="chiaVersionUpdateInfo"
></app-version-info>
</div>
<div class="col-6 col-sm-6 col-md-4 col-lg-3 col-xl col-xxl col-xxxl col-xxxxl col-xxxxxl p-1" *ngIf="hasFastFarmerVersion">
<app-version-info
versionName="Fast Farmer Version"
[versionString]="fastFarmerVersion"
[versionUpdateInfo]="fastFarmerVersionUpdateInfo"
></app-version-info>
</div>
<div class="col-6 col-sm-6 col-md-4 col-lg-3 col-xl col-xxl col-xxxl col-xxxxl col-xxxxxl p-1" *ngIf="hasOgVersion">
<app-version-info
versionName="OG Version"
Expand Down
41 changes: 38 additions & 3 deletions src/app/harvester-card/harvester-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ export class HarvesterCardComponent implements OnInit, OnDestroy {
return this.harvester.versionInfo.clientVersion
}

public get hasChiaVersion(): boolean {
return this.chiaVersion !== undefined
}

private get chiaRcVersion(): string|undefined {
if (this.harvester.versionInfo.localName1 === 'rc') {
return this.harvester.versionInfo.localVersion1 ?? undefined
Expand All @@ -520,10 +524,10 @@ export class HarvesterCardComponent implements OnInit, OnDestroy {
}
}

public get fullChiaVersionString(): string {
public get fullChiaVersionString(): string|undefined {
const chiaVersion = this.chiaVersion
if (chiaVersion === undefined) {
return 'Unknown'
return
}

// If we already show explicit compression version ignore rc and beta info
Expand Down Expand Up @@ -699,6 +703,31 @@ export class HarvesterCardComponent implements OnInit, OnDestroy {
return this.chiaCompressionVersion !== undefined
}

public get fastFarmerVersionUpdateInfo(): VersionUpdateInfo {
const fastFarmerVersion = this.fastFarmerVersion
if (fastFarmerVersion === undefined) {
return VersionUpdateInfo.noActionRequired
}
if (compare(fastFarmerVersion, clientVersions.fastFarmer.recommendedMinimum, '>=')) {
return VersionUpdateInfo.noActionRequired
}
if (compare(fastFarmerVersion, clientVersions.fastFarmer.minimum, '>=')) {
return VersionUpdateInfo.updateRecommended
}

return VersionUpdateInfo.updateStronglyRecommended
}

public get fastFarmerVersion(): string|undefined {
if (this.harvester.versionInfo.clientName === 'dg_fast_farmer') {
return this.harvester.versionInfo.clientVersion ?? undefined
}
}

public get hasFastFarmerVersion(): boolean {
return this.fastFarmerVersion !== undefined
}

public get rowColumnClasses(): string[] {
const cardCount = this.cardCount

Expand All @@ -709,7 +738,13 @@ export class HarvesterCardComponent implements OnInit, OnDestroy {
}

private get cardCount(): number {
let count = 6
let count = 5
if (this.hasChiaVersion) {
count += 1
}
if (this.hasFastFarmerVersion) {
count += 1
}
if (this.hasOgVersion) {
count += 1
}
Expand Down
33 changes: 26 additions & 7 deletions src/app/info/info.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,14 @@ export class InfoComponent implements OnInit, OnDestroy {

private makeRegularClientVersionsChartUpdateOptions(clientVersions: ClientVersion[]): EChartsOption {
const clientVersionWithCount = clientVersions.reduce((acc, clientVersion) => {
const key = clientVersion.clientName.indexOf('Chia') === -1 ? 'Unknown' : clientVersion.clientVersion
let key: string
if (clientVersion.clientName?.indexOf('Chia') !== -1) {
key = clientVersion.clientVersion
} else if (clientVersion.clientName === 'dg_fast_farmer') {
key = `Fast Farmer ${clientVersion.clientVersion}`
} else {
key = 'Unknown'
}
let clientCount = acc.get(key) ?? 0
clientCount += clientVersion.count
acc.set(key, clientCount)
Expand All @@ -172,13 +179,19 @@ export class InfoComponent implements OnInit, OnDestroy {
private makeSimplifiedClientVersionsChartUpdateOptions(clientVersionInfos: ClientVersion[]): EChartsOption {
const clientVersionWithCount = clientVersionInfos.reduce((acc, clientVersion) => {
let key: string
if (clientVersion.clientName.indexOf('Chia') === -1) {
let comparisonKey: 'chia'|'fastFarmer'|undefined
if (clientVersion.clientName === 'dg_fast_farmer') {
comparisonKey = 'fastFarmer'
} else if (clientVersion.clientName.indexOf('Chia') !== -1) {
comparisonKey = 'chia'
}
if (comparisonKey === undefined) {
key = 'Unknown'
} else if (compare(clientVersion.clientVersion, clientVersions.chia.current, '>=')) {
} else if (compare(clientVersion.clientVersion, clientVersions[comparisonKey].current, '>=')) {
key = 'Current'
} else if (compare(clientVersion.clientVersion, clientVersions.chia.recent, '>=')) {
} else if (compare(clientVersion.clientVersion, clientVersions[comparisonKey].recent, '>=')) {
key = 'Recent'
} else if (compare(clientVersion.clientVersion, clientVersions.chia.outdated, '>=')) {
} else if (compare(clientVersion.clientVersion, clientVersions[comparisonKey].outdated, '>=')) {
key = 'Outdated'
} else {
key = 'Ancient'
Expand All @@ -202,10 +215,16 @@ export class InfoComponent implements OnInit, OnDestroy {
private makeThirdPartyVersionsClientVersionsChartUpdateOptions(clientVersionInfos: ClientVersion[]): EChartsOption {
const clientVersionWithCount = clientVersionInfos.reduce((acc, clientVersion) => {
let key: string
if (clientVersion.localName1 === 'giga' || clientVersion.localName2 === 'giga') {
if (clientVersion.clientName === 'dg_fast_farmer') {
key = 'Fast Farmer'
} else if (clientVersion.localName1 === 'giga' || clientVersion.localName2 === 'giga') {
key = 'Gigahorse'
} else {
} else if (clientVersion.localName1 === 'ff' || clientVersion.localName2 === 'ff' || clientVersion.localName3 == 'ff') {
key = 'Foxy-Farmer'
} else if (clientVersion.clientName.indexOf('Chia') !== -1) {
key = 'Chia'
} else {
key = clientVersion.clientName ?? 'Unknown'
}
let clientCount = acc.get(key) ?? 0
clientCount += clientVersion.count
Expand Down

0 comments on commit 3623e77

Please sign in to comment.