Merge branch 'wh1te909:develop' into develop

This commit is contained in:
silversword411
2021-11-10 11:01:34 -05:00
committed by GitHub
18 changed files with 82 additions and 58 deletions

View File

@@ -44,7 +44,7 @@ class AgentSerializer(serializers.ModelSerializer):
class Meta:
model = Agent
exclude = ["last_seen", "id"]
exclude = ["last_seen", "id", "patches_last_installed"]
class AgentTableSerializer(serializers.ModelSerializer):

View File

@@ -152,10 +152,10 @@ class CoreSettings(BaseAuditModel):
return False
def send_mail(self, subject, body, alert_template=None, test=False):
if not alert_template and not self.email_is_configured:
if test:
return "Email server settings are not configured correctly"
if test and not self.email_is_configured:
return "There needs to be at least one email recipient configured"
# return since email must be configured to continue
elif not self.email_is_configured:
return False
# override email from if alert_template is passed and is set
@@ -200,7 +200,7 @@ class CoreSettings(BaseAuditModel):
return True
def send_sms(self, body, alert_template=None, test=False):
if not alert_template and not self.sms_is_configured:
if not self.sms_is_configured:
return "Sms alerting is not setup correctly."
# override email recipients if alert_template is passed and is set

View File

@@ -58,8 +58,9 @@ class UploadMeshAgent(APIView):
)
@permission_classes([IsAuthenticated, CoreSettingsPerms])
class GetEditCoreSettings(APIView):
permission_classes = [IsAuthenticated, CoreSettingsPerms]
def get(self, request):
settings = CoreSettings.objects.first()
return Response(CoreSettingsSerializer(settings).data)

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.9.0"
TRMM_VERSION = "0.9.2"
# bump this version everytime vue code is changed
# to alert user they need to manually refresh their browser
APP_VER = "0.0.148"
APP_VER = "0.0.150"
# https://github.com/wh1te909/rmmagent
LATEST_AGENT_VER = "1.6.2"

View File

@@ -10,10 +10,8 @@ export async function fetchDebugLog(payload) {
}
export async function fetchAuditLog(payload) {
try {
const { data } = await axios.patch(`${baseUrl}/audit/`, payload)
return data
} catch (e) { }
const { data } = await axios.patch(`${baseUrl}/audit/`, payload)
return data
}
// pending actions

View File

@@ -138,7 +138,7 @@ export default {
else return this.alertsCount;
},
pollAlerts() {
setInterval(() => {
this.poll = setInterval(() => {
this.getAlerts();
}, 60 * 1 * 1000);
},

View File

@@ -317,8 +317,12 @@ export default {
async function getTasks() {
loading.value = true;
const result = await fetchAgentTasks(selectedAgent.value);
tasks.value = result.filter(task => task.sync_status !== "pendingdeletion");
try {
const result = await fetchAgentTasks(selectedAgent.value);
tasks.value = result.filter(task => task.sync_status !== "pendingdeletion");
} catch (e) {
console.error(e);
}
loading.value = false;
}

View File

@@ -1,6 +1,6 @@
<template>
<div>
<div class="row">
<div class="row q-pt-sm q-pl-sm">
<div class="col-2">
<q-select dense options-dense outlined v-model="days" :options="lastDaysOptions" :label="showDays" />
</div>
@@ -15,7 +15,7 @@
class="remote-bg-tbl-sticky"
:rows="events"
:columns="columns"
style="max-height: 85vh"
:style="{ 'max-height': `${$q.screen.height - 85}px` }"
:pagination="{ rowsPerPage: 0, sortBy: 'record', descending: true }"
:filter="filter"
row-key="uid"
@@ -37,7 +37,7 @@
<q-radio v-model="logType" color="cyan" val="System" label="System" />
<q-radio v-model="logType" color="cyan" val="Security" label="Security" />
<q-space />
<q-input v-model="filter" outlined label="Search" dense clearable>
<q-input v-model="filter" style="width: 300px" outlined label="Search" dense clearable>
<template v-slot:prepend>
<q-icon name="search" />
</template>

View File

@@ -3,7 +3,7 @@
dense
:table-class="{ 'table-bgcolor': !$q.dark.isActive, 'table-bgcolor-dark': $q.dark.isActive }"
class="remote-bg-tbl-sticky"
style="max-height: 85vh"
:style="{ 'max-height': `${$q.screen.height - 36}px` }"
:rows="processes"
:columns="columns"
:pagination="{ rowsPerPage: 0, sortBy: 'cpu_percent', descending: true }"

View File

@@ -3,7 +3,7 @@
dense
:table-class="{ 'table-bgcolor': !$q.dark.isActive, 'table-bgcolor-dark': $q.dark.isActive }"
class="remote-bg-tbl-sticky"
style="max-height: 85vh"
:style="{ 'max-height': `${$q.screen.height - 36}px` }"
:rows="services"
:columns="columns"
:pagination="{ rowsPerPage: 0, sortBy: 'display_name', descending: false }"

View File

@@ -300,7 +300,7 @@ export default {
.onOk(() => {
this.$q.loading.show();
this.$axios
.delete(`/tasks/${task.pk}/`)
.delete(`/tasks/${task.id}/`)
.then(r => {
this.getTasks();
this.$q.loading.hide();

View File

@@ -115,9 +115,13 @@ export default {
onMounted(async () => {
$q.loading.show();
const fields = await fetchCustomFields({ model: "site" });
customFields.value = fields.filter(field => !field.hide_in_ui);
if (props.site) getSiteCustomFieldValues();
try {
const fields = await fetchCustomFields({ model: "site" });
customFields.value = fields.filter(field => !field.hide_in_ui);
if (props.site) getSiteCustomFieldValues();
} catch (e) {
console.error(e);
}
$q.loading.hide();
});

View File

@@ -274,10 +274,11 @@ export default {
if (timeFilter.value) data["timeFilter"] = timeFilter.value;
if (actionFilter.value && actionFilter.value.length > 0) data["actionFilter"] = actionFilter.value;
if (objectFilter.value && objectFilter.value.length > 0) data["objectFilter"] = objectFilter.value;
const { audit_logs, total } = await fetchAuditLog(data);
auditLogs.value = audit_logs;
pagination.value.rowsNumber = total;
try {
const { audit_logs, total } = await fetchAuditLog(data);
auditLogs.value = audit_logs;
pagination.value.rowsNumber = total;
} catch (e) {}
loading.value = false;
}

View File

@@ -60,7 +60,7 @@
</template>
<template v-slot:top-row>
<q-tr v-if="debugLog.length === 1000">
<q-tr v-if="Array.isArray(debugLog) && debugLog.length === 1000">
<q-td colspan="100%">
<q-icon name="warning" color="warning" />
Results are limited to 1000 rows.
@@ -141,13 +141,17 @@ export default {
async function getDebugLog() {
loading.value = true;
const data = {
logLevelFilter: logLevelFilter.value,
};
if (agentFilter.value) data["agentFilter"] = agentFilter.value;
if (logTypeFilter.value) data["logTypeFilter"] = logTypeFilter.value;
try {
const data = {
logLevelFilter: logLevelFilter.value,
};
if (agentFilter.value) data["agentFilter"] = agentFilter.value;
if (logTypeFilter.value) data["logTypeFilter"] = logTypeFilter.value;
debugLog.value = await fetchDebugLog(data);
debugLog.value = await fetchDebugLog(data);
} catch (e) {
console.error(e);
}
loading.value = false;
}

View File

@@ -128,7 +128,12 @@ export default {
const showCompleted = ref(false);
const loading = ref(false);
const completedCount = computed(() => {
return actions.value.filter(action => action.status === "completed").length;
try {
return actions.value.filter(action => action.status === "completed").length;
} catch (e) {
console.error(e);
return 0;
}
});
const visibleColumns = computed(() => {
@@ -152,7 +157,13 @@ export default {
async function getPendingActions() {
loading.value = true;
actions.value = props.agent ? await fetchAgentPendingActions(props.agent.agent_id) : await fetchPendingActions();
try {
actions.value = props.agent
? await fetchAgentPendingActions(props.agent.agent_id)
: await fetchPendingActions();
} catch (e) {
console.error(e);
}
loading.value = false;
}

View File

@@ -142,7 +142,7 @@
<div class="q-gutter-sm">
<q-checkbox
v-model="state.run_asap_after_missed"
label="Run task ASAP after a scheduled start is missed (requires agent v1.4.7)"
label="Run task ASAP after a scheduled start is missed"
/>
</div>
</div>

View File

@@ -1,5 +1,5 @@
<template>
<div class="q-pa-md">
<div>
<q-tabs
v-model="tab"
dense
@@ -18,26 +18,23 @@
</q-tabs>
<q-separator />
<q-tab-panels v-model="tab">
<q-tab-panel name="terminal">
<q-tab-panel name="terminal" class="q-pa-none">
<iframe
style="overflow: hidden; height: 715px"
:src="terminal"
width="100%"
height="100%"
scrolling="no"
:style="{ height: `${$q.screen.height - 30}px`, width: `${$q.screen.width}px` }"
></iframe>
</q-tab-panel>
<q-tab-panel name="processes">
<q-tab-panel name="processes" class="q-pa-none">
<ProcessManager :agent_id="agent_id" />
</q-tab-panel>
<q-tab-panel name="services">
<q-tab-panel name="services" class="q-pa-none">
<ServicesManager :agent_id="agent_id" />
</q-tab-panel>
<q-tab-panel name="eventlog">
<q-tab-panel name="eventlog" class="q-pa-none">
<EventLogManager :agent_id="agent_id" />
</q-tab-panel>
<q-tab-panel name="filebrowser">
<iframe style="overflow: hidden; height: 715px" :src="file" width="100%" height="100%" scrolling="no"></iframe>
<q-tab-panel name="filebrowser" class="q-pa-none">
<iframe :src="file" :style="{ height: `${$q.screen.height - 30}px`, width: `${$q.screen.width}px` }"></iframe>
</q-tab-panel>
</q-tab-panels>
</div>

View File

@@ -1,6 +1,6 @@
<template>
<div class="q-pa-none q-ma-none">
<div class="row q-pb-xs q-pl-md">
<div>
<q-bar>
<span class="text-caption">
Agent Status:
<q-badge :color="statusColor" :label="status" />
@@ -16,9 +16,9 @@
/>
<q-btn color="negative" size="sm" label="Recover Connection" icon="fas fa-first-aid" @click="repairMeshCentral" />
<q-space />
</div>
</q-bar>
<q-video v-show="control" :ratio="16 / 9" :src="control" style="padding-bottom: 51%"></q-video>
<q-video v-show="control" :src="control" :style="{ height: `${$q.screen.height - 26}px` }"></q-video>
</div>
</template>
@@ -66,10 +66,14 @@ export default {
async function getMeshURLs() {
$q.loading.show();
const data = await fetchAgentMeshCentralURLs(params.agent_id);
control.value = data.control;
status.value = data.status;
useMeta({ title: `${data.hostname} - ${data.client} - ${data.site} | Remote Background` });
try {
const data = await fetchAgentMeshCentralURLs(params.agent_id);
control.value = data.control;
status.value = data.status;
useMeta({ title: `${data.hostname} - ${data.client} - ${data.site} | Remote Background` });
} catch (e) {
console.error(e);
}
$q.loading.hide();
}