From 48f65fa84acdde49a61c3c104b0dc8303ab696df Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 16 Feb 2023 08:27:23 -0800 Subject: [PATCH] 10520 remove config, status - rebuild js --- netbox/dcim/views.py | 12 --- netbox/project-static/bundle.js | 2 - netbox/project-static/src/device/config.ts | 50 ------------- netbox/templates/dcim/device/config.html | 41 ---------- netbox/templates/dcim/device/status.html | 87 ---------------------- 5 files changed, 192 deletions(-) delete mode 100644 netbox/project-static/src/device/config.ts delete mode 100644 netbox/templates/dcim/device/config.html delete mode 100644 netbox/templates/dcim/device/status.html diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 580982e1c..c6db77ed5 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -2044,18 +2044,6 @@ class DeviceBulkRenameView(generic.BulkRenameView): table = tables.DeviceTable -@register_model_view(Device, 'status') -class DeviceStatusView(generic.ObjectView): - queryset = Device.objects.all() - template_name = 'dcim/device/status.html' - - -@register_model_view(Device, 'config') -class DeviceConfigView(generic.ObjectView): - queryset = Device.objects.all() - template_name = 'dcim/device/config.html' - - # # Modules # diff --git a/netbox/project-static/bundle.js b/netbox/project-static/bundle.js index 504c9951f..6f651cd05 100644 --- a/netbox/project-static/bundle.js +++ b/netbox/project-static/bundle.js @@ -40,8 +40,6 @@ async function bundleGraphIQL() { async function bundleNetBox() { const entryPoints = { netbox: 'src/index.ts', - lldp: 'src/device/lldp.ts', - config: 'src/device/config.ts', }; try { const result = await esbuild.build({ diff --git a/netbox/project-static/src/device/config.ts b/netbox/project-static/src/device/config.ts deleted file mode 100644 index c9c19e8d3..000000000 --- a/netbox/project-static/src/device/config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { createToast } from '../bs'; -import { apiGetBase, getNetboxData, hasError, toggleLoader } from '../util'; - -/** - * Initialize device config elements. - */ -function initConfig(): void { - toggleLoader('show'); - const url = getNetboxData('data-object-url'); - - if (url !== null) { - apiGetBase(url) - .then(data => { - if (hasError(data)) { - createToast('danger', 'Error Fetching Device Config', data.error).show(); - console.error(data.error); - return; - } else if (hasError>(data.get_config)) { - createToast('danger', 'Error Fetching Device Config', data.get_config.error).show(); - console.error(data.get_config.error); - return; - } else { - const configTypes = ['running', 'startup', 'candidate'] as DeviceConfigType[]; - - for (const configType of configTypes) { - const element = document.getElementById(`${configType}_config`); - if (element !== null) { - const config = data.get_config[configType]; - if (typeof config === 'string') { - // If the returned config is a string, set the element innerHTML as-is. - element.innerHTML = config; - } else { - // If the returned config is an object (dict), convert it to JSON. - element.innerHTML = JSON.stringify(data.get_config[configType], null, 2); - } - } - } - } - }) - .finally(() => { - toggleLoader('hide'); - }); - } -} - -if (document.readyState !== 'loading') { - initConfig(); -} else { - document.addEventListener('DOMContentLoaded', initConfig); -} diff --git a/netbox/templates/dcim/device/config.html b/netbox/templates/dcim/device/config.html deleted file mode 100644 index fda6d4992..000000000 --- a/netbox/templates/dcim/device/config.html +++ /dev/null @@ -1,41 +0,0 @@ -{% extends 'dcim/device/base.html' %} -{% load static %} - -{% block title %}{{ object }} - Config{% endblock %} - -{% block head %} - -{% endblock %} - -{% block content %} -
-
-
-
-
- Loading... -
-
-
Device Configuration
-
- -
-
-

-                    
-
-

-                    
-
-

-                    
-
-
-
-
-
-{% endblock %} diff --git a/netbox/templates/dcim/device/status.html b/netbox/templates/dcim/device/status.html deleted file mode 100644 index 48fa46e2d..000000000 --- a/netbox/templates/dcim/device/status.html +++ /dev/null @@ -1,87 +0,0 @@ -{% extends 'dcim/device/base.html' %} -{% load static %} - -{% block title %}{{ object }} - Status{% endblock %} - -{% block head %} - -{% endblock %} - -{% block content %} -
-
-
-
-
- Loading... -
-
-
Device Facts
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Hostname
FQDN
Vendor
Model
Serial Number
OS Version
Uptime -
-
-
-
-
-
-
-
-
-
- Loading... -
-
-
Environment
-
- - - - - - - - - - - - - - - - -
CPU
Memory
Temperature
Fans
Power
-
-
-
-
-{% endblock %}