Skip to content

Commit

Permalink
Added displaying version from appsettings.json (api/2.0/settings.json)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeySafronov committed Jul 14, 2021
1 parent 1ebc588 commit e81c3df
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions config/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"enabled": "enabled"
},
"version": {
"number": "1.0.0",
"release": {
"date": "",
"sign": ""
Expand Down
1 change: 1 addition & 0 deletions packages/asc-web-common/store/SettingsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class SettingsStore {
appId: "",
measurementId: "",
};
version = "";

constructor() {
makeAutoObservable(this);
Expand Down
3 changes: 2 additions & 1 deletion web/ASC.Web.Api/Controllers/SettingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ public SettingsWrapper GetSettings()
{
Culture = Tenant.GetCulture().ToString(),
GreetingSettings = Tenant.Name,
Personal = CoreBaseSettings.Personal
Personal = CoreBaseSettings.Personal,
Version = Configuration["version:number"] ?? ""
};

if (AuthContext.IsAuthenticated)
Expand Down
2 changes: 2 additions & 0 deletions web/ASC.Web.Api/Models/SettingsWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public class SettingsWrapper

public FirebaseWrapper Firebase { get; set; }

public string Version { get; set; }

public static SettingsWrapper GetSample()
{
return new SettingsWrapper
Expand Down
6 changes: 3 additions & 3 deletions web/ASC.Web.Client/src/components/pages/About/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -124,7 +123,7 @@ const Body = ({ t, personal }) => {

<VersionStyle>
<Text className="text_style" fontSize="14px" color="#A3A9AE">
{`${t("Common:Version")}: ${config.version}`}
{`${t("Common:Version")}: ${version}`}
</Text>
</VersionStyle>

Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit e81c3df

Please sign in to comment.