web/storagenode: node version bug fixed (#3339)

This commit is contained in:
Vitalii Shpital 2019-10-22 17:46:07 +03:00 committed by GitHub
parent 97018d6d64
commit 4489c86539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 24 deletions

View File

@ -106,7 +106,7 @@ export default class SNOContentTitle extends Vue {
public get version(): string { public get version(): string {
const version = this.$store.state.node.info.version; const version = this.$store.state.node.info.version;
return `v${version.major}.${version.minor}.${version.patch}`; return `v${version}`;
} }
public get online(): boolean { public get online(): boolean {

View File

@ -1,7 +1,7 @@
// Copyright (C) 2019 Storj Labs, Inc. // Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information. // See LICENSE for copying information.
import { BandwidthInfo, Dashboard, DiskSpaceInfo, SatelliteInfo, Version } from '@/storagenode/dashboard'; import { BandwidthInfo, Dashboard, DiskSpaceInfo, SatelliteInfo } from '@/storagenode/dashboard';
import { BandwidthUsed, Egress, Ingress, Metric, Satellite, Satellites, Stamp } from '@/storagenode/satellite'; import { BandwidthUsed, Egress, Ingress, Metric, Satellite, Satellites, Stamp } from '@/storagenode/satellite';
/** /**
@ -38,14 +38,12 @@ export class SNOApi {
return new SatelliteInfo(satellite.id, disqualified); return new SatelliteInfo(satellite.id, disqualified);
}); });
const version: Version = new Version(json.version.major, json.version.minor, json.version.patch);
const diskSpace: DiskSpaceInfo = new DiskSpaceInfo(json.diskSpace.used, json.diskSpace.available); const diskSpace: DiskSpaceInfo = new DiskSpaceInfo(json.diskSpace.used, json.diskSpace.available);
const bandwidth: BandwidthInfo = new BandwidthInfo(json.bandwidth.used, json.bandwidth.available); const bandwidth: BandwidthInfo = new BandwidthInfo(json.bandwidth.used, json.bandwidth.available);
return new Dashboard(json.nodeID, json.wallet, satellites, diskSpace, bandwidth, return new Dashboard(json.nodeID, json.wallet, satellites, diskSpace, bandwidth,
new Date(json.lastPinged), new Date(json.startedAt), version, json.upToDate); new Date(json.lastPinged), new Date(json.startedAt), json.version, json.upToDate);
} }
/** /**

View File

@ -13,28 +13,10 @@ export class Dashboard {
public bandwidth: BandwidthInfo, public bandwidth: BandwidthInfo,
public lastPinged: Date, public lastPinged: Date,
public startedAt: Date, public startedAt: Date,
public version: Version, public version: string,
public isUpToDate: boolean) {} public isUpToDate: boolean) {}
} }
/**
* Version represents a semantic version
*/
export class Version {
public constructor(
public major: number,
public minor: number,
public patch: number) {}
/**
* Converts version numbers to string type
* @returns version - string of version value
*/
public toString(): string {
return `v${this.major}.${this.minor}.${this.patch}`;
}
}
/** /**
* SatelliteInfo encapsulates satellite ID and disqualification * SatelliteInfo encapsulates satellite ID and disqualification
*/ */