Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
🚀 [RELEASE] Prequel v1.13
Browse files Browse the repository at this point in the history
Prequel v1.13 - see #53 for changelog.
  • Loading branch information
Quinten authored Jul 19, 2019
2 parents 7f3630d + 0a5e0f4 commit 03809e2
Show file tree
Hide file tree
Showing 18 changed files with 109,341 additions and 109 deletions.
19 changes: 17 additions & 2 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#### What is Laravel Prequel exactly?
Laravel Prequel is meant to be a database management tool to replace the need for separate standalone database tools like phpMyAdmin, Sequel Pro or MySQL Workbench. With its (hopefully) clear and concise UI, Prequel is to be a modern and lightweight database browser/tool ready for the web of the future. Prequel's design is purposefully based on that of [Laravel Telescope](https://github.com/laravel/telescope) because (web-)developers today have enough to learn and master already, so let's help eachother out and make sure to not add anything virtually useless to that huge pile of knowledge.

![Prequel Screenshot](./assets/prequel_screenshot.png)
![Prequel Screenshot](./assets/prequel_screenshot_table.png)
> Clear and concise database management
## Installation
Expand Down Expand Up @@ -117,10 +117,25 @@ That configuration file looks something like this.
|
*/
'pagination' => 100,

/*
|--------------------------------------------------------------------------
| Prequel middleware : array
|--------------------------------------------------------------------------
|
| Define custom middleware for Prequel to use.
|
| Ex. 'web', Protoqol\Prequel\Http\Middleware\Authorised::class
|
*/

'middleware' => [
Protoqol\Prequel\Http\Middleware\Authorised::class,
],
];
```

![Prequel Screenshot](./assets/prequel_screen_.png)
![Prequel Screenshot](./assets/prequel_screenshot.png)
> Clear and concise database management
## Contributing
Expand Down
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 .github/assets/prequel_screenshot_table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 24 additions & 4 deletions config/prequel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
| inside your database besides you or your dev team (obviously).
|
*/
'enabled' => env('PREQUEL_ENABLED', true),

'enabled' => env('PREQUEL_ENABLED', true),


/*
Expand All @@ -24,7 +25,8 @@
| Prequel API routes.
|
*/
'path' => 'prequel',

'path' => 'prequel',

/*
|--------------------------------------------------------------------------
Expand All @@ -34,7 +36,8 @@
| This enables you to fully configure your database connection for Prequel.
|
*/
'database' => [

'database' => [
'connection' => env('DB_CONNECTION', 'mysql'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
Expand All @@ -53,7 +56,8 @@
| Using 'mysql' => ['*'] ignores the entire mysql database.
|
*/
'ignored' => [

'ignored' => [
// 'information_schema' => ['*'],
// 'sys' => ['*'],
// 'performance_schema' => ['*'],
Expand All @@ -70,5 +74,21 @@
| records that will be in each page.
|
*/

'pagination' => 100,

/*
|--------------------------------------------------------------------------
| Prequel middleware : array
|--------------------------------------------------------------------------
|
| Define custom middleware for Prequel to use.
|
| Ex. 'web', Protoqol\Prequel\Http\Middleware\Authorised::class
|
*/

'middleware' => [
Protoqol\Prequel\Http\Middleware\Authorised::class,
],
];
35,075 changes: 35,074 additions & 1 deletion public/app.css

Large diffs are not rendered by default.

74,118 changes: 74,117 additions & 1 deletion public/app.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions resources/assets/js/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@
this.table.numberOfRecords = result.data.data.total;
this.table.structure = result.data.structure;
this.table.error.loadError = false;
window.scrollTo({
top : 0,
left : 0,
behavior: 'smooth',
});
if (updateUrlHistory) {
this.updateUrl();
Expand Down Expand Up @@ -446,6 +451,9 @@

<style lang="scss">
$break-md: 1400px;
.slide-fade-enter-active {
transition: all .2s ease;
}
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ window.axios = require('axios/index');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = document.head.querySelector(
'meta[name="csrf-token"]').content;
window.axios.defaults.baseURL = `${window.location.origin}/prequel/prequel-api`;
window.axios.defaults.baseURL = `${window.location.origin}/prequel-api`;

/**
* Fontawesome
Expand Down
4 changes: 3 additions & 1 deletion resources/assets/js/components/Elements/SwitchMode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@
.switch {
@apply flex;
@apply flex-row;
@apply mx-2;
@media (min-width: 1401px) {
@apply mx-2;
}
.tab {
@apply flex;
Expand Down
42 changes: 34 additions & 8 deletions resources/assets/js/components/Header/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</a>
</div>
<h1 class="header-left-logo-text text-logo">
<span>Laravel</span> Prequel
<span id="laravel">Laravel</span> Prequel
<a href="https://github.com/Protoqol"
target="_blank"
title="Creator of Laravel Prequel">
Expand Down Expand Up @@ -333,15 +333,31 @@
letter-spacing: 1px;
color: var(--header-text-color);
@media (min-width: 700px) and (max-width: 1400px) {
@apply font-bold;
}
#laravel {
@media (min-width: 700px) and (max-width: 1400px) {
display: none;
}
}
span {
@apply font-bold;
}
a {
letter-spacing: normal;
@apply not-italic;
@apply text-xs;
@apply font-light;
@media (min-width: 700px) and (max-width: 1400px) {
display: none;
}
@media (min-width: 1401px) {
letter-spacing: normal;
@apply not-italic;
@apply text-xs;
@apply font-light;
}
}
}
}
Expand All @@ -350,12 +366,16 @@
@apply ml-2;
@apply mt-1;
@apply self-center;
@apply flex ;
@apply flex;
@apply flex-row;
@apply items-center;
@apply mr-1 ;
@apply mr-1;
@apply tracking-wide;
@apply text-gray-700;
@media (min-width: 700px) and (max-width: 1400px) {
@apply text-sm;
}
}
}
Expand Down Expand Up @@ -493,7 +513,13 @@
@apply items-center;
button {
@apply mr-4;
@media (min-width: 700px) and (max-width: 1400px) {
@apply mr-2;
}
@media (min-width: 1401px) {
@apply mr-4;
}
@apply flex;
@apply justify-center;
@apply items-center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
:value="app.serverInfo.QUERIES_PER_SECOND_AVG ? app.serverInfo.QUERIES_PER_SECOND_AVG : 'Could not retrieve'"
:unit="app.serverInfo.QUERIES_PER_SECOND_AVG ? 'queries per second' : '...'">
<slot ref="alert">
<Badge v-if="app.serverInfo.QUERIES_PER_SECOND_AVG && app.serverInfo.QUERIES_PER_SECOND_AVG === 0"
<Badge v-if="app.serverInfo.QUERIES_PER_SECOND_AVG === 0"
type="critical"/>
<Badge v-if="app.serverInfo.QUERIES_PER_SECOND_AVG && app.serverInfo.QUERIES_PER_SECOND_AVG >= 0.3"
type="average"/>
<Badge v-if="app.serverInfo.QUERIES_PER_SECOND_AVG && app.serverInfo.QUERIES_PER_SECOND_AVG >= 1"
<Badge v-else-if="app.serverInfo.QUERIES_PER_SECOND_AVG <= 0.3 && app.serverInfo.QUERIES_PER_SECOND_AVG <= 0.9"
type="neutral"/>
<Badge v-else-if="app.serverInfo.QUERIES_PER_SECOND_AVG > 0.9"
type="good"/>
</slot>
</StatusDisplay>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
methods: {
runMigrations: function() {
api.get('run/migrations').then(res => {
api.get('database/migrations/run').then(res => {
if (res) {
window.location.reload();
}
});
},
resetMigrations: function() {
api.get('reset/migrations').finally(() => {
api.get('database/migrations/reset').finally(() => {
window.location.reload();
});
},
Expand Down
15 changes: 1 addition & 14 deletions src/Classes/Database/DatabaseTraverser.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,6 @@ public function getTablesFromDB(string $database): array
{
$tables = $this->connection->select($this->databaseQueries->showTablesFrom($database));

// Collect differently if postgres. @TODO.
$tmp = [];

if ($this->databaseConn === 'pgsql') {
for ($i = 0; $i < count($tables); $i++) {
if ($tables[$i]->schemaname === $database) {
array_push($tmp, $tables[$i]);
}
}
unset($tables);
$tables = $tmp;
}

return $this->normalise($tables);
}

Expand Down Expand Up @@ -227,7 +214,7 @@ public function getAllDatabases(): array

/**
* Normalise query results; assumes a lot about the structure, which can
* potentially cause problems later on. @TODO
* potentially cause problems later on.
* Assumed structure:
* -----------------
* Array [
Expand Down
25 changes: 3 additions & 22 deletions src/Http/Controllers/DatabaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Illuminate\Support\Facades\Route;
use Protoqol\Prequel\Classes\Database\DatabaseConnector;
use Protoqol\Prequel\Classes\Database\DatabaseTraverser;
use Protoqol\Prequel\Http\Requests\PrequelDatabaseRequest;

/**
* Class DatabaseActionController
Expand Down Expand Up @@ -71,17 +70,16 @@ public function getTableData()
{
// If Model exists
if ($this->model && $this->databaseName === config('database.connections.mysql.database')) {
$hidden = $this->model->getHidden();
$paginated = $this->model->paginate(config('prequel.pagination'));
$paginated->setCollection($paginated->getCollection()->makeVisible($hidden));
$paginated->setCollection($paginated->getCollection()->each->setHidden([])->each->setVisible([]));

return [
"table" => $this->qualifiedName,
"data" => $paginated,
"structure" => app(DatabaseTraverser::class)->getTableStructure(
$this->databaseName,
$this->tableName
),
"data" => $paginated,
];
}

Expand All @@ -92,29 +90,12 @@ public function getTableData()
$this->databaseName,
$this->tableName
),
"data" => DB::table($this->qualifiedName)->paginate(100),
];
}

/**
* Get count of rows in table
* Not yet used.
* @return array
*/
public function countTableRecords(): array
{
$count = DB::table($this->qualifiedName)
->count('id');

return [
"table" => $this->qualifiedName,
"count" => $count,
"data" => DB::table($this->qualifiedName)->paginate(config('prequel.pagination')),
];
}

/**
* Find given value in given column with given operator.
* @TODO Clean up.
* @return mixed
*/
public function findInTable()
Expand Down
21 changes: 19 additions & 2 deletions src/Http/Controllers/PrequelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

use Illuminate\Routing\Controller;
use Protoqol\Prequel\Classes\App\AppStatus;
use Protoqol\Prequel\Classes\App\Migrations;
use Protoqol\Prequel\Classes\Database\DatabaseTraverser;

/**
* Class PrequelController
*
* @package Protoqol\Prequel\Http\Controllers
*/
class PrequelController extends Controller
Expand Down Expand Up @@ -40,11 +40,28 @@ public function index()

/**
* Get app status.
*
* @return array
*/
public function status()
{
return (new AppStatus())->getStatus();
}

/**
* Run pending migrations.
* @return int
*/
public function runMigrations()
{
return (new Migrations())->run();
}

/**
* Reset latest migrations.
* @return int
*/
public function resetMigrations()
{
return (new Migrations())->reset();
}
}
Loading

0 comments on commit 03809e2

Please sign in to comment.