Merge pull request '2240-salix-version-refresh' (#1001) from 2240-salix-version-refresh into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
e4d71cfa15
|
@ -10,6 +10,7 @@ export default class App {
|
|||
constructor() {
|
||||
this.loaderStatus = 0;
|
||||
this.loading = false;
|
||||
this.versionInterval = setInterval(this.getVersion.bind(this), 300000);
|
||||
}
|
||||
|
||||
showMessage(message) {
|
||||
|
@ -38,6 +39,21 @@ export default class App {
|
|||
if (this.loaderStatus === 0)
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
getVersion() {
|
||||
this.logger.$http.get('Applications/status');
|
||||
}
|
||||
|
||||
setVersion(newVersion) {
|
||||
if (newVersion) {
|
||||
const currentVersion = localStorage.getItem('salix-version');
|
||||
if (newVersion != currentVersion) {
|
||||
this.hasNewVersion = true;
|
||||
clearInterval(this.versionInterval);
|
||||
}
|
||||
localStorage.setItem('salix-version', newVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.service('vnApp', App);
|
||||
|
|
|
@ -30,14 +30,17 @@ function interceptor($q, vnApp, vnToken, $translate) {
|
|||
},
|
||||
response(response) {
|
||||
vnApp.popLoader();
|
||||
const newVersion = response.headers('salix-version');
|
||||
vnApp.setVersion(newVersion);
|
||||
|
||||
return response;
|
||||
},
|
||||
responseError(rejection) {
|
||||
vnApp.popLoader();
|
||||
let err = new HttpError(rejection.statusText);
|
||||
const err = new HttpError(rejection.statusText);
|
||||
Object.assign(err, rejection);
|
||||
return $q.reject(err);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
ngModule.factory('vnInterceptor', interceptor);
|
||||
|
|
|
@ -19,6 +19,14 @@
|
|||
</div>
|
||||
<vn-slot name="topbar"></vn-slot>
|
||||
<div class="side end">
|
||||
<vn-icon-button
|
||||
id="refresh"
|
||||
icon="refresh"
|
||||
ng-if="$ctrl.vnApp.hasNewVersion"
|
||||
ng-click="$ctrl.refresh()"
|
||||
class="refresh"
|
||||
translate-attr="{title: 'There is a new version, click here to reload'}">
|
||||
</vn-icon-button>
|
||||
<vn-icon-button
|
||||
id="apps"
|
||||
icon="apps"
|
||||
|
@ -39,7 +47,6 @@
|
|||
translate-attr="{title: 'Account'}"
|
||||
on-error-src/>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
<vn-menu vn-id="apps-menu">
|
||||
<vn-list class="modules-menu">
|
||||
|
|
|
@ -26,6 +26,10 @@ export class Layout extends Component {
|
|||
const token = this.vnToken.token;
|
||||
return `/api/Images/user/160x160/${userId}/download?access_token=${token}`;
|
||||
}
|
||||
|
||||
refresh() {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
Layout.$inject = ['$element', '$scope', 'vnModules'];
|
||||
|
||||
|
|
|
@ -60,6 +60,9 @@ vn-layout {
|
|||
font-size: 1.05rem;
|
||||
padding: 0;
|
||||
}
|
||||
.vn-icon-button.refresh {
|
||||
color: $color-alert;
|
||||
}
|
||||
}
|
||||
& > vn-side-menu > .menu {
|
||||
display: flex;
|
||||
|
|
|
@ -17,6 +17,7 @@ Go to module summary: Ir a la vista previa del módulo
|
|||
Show summary: Mostrar vista previa
|
||||
What is new: Novedades de la versión
|
||||
Settings: Ajustes
|
||||
There is a new version, click here to reload: Hay una nueva versión, pulse aquí para recargar
|
||||
|
||||
# Actions
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
"loopback#token": {}
|
||||
},
|
||||
"auth:after": {
|
||||
"./middleware/current-user": {}
|
||||
"./middleware/current-user": {},
|
||||
"./middleware/salix-version": {}
|
||||
},
|
||||
"parse": {
|
||||
"body-parser#json":{}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
const packageJson = require('../../../package.json');
|
||||
|
||||
module.exports = function(options) {
|
||||
return function(req, res, next) {
|
||||
res.set('Salix-Version', packageJson.version);
|
||||
next();
|
||||
};
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-back",
|
||||
"version": "1.0.0",
|
||||
"version": "6.8.0",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "Salix backend",
|
||||
"license": "GPL-3.0",
|
||||
|
|
Loading…
Reference in New Issue