diff --git a/api/tacticalrmm/natsapi/urls.py b/api/tacticalrmm/natsapi/urls.py index fa2ddc98..cb639942 100644 --- a/api/tacticalrmm/natsapi/urls.py +++ b/api/tacticalrmm/natsapi/urls.py @@ -10,4 +10,5 @@ urlpatterns = [ path("wmi/", views.NatsWMI.as_view()), path("offline/", views.OfflineAgents.as_view()), path("logcrash/", views.LogCrash.as_view()), + path("superseded/", views.SupersededWinUpdate.as_view()), ] diff --git a/api/tacticalrmm/natsapi/views.py b/api/tacticalrmm/natsapi/views.py index adb770da..89d762fe 100644 --- a/api/tacticalrmm/natsapi/views.py +++ b/api/tacticalrmm/natsapi/views.py @@ -258,9 +258,23 @@ class NatsWinUpdates(APIView): agent.delete_superseded_updates() # more superseded updates cleanup - for u in agent.winupdates.filter( - date_installed__isnull=True, result="failed" - ).exclude(installed=True): + if pyver.parse(agent.version) <= pyver.parse("1.4.2"): + for u in agent.winupdates.filter( + date_installed__isnull=True, result="failed" + ).exclude(installed=True): + u.delete() + + return Response("ok") + + +class SupersededWinUpdate(APIView): + authentication_classes = [] + permission_classes = [] + + def post(self, request): + agent = get_object_or_404(Agent, agent_id=request.data["agent_id"]) + updates = agent.winupdates.filter(guid=request.data["guid"]) + for u in updates: u.delete() return Response("ok") diff --git a/go.mod b/go.mod index b543d5e2..add72a86 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,6 @@ require ( github.com/josephspurrier/goversioninfo v1.2.0 github.com/nats-io/nats.go v1.10.1-0.20210107160453-a133396829fc github.com/ugorji/go/codec v1.2.3 - github.com/wh1te909/rmmagent v1.4.2 + github.com/wh1te909/rmmagent v1.4.3-0.20210202083714-12142d6dfd1f golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect ) diff --git a/go.sum b/go.sum index 1e319813..87bd44d9 100644 --- a/go.sum +++ b/go.sum @@ -89,6 +89,8 @@ github.com/ugorji/go/codec v1.2.3/go.mod h1:5FxzDJIgeiWJZslYHPj+LS1dq1ZBQVelZFnj github.com/wh1te909/go-win64api v0.0.0-20201021040544-8fba2a0fc3d0/go.mod h1:cfD5/vNQFm5PD5Q32YYYBJ6VIs9etzp8CJ9dinUcpUA= github.com/wh1te909/rmmagent v1.4.2 h1:noG/ELSue3d6UF7o0gp1ty0DpGbfrVz0VG6NEQm9kGM= github.com/wh1te909/rmmagent v1.4.2/go.mod h1:mcI27szhAGjAQzhX8eCsluE5670kUAyi3tJVJa6LNTo= +github.com/wh1te909/rmmagent v1.4.3-0.20210202083714-12142d6dfd1f h1:9r7AFleOMiVs8AiAsUezau3GVL22bqbUDz6qlRUIMFM= +github.com/wh1te909/rmmagent v1.4.3-0.20210202083714-12142d6dfd1f/go.mod h1:mcI27szhAGjAQzhX8eCsluE5670kUAyi3tJVJa6LNTo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/natsapi/api.go b/natsapi/api.go index a4b85a87..eb25c267 100644 --- a/natsapi/api.go +++ b/natsapi/api.go @@ -161,6 +161,13 @@ func Listen(apihost, natshost, version string, debug bool) { rClient.R().SetBody(p).Patch("/winupdates/") } }() + case "superseded": + go func() { + var p *rmm.SupersededUpdate + if err := dec.Decode(&p); err == nil { + rClient.R().SetBody(p).Post("/superseded/") + } + }() case "needsreboot": go func() { var p *rmm.AgentNeedsReboot diff --git a/web/src/components/WindowsUpdates.vue b/web/src/components/WindowsUpdates.vue index 3f7178d1..5adb1ac1 100644 --- a/web/src/components/WindowsUpdates.vue +++ b/web/src/components/WindowsUpdates.vue @@ -68,7 +68,11 @@ {{ props.row.severity }} {{ formatMessage(props.row.title) }} - + {{ formatMessage(props.row.description) }} @@ -125,7 +129,7 @@ export default { }, { name: "description", - label: "Description", + label: "More Info", field: "description", align: "left", sortable: true, @@ -137,6 +141,14 @@ export default { align: "left", sortable: true, }, + { + name: "more_info_urls", + field: "more_info_urls", + }, + { + name: "categories", + field: "categories", + }, ], visibleColumns: ["action", "installed", "severity", "title", "description", "date_installed"], }; @@ -155,10 +167,19 @@ export default { formatMessage(msg) { return msg.substring(0, 80) + "..."; }, - showFullMsg(title, msg) { + showFullMsg(title, msg, urls, categories) { + let support_urls = ""; + urls.forEach(u => { + support_urls += `${u}
`; + }); + let cats = categories.join(", "); this.$q.dialog({ title: title, - message: msg.split(". ").join(".
"), + message: + `Categories: ${cats}

` + + "Description
" + + msg.split(". ").join(".
") + + `

Support Urls
${support_urls}`, html: true, fullWidth: true, });