...
This commit is contained in:
77
pkg/heroagent/web/templates/admin/index.jet
Normal file
77
pkg/heroagent/web/templates/admin/index.jet
Normal file
@@ -0,0 +1,77 @@
|
||||
{{ extends "layout" }}
|
||||
{{ block documentBody() }}
|
||||
<article>
|
||||
<header>
|
||||
<h2>Dashboard</h2>
|
||||
<p>Welcome to the HeroLauncher Admin Dashboard</p>
|
||||
</header>
|
||||
|
||||
<div class="grid">
|
||||
<div>
|
||||
<article>
|
||||
<header>
|
||||
<h3>System Status</h3>
|
||||
</header>
|
||||
|
||||
<div class="grid">
|
||||
<div>
|
||||
<h4>Services</h4>
|
||||
<p>
|
||||
<strong>12</strong> running
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4>CPU</h4>
|
||||
<p>
|
||||
<strong>24%</strong> usage
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4>Memory</h4>
|
||||
<p>
|
||||
<strong>1.2GB</strong> / 8GB
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<article>
|
||||
<header>
|
||||
<h3>Recent Activity</h3>
|
||||
</header>
|
||||
|
||||
<ul>
|
||||
<li>Service 'redis' started (2 minutes ago)</li>
|
||||
<li>Package 'web-ui' updated (10 minutes ago)</li>
|
||||
<li>System backup completed (1 hour ago)</li>
|
||||
<li>User 'admin' logged in (2 hours ago)</li>
|
||||
</ul>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<header>
|
||||
<h3>Quick Actions</h3>
|
||||
</header>
|
||||
|
||||
<div class="grid">
|
||||
<div>
|
||||
<a href="/admin/services/start" role="button">Start Service</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a href="/admin/services/stop" role="button" class="secondary">Stop Service</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a href="/admin/packages/install" role="button" class="contrast">Install Package</a>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</article>
|
||||
{{ end }}
|
56
pkg/heroagent/web/templates/admin/jobs.jet
Normal file
56
pkg/heroagent/web/templates/admin/jobs.jet
Normal file
@@ -0,0 +1,56 @@
|
||||
{{ extends "./layout" }}
|
||||
|
||||
{{ block documentBody() }}
|
||||
<div class="main-content">
|
||||
<header class="action-header">
|
||||
<div>
|
||||
<h2>Jobs</h2>
|
||||
<p>Manage all your scheduled jobs</p>
|
||||
</div>
|
||||
<div>
|
||||
<a href="/admin/jobs/new" class="button">Add New Job</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{{if len(warning) > 0}}
|
||||
<div class="alert alert-warning">
|
||||
{{warning}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if len(error) > 0}}
|
||||
<div class="alert alert-error">
|
||||
{{error}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<section>
|
||||
<div class="card">
|
||||
<div class="card-title">Filter Jobs</div>
|
||||
<div class="card-content">
|
||||
<form action="/admin/jobs/list" up-target="#jobs-list">
|
||||
<div class="form-group">
|
||||
<label for="circleid">Circle ID</label>
|
||||
<input id="circleid" type="text" name="circleid" placeholder="Enter circle ID">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="topic">Topic</label>
|
||||
<input id="topic" type="text" name="topic" placeholder="Enter topic">
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button class="button" type="submit">Filter Jobs</button>
|
||||
<a href="/admin/jobs/list" class="button" up-target="#jobs-list">Refresh</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="jobs-list">
|
||||
<!-- This will be populated by the server response -->
|
||||
<div up-hungry>
|
||||
<a href="/admin/jobs/list" up-target="#jobs-list" up-preload up-eager></a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{{ end }}
|
44
pkg/heroagent/web/templates/admin/jobs_list_fragment.jet
Normal file
44
pkg/heroagent/web/templates/admin/jobs_list_fragment.jet
Normal file
@@ -0,0 +1,44 @@
|
||||
<div class="card">
|
||||
<div class="card-title">Jobs List</div>
|
||||
|
||||
{{if len(error) > 0}}
|
||||
<div class="alert alert-error">
|
||||
{{error}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div class="card-content">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Job ID</th>
|
||||
<th>Circle ID</th>
|
||||
<th>Topic</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{if len(jobs) == 0}}
|
||||
<tr>
|
||||
<td colspan="5" class="text-center">No jobs found</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
{{range job := jobs}}
|
||||
<tr>
|
||||
<td>{{job.JobID}}</td>
|
||||
<td>{{job.CircleID}}</td>
|
||||
<td>{{job.Topic}}</td>
|
||||
<td>
|
||||
<span class="status-badge status-{{job.Status}}">{{job.Status}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/admin/jobs/get/{{job.JobID}}" class="button button-small" up-target=".main-content">View</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
37
pkg/heroagent/web/templates/admin/layout.jet
Normal file
37
pkg/heroagent/web/templates/admin/layout.jet
Normal file
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>HeroLauncher Admin</title>
|
||||
<link rel="icon" href="/img/hero-icon.svg" type="image/svg+xml">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<link rel="stylesheet" href="/css/pico.min.css">
|
||||
<link rel="stylesheet" href="/css/admin.css">
|
||||
<link rel="stylesheet" href="/css/unpoly.min.css">
|
||||
<link rel="stylesheet" href="/css/logs.css">
|
||||
<link rel="stylesheet" href="/css/jobs.css">
|
||||
<style>
|
||||
:root {
|
||||
--font-size: 70%; /* Reduce font size by 30% */
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{{ include "partials/header" }}
|
||||
<div class="sidebar">
|
||||
<nav>
|
||||
{{ include "partials/sidebar" }}
|
||||
</nav>
|
||||
</div>
|
||||
<main>
|
||||
{{block documentBody()}}{{end}}
|
||||
</main>
|
||||
|
||||
<script src="/js/unpoly.min.js"></script>
|
||||
<script src="/js/echarts/echarts.min.js"></script>
|
||||
<script src="/js/admin.js"></script>
|
||||
{{block scripts()}}{{end}}
|
||||
|
||||
</body>
|
||||
</html>
|
86
pkg/heroagent/web/templates/admin/openrpc/index.jet
Normal file
86
pkg/heroagent/web/templates/admin/openrpc/index.jet
Normal file
@@ -0,0 +1,86 @@
|
||||
{{ extends "../layout" }}
|
||||
|
||||
{{ block documentBody() }}
|
||||
<div class="container-fluid p-4">
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<h1 class="mb-3">OpenRPC Manager</h1>
|
||||
<p class="lead">This page provides access to all available OpenRPC servers and their APIs.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Available OpenRPC Servers</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Server Name</th>
|
||||
<th>Description</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Virtual File System (VFS)</td>
|
||||
<td>Provides file system operations including upload, download, and metadata management</td>
|
||||
<td>
|
||||
<span class="badge bg-success">Running</span>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/admin/openrpc/vfs" class="btn btn-sm btn-primary">View API</a>
|
||||
<a href="/api/vfs/openrpc" target="_blank" class="btn btn-sm btn-secondary ms-2">Schema</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">OpenRPC Information</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p>
|
||||
<strong>What is OpenRPC?</strong> OpenRPC is a standard for describing JSON-RPC 2.0 APIs, similar to how OpenAPI (Swagger) describes REST APIs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Benefits:</strong>
|
||||
<ul>
|
||||
<li>Standardized API documentation</li>
|
||||
<li>Automatic client and server code generation</li>
|
||||
<li>Consistent interface across different programming languages</li>
|
||||
<li>Self-documenting APIs with built-in schema validation</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Learn more:</strong>
|
||||
<a href="https://open-rpc.org/" target="_blank">open-rpc.org</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ block scripts() }}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Add any JavaScript functionality here
|
||||
console.log('OpenRPC Manager page loaded');
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
235
pkg/heroagent/web/templates/admin/openrpc/vfs.jet
Normal file
235
pkg/heroagent/web/templates/admin/openrpc/vfs.jet
Normal file
@@ -0,0 +1,235 @@
|
||||
{{ extends "../layout" }}
|
||||
|
||||
{{ block documentBody() }}
|
||||
<div class="container-fluid p-4">
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<h1 class="mb-3">Virtual File System API</h1>
|
||||
<p class="lead">This page provides access to the VFS OpenRPC API documentation, methods, and logs.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabs navigation -->
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<ul class="nav nav-tabs" id="vfsTabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="#overview" up-target=".tab-content">Overview</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin/openrpc/vfs/logs" up-target="#logs">Logs</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tab content -->
|
||||
<div class="tab-content">
|
||||
<!-- Overview tab -->
|
||||
<div id="overview">
|
||||
{{ include "./vfs_overview" }}
|
||||
</div>
|
||||
|
||||
<!-- Logs tab (will be loaded via Unpoly) -->
|
||||
<div id="logs">
|
||||
<div class="text-center py-5">
|
||||
<div class="spinner-border" role="status">
|
||||
<div class="mt-3">Loading logs...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ block scripts() }}
|
||||
<script>
|
||||
/* Handle tab switching */
|
||||
up.compiler('#vfsTabs a', function(element) {
|
||||
element.addEventListener('click', function(e) {
|
||||
/* Remove active class from all tabs */
|
||||
document.querySelectorAll('#vfsTabs a').forEach(function(tab) {
|
||||
tab.classList.remove('active');
|
||||
});
|
||||
|
||||
/* Add active class to clicked tab */
|
||||
element.classList.add('active');
|
||||
|
||||
/* If overview tab is clicked, show overview and hide logs */
|
||||
if (element.getAttribute('href') === '#overview') {
|
||||
e.preventDefault(); /* Prevent default anchor behavior */
|
||||
document.getElementById('overview').style.display = 'block';
|
||||
document.getElementById('logs').style.display = 'none';
|
||||
} else {
|
||||
/* For logs tab, hide overview (logs will be loaded via Unpoly) */
|
||||
document.getElementById('overview').style.display = 'none';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const methodSelect = document.getElementById('method-select');
|
||||
const methodParams = document.getElementById('method-params');
|
||||
const paramFields = document.getElementById('param-fields');
|
||||
const executeBtn = document.getElementById('execute-btn');
|
||||
const resultContainer = document.getElementById('result-container');
|
||||
const resultOutput = document.getElementById('result-output');
|
||||
|
||||
/* Method parameter definitions */
|
||||
const methodDefinitions = {
|
||||
'UploadFile': [
|
||||
{ name: 'vfspath', type: 'string', description: 'Path in the virtual file system' },
|
||||
{ name: 'dedupepath', type: 'string', description: 'Path for deduplication' },
|
||||
{ name: 'filepath', type: 'string', description: 'Local file path to upload' }
|
||||
],
|
||||
'UploadDir': [
|
||||
{ name: 'vfspath', type: 'string', description: 'Path in the virtual file system' },
|
||||
{ name: 'dedupepath', type: 'string', description: 'Path for deduplication' },
|
||||
{ name: 'dirpath', type: 'string', description: 'Local directory path to upload' }
|
||||
],
|
||||
'DownloadFile': [
|
||||
{ name: 'vfspath', type: 'string', description: 'Path in the virtual file system' },
|
||||
{ name: 'dedupepath', type: 'string', description: 'Path for deduplication' },
|
||||
{ name: 'destpath', type: 'string', description: 'Local destination path' }
|
||||
],
|
||||
'ExportMeta': [
|
||||
{ name: 'vfspath', type: 'string', description: 'Path in the virtual file system' },
|
||||
{ name: 'destpath', type: 'string', description: 'Local destination path for metadata' }
|
||||
],
|
||||
'ImportMeta': [
|
||||
{ name: 'vfspath', type: 'string', description: 'Path in the virtual file system' },
|
||||
{ name: 'sourcepath', type: 'string', description: 'Local source path for metadata' }
|
||||
],
|
||||
'ExportDedupe': [
|
||||
{ name: 'vfspath', type: 'string', description: 'Path in the virtual file system' },
|
||||
{ name: 'dedupepath', type: 'string', description: 'Path for deduplication' },
|
||||
{ name: 'destpath', type: 'string', description: 'Local destination path for dedupe info' }
|
||||
],
|
||||
'ImportDedupe': [
|
||||
{ name: 'vfspath', type: 'string', description: 'Path in the virtual file system' },
|
||||
{ name: 'dedupepath', type: 'string', description: 'Path for deduplication' },
|
||||
{ name: 'sourcepath', type: 'string', description: 'Local source path for dedupe info' }
|
||||
],
|
||||
'Send': [
|
||||
{ name: 'dedupepath', type: 'string', description: 'Path for deduplication' },
|
||||
{ name: 'pubkeydest', type: 'string', description: 'Public key of destination' },
|
||||
{ name: 'hashlist', type: 'array', description: 'List of hashes to send' },
|
||||
{ name: 'secret', type: 'string', description: 'Secret for authentication' }
|
||||
],
|
||||
'SendExist': [
|
||||
{ name: 'dedupepath', type: 'string', description: 'Path for deduplication' },
|
||||
{ name: 'pubkeydest', type: 'string', description: 'Public key of destination' },
|
||||
{ name: 'hashlist', type: 'array', description: 'List of hashes to check' },
|
||||
{ name: 'secret', type: 'string', description: 'Secret for authentication' }
|
||||
],
|
||||
'ExposeWebDAV': [
|
||||
{ name: 'vfspath', type: 'string', description: 'Path in the virtual file system' },
|
||||
{ name: 'port', type: 'number', description: 'Port to expose on' },
|
||||
{ name: 'username', type: 'string', description: 'WebDAV username' },
|
||||
{ name: 'password', type: 'string', description: 'WebDAV password' }
|
||||
],
|
||||
'Expose9P': [
|
||||
{ name: 'vfspath', type: 'string', description: 'Path in the virtual file system' },
|
||||
{ name: 'port', type: 'number', description: 'Port to expose on' },
|
||||
{ name: 'readonly', type: 'boolean', description: 'Whether to expose as read-only' }
|
||||
]
|
||||
};
|
||||
|
||||
/* When a method is selected, show the parameter form */
|
||||
methodSelect.addEventListener('change', function() {
|
||||
const selectedMethod = this.value;
|
||||
|
||||
if (!selectedMethod) {
|
||||
methodParams.classList.add('d-none');
|
||||
return;
|
||||
}
|
||||
|
||||
/* Clear previous parameters */
|
||||
paramFields.innerHTML = '';
|
||||
|
||||
/* Add parameter fields for the selected method */
|
||||
const params = methodDefinitions[selectedMethod] || [];
|
||||
params.forEach(param => {
|
||||
const formGroup = document.createElement('div');
|
||||
formGroup.className = 'form-group mb-2';
|
||||
|
||||
const label = document.createElement('label');
|
||||
label.textContent = `${param.name} (${param.type}):`;
|
||||
label.setAttribute('for', `param-${param.name}`);
|
||||
|
||||
const input = document.createElement('input');
|
||||
input.className = 'form-control';
|
||||
input.id = `param-${param.name}`;
|
||||
input.name = param.name;
|
||||
input.setAttribute('data-type', param.type);
|
||||
|
||||
if (param.type === 'boolean') {
|
||||
input.type = 'checkbox';
|
||||
input.className = 'form-check-input ms-2';
|
||||
} else {
|
||||
input.type = 'text';
|
||||
}
|
||||
|
||||
const small = document.createElement('small');
|
||||
small.className = 'form-text text-muted';
|
||||
small.textContent = param.description;
|
||||
|
||||
formGroup.appendChild(label);
|
||||
formGroup.appendChild(input);
|
||||
formGroup.appendChild(small);
|
||||
paramFields.appendChild(formGroup);
|
||||
});
|
||||
|
||||
methodParams.classList.remove('d-none');
|
||||
});
|
||||
|
||||
/* Execute button handler */
|
||||
executeBtn.addEventListener('click', function() {
|
||||
const selectedMethod = methodSelect.value;
|
||||
if (!selectedMethod) return;
|
||||
|
||||
const params = {};
|
||||
const paramDefs = methodDefinitions[selectedMethod] || [];
|
||||
|
||||
/* Collect parameter values */
|
||||
paramDefs.forEach(param => {
|
||||
const input = document.getElementById(`param-${param.name}`);
|
||||
if (!input) return;
|
||||
|
||||
let value = input.value;
|
||||
if (param.type === 'boolean') {
|
||||
value = input.checked;
|
||||
} else if (param.type === 'number') {
|
||||
value = parseFloat(value);
|
||||
} else if (param.type === 'array' && value) {
|
||||
try {
|
||||
value = JSON.parse(value);
|
||||
} catch (e) {
|
||||
value = value.split(',').map(item => item.trim());
|
||||
}
|
||||
}
|
||||
|
||||
params[param.name] = value;
|
||||
});
|
||||
|
||||
/* Call the API */
|
||||
fetch(`/api/vfs/${selectedMethod.toLowerCase()}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
resultOutput.textContent = JSON.stringify(data, null, 2);
|
||||
resultContainer.classList.remove('d-none');
|
||||
})
|
||||
.catch(error => {
|
||||
resultOutput.textContent = `Error: ${error.message}`;
|
||||
resultContainer.classList.remove('d-none');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
118
pkg/heroagent/web/templates/admin/openrpc/vfs_overview.jet
Normal file
118
pkg/heroagent/web/templates/admin/openrpc/vfs_overview.jet
Normal file
@@ -0,0 +1,118 @@
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">OpenRPC Schema</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p>The OpenRPC schema describes all available methods for interacting with the Virtual File System.</p>
|
||||
<a href="/api/vfs/openrpc" target="_blank" class="btn btn-primary">View Schema</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Available Methods</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Method</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>UploadFile</td>
|
||||
<td>Uploads a file to the virtual file system</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UploadDir</td>
|
||||
<td>Uploads a directory to the virtual file system</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DownloadFile</td>
|
||||
<td>Downloads a file from the virtual file system</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ExportMeta</td>
|
||||
<td>Exports metadata from the virtual file system</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ImportMeta</td>
|
||||
<td>Imports metadata to the virtual file system</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ExportDedupe</td>
|
||||
<td>Exports dedupe information from the virtual file system</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ImportDedupe</td>
|
||||
<td>Imports dedupe information to the virtual file system</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Send</td>
|
||||
<td>Sends files based on dedupe hashes to a destination</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SendExist</td>
|
||||
<td>Checks which dedupe hashes exist and returns a list</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ExposeWebDAV</td>
|
||||
<td>Exposes the virtual file system via WebDAV</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Expose9P</td>
|
||||
<td>Exposes the virtual file system via 9P protocol</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">API Testing</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="mb-3">You can test the VFS API methods directly from this interface.</p>
|
||||
<div class="form-group mb-3">
|
||||
<label for="method-select">Select Method:</label>
|
||||
<select id="method-select" class="form-control">
|
||||
<option value="">-- Select a method --</option>
|
||||
<option value="UploadFile">UploadFile</option>
|
||||
<option value="UploadDir">UploadDir</option>
|
||||
<option value="DownloadFile">DownloadFile</option>
|
||||
<option value="ExportMeta">ExportMeta</option>
|
||||
<option value="ImportMeta">ImportMeta</option>
|
||||
<option value="ExportDedupe">ExportDedupe</option>
|
||||
<option value="ImportDedupe">ImportDedupe</option>
|
||||
<option value="Send">Send</option>
|
||||
<option value="SendExist">SendExist</option>
|
||||
<option value="ExposeWebDAV">ExposeWebDAV</option>
|
||||
<option value="Expose9P">Expose9P</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="method-params" class="d-none">
|
||||
<h6 class="mb-3">Parameters:</h6>
|
||||
<div id="param-fields"></div>
|
||||
</div>
|
||||
<button id="execute-btn" class="btn btn-primary mt-3">Execute Method</button>
|
||||
<div id="result-container" class="mt-4 d-none">
|
||||
<h6>Result:</h6>
|
||||
<pre id="result-output" class="bg-light p-3 border rounded"></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
25
pkg/heroagent/web/templates/admin/partials/header.jet
Normal file
25
pkg/heroagent/web/templates/admin/partials/header.jet
Normal file
@@ -0,0 +1,25 @@
|
||||
<!-- header -->
|
||||
<header>
|
||||
<nav class="top-nav">
|
||||
<div class="brand">
|
||||
<a href="/admin">
|
||||
<img class="brand-icon" src="/img/hero-icon.svg" alt="HeroLauncher Logo" width="24" height="24">
|
||||
<span>HeroLauncher</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a class="nav-link" href="/admin">Home</a>
|
||||
<a class="nav-link" href="/admin/services">Services</a>
|
||||
<a class="nav-link" href="/admin/system/info">System</a>
|
||||
</div>
|
||||
|
||||
<div class="nav-right">
|
||||
<input class="search-box" type="search" placeholder="Search...">
|
||||
<button class="menu-toggle" aria-label="Toggle menu">
|
||||
<span>Menu</span>
|
||||
</button>
|
||||
<a role="button" href="/">Back to App</a>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
7
pkg/heroagent/web/templates/admin/partials/log-panel.jet
Normal file
7
pkg/heroagent/web/templates/admin/partials/log-panel.jet
Normal file
@@ -0,0 +1,7 @@
|
||||
<!-- log-panel - Log panel component -->
|
||||
<div class="log-panel">
|
||||
<h3>System Logs</h3>
|
||||
<div class="log-content"></div>
|
||||
</div>
|
||||
|
||||
<button class="log-toggle" aria-label="Toggle logs">Logs</button>
|
23
pkg/heroagent/web/templates/admin/partials/sidebar.jet
Normal file
23
pkg/heroagent/web/templates/admin/partials/sidebar.jet
Normal file
@@ -0,0 +1,23 @@
|
||||
<!-- sidebar -->
|
||||
<div class="sidebar-wrapper">
|
||||
<nav class="sidebar-nav">
|
||||
<div class="sidebar-section">
|
||||
<a class="sidebar-link" href="/admin">Dashboard</a>
|
||||
</div>
|
||||
<div class="sidebar-section">
|
||||
<a class="sidebar-link" href="/admin/system/info">System</a>
|
||||
</div>
|
||||
<div class="sidebar-section">
|
||||
<a class="sidebar-link" href="/admin/system/processes">Processes</a>
|
||||
</div>
|
||||
<div class="sidebar-section">
|
||||
<a class="sidebar-link" href="/admin/services">Services</a>
|
||||
</div>
|
||||
<div class="sidebar-section">
|
||||
<a class="sidebar-link" href="/jobs">Jobs</a>
|
||||
</div>
|
||||
<div class="sidebar-section">
|
||||
<a class="sidebar-link" href="/admin/system/logs">Logs</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
47
pkg/heroagent/web/templates/admin/services.jet
Normal file
47
pkg/heroagent/web/templates/admin/services.jet
Normal file
@@ -0,0 +1,47 @@
|
||||
{{ extends "./layout" }}
|
||||
|
||||
{{ block documentBody() }}
|
||||
<div class="services-page">
|
||||
<h2 class="section-title">Services</h2>
|
||||
<p class="section-description">Manage all your running services</p>
|
||||
<div class="two-column-layout">
|
||||
<div class="card">
|
||||
<div class="card-title">Active Services</div>
|
||||
<div class="card-actions">
|
||||
<button class="button refresh" onclick="refreshServices()">Refresh</button>
|
||||
</div>
|
||||
|
||||
<!-- Service list -->
|
||||
<div id="services-table">
|
||||
{{ include "./services_fragment" }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-title">Start New Service</div>
|
||||
<div class="card-content">
|
||||
<form id="start-service-form" onsubmit="startService(event)">
|
||||
<div class="form-group">
|
||||
<label for="service-name">Service Name</label>
|
||||
<input id="service-name" type="text" name="name" required="required">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="service-command">Command</label>
|
||||
<input id="service-command" type="text" name="command" required="required">
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="button" type="submit">Start Service</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="start-result" class="alert" style="display: none"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ block scripts() }}
|
||||
<script src="/js/services.js"></script>
|
||||
{{ end }}
|
47
pkg/heroagent/web/templates/admin/services_fragment.jet
Normal file
47
pkg/heroagent/web/templates/admin/services_fragment.jet
Normal file
@@ -0,0 +1,47 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
<th>PID</th>
|
||||
<th>CPU</th>
|
||||
<th>Memory</th>
|
||||
<th>Uptime</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ if processes }}
|
||||
{{ range processes }}
|
||||
<tr>
|
||||
<td>{{ .Name }}</td>
|
||||
<td>
|
||||
{{ if .Status == "running" }}
|
||||
<span class="badge success">Running</span>
|
||||
{{ else if .Status == "stopped" }}
|
||||
<span class="badge danger">Stopped</span>
|
||||
{{ else }}
|
||||
<span class="badge warning">{{ .Status }}</span>
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>{{ .ID }}</td>
|
||||
<td>{{ if .Status == "running" }}{{ .CPU }}{{ else }}-{{ end }}</td>
|
||||
<td>{{ if .Status == "running" }}{{ .Memory }}{{ else }}-{{ end }}</td>
|
||||
<td>{{ if .Status == "running" }}{{ .Uptime }}{{ else }}-{{ end }}</td>
|
||||
<td>
|
||||
<div class="button-group">
|
||||
<button class="button" onclick="restartProcess('{{ .Name }}')">Restart</button>
|
||||
<button class="button secondary" onclick="stopProcess('{{ .Name }}')">Stop</button>
|
||||
<button class="button danger" style="background-color: #e53935 !important; color: #fff !important;" onclick="deleteProcess('{{ .Name }}')">Delete</button>
|
||||
<button class="button info" onclick="showProcessLogs('{{ .Name }}')">Logs</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<tr>
|
||||
<td colspan="7">No services found</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
@@ -0,0 +1,19 @@
|
||||
<!-- Hardware stats fragment for polling updates -->
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">CPU</th>
|
||||
<td>{{ cpuInfo }} ({{ cpuUsage }})</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Memory</th>
|
||||
<td>{{ memoryInfo }} ({{ memUsage }})</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Disk</th>
|
||||
<td>{{ diskInfo }} ({{ diskUsage }})</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Network</th>
|
||||
<td style="white-space: pre-line;">{{ networkInfo }}</td>
|
||||
</tr>
|
||||
</tbody>
|
79
pkg/heroagent/web/templates/admin/system/info.jet
Normal file
79
pkg/heroagent/web/templates/admin/system/info.jet
Normal file
@@ -0,0 +1,79 @@
|
||||
{{ extends "../layout" }}
|
||||
|
||||
{{ block documentBody() }}
|
||||
<article class="system-info">
|
||||
<header>
|
||||
<h2 class="title">System Information</h2>
|
||||
<p class="description text-muted">Overview of system resources and configuration</p>
|
||||
</header>
|
||||
|
||||
<div class="grid" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem;">
|
||||
<div>
|
||||
<article class="hardware-info">
|
||||
<header>
|
||||
<h3 id="hardware-title">Hardware</h3>
|
||||
</header>
|
||||
|
||||
<table class="table table-striped" up:poll="/admin/system/hardware-stats" up:target=".hardware-stats" up:poll-interval="1000">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">CPU</th>
|
||||
<td>{{ cpuInfo }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Memory</th>
|
||||
<td>{{ memoryInfo }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Disk</th>
|
||||
<td>{{ diskInfo }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Network</th>
|
||||
<td style="white-space: pre-line;">{{ networkInfo }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{ include "partials/network_chart" }}
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<article class="software-info">
|
||||
<header>
|
||||
<h3 id="software-title">Software</h3>
|
||||
</header>
|
||||
|
||||
<table class="table table-bordered" data:type="software-info">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">OS</th>
|
||||
<td>{{ osInfo }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">HeroLauncher</th>
|
||||
<td>HeroLauncher</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Uptime</th>
|
||||
<td>{{ uptimeInfo }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{ include "partials/__cpu_chart" }}
|
||||
{{ include "partials/__memory_chart" }}
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
{{ block scripts() }}
|
||||
<script src="/js/echarts/echarts.min.js"></script>
|
||||
<script src="/js/charts/cpu-chart.js"></script>
|
||||
<script src="/js/charts/memory-chart.js"></script>
|
||||
<script src="/js/charts/network-chart.js"></script>
|
||||
<script src="/js/charts/stats-fetcher.js"></script>
|
||||
{{ end }}
|
58
pkg/heroagent/web/templates/admin/system/jobs.jet
Normal file
58
pkg/heroagent/web/templates/admin/system/jobs.jet
Normal file
@@ -0,0 +1,58 @@
|
||||
{{ extends "../layout" }}
|
||||
|
||||
<header>
|
||||
<h2 class="title">System Jobs</h2>
|
||||
<p class="description text-muted">Overview of scheduled jobs</p>
|
||||
</header>
|
||||
<article class="jobs-info">
|
||||
<div class="grid" style="display: grid; grid-template-columns: 1fr; gap: 1rem;">
|
||||
<div>
|
||||
<article class="jobs-table">
|
||||
<header>
|
||||
<h3 id="jobs-title">Scheduled Jobs</h3>
|
||||
<p class="refresh-status">
|
||||
<button class="btn btn-sm" onclick="refreshJobs()">
|
||||
Refresh
|
||||
<span class="loading-indicator" id="refresh-loading" style="display: none;"> Loading...</span>
|
||||
</button>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div class="jobs-table-content" up-poll="/admin/system/jobs-data" up-hungry="true" up-interval="10000" style="display: block; width: 100%;" id="jobs-content">
|
||||
{{ if isset(., "error") }}
|
||||
<div class="alert alert-danger">{{ .error }}</div>
|
||||
{{ end }}
|
||||
|
||||
<table class="table table-striped" id="jobs-stats">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">ID</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Next Run</th>
|
||||
<th scope="col">Last Run</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ if isset(., "jobs") && len(.jobs) > 0 }}
|
||||
{{ range .jobs }}
|
||||
<tr class="{{ if .is_current }}table-primary{{ end }}">
|
||||
<td>{{ .id }}</td>
|
||||
<td>{{ .name }}</td>
|
||||
<td>{{ .status }}</td>
|
||||
<td>{{ .next_run }}</td>
|
||||
<td>{{ .last_run }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<tr>
|
||||
<td colspan="5">No job data available.</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
135
pkg/heroagent/web/templates/admin/system/logs.jet
Normal file
135
pkg/heroagent/web/templates/admin/system/logs.jet
Normal file
@@ -0,0 +1,135 @@
|
||||
{{ extends "../layout" }}
|
||||
|
||||
{{ block documentBody() }}
|
||||
<article>
|
||||
<header class="flex-container">
|
||||
<div>
|
||||
<h2>{{title}}</h2>
|
||||
<p>View and filter logs from different sources</p>
|
||||
</div>
|
||||
<div>
|
||||
<a href="/api/logs/export" role="button" class="outline">Export Logs</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<article class="filter-controls">
|
||||
<form class="log-controls" id="log-filter-form" action="/admin/system/logs" method="get" up-target="#logs-table-container" up-submit>
|
||||
<div class="grid filter-grid">
|
||||
<div class="filter-item">
|
||||
<label for="log-type">Log Type</label>
|
||||
<select id="log-type" name="log_type">
|
||||
{{range logTypes}}
|
||||
<option value="{{.}}" {{if selectedLogType == '.'}}selected{{end}}>{{if . == "all"}}All Logs{{else if . == "system"}}System Logs{{else if . == "service"}}Service Logs{{else if . == "job"}}Job Logs{{else if . == "process"}}Process Logs{{end}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-item">
|
||||
<label for="log-level">Log Level</label>
|
||||
<select id="log-level" name="type">
|
||||
<option value="all" {{if typeParam == "all" || typeParam == ""}}selected{{end}}>All Levels</option>
|
||||
<option value="info" {{if typeParam == "info"}}selected{{end}}>Info</option>
|
||||
<option value="error" {{if typeParam == "error"}}selected{{end}}>Error</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-item">
|
||||
<label for="log-source">Log Source</label>
|
||||
<select id="log-source" name="category">
|
||||
<option value="" {{if categoryParam == ""}}selected{{end}}>All Sources</option>
|
||||
<option value="system" {{if categoryParam == "system"}}selected{{end}}>System</option>
|
||||
<option value="redis" {{if categoryParam == "redis"}}selected{{end}}>Redis</option>
|
||||
<option value="executor" {{if categoryParam == "executor"}}selected{{end}}>Executor</option>
|
||||
<option value="package" {{if categoryParam == "package"}}selected{{end}}>Package Manager</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-item">
|
||||
<label for="log-from-date">From Date</label>
|
||||
<input type="datetime-local" id="log-from-date" name="from">
|
||||
</div>
|
||||
|
||||
<div class="filter-item">
|
||||
<label for="log-to-date">To Date</label>
|
||||
<input type="datetime-local" id="log-to-date" name="to">
|
||||
</div>
|
||||
|
||||
<div class="filter-button">
|
||||
<button type="submit" class="filter-apply" up-target="#logs-table-container">Apply Filters</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</article>
|
||||
|
||||
<article class="log-container">
|
||||
<header>
|
||||
<h3>Log Output</h3>
|
||||
</header>
|
||||
|
||||
<div id="logs-table-container">
|
||||
<!-- Log content is loaded directly -->
|
||||
{{ if isset(., "error") }}
|
||||
<div class="alert alert-danger">{{ .error }}</div>
|
||||
{{ end }}
|
||||
|
||||
<!-- Include logs table -->
|
||||
<div class="log-table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Timestamp</th>
|
||||
<th>Level</th>
|
||||
<th>Source</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{if isset(., "logs")}}
|
||||
{{range logs}}
|
||||
<tr>
|
||||
<td>{{.timestamp}}</td>
|
||||
<td class="log-{{.type | lower}}">{{.type}}</td>
|
||||
<td>{{.category}}</td>
|
||||
<td>{{.message}}</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">No logs found matching your criteria</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">Loading logs...</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<div class="pagination-info">
|
||||
{{if isset(., "logs")}}
|
||||
{{if len(logs) > 0}}
|
||||
<span>Showing {{showing}} of {{total}} logs</span>
|
||||
{{else}}
|
||||
<span>No logs found</span>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<span>Loading logs...</span>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="pagination-controls">
|
||||
{{if isset(., "page") && isset(., "totalPages")}}
|
||||
{{if page > 1}}
|
||||
<a href="/admin/system/logs?page={{page - 1}}{{if isset(., "categoryParam")}}&category={{categoryParam}}{{end}}{{if isset(., "typeParam")}}&type={{typeParam}}{{end}}{{if isset(., "fromParam")}}&from={{fromParam}}{{end}}{{if isset(., "toParam")}}&to={{toParam}}{{end}}" role="button" class="outline secondary" up-target="#logs-table-container">← Previous</a>
|
||||
{{end}}
|
||||
{{if page < totalPages}}
|
||||
<a href="/admin/system/logs?page={{page + 1}}{{if isset(., "categoryParam")}}&category={{categoryParam}}{{end}}{{if isset(., "typeParam")}}&type={{typeParam}}{{end}}{{if isset(., "fromParam")}}&from={{fromParam}}{{end}}{{if isset(., "toParam")}}&to={{toParam}}{{end}}" role="button" class="outline secondary" up-target="#logs-table-container">Next →</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</article>
|
||||
{{ end }}
|
49
pkg/heroagent/web/templates/admin/system/logs_fragment.jet
Normal file
49
pkg/heroagent/web/templates/admin/system/logs_fragment.jet
Normal file
@@ -0,0 +1,49 @@
|
||||
<!-- This template contains just the logs table content for Unpoly updates -->
|
||||
{{ if isset(., "error") }}
|
||||
<div class="alert alert-danger">{{ .error }}</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="log-table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Timestamp</th>
|
||||
<th>Level</th>
|
||||
<th>Source</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range logs}}
|
||||
<tr>
|
||||
<td>{{.timestamp}}</td>
|
||||
<td class="log-{{.type | lower}}">{{.type}}</td>
|
||||
<td>{{.category}}</td>
|
||||
<td>{{.message}}</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">No logs found matching your criteria</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<div class="pagination-info">
|
||||
{{if len(logs) > 0}}
|
||||
<span>Showing {{len(logs)}} of {{total}} logs</span>
|
||||
{{else}}
|
||||
<span>No logs found</span>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="pagination-controls">
|
||||
{{if page > 1}}
|
||||
<a href="/admin/system/logs?page={{page - 1}}{{if isset(., "selectedLogType")}}&log_type={{selectedLogType}}{{end}}{{if isset(., "categoryParam")}}&category={{categoryParam}}{{end}}{{if isset(., "typeParam")}}&type={{typeParam}}{{end}}{{if isset(., "fromParam")}}&from={{fromParam}}{{end}}{{if isset(., "toParam")}}&to={{toParam}}{{end}}" role="button" class="outline secondary" up-target="#logs-table-container">← Previous</a>
|
||||
{{end}}
|
||||
{{if page < totalPages}}
|
||||
<a href="/admin/system/logs?page={{page + 1}}{{if isset(., "selectedLogType")}}&log_type={{selectedLogType}}{{end}}{{if isset(., "categoryParam")}}&category={{categoryParam}}{{end}}{{if isset(., "typeParam")}}&type={{typeParam}}{{end}}{{if isset(., "fromParam")}}&from={{fromParam}}{{end}}{{if isset(., "toParam")}}&to={{toParam}}{{end}}" role="button" class="outline secondary" up-target="#logs-table-container">Next →</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
6
pkg/heroagent/web/templates/admin/system/logs_test.jet
Normal file
6
pkg/heroagent/web/templates/admin/system/logs_test.jet
Normal file
@@ -0,0 +1,6 @@
|
||||
{{ extends "admin/layout" }}
|
||||
|
||||
{{ block documentBody() }}
|
||||
<h1>Test Logs Page</h1>
|
||||
<p>This is a simple test template</p>
|
||||
{{ end }}
|
@@ -0,0 +1,2 @@
|
||||
<h4 style="margin-bottom: 10px;">Process CPU Usage</h4>
|
||||
<div id="cpu-chart" style="width: 100%; height: 300px; margin-bottom: 30px;"></div>
|
@@ -0,0 +1,2 @@
|
||||
<h4 style="margin-bottom: 10px;">Process Memory Usage</h4>
|
||||
<div id="memory-chart" style="width: 100%; height: 300px;"></div>
|
@@ -0,0 +1 @@
|
||||
<!-- Stats fetcher removed - now loaded from external JS file -->
|
@@ -0,0 +1,2 @@
|
||||
<h4 style="margin-bottom: 10px;">Network Traffic</h4>
|
||||
<div id="network-chart" style="width: 100%; height: 300px; margin-top: 10px;"></div>
|
77
pkg/heroagent/web/templates/admin/system/processes.jet
Normal file
77
pkg/heroagent/web/templates/admin/system/processes.jet
Normal file
@@ -0,0 +1,77 @@
|
||||
{{ extends "../layout" }}
|
||||
|
||||
{{ block documentBody() }}
|
||||
<article class="processes-info">
|
||||
<header>
|
||||
<h2 class="title">System Processes</h2>
|
||||
<p class="description text-muted">Overview of running processes with CPU and memory usage</p>
|
||||
</header>
|
||||
|
||||
<div class="grid" style="display: grid; grid-template-columns: 1fr; gap: 1rem;">
|
||||
<div>
|
||||
<article class="processes-table">
|
||||
<header>
|
||||
<h3 id="processes-title">Running Processes</h3>
|
||||
<p class="refresh-status">
|
||||
<button class="btn btn-sm" onclick="refreshProcesses()">
|
||||
Refresh
|
||||
<span class="loading-indicator" id="refresh-loading" style="display: none;"> Loading...</span>
|
||||
</button>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div class="processes-table-content" up-poll="/admin/system/processes-data" up-hungry="true" up-interval="10000" style="display: block; width: 100%;" id="processes-content">
|
||||
{{ if isset(., "error") }}
|
||||
<div class="alert alert-danger">{{ .error }}</div>
|
||||
{{ end }}
|
||||
|
||||
<table class="table table-striped" id="processes-stats">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">PID</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">CPU (%)</th>
|
||||
<th scope="col">Memory (MB)</th>
|
||||
<th scope="col">Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ if isset(., "processes") && len(.processes) > 0 }}
|
||||
{{ range .processes }}
|
||||
<tr class="{{ if .is_current }}table-primary{{ end }}">
|
||||
<td>{{ .pid }}</td>
|
||||
<td>{{ .name }}</td>
|
||||
<td>{{ .status }}</td>
|
||||
<td>{{ .cpu_percent_str }}</td>
|
||||
<td>{{ .memory_mb_str }}</td>
|
||||
<td>{{ .create_time_str }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<tr>
|
||||
<td colspan="6">No process data available.</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<script>
|
||||
// Ensure processes data is loaded on page load
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Check if the processes content is empty or shows 'No process data available'
|
||||
const processesContent = document.getElementById('processes-content');
|
||||
const tableBody = processesContent ? processesContent.querySelector('tbody') : null;
|
||||
|
||||
if (tableBody && (tableBody.innerText.includes('No process data available') || tableBody.children.length <= 1)) {
|
||||
console.log('Triggering initial process data load');
|
||||
refreshProcesses();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
48
pkg/heroagent/web/templates/admin/system/processes_data.jet
Normal file
48
pkg/heroagent/web/templates/admin/system/processes_data.jet
Normal file
@@ -0,0 +1,48 @@
|
||||
<!-- This template contains just the process table content for AJAX updates -->
|
||||
<div class="processes-table-content">
|
||||
{{ if isset(., "error") }}
|
||||
<div class="alert alert-danger">{{ .error }}</div>
|
||||
{{ end }}
|
||||
|
||||
<!-- Debug info -->
|
||||
<div class="alert alert-info">
|
||||
{{ if isset(., "debug") }}
|
||||
Debug: {{ debug }}
|
||||
{{ end }}
|
||||
|
||||
<!-- Direct debug output to help troubleshoot -->
|
||||
Has processes: {{ hasProcesses ? "Yes" : "No" }}
|
||||
Process count: {{ processCount }}
|
||||
</div>
|
||||
|
||||
<table class="table table-striped" id="processes-stats">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">PID</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">CPU (%)</th>
|
||||
<th scope="col">Memory (MB)</th>
|
||||
<th scope="col">Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ if hasProcesses }}
|
||||
{{ range processStats }}
|
||||
<tr{{ if .is_current == true }} class="table-primary"{{ end }}>
|
||||
<td>{{ .pid }}</td>
|
||||
<td>{{ .name }}</td>
|
||||
<td>{{ .status }}</td>
|
||||
<td>{{ .cpu_percent_str }}</td>
|
||||
<td>{{ .memory_mb_str }}</td>
|
||||
<td>{{ .create_time_str }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<tr>
|
||||
<td colspan="6">No process data available.</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
@@ -0,0 +1,36 @@
|
||||
<!-- This template contains just the process table content for AJAX updates -->
|
||||
{{ if .error }}
|
||||
<div class="alert alert-danger">{{ .error }}</div>
|
||||
{{ end }}
|
||||
|
||||
<!-- Process data table - regenerated on each refresh -->
|
||||
<table class="table table-striped" id="processes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope='col'>PID</th>
|
||||
<th scope='col'>Name</th>
|
||||
<th scope='col'>Status</th>
|
||||
<th scope='col'>CPU (%)</th>
|
||||
<th scope='col'>Memory (MB)</th>
|
||||
<th scope='col'>Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ if .processes }}
|
||||
{{ range .processes }}
|
||||
<tr{{ if .is_current }} class="table-primary"{{ end }}>
|
||||
<td>{{ .pid }}</td>
|
||||
<td>{{ .name }}</td>
|
||||
<td>{{ .status }}</td>
|
||||
<td>{{ .cpu_percent | printf("%.1f%%") }}</td>
|
||||
<td>{{ .memory_mb | printf("%.1f MB") }}</td>
|
||||
<td>{{ .create_time_str }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<tr>
|
||||
<td colspan="6">No process data available.</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
40
pkg/heroagent/web/templates/admin/system/processes_table.jet
Normal file
40
pkg/heroagent/web/templates/admin/system/processes_table.jet
Normal file
@@ -0,0 +1,40 @@
|
||||
{{ if isset(., "error") }}
|
||||
<div class="alert alert-danger">{{ .error }}</div>
|
||||
{{ end }}
|
||||
|
||||
<table class="table table-striped" id="processes-stats">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">PID</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">CPU (%)</th>
|
||||
<th scope="col">Memory (MB)</th>
|
||||
<th scope="col">Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ if isset(., "processes") }}
|
||||
{{ if .processes }}
|
||||
{{ range .processes }}
|
||||
<tr class="{{ if .is_current }}table-primary{{ end }}">
|
||||
<td>{{.pid}}</td>
|
||||
<td>{{.name}}</td>
|
||||
<td>{{.status}}</td>
|
||||
<td>{{ printf("%.1f%%", .cpu_percent) }}</td>
|
||||
<td>{{ printf("%.1f MB", .memory_mb) }}</td>
|
||||
<td>{{.create_time_str}}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<tr>
|
||||
<td colspan="6">No process data available.</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<tr>
|
||||
<td colspan="6">Loading process data...</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
77
pkg/heroagent/web/templates/admin/system/settings.jet
Normal file
77
pkg/heroagent/web/templates/admin/system/settings.jet
Normal file
@@ -0,0 +1,77 @@
|
||||
{{ extends "../../layout" }}
|
||||
|
||||
{{ block documentBody() }}
|
||||
<article>
|
||||
<header>
|
||||
<h2>System Settings</h2>
|
||||
<p>Configure system parameters and preferences</p>
|
||||
</header>
|
||||
<form>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<article>
|
||||
<header>
|
||||
<h3>Server Settings</h3>
|
||||
</header>
|
||||
<label for="server-port">Server Port</label>
|
||||
<input id="server-port" type="number" value="9001">
|
||||
|
||||
<label for="log-level">Default Log Level</label>
|
||||
<select id="log-level">
|
||||
<option value="info">Info</option>
|
||||
<option value="warning">Warning</option>
|
||||
<option value="error">Error</option>
|
||||
<option value="debug">Debug</option>
|
||||
</select>
|
||||
|
||||
<label for="max-connections">Max Connections</label>
|
||||
<input id="max-connections" type="number" value="100">
|
||||
</article>
|
||||
</div>
|
||||
<div>
|
||||
<article>
|
||||
<header>
|
||||
<h3>Security Settings</h3>
|
||||
</header>
|
||||
<label for="enable-auth">Enable Authentication</label>
|
||||
<input id="enable-auth" type="checkbox" checked>
|
||||
|
||||
<label for="session-timeout">Session Timeout (minutes)</label>
|
||||
<input id="session-timeout" type="number" value="30">
|
||||
|
||||
<label for="allowed-origins">Allowed Origins (CORS)</label>
|
||||
<input id="allowed-origins" type="text" value="*">
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<article>
|
||||
<header>
|
||||
<h3>Redis Settings</h3>
|
||||
</header>
|
||||
<label for="redis-port">Redis Port</label>
|
||||
<input id="redis-port" type="number" value="6378">
|
||||
|
||||
<label for="redis-max-memory">Max Memory (MB)</label>
|
||||
<input id="redis-max-memory" type="number" value="512">
|
||||
</article>
|
||||
</div>
|
||||
<div>
|
||||
<article>
|
||||
<header>
|
||||
<h3>Executor Settings</h3>
|
||||
</header>
|
||||
<label for="executor-timeout">Command Timeout (seconds)</label>
|
||||
<input id="executor-timeout" type="number" value="60">
|
||||
|
||||
<label for="executor-max-processes">Max Concurrent Processes</label>
|
||||
<input id="executor-max-processes" type="number" value="10">
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit">Save Settings</button>
|
||||
<button class="secondary" type="reset">Reset</button>
|
||||
</form>
|
||||
</article>
|
||||
{{ end }}
|
153
pkg/heroagent/web/templates/admin/vfs_logs.html
Normal file
153
pkg/heroagent/web/templates/admin/vfs_logs.html
Normal file
@@ -0,0 +1,153 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{.title}} - HeroLauncher</title>
|
||||
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/custom.css">
|
||||
<script src="/static/js/jquery.min.js"></script>
|
||||
<script src="/static/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="/static/js/unpoly.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid p-4">
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<h2>{{.managerName}} Logs</h2>
|
||||
<p>View and filter logs from the {{.managerName}} service.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Filter Logs</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form id="filter-form">
|
||||
<input type="hidden" id="manager" name="manager" value="{{.managerName}}">
|
||||
<input type="hidden" id="endpoint" name="endpoint" value="{{.managerEndpoint}}">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<label for="method-filter">Filter by Method:</label>
|
||||
<select class="form-control" id="method-filter">
|
||||
<option value="">All Methods</option>
|
||||
{{range .methods}}
|
||||
<option value="{{.}}">{{index $.methodDisplayNames .}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label for="status-filter">Filter by Status:</label>
|
||||
<select class="form-control" id="status-filter">
|
||||
<option value="">All Statuses</option>
|
||||
<option value="success">Success</option>
|
||||
<option value="error">Error</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label for="date-filter">Filter by Date:</label>
|
||||
<input type="date" class="form-control" id="date-filter">
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label for="limit-filter">Limit Results:</label>
|
||||
<select class="form-control" id="limit-filter">
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
<option value="200">200</option>
|
||||
<option value="500">500</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col">
|
||||
<button type="button" id="apply-filters" class="btn btn-primary">Apply Filters</button>
|
||||
<button type="button" id="reset-filters" class="btn btn-secondary">Reset Filters</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Logs</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Timestamp</th>
|
||||
<th>Method</th>
|
||||
<th>Status</th>
|
||||
<th>Duration</th>
|
||||
<th>Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="logs-table-body">
|
||||
<!-- Logs will be loaded here -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Apply filters when the button is clicked
|
||||
$('#apply-filters').click(function() {
|
||||
const queryParams = new URLSearchParams();
|
||||
|
||||
// Get filter values
|
||||
const methodFilter = $('#method-filter').val();
|
||||
const statusFilter = $('#status-filter').val();
|
||||
const dateFilter = $('#date-filter').val();
|
||||
const limitFilter = $('#limit-filter').val();
|
||||
|
||||
// Add filters to query parameters if they are set
|
||||
if (methodFilter) queryParams.append('method', methodFilter);
|
||||
if (statusFilter) queryParams.append('status', statusFilter);
|
||||
if (dateFilter) queryParams.append('date', dateFilter);
|
||||
if (limitFilter) queryParams.append('limit', limitFilter);
|
||||
|
||||
// Add the manager and endpoint parameters to preserve them when reloading
|
||||
queryParams.append('manager', document.getElementById('manager').value);
|
||||
queryParams.append('endpoint', document.getElementById('endpoint').value);
|
||||
|
||||
// Redirect to the same page with new query parameters
|
||||
window.location.href = '/admin/openrpc/vfs/logs?' + queryParams.toString();
|
||||
});
|
||||
|
||||
// Reset filters when the button is clicked
|
||||
$('#reset-filters').click(function() {
|
||||
// Clear all filter inputs
|
||||
$('#method-filter').val('');
|
||||
$('#status-filter').val('');
|
||||
$('#date-filter').val('');
|
||||
$('#limit-filter').val('50');
|
||||
|
||||
// Redirect to the base URL with only manager and endpoint parameters
|
||||
const queryParams = new URLSearchParams();
|
||||
queryParams.append('manager', document.getElementById('manager').value);
|
||||
queryParams.append('endpoint', document.getElementById('endpoint').value);
|
||||
window.location.href = '/admin/openrpc/vfs/logs?' + queryParams.toString();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user