Initial commit
This commit is contained in:
86
application/view/database/index.php
Normal file
86
application/view/database/index.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<div class="dbm-content-header">
|
||||
<div class="dbm-breadcrumb">
|
||||
<a href="<?php echo Config::get('URL'); ?>database/index">Databases</a>
|
||||
</div>
|
||||
<div class="dbm-title">
|
||||
<h1>All Databases</h1>
|
||||
<span class="badge"><?php echo count($this->databases); ?> total</span>
|
||||
</div>
|
||||
<div class="dbm-actions">
|
||||
<button type="button" class="dbm-btn dbm-btn-success" onclick="document.getElementById('create-db-modal').style.display='flex'">
|
||||
<i data-lucide="plus"></i>
|
||||
Create Database
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dbm-content-body">
|
||||
<div class="dbm-stats">
|
||||
<div class="dbm-stat">
|
||||
<div class="dbm-stat-value"><?php echo count($this->databases); ?></div>
|
||||
<div class="dbm-stat-label">Databases</div>
|
||||
</div>
|
||||
<div class="dbm-stat">
|
||||
<div class="dbm-stat-value"><?php echo htmlspecialchars($this->current_db); ?></div>
|
||||
<div class="dbm-stat-label">Current Database</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dbm-table-wrapper">
|
||||
<table class="dbm-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Database Name</th>
|
||||
<th>Tables</th>
|
||||
<th style="width: 200px;">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->databases as $db):
|
||||
$tables = DatabaseModel::getTablesInDatabase($db);
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo Config::get('URL'); ?>database/show/<?php echo urlencode($db); ?>" style="color: var(--accent-blue); text-decoration: none;">
|
||||
<?php echo htmlspecialchars($db); ?>
|
||||
</a>
|
||||
<?php if ($db === $this->current_db): ?>
|
||||
<span style="margin-left: 8px; font-size: 10px; padding: 2px 6px; background: var(--accent-green); color: #fff; border-radius: 3px;">ACTIVE</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?php echo count($tables); ?></td>
|
||||
<td>
|
||||
<a href="<?php echo Config::get('URL'); ?>database/show/<?php echo urlencode($db); ?>" class="dbm-btn dbm-btn-sm dbm-btn-secondary">Browse</a>
|
||||
<?php if ($db !== $this->current_db): ?>
|
||||
<a href="<?php echo Config::get('URL'); ?>database/delete/<?php echo urlencode($db); ?>"
|
||||
class="dbm-btn dbm-btn-sm dbm-btn-danger"
|
||||
data-confirm="Delete database '<?php echo htmlspecialchars($db); ?>'? This cannot be undone!">Drop</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Create Database Modal -->
|
||||
<div id="create-db-modal" style="display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.8); z-index:1000; align-items:center; justify-content:center;">
|
||||
<div class="dbm-card" style="width: 400px; max-width: 90%;">
|
||||
<div class="dbm-card-header">
|
||||
<h3>Create New Database</h3>
|
||||
</div>
|
||||
<div class="dbm-card-body">
|
||||
<form method="post" action="<?php echo Config::get('URL'); ?>database/create" data-ajax-form>
|
||||
<div class="dbm-form-group">
|
||||
<label class="dbm-form-label">Database Name</label>
|
||||
<input type="text" name="database_name" class="dbm-form-input" required pattern="[a-zA-Z0-9_]+" placeholder="my_database" style="width:100%;max-width:100%;">
|
||||
</div>
|
||||
<div style="display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;">
|
||||
<button type="button" class="dbm-btn dbm-btn-secondary" onclick="document.getElementById('create-db-modal').style.display='none'">Cancel</button>
|
||||
<button type="submit" class="dbm-btn dbm-btn-success">Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
76
application/view/database/show.php
Normal file
76
application/view/database/show.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<div class="dbm-content-header">
|
||||
<div class="dbm-breadcrumb">
|
||||
<a href="<?php echo Config::get('URL'); ?>database/index">Databases</a>
|
||||
<span class="separator">/</span>
|
||||
<span><?php echo htmlspecialchars($this->database_name); ?></span>
|
||||
</div>
|
||||
<div class="dbm-title">
|
||||
<h1><?php echo htmlspecialchars($this->database_name); ?></h1>
|
||||
<span class="badge"><?php echo count($this->tables); ?> tables</span>
|
||||
</div>
|
||||
<div class="dbm-actions">
|
||||
<a href="<?php echo Config::get('URL'); ?>table/create/<?php echo urlencode($this->database_name); ?>" class="dbm-btn dbm-btn-success">
|
||||
<i data-lucide="plus"></i>
|
||||
New Table
|
||||
</a>
|
||||
<a href="<?php echo Config::get('URL'); ?>database/export/<?php echo urlencode($this->database_name); ?>" class="dbm-btn dbm-btn-secondary" target="_blank">
|
||||
<i data-lucide="download"></i>
|
||||
Export SQL
|
||||
</a>
|
||||
<a href="<?php echo Config::get('URL'); ?>sql/index/<?php echo urlencode($this->database_name); ?>" class="dbm-btn dbm-btn-secondary">
|
||||
<i data-lucide="terminal"></i>
|
||||
SQL Console
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dbm-content-body">
|
||||
<?php if (empty($this->tables)): ?>
|
||||
<div class="dbm-empty">
|
||||
<i data-lucide="table" class="dbm-empty-icon"></i>
|
||||
<h3>No tables yet</h3>
|
||||
<p>This database is empty. Create your first table to get started.</p>
|
||||
<a href="<?php echo Config::get('URL'); ?>table/create/<?php echo urlencode($this->database_name); ?>" class="dbm-btn dbm-btn-success" style="margin-top: 16px;">Create Table</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="dbm-table-wrapper">
|
||||
<table class="dbm-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Table Name</th>
|
||||
<th>Engine</th>
|
||||
<th>Rows</th>
|
||||
<th>Size</th>
|
||||
<th>Collation</th>
|
||||
<th style="width: 220px;">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->tables as $table):
|
||||
$info = isset($this->table_info[$table]) ? $this->table_info[$table] : [];
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo Config::get('URL'); ?>table/show/<?php echo urlencode($this->database_name); ?>/<?php echo urlencode($table); ?>" style="color: var(--accent-blue); text-decoration: none; font-weight: 500;">
|
||||
<?php echo htmlspecialchars($table); ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><span class="type-column"><?php echo isset($info['engine']) ? htmlspecialchars($info['engine']) : '-'; ?></span></td>
|
||||
<td><?php echo isset($info['rows']) ? number_format($info['rows']) : '-'; ?></td>
|
||||
<td><?php echo isset($info['total_size']) ? $info['total_size'] : '-'; ?></td>
|
||||
<td><span style="font-size: 11px;"><?php echo isset($info['collation']) ? htmlspecialchars($info['collation']) : '-'; ?></span></td>
|
||||
<td>
|
||||
<a href="<?php echo Config::get('URL'); ?>table/show/<?php echo urlencode($this->database_name); ?>/<?php echo urlencode($table); ?>" class="dbm-btn dbm-btn-sm dbm-btn-primary">Browse</a>
|
||||
<a href="<?php echo Config::get('URL'); ?>table/structure/<?php echo urlencode($this->database_name); ?>/<?php echo urlencode($table); ?>" class="dbm-btn dbm-btn-sm dbm-btn-secondary">Structure</a>
|
||||
<a href="<?php echo Config::get('URL'); ?>table/export/<?php echo urlencode($this->database_name); ?>/<?php echo urlencode($table); ?>" class="dbm-btn dbm-btn-sm dbm-btn-secondary" target="_blank">Export</a>
|
||||
<a href="<?php echo Config::get('URL'); ?>table/delete/<?php echo urlencode($this->database_name); ?>/<?php echo urlencode($table); ?>"
|
||||
class="dbm-btn dbm-btn-sm dbm-btn-danger"
|
||||
data-confirm="Drop table '<?php echo htmlspecialchars($table); ?>'? This cannot be undone!">Drop</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user