From 45fa677df8f95789a6308a75067139648b9b683e Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 10 Aug 2023 12:46:06 -0400 Subject: out of data version alert client side --- src/client/util/CurrentUserUtils.ts | 4 +++- src/client/util/SettingsManager.tsx | 4 ++-- src/client/views/topbar/TopBar.tsx | 7 ++++--- src/fields/DocSymbols.ts | 2 ++ src/fields/Types.ts | 9 ++++----- src/mobile/MobileMain.tsx | 2 +- src/server/ApiManagers/UserManager.ts | 14 +++++++++++++- 7 files changed, 29 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index f8fc2b531..ad9913c7d 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -914,10 +914,12 @@ export class CurrentUserUtils { }); } + public static ServerVersion: string = ';' public static async loadCurrentUser() { return rp.get(Utils.prepend("/getCurrentUser")).then(async response => { if (response) { - const result: { userDocumentId: string, sharingDocumentId: string, linkDatabaseId: string, email: string, cacheDocumentIds: string, resolvedPorts: string } = JSON.parse(response); + const result: { version: string, userDocumentId: string, sharingDocumentId: string, linkDatabaseId: string, email: string, cacheDocumentIds: string, resolvedPorts: string } = JSON.parse(response); + CurrentUserUtils.ServerVersion = result.version; Doc.CurrentUserEmail = result.email; resolvedPorts = result.resolvedPorts as any; DocServer.init(window.location.protocol, window.location.hostname, resolvedPorts.socket, result.email); diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx index 534a5dbc6..b2b5be070 100644 --- a/src/client/util/SettingsManager.tsx +++ b/src/client/util/SettingsManager.tsx @@ -6,6 +6,7 @@ import * as React from 'react'; import { BsGoogle } from 'react-icons/bs'; import { FaFillDrip, FaPalette } from 'react-icons/fa'; import { Doc } from '../../fields/Doc'; +import { DashVersion } from '../../fields/DocSymbols'; import { BoolCast, Cast, StrCast } from '../../fields/Types'; import { addStyleSheet, addStyleSheetRule, Utils } from '../../Utils'; import { GoogleAuthenticationManager } from '../apis/GoogleAuthenticationManager'; @@ -36,7 +37,6 @@ export enum freeformScrollMode { @observer export class SettingsManager extends React.Component<{}> { - static Version = 'v0.5.2'; public static Instance: SettingsManager; static _settingsStyle = addStyleSheet(); @observable public isOpen = false; @@ -450,7 +450,7 @@ export class SettingsManager extends React.Component<{}> {
-
{SettingsManager.Version}
+
{DashVersion}
{Doc.CurrentUserEmail}
diff --git a/src/client/views/topbar/TopBar.tsx b/src/client/views/topbar/TopBar.tsx index 8caba930d..bdea07fe7 100644 --- a/src/client/views/topbar/TopBar.tsx +++ b/src/client/views/topbar/TopBar.tsx @@ -5,7 +5,7 @@ import { observer } from 'mobx-react'; import * as React from 'react'; import { FaBug, FaCamera, FaStamp } from 'react-icons/fa'; import { Doc, DocListCast } from '../../../fields/Doc'; -import { AclAdmin } from '../../../fields/DocSymbols'; +import { AclAdmin, DashVersion } from '../../../fields/DocSymbols'; import { StrCast } from '../../../fields/Types'; import { GetEffectiveAcl } from '../../../fields/util'; import { DocumentManager } from '../../util/DocumentManager'; @@ -21,6 +21,7 @@ import { MainView } from '../MainView'; import { CollectionDockingView } from '../collections/CollectionDockingView'; import { Colors } from '../global/globalEnums'; import './TopBar.scss'; +import { CurrentUserUtils } from '../../util/CurrentUserUtils'; /** * ABOUT: This is the topbar in Dash, which included the current Dashboard as well as access to information on the user @@ -155,8 +156,8 @@ export class TopBar extends React.Component { size={Size.SMALL} onClick={ServerStats.Instance.open} type={Type.TERT} - tooltip={'Server is ' + (PingManager.Instance.IsBeating ? '' : 'NOT ') + 'running ' + SettingsManager.Version} - color={this.happyHeart ? Colors.LIGHT_BLUE : Colors.ERROR_RED} + tooltip={'Server is ' + (PingManager.Instance.IsBeating ? '' : 'NOT ') + 'running ' + DashVersion} + color={this.happyHeart ? (DashVersion === CurrentUserUtils.ServerVersion ? Colors.LIGHT_BLUE : Colors.YELLOW) : Colors.ERROR_RED} icon={} /> {/*