fix alert template name rendering and circular import issue
This commit is contained in:
@@ -42,15 +42,20 @@ class AgentSerializer(serializers.ModelSerializer):
|
||||
last_seen = serializers.ReadOnlyField()
|
||||
applied_policies = serializers.SerializerMethodField()
|
||||
effective_patch_policy = serializers.SerializerMethodField()
|
||||
alert_template = serializers.SerializerMethodField()
|
||||
|
||||
def get_alert_template(self, obj):
|
||||
from alerts.serializers import AlertTemplateSerializer
|
||||
if obj.alert_template:
|
||||
return AlertTemplateSerializer(obj.alert_template).data
|
||||
else:
|
||||
None
|
||||
|
||||
def get_effective_patch_policy(self, obj):
|
||||
from winupdate.serializers import WinUpdatePolicySerializer
|
||||
|
||||
return WinUpdatePolicySerializer(obj.get_patch_policy()).data
|
||||
|
||||
def get_applied_policies(self, obj):
|
||||
from automation.serializers import PolicySerializer
|
||||
|
||||
policies = obj.get_agent_policies()
|
||||
|
||||
# need to serialize model objects manually
|
||||
|
||||
@@ -147,11 +147,11 @@
|
||||
<q-list dense padding>
|
||||
<q-item>
|
||||
<q-item-section>
|
||||
<q-item-label>{{ agent.alert_template ? alert_template.name : "None" }}</q-item-label>
|
||||
<q-item-label>{{ agent.alert_template ? agent.alert_template.name : "None" }}</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side v-if="agent.alert_template">
|
||||
<q-item-label>
|
||||
<i>{{ agent.alert_template.active ? "" : "disabled" }}</i>
|
||||
<i>{{ agent.alert_template.is_active ? "" : "disabled" }}</i>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
@@ -322,7 +322,6 @@ export default {
|
||||
.get(`/agents/${this.agent_id}/`)
|
||||
.then(r => {
|
||||
this.agent = r.data;
|
||||
console.log(r.data);
|
||||
this.allTimezones = Object.freeze(r.data.all_timezones);
|
||||
|
||||
// r.data.time_zone is the actual db column from the agent
|
||||
|
||||
Reference in New Issue
Block a user