-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Change URLs in Usage to docs * Update project description * Add video presentation * Closes #50: Add template field to ConfigDiffScript (#51) * Add name template for searching in DataSource * Add docs for templating files name in DataSource * Closes #47: Move plugin to separete menu item in navbar (#52) * Move plugin into separate menu item * Add tab for devices with their config compliance * Closes #53: Add netbox-rq to installation process docs * Changelog for 2.2.0 version
- Loading branch information
Showing
20 changed files
with
234 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
__author__ = "Artem Kotik" | ||
__email__ = "[email protected]" | ||
__version__ = "2.1.0" | ||
__version__ = "2.2.0" | ||
|
||
|
||
class ConfigDiffConfig(PluginConfig): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
netbox_config_diff/migrations/0008_alter_configcompliance_device.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("dcim", "0181_rename_device_role_device_role"), | ||
("netbox_config_diff", "0007_configurationrequest"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="configcompliance", | ||
name="device", | ||
field=models.OneToOneField( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="config_compliance", | ||
to="dcim.device", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 10 additions & 78 deletions
88
netbox_config_diff/templates/netbox_config_diff/configcompliance.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,13 @@ | ||
{% extends "netbox_config_diff/configcompliance/base.html" %} | ||
{% load static %} | ||
{% extends "generic/object.html" %} | ||
{% load buttons %} | ||
{% load perms %} | ||
|
||
{% block content %} | ||
<div class="row mb-3"> | ||
<div class="col col-md-6"> | ||
<div class="card"> | ||
<h5 class="card-header">{{ object|meta:"verbose_name"|bettertitle }}</h5> | ||
<div class="card-body"> | ||
<table class="table table-hover attr-table"> | ||
<tr> | ||
<th scope="row">Device</th> | ||
<td>{{ object.device|linkify }}</td> | ||
</tr> | ||
<tr> | ||
<th scope="row">Status</th> | ||
<td>{% badge object.get_status_display bg_color=object.get_status_color %}</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
{% block controls %} | ||
<div class="controls"> | ||
<div class="control-group"> | ||
{% if request.user|can_delete:object %} | ||
{% delete_button object %} | ||
{% endif %} | ||
</div> | ||
{% if object.error %} | ||
<div class="col col-md-6"> | ||
<div class="card"> | ||
<h5 class="card-header">Error</h5> | ||
<div class="card-body"> | ||
<pre class="block">{{ object.error }}</pre> | ||
</div> | ||
</div> | ||
</div> | ||
{% endif %} | ||
</div> | ||
{% if object.diff %} | ||
<div class="row mb-3"> | ||
<div class="col col-md-12"> | ||
<div class="card"> | ||
<h5 class="card-header">Diff</h5> | ||
<div class="card-body" id="diffElement"></div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% endblock content %} | ||
|
||
{% block javascript %} | ||
<script type="text/javascript" src="{% static 'netbox_config_diff/diff2html-ui.min.js' %}"></script> | ||
<script type="text/javascript"> | ||
var link = document.createElement('link'); | ||
link.type = 'text/css'; | ||
link.rel = 'stylesheet'; | ||
const colorMode = localStorage.getItem("netbox-color-mode"); | ||
if (colorMode === 'dark') { | ||
link.href = `{% static 'netbox_config_diff/diff2html.dark.min.css' %}` | ||
} else { | ||
link.href = `{% static 'netbox_config_diff/diff2html.min.css' %}` | ||
}; | ||
document.head.appendChild(link); | ||
document.addEventListener('DOMContentLoaded', () => { | ||
var configuration = { | ||
drawFileList: false, | ||
fileListToggle: false, | ||
fileListStartVisible: false, | ||
fileContentToggle: false, | ||
matching: 'lines', | ||
outputFormat: 'side-by-side', | ||
synchronisedScroll: true, | ||
highlight: true, | ||
renderNothingWhenEmpty: false, | ||
stickyFileHeaders: false, | ||
drawFileList: false, | ||
}; | ||
const jsonDiff = `{{ object.diff|safe }}`; | ||
var targetElement = document.getElementById('diffElement'); | ||
var diff2htmlUi = new Diff2HtmlUI(targetElement, jsonDiff, configuration); | ||
diff2htmlUi.draw(); | ||
document.querySelector(".d2h-file-header").remove(); | ||
diff2htmlUi.highlightCode(); | ||
}); | ||
</script> | ||
{% endblock javascript %} | ||
{% endblock controls %} |
13 changes: 0 additions & 13 deletions
13
netbox_config_diff/templates/netbox_config_diff/configcompliance/base.html
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
netbox_config_diff/templates/netbox_config_diff/configcompliance/config.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.