Compare commits
4 Commits
ae28d3fb26
..
v1.9.9
| Author | SHA1 | Date | |
|---|---|---|---|
| c8c483ae95 | |||
| fd2b561308 | |||
| 3e5ee0800e | |||
| 5850898d5b |
@@ -8,6 +8,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
|
name: Build & Release
|
||||||
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'v')
|
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'v')
|
||||||
runs-on: build-htz-01
|
runs-on: build-htz-01
|
||||||
steps:
|
steps:
|
||||||
@@ -44,3 +45,30 @@ jobs:
|
|||||||
body: ${{ steps.changelog.outputs.changelog }}
|
body: ${{ steps.changelog.outputs.changelog }}
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
||||||
|
sonarqube:
|
||||||
|
name: SonarQube
|
||||||
|
runs-on: build-htz-01
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Create Valid Project Key
|
||||||
|
id: sonar_setup
|
||||||
|
run: |
|
||||||
|
CLEAN_KEY=$(echo "${{ gitea.repository }}" | tr '/' ':')
|
||||||
|
echo "key=$CLEAN_KEY" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: SonarQube Scan
|
||||||
|
uses: sonarsource/sonarqube-scan-action@master
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||||
|
with:
|
||||||
|
args: >
|
||||||
|
-Dsonar.projectKey=${{ steps.sonar_setup.outputs.key }}
|
||||||
|
-Dsonar.projectName=${{ gitea.repository }}
|
||||||
|
-Dsonar.qualitygate.wait=true
|
||||||
@@ -539,7 +539,7 @@ def prewarm_cache(app):
|
|||||||
|
|
||||||
# Pre-warm index page (all subnets with utilization)
|
# Pre-warm index page (all subnets with utilization)
|
||||||
logging.info("Pre-warming cache: Loading all subnets for index page...")
|
logging.info("Pre-warming cache: Loading all subnets for index page...")
|
||||||
cursor.execute('SELECT id, name, cidr, site FROM Subnet')
|
cursor.execute('SELECT id, name, cidr, site, vlan_id FROM Subnet')
|
||||||
subnets = cursor.fetchall()
|
subnets = cursor.fetchall()
|
||||||
sites_subnets = {}
|
sites_subnets = {}
|
||||||
for subnet in subnets:
|
for subnet in subnets:
|
||||||
@@ -570,6 +570,7 @@ def prewarm_cache(app):
|
|||||||
'id': subnet[0],
|
'id': subnet[0],
|
||||||
'name': subnet[1],
|
'name': subnet[1],
|
||||||
'cidr': subnet[2],
|
'cidr': subnet[2],
|
||||||
|
'vlan_id': subnet[4],
|
||||||
'utilization': round(utilization_percent, 1)
|
'utilization': round(utilization_percent, 1)
|
||||||
})
|
})
|
||||||
cache.set('index', sites_subnets, ttl=10800)
|
cache.set('index', sites_subnets, ttl=10800)
|
||||||
@@ -990,7 +991,7 @@ def register_routes(app, limiter=None):
|
|||||||
conn = get_db_connection(current_app)
|
conn = get_db_connection(current_app)
|
||||||
try:
|
try:
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute('SELECT id, name, cidr, site FROM Subnet')
|
cursor.execute('SELECT id, name, cidr, site, vlan_id FROM Subnet')
|
||||||
subnets = cursor.fetchall()
|
subnets = cursor.fetchall()
|
||||||
sites_subnets = {}
|
sites_subnets = {}
|
||||||
for subnet in subnets:
|
for subnet in subnets:
|
||||||
@@ -1024,6 +1025,7 @@ def register_routes(app, limiter=None):
|
|||||||
'id': subnet[0],
|
'id': subnet[0],
|
||||||
'name': subnet[1],
|
'name': subnet[1],
|
||||||
'cidr': subnet[2],
|
'cidr': subnet[2],
|
||||||
|
'vlan_id': subnet[4],
|
||||||
'utilization': round(utilization_percent, 1)
|
'utilization': round(utilization_percent, 1)
|
||||||
})
|
})
|
||||||
# Cache for 3 hours
|
# Cache for 3 hours
|
||||||
|
|||||||
+11
-5
@@ -24,12 +24,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<ul class="subnet-list hidden space-y-4 px-2 pb-4">
|
<ul class="subnet-list hidden space-y-4 px-2 pb-4">
|
||||||
{% for subnet in subnets %}
|
{% for subnet in subnets %}
|
||||||
<li class="p-4 bg-gray-300 hover:bg-gray-100 dark:bg-zinc-900 hover:dark:bg-zinc-700 rounded-lg shadow-md flex items-center justify-between">
|
<li class="relative p-4 bg-gray-300 hover:bg-gray-100 dark:bg-zinc-900 hover:dark:bg-zinc-700 rounded-lg shadow-md flex items-center justify-between">
|
||||||
<a href="/subnet/{{ subnet.id }}">
|
<a href="/subnet/{{ subnet.id }}" class="absolute inset-0 z-0 rounded-lg"></a>
|
||||||
|
<div class="pointer-events-none z-10 flex-grow">
|
||||||
<p class="text-gray-900 dark:text-white text-lg font-medium">{{ subnet.name }}</p>
|
<p class="text-gray-900 dark:text-white text-lg font-medium">{{ subnet.name }}</p>
|
||||||
<p class="text-sm text-gray-800 dark:text-gray-400">{{ subnet.cidr }}</p>
|
<div class="flex items-center space-x-2">
|
||||||
</a>
|
<p class="text-sm text-gray-800 dark:text-gray-400">{{ subnet.cidr }}</p>
|
||||||
<button type="button" class="export-csv-btn ml-2 bg-gray-200 hover:bg-gray-400 dark:bg-zinc-600 dark:hover:bg-zinc-500 hover:cursor-pointer flex items-center justify-center rounded-full w-9 h-9" title="Export as CSV" data-subnet-id="{{ subnet.id }}">
|
{% if subnet.vlan_id %}
|
||||||
|
<span class="px-2 py-0.5 text-xs font-semibold bg-gray-200 dark:bg-zinc-800 rounded-full">VLAN {{ subnet.vlan_id }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="relative z-10 export-csv-btn ml-2 bg-gray-200 hover:bg-gray-400 dark:bg-zinc-600 dark:hover:bg-zinc-500 hover:cursor-pointer flex items-center justify-center rounded-full w-9 h-9 shrink-0" title="Export as CSV" data-subnet-id="{{ subnet.id }}">
|
||||||
<i class="fas fa-file-csv"></i>
|
<i class="fas fa-file-csv"></i>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user