diff --git a/README.md b/README.md
index 75e8d30..421e4e5 100755
--- a/README.md
+++ b/README.md
@@ -363,3 +363,9 @@ Below some of the communities available:
- **[Official - Slack Community (english)](https://netdev.chat/)**
- **[Community Discord Channel - 🇧🇷 (pt-br)](https://discord.gg/X6FudvXW)**
- **[Community Telegram Chat - 🇧🇷 (pt-br)](https://t.me/netboxbr)**
+
+---
+
+## Stars History 📈
+
+[![Star History Chart](https://api.star-history.com/svg?repos=netdevopsbr/netbox-proxbox&type=Timeline)](https://star-history.com/#netdevopsbr/netbox-proxbox&Timeline)
diff --git a/netbox_proxbox/github.py b/netbox_proxbox/github.py
new file mode 100644
index 0000000..31d4a49
--- /dev/null
+++ b/netbox_proxbox/github.py
@@ -0,0 +1,33 @@
+import requests
+import base64
+
+def get(**kwargs):
+ branch = None
+
+ owner = "netdevopsbr"
+ repo = "netbox-proxbox"
+ branch = "develop"
+
+ # Get variable passed from function
+ if kwargs.get("filename"):
+ filename = kwargs.get("filename")
+
+ # Construct the API endpoint URL
+ url = f"https://api.github.com/repos/{owner}/{repo}/contents/{filename}"
+
+ # Make the GET request
+ response = requests.get(url)
+
+ # Check if the request was successful (status code 200)
+ if response.status_code == 200:
+ # Retrieve the content from the response
+ content_url = response.json()["download_url"]
+
+ if content_url:
+ markdown_content = requests.get(content_url)
+
+ if markdown_content.status_code == 200:
+ return markdown_content.text
+ else:
+ # Print the error message if the request was not successful
+ print(f"Error: {response.status_code} - {response.json()['message']}")
\ No newline at end of file
diff --git a/netbox_proxbox/navigation.py b/netbox_proxbox/navigation.py
index 59482d3..aebb9fe 100755
--- a/netbox_proxbox/navigation.py
+++ b/netbox_proxbox/navigation.py
@@ -1,25 +1,46 @@
-from extras.plugins import PluginMenuButton, PluginMenuItem
+from extras.plugins import PluginMenuButton, PluginMenuItem, PluginMenu
from utilities.choices import ButtonColorChoices
-menu_items = (
- PluginMenuItem(
- link="plugins:netbox_proxbox:home",
- link_text="Home",
- ),
+fullupdate_item = PluginMenuItem(
+ link='plugins:netbox_proxbox:home',
+ link_text='Full Update',
+)
+
+contributing_item = PluginMenuItem(
+ link='plugins:netbox_proxbox:contributing',
+ link_text='Contributing!',
+)
+
+community_item = PluginMenuItem(
+ link='plugins:netbox_proxbox:community',
+ link_text='Community',
+ buttons=[
+ PluginMenuButton(
+ "plugins:netbox_proxbox:discussions",
+ "GitHub Discussions",
+ "mdi mdi-github",
+ ButtonColorChoices.GRAY,
+ ),
+ PluginMenuButton(
+ "plugins:netbox_proxbox:discord",
+ "Discord Community",
+ "mdi mdi-forum",
+ ButtonColorChoices.BLACK,
+ ),
+ PluginMenuButton(
+ "plugins:netbox_proxbox:telegram",
+ "Telegram Community",
+ "mdi mdi-send",
+ ButtonColorChoices.BLUE,
+ ),
+ ]
)
-'''
-buttons=(
- PluginMenuButton(
- # match the names of the path for create view defined in ./urls.py
- link="plugins:netbox_proxbox:proxmoxvm_add",
- # text that appears when hovering the ubtton
- title="Add",
- # font-awesome icon to use
- icon_class="mdi mdi-plus-thick", # 'fa fa-plus' didn't work
- # defines color button to green
- color=ButtonColorChoices.GREEN,
- permissions=["netbox_proxbox.add_proxmoxvm"],
+menu = PluginMenu(
+ label='Proxbox',
+ groups=(
+ ('Proxmox Plugin', (fullupdate_item,)),
+ ('Join our community', (contributing_item, community_item,)),
),
-),
-'''
\ No newline at end of file
+ icon_class='mdi mdi-dns'
+)
\ No newline at end of file
diff --git a/netbox_proxbox/static/netbox_proxbox/discord-banner.png b/netbox_proxbox/static/netbox_proxbox/discord-banner.png
new file mode 100644
index 0000000..f30594a
Binary files /dev/null and b/netbox_proxbox/static/netbox_proxbox/discord-banner.png differ
diff --git a/netbox_proxbox/static/netbox_proxbox/discord.png b/netbox_proxbox/static/netbox_proxbox/discord.png
new file mode 100644
index 0000000..c71fe21
Binary files /dev/null and b/netbox_proxbox/static/netbox_proxbox/discord.png differ
diff --git a/netbox_proxbox/static/netbox_proxbox/github.png b/netbox_proxbox/static/netbox_proxbox/github.png
new file mode 100644
index 0000000..9490ffc
Binary files /dev/null and b/netbox_proxbox/static/netbox_proxbox/github.png differ
diff --git a/netbox_proxbox/static/netbox_proxbox/linkedin.png b/netbox_proxbox/static/netbox_proxbox/linkedin.png
new file mode 100644
index 0000000..cccea43
Binary files /dev/null and b/netbox_proxbox/static/netbox_proxbox/linkedin.png differ
diff --git a/netbox_proxbox/static/netbox_proxbox/telegram-banner.jpg b/netbox_proxbox/static/netbox_proxbox/telegram-banner.jpg
new file mode 100644
index 0000000..180bd1c
Binary files /dev/null and b/netbox_proxbox/static/netbox_proxbox/telegram-banner.jpg differ
diff --git a/netbox_proxbox/static/netbox_proxbox/telegram.png b/netbox_proxbox/static/netbox_proxbox/telegram.png
new file mode 100644
index 0000000..34b7ee2
Binary files /dev/null and b/netbox_proxbox/static/netbox_proxbox/telegram.png differ
diff --git a/netbox_proxbox/static/proxmox-logo.svg b/netbox_proxbox/static/proxmox-logo.svg
deleted file mode 100644
index bc5d22a..0000000
--- a/netbox_proxbox/static/proxmox-logo.svg
+++ /dev/null
@@ -1,243 +0,0 @@
-
-
-
-
diff --git a/netbox_proxbox/templates/netbox_proxbox/community.html b/netbox_proxbox/templates/netbox_proxbox/community.html
new file mode 100644
index 0000000..b6117f3
--- /dev/null
+++ b/netbox_proxbox/templates/netbox_proxbox/community.html
@@ -0,0 +1,166 @@
+{% extends 'base/layout.html' %}
+{% load static %}
+
+{% block content %}
+
+ Font Awesome Icons
+
+
+
+
+
+ {{ title }}
+
+
+
+
+
+
+
+
+
+ English (en) |
+ Join our Discord Community |
+
+
+ Português (pt-br) |
+ Participe de nossa comunidade no Discord |
+
+
+
+
+
+
+
+
+
+
+
+
+ English (en) |
+ Join our Telegram Community |
+
+
+ Português (pt-br) |
+ Participe de nossa comunidade no Telegram |
+
+
+
+
+
+
+
+
+
+
+
+
+ English (en) |
+ Know more about @netdevopsbr and other opensource projects |
+
+
+ Português (pt-br) |
+ Saiba mais sobre a @netdevopsbr e outros projetos opensource |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ English (en) |
+ Would you like to know more about my work? Follow or connect with me! |
+
+
+ Português (pt-br) |
+ Gostaria de saber mais sobre o meu trabalho? Me siga ou conecte-se comigo! |
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/netbox_proxbox/templates/netbox_proxbox/contributing.html b/netbox_proxbox/templates/netbox_proxbox/contributing.html
new file mode 100644
index 0000000..9bd6217
--- /dev/null
+++ b/netbox_proxbox/templates/netbox_proxbox/contributing.html
@@ -0,0 +1,17 @@
+{% extends 'base/layout.html' %}
+{% block content %}
+
+
+
+
+ {% if html %}
+ {{ html|markdown }}
+ {% else %}
+ None
+ {% endif %}
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/netbox_proxbox/urls.py b/netbox_proxbox/urls.py
index 403a199..b78c378 100755
--- a/netbox_proxbox/urls.py
+++ b/netbox_proxbox/urls.py
@@ -2,38 +2,32 @@
from django.http import HttpResponse
from django.urls import path
-from .views import (
- HomeView,
- ProxmoxVMCreateView,
- ProxmoxVMDeleteView,
- ProxmoxVMEditView,
- ProxmoxVMListView,
- ProxmoxVMView,
- ProxmoxFullUpdate,
- ProxmoxSingleUpdate,
-)
+from . import views
from netbox_proxbox import proxbox_api
import json
urlpatterns = [
# Home View
- path('', HomeView.as_view(), name='home'),
+ path('', views.HomeView.as_view(), name='home'),
+ path('contributing/', views.ContributingView.as_view(), name='contributing'),
+ path('community/', views.CommunityView.as_view(), name='community'),
+
+ # Redirect to: "https://github.com/orgs/netdevopsbr/discussions"
+ path('discussions/', views.DiscussionsView, name='discussions'),
+ path('discord/', views.DiscordView, name='discord'),
+ path('telegram/', views.TelegramView, name='telegram'),
# Base Views
- path("list/", ProxmoxVMListView.as_view(), name="proxmoxvm_list"),
+ path("list/", views.ProxmoxVMListView.as_view(), name="proxmoxvm_list"),
# = plugins/netbox_proxmoxvm/ | example: plugins/netbox_proxmoxvm/1/
# ProxmoxVMView.as_view() - as.view() is need so that our view class can process requests.
# as_view() takes request and returns well-formed response, that is a class based view.
- path("/", ProxmoxVMView.as_view(), name="proxmoxvm"),
- path("add/", ProxmoxVMCreateView.as_view(), name="proxmoxvm_add"),
- path("/delete/", ProxmoxVMDeleteView.as_view(), name="proxmoxvm_delete"),
- path("/edit/", ProxmoxVMEditView.as_view(), name="proxmoxvm_edit"),
-
-
+ path("/", views.ProxmoxVMView.as_view(), name="proxmoxvm"),
+ path("add/", views.ProxmoxVMCreateView.as_view(), name="proxmoxvm_add"),
+ path("/delete/", views.ProxmoxVMDeleteView.as_view(), name="proxmoxvm_delete"),
+ path("/edit/", views.ProxmoxVMEditView.as_view(), name="proxmoxvm_edit"),
# Proxbox API full update
- #path("full_update/", ProxmoxVMFullUpdate.as_view(), name="proxmoxvm_full_update")
- path("full_update/", ProxmoxFullUpdate.as_view(), name="proxmoxvm_full_update"),
- path("single_update/", ProxmoxSingleUpdate.as_view(), name="proxmoxvm_single_update"),
-]
+ path("full_update/", views.ProxmoxFullUpdate.as_view(), name="proxmoxvm_full_update"),
+ path("single_update/", views.ProxmoxSingleUpdate.as_view(), name="proxmoxvm_single_update"),
diff --git a/netbox_proxbox/views.py b/netbox_proxbox/views.py
index 3879084..59e6e76 100755
--- a/netbox_proxbox/views.py
+++ b/netbox_proxbox/views.py
@@ -1,4 +1,4 @@
-from django.shortcuts import get_object_or_404, render
+from django.shortcuts import get_object_or_404, render, redirect
from django.urls import reverse_lazy
# 'View' is a django subclass. Basic type of class-based views
from django.views import View
@@ -24,6 +24,9 @@
from . import ProxboxConfig
+import markdown
+from . import github
+
class HomeView(View):
"""Homepage"""
template_name = 'netbox_proxbox/home.html'
@@ -45,6 +48,56 @@ def get(self, request):
"default_config_json": json.dumps(default_config, indent=4)
}
)
+
+class ContributingView(View):
+ """Contributing"""
+ template_name = 'netbox_proxbox/contributing.html'
+
+ # service incoming GET HTTP requests
+ def get(self, request):
+ """Get request."""
+
+ title = "Contributing to Proxbox Project"
+
+ return render(
+ request,
+ self.template_name,
+ {
+ "html": github.get(filename = "CONTRIBUTING.md"),
+ "title": title,
+ }
+ )
+
+
+class CommunityView(View):
+ """Community"""
+ template_name = 'netbox_proxbox/community.html'
+
+ # service incoming GET HTTP requests
+ def get(self, request):
+ """Get request."""
+
+ title = "Join our Community!"
+
+ return render(
+ request,
+ self.template_name,
+ {
+ "title": title,
+ }
+ )
+
+def DiscussionsView(request):
+ external_url = "https://github.com/orgs/netdevopsbr/discussions"
+ return redirect(external_url)
+
+def DiscordView(request):
+ external_url = "https://discord.com/invite/9N3V4mpMXU"
+ return redirect(external_url)
+
+def TelegramView(request):
+ external_url = "https://t.me/netboxbr"
+ return redirect(external_url)
'''
def table_data():