Compare commits

..

6 Commits

Author SHA1 Message Date
wh1te909
1432853b39 Release 0.4.32 2021-03-31 18:35:05 +00:00
wh1te909
77b1d964b5 bump versions 2021-03-31 18:33:43 +00:00
wh1te909
549936fc09 add logging and timeout to deployment gen 2021-03-31 18:24:27 +00:00
wh1te909
c9c32f09c5 public docs on push to master instead of develop 2021-03-31 18:11:14 +00:00
sadnub
77f7778d4a fix being ablwe to add/edit automation and alert templates on sites and clients 2021-03-31 12:03:26 -04:00
wh1te909
84b6be9364 un-hide custom fields 2021-03-31 07:29:28 +00:00
9 changed files with 75 additions and 55 deletions

View File

@@ -2,7 +2,7 @@ name: Deploy Docs
on:
push:
branches:
- develop
- master
defaults:
run:

View File

@@ -87,7 +87,7 @@ def uninstall(request):
return Response(f"{name} will now be uninstalled.")
@api_view(["PATCH"])
@api_view(["PATCH", "PUT"])
def edit_agent(request):
agent = get_object_or_404(Agent, pk=request.data["id"])

View File

@@ -33,6 +33,7 @@ class SiteSerializer(ModelSerializer):
"name",
"server_policy",
"workstation_policy",
"alert_template",
"client_name",
"client",
"custom_fields",
@@ -75,6 +76,7 @@ class ClientSerializer(ModelSerializer):
"name",
"server_policy",
"workstation_policy",
"alert_template",
"sites",
"custom_fields",
)

View File

@@ -6,6 +6,7 @@ import pytz
from django.conf import settings
from django.shortcuts import get_object_or_404
from django.utils import timezone as djangotime
from loguru import logger
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -24,6 +25,8 @@ from .serializers import (
SiteSerializer,
)
logger.configure(**settings.LOG_CONFIG)
class GetAddClients(APIView):
def get(self, request):
@@ -167,13 +170,15 @@ class GetUpdateSite(APIView):
def put(self, request, pk):
site = get_object_or_404(Site, pk=pk)
if (
if "client" in request.data["site"].keys() and (
site.client.id != request.data["site"]["client"]
and site.client.sites.count() == 1
):
return notify_error("A client must have at least one site")
serializer = SiteSerializer(instance=site, data=request.data["site"])
serializer = SiteSerializer(
instance=site, data=request.data["site"], partial=True
)
serializer.is_valid(raise_exception=True)
serializer.save()
@@ -278,8 +283,8 @@ class GenerateAgent(APIView):
permission_classes = (AllowAny,)
def get(self, request, uid):
import requests
import tempfile
import requests
from django.http import FileResponse
try:
@@ -317,12 +322,20 @@ class GenerateAgent(APIView):
headers = {"Content-type": "application/json"}
with tempfile.NamedTemporaryFile() as fp:
r = requests.post(
settings.EXE_GEN_URL,
json=data,
headers=headers,
stream=True,
)
try:
r = requests.post(
settings.EXE_GEN_URL,
json=data,
headers=headers,
stream=True,
timeout=900,
)
except Exception as e:
logger.error(str(e))
return notify_error(
"Something went wrong. Check debug error log for exact error message"
)
with open(fp.name, "wb") as f:
for chunk in r.iter_content(chunk_size=1024):
if chunk:

View File

@@ -15,11 +15,11 @@ EXE_DIR = os.path.join(BASE_DIR, "tacticalrmm/private/exe")
AUTH_USER_MODEL = "accounts.User"
# latest release
TRMM_VERSION = "0.4.31"
TRMM_VERSION = "0.4.32"
# bump this version everytime vue code is changed
# to alert user they need to manually refresh their browser
APP_VER = "0.0.124"
APP_VER = "0.0.125"
# https://github.com/wh1te909/rmmagent
LATEST_AGENT_VER = "1.4.13"

View File

@@ -111,45 +111,43 @@ export default {
let data = {};
let url = "";
if (this.type === "client" || this.type === "site") {
if (this.type === "client") {
url = `/clients/${this.object.id}/client/`;
data = {
pk: this.object.id,
server_policy: this.selectedServerPolicy,
workstation_policy: this.selectedWorkstationPolicy,
client: {
pk: this.object.id,
server_policy: this.selectedServerPolicy,
workstation_policy: this.selectedWorkstationPolicy,
},
};
} else if (this.type === "site") {
url = `/clients/sites/${this.object.id}/`;
data = {
site: {
pk: this.object.id,
server_policy: this.selectedServerPolicy,
workstation_policy: this.selectedWorkstationPolicy,
},
};
if (this.type === "client") url = `/clients/${this.object.id}/client/`;
else if (this.type === "site") url = `/clients/${this.object.id}/site/`;
this.$axios
.put(url, data)
.then(r => {
this.$q.loading.hide();
this.onOk();
this.notifySuccess("Policies Updated Successfully!");
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error updating policies");
});
} else if (this.type === "agent") {
url = "/agents/editagent/";
data = {
id: this.object.id,
policy: this.selectedAgentPolicy,
};
this.$axios
.patch("/agents/editagent/", data)
.then(r => {
this.$q.loading.hide();
this.onOk();
this.notifySuccess("Policies Updated Successfully!");
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error updating policies");
});
}
this.$axios
.put(url, data)
.then(r => {
this.$q.loading.hide();
this.onOk();
this.notifySuccess("Policies Updated Successfully!");
})
.catch(e => {
this.$q.loading.hide();
this.notifyError("There was an error updating policies");
});
},
getPolicies() {
this.$q.loading.show();

View File

@@ -65,15 +65,22 @@ export default {
this.$q.loading.show();
const data = {
id: this.object.id,
alert_template: this.selectedTemplate,
};
let url = "";
if (this.type === "client") url = `/clients/${this.object.id}/client/`;
else if (this.type === "site") url = `/clients/${this.object.id}/site/`;
else if (this.type === "policy") url = `/automation/policies/${this.object.id}/`;
let data = {};
if (this.type === "client") {
url = `/clients/${this.object.id}/client/`;
data = {
client: { id: this.object.id, alert_template: this.selectedTemplate },
};
} else if (this.type === "site") {
url = `/clients/sites/${this.object.id}/`;
data = {
site: { id: this.object.id, alert_template: this.selectedTemplate },
};
} else if (this.type === "policy") {
url = `/automation/policies/${this.object.id}/`;
data = { id: this.object.id, alert_template: this.selectedTemplate };
}
const text = this.selectedTemplate ? "assigned" : "removed";
this.$axios

View File

@@ -7,7 +7,7 @@
<q-tab name="emailalerts" label="Email Alerts" />
<q-tab name="smsalerts" label="SMS Alerts" />
<q-tab name="meshcentral" label="MeshCentral" />
<!-- <q-tab name="customfields" label="Custom Fields" /> -->
<q-tab name="customfields" label="Custom Fields" />
</q-tabs>
</template>
<template v-slot:after>

View File

@@ -617,7 +617,7 @@ export default {
object: node,
})
.onOk(() => {
this.getTree();
this.clearTreeSelected();
});
},
showAddSiteModal(node) {
@@ -666,7 +666,7 @@ export default {
object: node,
})
.onOk(() => {
this.getTree();
this.clearTreeSelected();
});
},
reload() {