Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 4 additions & 40 deletions src/stores/standalone/threatShield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { ubusCall, ValidationError } from '@/lib/standalone/ubus'
import { getAxiosErrorMessage, sortByProperty } from '@nethesis/vue-components'
import { defineStore } from 'pinia'
import { useUciPendingChangesStore } from './uciPendingChanges'
import { useNotificationsStore } from '../notifications'

export type Blocklist = {
name: string
Expand Down Expand Up @@ -36,7 +35,6 @@ export type DnsAllowedDomain = {
export const useThreatShieldStore = defineStore('threatShield', () => {
const { t, te } = useI18n()
const uciChangesStore = useUciPendingChangesStore()
const notificationsStore = useNotificationsStore()
const dnsBlocklists = ref<Blocklist[]>([])
const dnsSettings = ref<DnsSettings>()
const dnsZones = ref<string[]>([])
Expand Down Expand Up @@ -190,17 +188,7 @@ export const useThreatShieldStore = defineStore('threatShield', () => {

try {
await ubusCall('ns.threatshield', method, domain)

if (!isEditing) {
// applied instantly, show notification (only if creating)
notificationsStore.createNotification({
kind: 'success',
title: t('standalone.threat_shield_dns.blocked_domain_added_title'),
description: t('standalone.threat_shield_dns.blocked_domain_added_description', {
domain: domain.address
})
})
}
uciChangesStore.getChanges()
} catch (err: any) {
console.error(err)

Expand All @@ -223,17 +211,7 @@ export const useThreatShieldStore = defineStore('threatShield', () => {

try {
await ubusCall('ns.threatshield', method, domain)

if (!isEditing) {
// applied instantly, show notification (only if creating)
notificationsStore.createNotification({
kind: 'success',
title: t('standalone.threat_shield_dns.allowed_domain_added_title'),
description: t('standalone.threat_shield_dns.allowed_domain_added_description', {
domain: domain.address
})
})
}
uciChangesStore.getChanges()
} catch (err: any) {
console.error(err)

Expand Down Expand Up @@ -278,14 +256,7 @@ export const useThreatShieldStore = defineStore('threatShield', () => {
await ubusCall('ns.threatshield', 'dns-delete-blocked', {
address: domain
})
// applied instantly, show notification
notificationsStore.createNotification({
kind: 'success',
title: t('standalone.threat_shield_dns.blocked_domain_deleted_title'),
description: t('standalone.threat_shield_dns.blocked_domain_deleted_description', {
domain
})
})
uciChangesStore.getChanges()
} catch (err: any) {
console.error(err)
errorDeleteDnsBlockedDomain.value = t(getAxiosErrorMessage(err))
Expand All @@ -310,14 +281,7 @@ export const useThreatShieldStore = defineStore('threatShield', () => {
await ubusCall('ns.threatshield', 'dns-delete-allowed', {
address: domain
})
// applied instantly, show notification
notificationsStore.createNotification({
kind: 'success',
title: t('standalone.threat_shield_dns.allowed_domain_deleted_title'),
description: t('standalone.threat_shield_dns.allowed_domain_deleted_description', {
domain
})
})
uciChangesStore.getChanges()
} catch (err: any) {
console.error(err)
errorDeleteDnsAllowedDomain.value = t(getAxiosErrorMessage(err))
Expand Down
Loading