Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1432853b39 | ||
|
|
77b1d964b5 | ||
|
|
549936fc09 | ||
|
|
c9c32f09c5 | ||
|
|
77f7778d4a | ||
|
|
84b6be9364 |
2
.github/workflows/deploy-docs.yml
vendored
2
.github/workflows/deploy-docs.yml
vendored
@@ -2,7 +2,7 @@ name: Deploy Docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- master
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
||||
@@ -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"])
|
||||
|
||||
|
||||
@@ -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",
|
||||
)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user