Skip to content

Commit

Permalink
Merge branch 'add-multi-cluster' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
emersonfelipesp authored Jul 21, 2023
2 parents 0002900 + df27c08 commit ec1afbc
Show file tree
Hide file tree
Showing 14 changed files with 333 additions and 286 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
33 changes: 33 additions & 0 deletions netbox_proxbox/github.py
Original file line number Diff line number Diff line change
@@ -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']}")
61 changes: 41 additions & 20 deletions netbox_proxbox/navigation.py
Original file line number Diff line number Diff line change
@@ -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,)),
),
),
'''
icon_class='mdi mdi-dns'
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added netbox_proxbox/static/netbox_proxbox/discord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added netbox_proxbox/static/netbox_proxbox/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added netbox_proxbox/static/netbox_proxbox/linkedin.png
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
243 changes: 0 additions & 243 deletions netbox_proxbox/static/proxmox-logo.svg

This file was deleted.

166 changes: 166 additions & 0 deletions netbox_proxbox/templates/netbox_proxbox/community.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{% extends 'base/layout.html' %}
{% load static %}

{% block content %}
<head>
<title>Font Awesome Icons</title>
<!-- Add the Font Awesome CSS link in the head section -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<br>
<h1 align="center">
{{ title }}
</h1>
<br>
<div class="row">
<div class="col col-12 col-xl-6">
<div class="card">
<div align="center">
<br>
<a target="_blank" href="https://discord.gg/9N3V4mpMXU">
<img src="{% static 'netbox_proxbox/discord.png' %}" alt="Discord Logo" width="50rem">
</a>
</div>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<th scope="row"><strong>English (en)</strong></th>
<td>Join our Discord Community</td>
</tr>
<tr>
<th scope="row"><strong>Português (pt-br)</strong></th>
<td>Participe de nossa comunidade no Discord</td>
</tr>
</table>
<div align="right">
<button class="btn btn-purple" type="button">
<a
style="text-decoration: none; color: inherit"
target="_blank"
href="https://t.me/netboxbr"
>Discord Community
<i class="fa-brands fa-discord fa-shake" style="color: #ffffff;"></i>
</a>
</button>
</div>
</div>
</div>
</div>
<div class="col col-12 col-xl-6">
<div class="card">
<div align="center">
<br>
<a href="https://t.me/netboxbr" target="_blank">
<img src="{% static 'netbox_proxbox/telegram.png' %}" alt="Telegram Logo" width="50rem">
</a>
</div>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<th scope="row"><strong>English (en)</strong></th>
<td>Join our Telegram Community</td>
</tr>
<tr>
<th scope="row"><strong>Português (pt-br)</strong></th>
<td>Participe de nossa comunidade no Telegram</td>
</tr>
</table>
<div align="right">
<button class="btn btn-primary" type="button">
<a
style="text-decoration: none; color: inherit"
target="_blank"
href="https://t.me/netboxbr"
>Telegram Community
<svg
xmlns="http://www.w3.org/2000/svg"
height="1em"
viewBox="0 0 496 512">
<!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><style>svg{fill:#ffffff}</style><path d="M248,8C111.033,8,0,119.033,0,256S111.033,504,248,504,496,392.967,496,256,384.967,8,248,8ZM362.952,176.66c-3.732,39.215-19.881,134.378-28.1,178.3-3.476,18.584-10.322,24.816-16.948,25.425-14.4,1.326-25.338-9.517-39.287-18.661-21.827-14.308-34.158-23.215-55.346-37.177-24.485-16.135-8.612-25,5.342-39.5,3.652-3.793,67.107-61.51,68.335-66.746.153-.655.3-3.1-1.154-4.384s-3.59-.849-5.135-.5q-3.283.746-104.608,69.142-14.845,10.194-26.894,9.934c-8.855-.191-25.888-5.006-38.551-9.123-15.531-5.048-27.875-7.717-26.8-16.291q.84-6.7,18.45-13.7,108.446-47.248,144.628-62.3c68.872-28.647,83.183-33.623,92.511-33.789,2.052-.034,6.639.474,9.61,2.885a10.452,10.452,0,0,1,3.53,6.716A43.765,43.765,0,0,1,362.952,176.66Z"/>
</svg>
</a>
</button>
</div>
</div>
</div>
</div>
<div class="col col-12 col-xl-6">
<div class="card">
<div align="center">
<br>
<a target="_blank" href="https://github.com/netdevopsbr">
<img src="{% static 'netbox_proxbox/github.png' %}" alt="Discord Logo" width="50rem">
</a>
</div>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<th scope="row"><strong>English (en)</strong></th>
<td>Know more about <strong>@netdevopsbr</strong> and other <strong>opensource projects</strong></td>
</tr>
<tr>
<th scope="row"><strong>Português (pt-br)</strong></th>
<td>Saiba mais sobre a <strong>@netdevopsbr</strong> e outros <strong>projetos opensource</strong></td>
</tr>
</table>
<div>

</div>
<div align="right">
<button class="btn btn-black" type="button">
<a
style="text-decoration: none; color: inherit"
target="_blank"
href="https://github.com/netdevopsbr"
>@netdevopsbr
<i class="fa-brands fa-github fa-shake" style="color: #ffffff;"></i>
</a>
</button>
<button class="btn btn-black" type="button">
<a
style="text-decoration: none; color: inherit"
target="_blank"
href="https://github.com/emersonfelipesp"
>@emersonfelipesp
<i class="fa-brands fa-github fa-shake" style="color: #ffffff;"></i>
</a>
</button>
</div>
</div>
</div>
</div>
<div class="col col-12 col-xl-6">
<div class="card">
<div align="center">
<br>
<a href="https://www.linkedin.com/in/emersonfelipesp/" target="_blank">
<img src="{% static 'netbox_proxbox/linkedin.png' %}" alt="Telegram Logo" width="50rem">
</a>
</div>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<th scope="row"><strong>English (en)</strong></th>
<td>Would you like to know more about my work? <strong>Follow or connect with me!</strong></td>
</tr>
<tr>
<th scope="row"><strong>Português (pt-br)</strong></th>
<td>Gostaria de saber mais sobre o meu trabalho? <strong>Me siga ou conecte-se comigo!</strong></td>
</tr>
</table>
<div align="right">
<button class="btn btn-primary" type="button">
<a
style="text-decoration: none; color: inherit"
target="_blank"
href="https://t.me/netboxbr"
>Follow/Connect
<i class="fa-brands fa-linkedin fa-shake" style="color: #ffffff;"></i>
</a>
</button>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
17 changes: 17 additions & 0 deletions netbox_proxbox/templates/netbox_proxbox/contributing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'base/layout.html' %}
{% block content %}
<div class="row">
<div class="card">
<h1 class="card-header">
{{ title }}
</h1>
<div class="card-body">
{% if html %}
{{ html|markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
</div>
{% endblock %}
38 changes: 16 additions & 22 deletions netbox_proxbox/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
# <int:pk> = plugins/netbox_proxmoxvm/<pk> | 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("<int:pk>/", ProxmoxVMView.as_view(), name="proxmoxvm"),
path("add/", ProxmoxVMCreateView.as_view(), name="proxmoxvm_add"),
path("<int:pk>/delete/", ProxmoxVMDeleteView.as_view(), name="proxmoxvm_delete"),
path("<int:pk>/edit/", ProxmoxVMEditView.as_view(), name="proxmoxvm_edit"),


path("<int:pk>/", views.ProxmoxVMView.as_view(), name="proxmoxvm"),
path("add/", views.ProxmoxVMCreateView.as_view(), name="proxmoxvm_add"),
path("<int:pk>/delete/", views.ProxmoxVMDeleteView.as_view(), name="proxmoxvm_delete"),
path("<int:pk>/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"),
Loading

0 comments on commit ec1afbc

Please sign in to comment.