mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-25 14:59:16 +01:00
Finished UI for updater
This commit is contained in:
50
public/js/app.js
vendored
50
public/js/app.js
vendored
@@ -127865,6 +127865,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
||||
|
||||
|
||||
|
||||
|
||||
var Version = /*#__PURE__*/function (_Component) {
|
||||
_inherits(Version, _Component);
|
||||
|
||||
@@ -127907,11 +127908,48 @@ var Version = /*#__PURE__*/function (_Component) {
|
||||
});
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "updateApp", function () {
|
||||
_this.setState({
|
||||
showProgress: true,
|
||||
updateProgress: 0
|
||||
});
|
||||
|
||||
react_toastify__WEBPACK_IMPORTED_MODULE_3__["toast"].info('Downloading update');
|
||||
axios__WEBPACK_IMPORTED_MODULE_2___default.a.get('/api/update/download').then(function (resp) {
|
||||
_this.setState({
|
||||
updateProgress: 50
|
||||
});
|
||||
|
||||
react_toastify__WEBPACK_IMPORTED_MODULE_3__["toast"].info('Extracting update');
|
||||
axios__WEBPACK_IMPORTED_MODULE_2___default.a.get('/api/speedtest/extract').then(function (resp) {
|
||||
_this.setState({
|
||||
updateProgress: 75
|
||||
});
|
||||
|
||||
react_toastify__WEBPACK_IMPORTED_MODULE_3__["toast"].info('Applying update');
|
||||
axios__WEBPACK_IMPORTED_MODULE_2___default.a.get('/api/update/move').then(function (resp) {
|
||||
_this.setState({
|
||||
updateProgress: 100
|
||||
});
|
||||
|
||||
react_toastify__WEBPACK_IMPORTED_MODULE_3__["toast"].success('Update successful. Refreshing your page...');
|
||||
setTimeout(function () {
|
||||
location.reload(true);
|
||||
}, 5000);
|
||||
});
|
||||
});
|
||||
})["catch"](function (err) {
|
||||
react_toastify__WEBPACK_IMPORTED_MODULE_3__["toast"].error('Something went wrong...');
|
||||
});
|
||||
});
|
||||
|
||||
_this.state = {
|
||||
version: document.querySelector('meta[name="version"]').content,
|
||||
update: false,
|
||||
modalShow: false,
|
||||
changelog: []
|
||||
changelog: [],
|
||||
showProgress: false,
|
||||
updateProgress: 0
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
@@ -127928,6 +127966,8 @@ var Version = /*#__PURE__*/function (_Component) {
|
||||
var update = this.state.update;
|
||||
var modalShow = this.state.modalShow;
|
||||
var changelog = this.state.changelog;
|
||||
var showProgress = this.state.showProgress;
|
||||
var updateProgress = this.state.updateProgress;
|
||||
|
||||
if (update === false) {
|
||||
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p", {
|
||||
@@ -127961,7 +128001,13 @@ var Version = /*#__PURE__*/function (_Component) {
|
||||
rel: "noopener noreferer"
|
||||
}, e.description));
|
||||
}
|
||||
})))));
|
||||
})), showProgress && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p", null, "Update progress:"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_bootstrap__WEBPACK_IMPORTED_MODULE_4__["ProgressBar"], {
|
||||
animated: true,
|
||||
now: updateProgress
|
||||
})), !showProgress && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_bootstrap__WEBPACK_IMPORTED_MODULE_4__["Button"], {
|
||||
variant: "primary",
|
||||
onClick: this.updateApp
|
||||
}, "Update"))));
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user