footer: show Primate version

Show Primate version in footer based on package.json

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2020-06-16 22:06:33 +05:30
parent 2490b5d93e
commit 386dff988b
5 changed files with 18 additions and 6 deletions

View File

@ -22,8 +22,6 @@ set -x
ROOT=$PWD
function package_deb() {
VERSION=$(cd ../; grep --color=none \"version\" package.json | cut -d '"' -f4)
DATE=$(date +"%Y%m%d")
sed -i "s/VERSION/$VERSION-$DATE/g" debian/changelog
dpkg-buildpackage -uc -us
$(cd ../; tar czf cloudstack-primate-$VERSION-$DATE.tar.gz dist --transform s/dist/primate/)
@ -33,10 +31,9 @@ function package_rpm() {
CWD=`pwd`
RPMDIR=$CWD/../build
VERSION=$(cd ../; grep --color=none \"version\" package.json | cut -d '"' -f4)
REALVER=`echo $VERSION`
DEFVER="-D_ver $REALVER"
DEFREL="-D_rel $(date +"%Y%m%d")"
DEFREL="-D_rel $DATE"
echo Preparing to package CloudStack Primate ${VERSION}
@ -63,6 +60,10 @@ function package_rpm() {
fi
}
DATE=$(date +"%Y%m%d")
VERSION=$(grep -Po '"version": "\K[^"]*' ../package.json)
sed -i "s/\"version\":.*/\"version\": \"$VERSION$DATE\",/g" ../package.json
case "$1" in
deb ) package_deb
;;

View File

@ -18,7 +18,9 @@
<template>
<div class="footer">
<div class="links">
CloudStack Server {{ $store.getters.features.cloudstackversion }}
CloudStack {{ $store.getters.features.cloudstackversion }}
<a-divider type="vertical" />
Primate {{ $store.getters.version }}
<a-divider type="vertical" />
<a href="https://github.com/apache/cloudstack-primate/issues/new/choose" target="_blank">
<a-icon type="github"/>

View File

@ -17,6 +17,7 @@
const getters = {
device: state => state.app.device,
version: state => state.app.version,
theme: state => state.app.theme,
color: state => state.app.color,
token: state => state.user.token,

View File

@ -31,6 +31,7 @@ import {
const app = {
state: {
version: process.env.PACKAGE_VERSION || 'master',
sidebar: true,
device: 'desktop',
theme: '',

View File

@ -18,6 +18,8 @@
const path = require('path')
const webpack = require('webpack')
const fs = require('fs')
const packageJson = fs.readFileSync('./package.json')
const version = JSON.parse(packageJson).version || 'master'
function resolve (dir) {
return path.join(__dirname, dir)
@ -43,7 +45,12 @@ module.exports = {
configureWebpack: {
plugins: [
// Ignore all locale files of moment.js
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.DefinePlugin({
'process.env': {
PACKAGE_VERSION: '"' + version + '"'
}
})
]
},