add alert if new trmm version available #453
This commit is contained in:
parent
d481ae3da4
commit
c96d688a9c
|
@ -62,9 +62,12 @@ def version(request):
|
|||
|
||||
@api_view()
|
||||
def dashboard_info(request):
|
||||
from tacticalrmm.utils import get_latest_trmm_ver
|
||||
|
||||
return Response(
|
||||
{
|
||||
"trmm_version": settings.TRMM_VERSION,
|
||||
"latest_trmm_ver": get_latest_trmm_ver(),
|
||||
"dark_mode": request.user.dark_mode,
|
||||
"show_community_scripts": request.user.show_community_scripts,
|
||||
"dbl_click_action": request.user.agent_dblclick_action,
|
||||
|
|
|
@ -263,3 +263,20 @@ def run_nats_api_cmd(mode: str, ids: list[str], timeout: int = 30) -> None:
|
|||
subprocess.run(cmd, capture_output=True, timeout=timeout)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
|
||||
def get_latest_trmm_ver() -> str:
|
||||
url = "https://raw.githubusercontent.com/wh1te909/tacticalrmm/master/api/tacticalrmm/tacticalrmm/settings.py"
|
||||
try:
|
||||
r = requests.get(url, timeout=5)
|
||||
except:
|
||||
return "error"
|
||||
|
||||
try:
|
||||
for line in r.text.splitlines():
|
||||
if "TRMM_VERSION" in line:
|
||||
return line.split(" ")[2].strip('"')
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
return "error"
|
||||
|
|
|
@ -8,7 +8,14 @@
|
|||
<q-toolbar>
|
||||
<q-btn dense flat push @click="refreshEntireSite" icon="refresh" />
|
||||
<q-toolbar-title>
|
||||
Tactical RMM<span class="text-overline"> v{{ currentTRMMVersion }}</span>
|
||||
Tactical RMM<span class="text-overline q-ml-sm">v{{ currentTRMMVersion }}</span>
|
||||
<span
|
||||
class="text-overline q-ml-md"
|
||||
v-if="latestTRMMVersion !== 'error' && currentTRMMVersion !== latestTRMMVersion"
|
||||
><q-badge color="warning"
|
||||
><a :href="latestReleaseURL" target="_blank">v{{ latestTRMMVersion }} available</a></q-badge
|
||||
></span
|
||||
>
|
||||
</q-toolbar-title>
|
||||
|
||||
<!-- temp dark mode toggle -->
|
||||
|
@ -411,6 +418,7 @@ export default {
|
|||
filterChecksFailing: false,
|
||||
filterRebootNeeded: false,
|
||||
currentTRMMVersion: null,
|
||||
latestTRMMVersion: "error",
|
||||
showUserPreferencesModal: false,
|
||||
columns: [
|
||||
{
|
||||
|
@ -719,6 +727,7 @@ export default {
|
|||
this.darkMode = r.data.dark_mode;
|
||||
this.$q.dark.set(this.darkMode);
|
||||
this.currentTRMMVersion = r.data.trmm_version;
|
||||
this.latestTRMMVersion = r.data.latest_trmm_ver;
|
||||
this.$store.commit("SET_AGENT_DBLCLICK_ACTION", r.data.dbl_click_action);
|
||||
this.$store.commit("setShowCommunityScripts", r.data.show_community_scripts);
|
||||
this.$store.commit("SET_NO_CODE_SIGN", r.data.no_code_sign);
|
||||
|
@ -805,6 +814,11 @@ export default {
|
|||
clients: state => state.clients,
|
||||
}),
|
||||
...mapGetters(["selectedAgentPk", "needRefresh", "clientTreeSplitterModel"]),
|
||||
latestReleaseURL() {
|
||||
return this.latestTRMMVersion !== "error"
|
||||
? `https://github.com/wh1te909/tacticalrmm/releases/tag/v${this.latestTRMMVersion}`
|
||||
: "";
|
||||
},
|
||||
wsUrl() {
|
||||
return getBaseUrl().split("://")[1];
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue