Merge: - fix 'Check for Updates' button visibility
Close #1878 * commit '61981a927babe1ec771c01c13e2d503e3dc957e5': Change getVersionSuccess reducer minor * POST /control/version.json: change response when update is disabled
This commit is contained in:
commit
95f4128551
@ -344,10 +344,14 @@ Response:
|
|||||||
|
|
||||||
If `can_autoupdate` is true, then the server can automatically upgrade to a new version.
|
If `can_autoupdate` is true, then the server can automatically upgrade to a new version.
|
||||||
|
|
||||||
Response with empty body:
|
Response when auto-update is disabled by command-line argument:
|
||||||
|
|
||||||
200 OK
|
200 OK
|
||||||
|
|
||||||
|
{
|
||||||
|
"disabled":true
|
||||||
|
}
|
||||||
|
|
||||||
It means that update check is disabled by user. UI should do nothing.
|
It means that update check is disabled by user. UI should do nothing.
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ const dashboard = handleActions(
|
|||||||
[actions.getVersionSuccess]: (state, { payload }) => {
|
[actions.getVersionSuccess]: (state, { payload }) => {
|
||||||
const currentVersion = state.dnsVersion === 'undefined' ? 0 : state.dnsVersion;
|
const currentVersion = state.dnsVersion === 'undefined' ? 0 : state.dnsVersion;
|
||||||
|
|
||||||
if (payload && isVersionGreater(currentVersion, payload.new_version)) {
|
if (!payload.disabled && isVersionGreater(currentVersion, payload.new_version)) {
|
||||||
const {
|
const {
|
||||||
announcement_url: announcementUrl,
|
announcement_url: announcementUrl,
|
||||||
new_version: newVersion,
|
new_version: newVersion,
|
||||||
@ -96,7 +96,7 @@ const dashboard = handleActions(
|
|||||||
canAutoUpdate,
|
canAutoUpdate,
|
||||||
isUpdateAvailable: true,
|
isUpdateAvailable: true,
|
||||||
processingVersion: false,
|
processingVersion: false,
|
||||||
checkUpdateFlag: !!payload,
|
checkUpdateFlag: !payload.disabled,
|
||||||
};
|
};
|
||||||
return newState;
|
return newState;
|
||||||
}
|
}
|
||||||
@ -104,6 +104,7 @@ const dashboard = handleActions(
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
processingVersion: false,
|
processingVersion: false,
|
||||||
|
checkUpdateFlag: !payload.disabled,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -41,6 +41,10 @@ type getVersionJSONRequest struct {
|
|||||||
// Get the latest available version from the Internet
|
// Get the latest available version from the Internet
|
||||||
func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) {
|
func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) {
|
||||||
if Context.disableUpdate {
|
if Context.disableUpdate {
|
||||||
|
resp := make(map[string]interface{})
|
||||||
|
resp["disabled"] = true
|
||||||
|
d, _ := json.Marshal(resp)
|
||||||
|
_, _ = w.Write(d)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user