diff --git a/server/src/app/app.service.ts b/server/src/app/app.service.ts index ae956643..a3b70af4 100644 --- a/server/src/app/app.service.ts +++ b/server/src/app/app.service.ts @@ -1,5 +1,5 @@ import { Injectable, Logger } from '@nestjs/common'; -import { ExternalApiService } from 'src/modules/api/external-api/external-api.service'; +import { ExternalApiService } from '../modules/api/external-api/external-api.service'; interface VersionResponse { status: 1 | 0; @@ -27,9 +27,9 @@ export class AppService { const calculatedVersion = versionTag !== 'stable' ? process.env.GIT_SHA - ? `${versionTag}-${process.env.GIT_SHA}` + ? `${versionTag}-${process.env.GIT_SHA.substring(0, 7)}` : `${versionTag}-` - : `${versionTag}-${packageVersion}`; + : `${packageVersion}`; const local = process.env.NODE_ENV !== 'production'; diff --git a/ui/src/components/VersionStatus/index.tsx b/ui/src/components/VersionStatus/index.tsx index d343c50e..753643e2 100644 --- a/ui/src/components/VersionStatus/index.tsx +++ b/ui/src/components/VersionStatus/index.tsx @@ -26,9 +26,10 @@ interface VersionStatusProps { } const VersionStatus = ({ onClick }: VersionStatusProps) => { - const [version, setVersion] = useState('1.7.1') + const [version, setVersion] = useState('0.0.1') const [commitTag, setCommitTag] = useState('') const [updateAvailable, setUpdateAvailable] = useState(false) + const [loading, setLoading] = useState(true) useEffect(() => { GetApiHandler('/app/status').then((resp: VersionResponse) => { @@ -36,6 +37,7 @@ const VersionStatus = ({ onClick }: VersionStatusProps) => { setVersion(resp.version) setCommitTag(resp.commitTag) setUpdateAvailable(resp.updateAvailable) + setLoading(false) } }) }, []) @@ -48,46 +50,50 @@ const VersionStatus = ({ onClick }: VersionStatusProps) => { : messages.STABLE return ( - { - if (e.key === 'Enter' && onClick) { - onClick() - } - }} - role="button" - tabIndex={0} - className={`mx-2 flex items-center rounded-lg p-2 text-xs ring-1 ring-zinc-700 transition duration-300 ${ - updateAvailable - ? 'bg-amber-800 text-white hover:bg-amber-600' - : 'bg-zinc-900 text-zinc-300 hover:bg-zinc-800' - }`} - > - {commitTag === 'local' ? ( - - ) : version.startsWith('develop-') ? ( - - ) : ( - - )} -
- {versionStream} - + <> + {!loading ? ( + { + if (e.key === 'Enter' && onClick) { + onClick() + } + }} + role="button" + tabIndex={0} + className={`mx-2 flex items-center rounded-lg p-2 text-xs ring-1 ring-zinc-700 transition duration-300 ${ + updateAvailable + ? 'bg-amber-800 text-white hover:bg-amber-600' + : 'bg-zinc-900 text-zinc-300 hover:bg-zinc-800' + }`} + > {commitTag === 'local' ? ( - '' - ) : updateAvailable ? ( - messages.OUT_OF_DATE + + ) : version.startsWith('develop-') ? ( + ) : ( - - {version.replace('develop-', '')} - + )} - -
- {updateAvailable && } - +
+ {versionStream} + + {commitTag === 'local' ? ( + '' + ) : updateAvailable ? ( + messages.OUT_OF_DATE + ) : ( + + {version.replace('develop-', '')} + + )} + +
+ {updateAvailable && } + + ) : undefined} + ) }