From 3623e777ee23a35626850d7ff69fbaad731d0ca3 Mon Sep 17 00:00:00 2001 From: Felix Brucker Date: Sat, 11 Nov 2023 18:33:06 +0530 Subject: [PATCH] Add Fast Farmer version card --- src/app/api/types/pool/client-version.ts | 4 +- src/app/client-versions.ts | 7 ++++ .../harvester-card.component.html | 9 +++- .../harvester-card.component.ts | 41 +++++++++++++++++-- src/app/info/info.component.ts | 33 +++++++++++---- 5 files changed, 81 insertions(+), 13 deletions(-) diff --git a/src/app/api/types/pool/client-version.ts b/src/app/api/types/pool/client-version.ts index 6cdda4d..2122662 100644 --- a/src/app/api/types/pool/client-version.ts +++ b/src/app/api/types/pool/client-version.ts @@ -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 diff --git a/src/app/client-versions.ts b/src/app/client-versions.ts index 60dda0a..d8fdd72 100644 --- a/src/app/client-versions.ts +++ b/src/app/client-versions.ts @@ -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, diff --git a/src/app/harvester-card/harvester-card.component.html b/src/app/harvester-card/harvester-card.component.html index eb0626f..5cc10ba 100644 --- a/src/app/harvester-card/harvester-card.component.html +++ b/src/app/harvester-card/harvester-card.component.html @@ -88,13 +88,20 @@
+
+
+ +
=')) { + 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 @@ -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 } diff --git a/src/app/info/info.component.ts b/src/app/info/info.component.ts index 5041e97..d5dbf5c 100644 --- a/src/app/info/info.component.ts +++ b/src/app/info/info.component.ts @@ -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) @@ -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' @@ -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