mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-25 22:49:54 +03:00
fix: should notify new version only once a day even when an error occurs (#353)
Add more messages in console fixes #353
This commit is contained in:
parent
6318ccfdf5
commit
6c3c27e215
3 changed files with 12 additions and 6 deletions
2
dist/docker-registry-ui.js
vendored
2
dist/docker-registry-ui.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docker-registry-ui",
|
"name": "docker-registry-ui",
|
||||||
"version": "2.5.6",
|
"version": "2.5.7",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "npm run format-html && npm run format-js && npm run format-riot",
|
"format": "npm run format-html && npm run format-js && npm run format-riot",
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
if (latest && latest.tag_name) {
|
if (latest && latest.tag_name) {
|
||||||
this.update({ tag_name: latest.tag_name, latest });
|
this.update({ tag_name: latest.tag_name, latest });
|
||||||
}
|
}
|
||||||
if (!latest || isNaN(expires) || new Date().getTime() > expires) {
|
if (isNaN(expires) || new Date().getTime() > expires) {
|
||||||
this.checkForUpdates(props, state);
|
this.checkForUpdates(props, state);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -64,16 +64,22 @@
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
oReq.addEventListener('load', function () {
|
oReq.addEventListener('load', function () {
|
||||||
|
localStorage.setItem(EXPIRES, new Date().getTime() + ONE_DAY);
|
||||||
if (this.status === 200) {
|
if (this.status === 200) {
|
||||||
const latest = parseJSON(this.responseText);
|
const latest = parseJSON(this.responseText);
|
||||||
if (latest && self.tag_name !== latest.tag_name && !isNewestVersion(props.version, latest.tag_name)) {
|
if (latest && self.tag_name !== latest.tag_name && !isNewestVersion(props.version, latest.tag_name)) {
|
||||||
props.onNotify('A new version of Docker Registry UI is available!');
|
props.onNotify('A new version of Docker Registry UI is available!');
|
||||||
}
|
}
|
||||||
localStorage.setItem(LATEST, this.responseText);
|
localStorage.setItem(LATEST, this.responseText);
|
||||||
localStorage.setItem(EXPIRES, new Date().getTime() + ONE_DAY);
|
|
||||||
self.update({ tag_name: latest.tag_name, latest });
|
self.update({ tag_name: latest.tag_name, latest });
|
||||||
} else {
|
} else if (this.status !== 404) {
|
||||||
props.onNotify('Cannot check for new updates. See the browser console.');
|
// Should not notify if the project is not found.
|
||||||
|
props.onNotify('Cannot check for new updates. Will try again in 24 hours. See the browser console.');
|
||||||
|
|
||||||
|
console.error(
|
||||||
|
`Cannot check for new Docker Registry UI updates. This is most likely a GitHub issue. You don't need to worry about it.`
|
||||||
|
);
|
||||||
|
|
||||||
console.error(`Got status code ${this.status} from Github API with response ${this.responseText}`);
|
console.error(`Got status code ${this.status} from Github API with response ${this.responseText}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue