diff --git a/ui/v2.5/src/components/Settings/SettingsAboutPanel.tsx b/ui/v2.5/src/components/Settings/SettingsAboutPanel.tsx
index 2e70f7abf..69dbc3a26 100644
--- a/ui/v2.5/src/components/Settings/SettingsAboutPanel.tsx
+++ b/ui/v2.5/src/components/Settings/SettingsAboutPanel.tsx
@@ -1,9 +1,10 @@
import React from "react";
-import { Table, Spinner } from "react-bootstrap";
+import { Button, Table, Spinner } from "react-bootstrap";
import { StashService } from "src/core/StashService";
export const SettingsAboutPanel: React.FC = () => {
const { data, error, loading } = StashService.useVersion();
+ const { data: dataLatest, error: errorLatest, loading: loadingLatest, refetch, networkStatus } = StashService.useLatestVersion();
function maybeRenderTag() {
if (!data || !data.version || !data.version.version) {
@@ -17,6 +18,44 @@ export const SettingsAboutPanel: React.FC = () => {
);
}
+ function maybeRenderLatestVersion() {
+ if (!dataLatest || !dataLatest.latestversion || !dataLatest.latestversion.shorthash || !dataLatest.latestversion.url) { return; }
+ if (!data || !data.version || !data.version.hash) {
+ return (
+ <>{dataLatest.latestversion.shorthash}>
+ );
+ }
+
+ if (data.version.hash !== dataLatest.latestversion.shorthash) {
+ return (
+ <>
+ {dataLatest.latestversion.shorthash} [NEW] Download
+ >
+ );
+ }
+
+ return (
+ <>{dataLatest.latestversion.shorthash}>
+ );
+ }
+
+ function renderLatestVersion() {
+ if (!data || !data.version || !data.version.version) { return; } //if there is no "version" latest version check is obviously not supported
+ return (
+
+
+
+ Latest Version Build Hash: |
+ {maybeRenderLatestVersion()} |
+
+
+ |
+
+
+
+ );
+ }
+
function renderVersion() {
if (!data || !data.version) {
return;
@@ -43,8 +82,10 @@ export const SettingsAboutPanel: React.FC = () => {
<>
About
{!data || loading ? : ""}
- {error ? error.message : ""}
+ {!!error ? {error.message} : undefined}
+ {!!errorLatest ? {errorLatest.message} : undefined}
{renderVersion()}
+ {!dataLatest || loadingLatest || networkStatus === 4 ? : <>{renderLatestVersion()}>}
>
);
};
diff --git a/ui/v2.5/src/core/StashService.ts b/ui/v2.5/src/core/StashService.ts
index 3be5b544c..536664abd 100644
--- a/ui/v2.5/src/core/StashService.ts
+++ b/ui/v2.5/src/core/StashService.ts
@@ -275,6 +275,8 @@ export class StashService {
public static useVersion() {
return GQL.useVersionQuery();
}
+ public static useLatestVersion() { return GQL.useLatestVersionQuery({ notifyOnNetworkStatusChange: true, errorPolicy: 'ignore' }); }
+
public static useConfiguration() {
return GQL.useConfigurationQuery();
diff --git a/ui/v2.5/src/core/generated-graphql.tsx b/ui/v2.5/src/core/generated-graphql.tsx
index b8ca5de3b..a239ea9aa 100644
--- a/ui/v2.5/src/core/generated-graphql.tsx
+++ b/ui/v2.5/src/core/generated-graphql.tsx
@@ -7,7 +7,7 @@ import * as ApolloReactHooks from '@apollo/react-hooks';
export type Maybe = T | null;
export type Omit = Pick>;
-// Generated in 2020-01-21T19:57:40+01:00
+// Generated in 2020-01-23T14:20:33+01:00
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
@@ -548,6 +548,8 @@ export type Query = {
allTags: Array,
/** Version */
version: Version,
+ /** LatestVersion */
+ latestversion: ShortVersion,
};
@@ -788,6 +790,8 @@ export type SceneFilterType = {
rating?: Maybe,
/** Filter by resolution */
resolution?: Maybe,
+ /** Filter by duration (in seconds) */
+ duration?: Maybe,
/** Filter to only include scenes which have markers. `true` or `false` */
has_markers?: Maybe,
/** Filter to only include scenes missing this property */
@@ -1012,6 +1016,12 @@ export enum ScrapeType {
Url = 'URL'
}
+export type ShortVersion = {
+ __typename?: 'ShortVersion',
+ shorthash: Scalars['String'],
+ url: Scalars['String'],
+};
+
export enum SortDirectionEnum {
Asc = 'ASC',
Desc = 'DESC'
@@ -1739,6 +1749,17 @@ export type VersionQuery = (
) }
);
+export type LatestVersionQueryVariables = {};
+
+
+export type LatestVersionQuery = (
+ { __typename?: 'Query' }
+ & { latestversion: (
+ { __typename?: 'ShortVersion' }
+ & Pick
+ ) }
+);
+
export type FindPerformersQueryVariables = {
filter?: Maybe,
performer_filter?: Maybe
@@ -3750,6 +3771,45 @@ export function useVersionLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHook
export type VersionQueryHookResult = ReturnType;
export type VersionLazyQueryHookResult = ReturnType;
export type VersionQueryResult = ApolloReactCommon.QueryResult;
+export const LatestVersionDocument = gql`
+ query LatestVersion {
+ latestversion {
+ shorthash
+ url
+ }
+}
+ `;
+export type LatestVersionComponentProps = Omit, 'query'>;
+
+ export const LatestVersionComponent = (props: LatestVersionComponentProps) => (
+ query={LatestVersionDocument} {...props} />
+ );
+
+
+/**
+ * __useLatestVersionQuery__
+ *
+ * To run a query within a React component, call `useLatestVersionQuery` and pass it any options that fit your needs.
+ * When your component renders, `useLatestVersionQuery` returns an object from Apollo Client that contains loading, error, and data properties
+ * you can use to render your UI.
+ *
+ * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
+ *
+ * @example
+ * const { data, loading, error } = useLatestVersionQuery({
+ * variables: {
+ * },
+ * });
+ */
+export function useLatestVersionQuery(baseOptions?: ApolloReactHooks.QueryHookOptions) {
+ return ApolloReactHooks.useQuery(LatestVersionDocument, baseOptions);
+ }
+export function useLatestVersionLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions) {
+ return ApolloReactHooks.useLazyQuery(LatestVersionDocument, baseOptions);
+ }
+export type LatestVersionQueryHookResult = ReturnType;
+export type LatestVersionLazyQueryHookResult = ReturnType;
+export type LatestVersionQueryResult = ApolloReactCommon.QueryResult;
export const FindPerformersDocument = gql`
query FindPerformers($filter: FindFilterType, $performer_filter: PerformerFilterType) {
findPerformers(filter: $filter, performer_filter: $performer_filter) {