mirror of
https://github.com/jpros/tacticalrmm-web.git
synced 2026-02-21 11:51:08 +00:00
policy task and check rework. Added basic collector task implementation
This commit is contained in:
@@ -60,6 +60,14 @@
|
||||
<q-th auto-width :props="props"></q-th>
|
||||
</template>
|
||||
|
||||
<template v-slot:header-cell-collector="props">
|
||||
<q-th auto-width :props="props">
|
||||
<q-icon name="mdi-database-arrow-up" size="1.5em">
|
||||
<q-tooltip>Collector Task</q-tooltip>
|
||||
</q-icon>
|
||||
</q-th>
|
||||
</template>
|
||||
|
||||
<template v-slot:header-cell-status="props">
|
||||
<q-th auto-width :props="props"></q-th>
|
||||
</template>
|
||||
@@ -170,6 +178,13 @@
|
||||
<q-tooltip>This task is managed by a policy</q-tooltip>
|
||||
</q-icon>
|
||||
</q-td>
|
||||
|
||||
<!-- is collector task -->
|
||||
<q-td>
|
||||
<q-icon v-if="!!props.row.custom_field" style="font-size: 1.3rem" name="check">
|
||||
<q-tooltip>The task updates a custom field on the agent</q-tooltip>
|
||||
</q-icon>
|
||||
</q-td>
|
||||
<!-- status icon -->
|
||||
<q-td v-if="props.row.status === 'passing'">
|
||||
<q-icon style="font-size: 1.3rem" color="positive" name="check_circle">
|
||||
@@ -199,6 +214,8 @@
|
||||
<q-td v-if="props.row.sync_status === 'notsynced'">Will sync on next agent checkin</q-td>
|
||||
<q-td v-else-if="props.row.sync_status === 'synced'">Synced with agent</q-td>
|
||||
<q-td v-else-if="props.row.sync_status === 'pendingdeletion'">Pending deletion on agent</q-td>
|
||||
<q-td v-else-if="props.row.sync_status === 'initial'">Waiting for task creation on agent</q-td>
|
||||
<q-td v-else></q-td>
|
||||
<q-td v-if="props.row.retcode !== null || props.row.stdout || props.row.stderr">
|
||||
<span
|
||||
style="cursor: pointer; text-decoration: underline"
|
||||
@@ -249,6 +266,7 @@ export default {
|
||||
{ name: "emailalert", field: "email_alert", align: "left" },
|
||||
{ name: "dashboardalert", field: "dashboard_alert", align: "left" },
|
||||
{ name: "policystatus", align: "left" },
|
||||
{ name: "collector", label: "Collector", field: "custom_field", align: "left" },
|
||||
{ name: "status", align: "left" },
|
||||
{ name: "name", label: "Name", field: "name", align: "left" },
|
||||
{ name: "sync_status", label: "Sync Status", field: "sync_status", align: "left" },
|
||||
@@ -383,7 +401,7 @@ export default {
|
||||
automatedTasks: state => state.automatedTasks,
|
||||
}),
|
||||
tasks() {
|
||||
return this.automatedTasks.autotasks;
|
||||
return this.automatedTasks.autotasks.filter(task => task.sync_status !== "pendingdeletion");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -61,6 +61,15 @@
|
||||
</q-icon>
|
||||
</q-th>
|
||||
</template>
|
||||
|
||||
<template v-slot:header-cell-collector="props">
|
||||
<q-th auto-width :props="props">
|
||||
<q-icon name="mdi-database-arrow-up" size="1.5em">
|
||||
<q-tooltip>Collector Task</q-tooltip>
|
||||
</q-icon>
|
||||
</q-th>
|
||||
</template>
|
||||
|
||||
<!-- body slots -->
|
||||
<template v-slot:body="props" :props="props">
|
||||
<q-tr class="cursor-pointer" @dblclick="showEditTask(props.row)">
|
||||
@@ -130,6 +139,12 @@
|
||||
v-model="props.row.dashboard_alert"
|
||||
/>
|
||||
</q-td>
|
||||
<!-- is collector task -->
|
||||
<q-td>
|
||||
<q-icon v-if="!!props.row.custom_field" style="font-size: 1.3rem" name="check">
|
||||
<q-tooltip>The task updates a custom field on the agent</q-tooltip>
|
||||
</q-icon>
|
||||
</q-td>
|
||||
<q-td>{{ props.row.name }}</q-td>
|
||||
<q-td>{{ props.row.schedule }}</q-td>
|
||||
<q-td>
|
||||
@@ -182,6 +197,7 @@ export default {
|
||||
{ name: "smsalert", field: "text_alert", align: "left" },
|
||||
{ name: "emailalert", field: "email_alert", align: "left" },
|
||||
{ name: "dashboardalert", field: "dashboard_alert", align: "left" },
|
||||
{ name: "collector", label: "Collector", field: "custom_field", align: "left" },
|
||||
{ name: "name", label: "Name", field: "name", align: "left" },
|
||||
{
|
||||
name: "schedule",
|
||||
|
||||
@@ -62,6 +62,8 @@
|
||||
<q-td v-else-if="props.row.sync_status === 'notsynced'">Will sync on next agent checkin</q-td>
|
||||
<q-td v-else-if="props.row.sync_status === 'synced'">Synced with agent</q-td>
|
||||
<q-td v-else-if="props.row.sync_status === 'pendingdeletion'">Pending deletion on agent</q-td>
|
||||
<q-td v-else-if="props.row.sync_status === 'initial'">Waiting for task creation on agent</q-td>
|
||||
<q-td v-else></q-td>
|
||||
<!-- more info -->
|
||||
<q-td v-if="props.row.check_type === 'ping'">
|
||||
<span
|
||||
|
||||
@@ -64,6 +64,28 @@
|
||||
dense
|
||||
v-model="autotask.name"
|
||||
label="Descriptive name of task"
|
||||
class="q-pb-none"
|
||||
/>
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
<q-checkbox
|
||||
dense
|
||||
label="Collector Task"
|
||||
v-model="collector"
|
||||
class="q-pb-sm"
|
||||
@input="autotask.custom_field = null"
|
||||
/>
|
||||
<q-select
|
||||
v-if="collector"
|
||||
v-model="autotask.custom_field"
|
||||
:options="customFieldOptions"
|
||||
dense
|
||||
label="Custom Field to update"
|
||||
outlined
|
||||
map-options
|
||||
emit-value
|
||||
options-dense
|
||||
hint="The return value of script will be saved to custom field selected"
|
||||
/>
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
@@ -86,6 +108,7 @@
|
||||
v-model.number="autotask.timeout"
|
||||
type="number"
|
||||
label="Maximum permitted execution time (seconds)"
|
||||
class="q-pb-none"
|
||||
/>
|
||||
</q-card-section>
|
||||
</q-step>
|
||||
@@ -190,10 +213,13 @@ export default {
|
||||
return {
|
||||
step: 1,
|
||||
scriptOptions: [],
|
||||
customFieldOptions: [],
|
||||
collector: false,
|
||||
autotask: {
|
||||
script: null,
|
||||
script_args: [],
|
||||
assigned_check: null,
|
||||
custom_field: null,
|
||||
name: null,
|
||||
run_time_days: [],
|
||||
run_time_minute: null,
|
||||
@@ -319,6 +345,10 @@ export default {
|
||||
if (this.policypk) {
|
||||
this.getPolicyChecks();
|
||||
}
|
||||
|
||||
this.getCustomFields("agent").then(r => {
|
||||
this.customFieldOptions = r.data.map(field => ({ label: field.name, value: field.id }));
|
||||
});
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user