From e81c3df0bed82111eb282b80da2da8961c877622 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Wed, 14 Jul 2021 17:31:06 +0300 Subject: [PATCH] Added displaying version from appsettings.json (api/2.0/settings.json) --- config/appsettings.json | 1 + packages/asc-web-common/store/SettingsStore.js | 1 + web/ASC.Web.Api/Controllers/SettingsController.cs | 3 ++- web/ASC.Web.Api/Models/SettingsWrapper.cs | 2 ++ web/ASC.Web.Client/src/components/pages/About/index.js | 6 +++--- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config/appsettings.json b/config/appsettings.json index 2fe3f75875..5a0b08d78e 100644 --- a/config/appsettings.json +++ b/config/appsettings.json @@ -45,6 +45,7 @@ "enabled": "enabled" }, "version": { + "number": "1.0.0", "release": { "date": "", "sign": "" diff --git a/packages/asc-web-common/store/SettingsStore.js b/packages/asc-web-common/store/SettingsStore.js index e9e555f328..268407aafd 100644 --- a/packages/asc-web-common/store/SettingsStore.js +++ b/packages/asc-web-common/store/SettingsStore.js @@ -82,6 +82,7 @@ class SettingsStore { appId: "", measurementId: "", }; + version = ""; constructor() { makeAutoObservable(this); diff --git a/web/ASC.Web.Api/Controllers/SettingsController.cs b/web/ASC.Web.Api/Controllers/SettingsController.cs index f7004ddc15..4c901f1a5b 100644 --- a/web/ASC.Web.Api/Controllers/SettingsController.cs +++ b/web/ASC.Web.Api/Controllers/SettingsController.cs @@ -300,7 +300,8 @@ namespace ASC.Api.Settings { Culture = Tenant.GetCulture().ToString(), GreetingSettings = Tenant.Name, - Personal = CoreBaseSettings.Personal + Personal = CoreBaseSettings.Personal, + Version = Configuration["version:number"] ?? "" }; if (AuthContext.IsAuthenticated) diff --git a/web/ASC.Web.Api/Models/SettingsWrapper.cs b/web/ASC.Web.Api/Models/SettingsWrapper.cs index e9796b36df..6c7d711187 100644 --- a/web/ASC.Web.Api/Models/SettingsWrapper.cs +++ b/web/ASC.Web.Api/Models/SettingsWrapper.cs @@ -67,6 +67,8 @@ namespace ASC.Api.Settings public FirebaseWrapper Firebase { get; set; } + public string Version { get; set; } + public static SettingsWrapper GetSample() { return new SettingsWrapper diff --git a/web/ASC.Web.Client/src/components/pages/About/index.js b/web/ASC.Web.Client/src/components/pages/About/index.js index 7b3551fb0b..161274ff83 100644 --- a/web/ASC.Web.Client/src/components/pages/About/index.js +++ b/web/ASC.Web.Client/src/components/pages/About/index.js @@ -7,7 +7,6 @@ import styled from "styled-components"; import { isMobile } from "react-device-detect"; import { setDocumentTitle } from "../../../helpers/utils"; import i18n from "./i18n"; -import config from "../../../../package.json"; import withLoader from "../Confirm/withLoader"; import { inject, observer } from "mobx-react"; import { ReactSVG } from "react-svg"; @@ -78,7 +77,7 @@ const VersionStyle = styled.div` padding: 8px 0px 20px 0px; `; -const Body = ({ t, personal }) => { +const Body = ({ t, personal, version }) => { useEffect(() => { setDocumentTitle(t("Common:About")); }, [t]); @@ -124,7 +123,7 @@ const Body = ({ t, personal }) => { - {`${t("Common:Version")}: ${config.version}`} + {`${t("Common:Version")}: ${version}`} @@ -198,6 +197,7 @@ const Body = ({ t, personal }) => { const BodyWrapper = inject(({ auth }) => ({ personal: auth.settingsStore, + version: auth.settingsStore.version, }))(withTranslation(["About", "Common"])(withLoader(observer(Body)))); const About = (props) => {