Merge: - client: fix update now button and notification

#815

* commit '71c1157ef56fa456698e828b3d4ff992d62199ff':
  * client: remove version truncate for desktop
  - client: fix update now button and notification
This commit is contained in:
Simon Zolin 2019-07-05 18:26:53 +03:00
commit f0c9ffcbeb
4 changed files with 28 additions and 7 deletions

View File

@ -1,4 +1,5 @@
{
"client_settings": "Client settings",
"example_upstream_reserved": "you can specify DNS upstream <0>for a specific domain(s)<\/0>",
"upstream_parallel": "Use parallel queries to speed up resolving by simultaneously querying all upstream servers",
"bootstrap_dns": "Bootstrap DNS servers",
@ -52,7 +53,7 @@
"filters": "Filters",
"query_log": "Query Log",
"faq": "FAQ",
"version": "version",
"version": "Version",
"address": "address",
"on": "ON",
"off": "OFF",
@ -99,7 +100,6 @@
"dns_settings": "DNS settings",
"encryption_settings": "Encryption settings",
"dhcp_settings": "DHCP settings",
"client_settings": "Client settings",
"upstream_dns": "Upstream DNS servers",
"upstream_dns_hint": "If you keep this field empty, AdGuard Home will use <a href='https:\/\/1.1.1.1\/' target='_blank'>Cloudflare DNS<\/a> as an upstream.",
"test_upstream_btn": "Test upstreams",
@ -314,6 +314,7 @@
"access_blocked_desc": "Don't confuse this with filters. AdGuard Home will drop DNS queries with these domains in query's question.",
"access_settings_saved": "Access settings successfully saved",
"updates_checked": "Updates successfully checked",
"updates_version_equal": "AdGuard Home is up-to-date",
"check_updates_now": "Check for updates now",
"dns_privacy": "DNS Privacy",
"setup_dns_privacy_1": "<0>DNS-over-TLS:</0> Use <1>{{address}}</1> string.",

View File

@ -4,6 +4,7 @@ import { t } from 'i18next';
import { showLoading, hideLoading } from 'react-redux-loading-bar';
import axios from 'axios';
import versionCompare from '../helpers/versionCompare';
import { normalizeHistory, normalizeFilteringStatus, normalizeLogs, normalizeTextarea, sortClients } from '../helpers/helpers';
import { SETTINGS_NAMES, CHECK_TIMEOUT } from '../helpers/constants';
import { getTlsStatus } from './encryption';
@ -146,13 +147,21 @@ export const getVersionRequest = createAction('GET_VERSION_REQUEST');
export const getVersionFailure = createAction('GET_VERSION_FAILURE');
export const getVersionSuccess = createAction('GET_VERSION_SUCCESS');
export const getVersion = (recheck = false) => async (dispatch) => {
export const getVersion = (recheck = false) => async (dispatch, getState) => {
dispatch(getVersionRequest());
try {
const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck });
dispatch(getVersionSuccess(newVersion));
const data = await apiClient.getGlobalVersion({ recheck_now: recheck });
dispatch(getVersionSuccess(data));
if (recheck) {
dispatch(addSuccessToast('updates_checked'));
const { dnsVersion } = getState().dashboard;
const currentVersion = dnsVersion === 'undefined' ? 0 : dnsVersion;
if (data && versionCompare(currentVersion, data.new_version) === -1) {
dispatch(addSuccessToast('updates_checked'));
} else {
dispatch(addSuccessToast('updates_version_equal'));
}
}
} catch (error) {
dispatch(addErrorToast({ error }));

View File

@ -82,6 +82,14 @@
overflow: hidden;
}
@media screen and (min-width: 992px) {
.nav-version__value {
max-width: 100%;
overflow: visible;
white-space: normal;
}
}
.nav-version__link {
position: relative;
display: inline-block;

View File

@ -142,7 +142,10 @@ const dashboard = handleActions({
return newState;
}
return state;
return {
...state,
processingVersion: false,
};
},
[actions.getUpdateRequest]: state => ({ ...state, processingUpdate: true }),