Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulma React dashboard #41

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bf0bf5d
ignore node modules folder
tomjn May 18, 2021
b42c3d9
add babel config
tomjn May 18, 2021
89017ed
add package files and webpack config
tomjn May 18, 2021
5625ffc
add react bulma dash
tomjn May 18, 2021
f00fa8e
add more data for the app and remove old cruft
tomjn May 18, 2021
77a01fd
colour updates and fixes
tomjn May 18, 2021
6c1323e
codacy fixes
tomjn May 18, 2021
929709e
more codacy fixes
tomjn May 18, 2021
92bedd0
added an editor config file
tomjn May 18, 2021
f320127
fixed site URL buttons
tomjn May 18, 2021
7d53a6e
tell codacy to igore the dist build folder
tomjn May 18, 2021
41673ca
more codacy fixes
tomjn May 18, 2021
fa7787b
move the site list component and add disabled filter and sorting cont…
tomjn May 19, 2021
c84b6ca
add dedicated database ad php tool pages
tomjn May 19, 2021
a688544
add new pages and make the nav bar show the active page
tomjn May 24, 2021
04e38b9
update built file
tomjn May 24, 2021
4765c0f
codacy linting fixes
tomjn May 24, 2021
51ba491
add stylelint config
tomjn May 24, 2021
8fa9256
add the classnames package, update a dependency, and make the license…
tomjn May 29, 2021
45d50d7
add proptypes for the site list item component
tomjn May 29, 2021
da345a4
implement filtering the sites list
tomjn May 29, 2021
c079e00
change code tags from red to yellow
tomjn May 29, 2021
ce17fc8
update sidebar styling
tomjn Jun 14, 2021
0cf2fc9
rebuild and update browser list
tomjn Nov 4, 2021
a46f634
add more info to dashboard json data
tomjn Nov 7, 2021
eb8f0d8
fix gapless columns
tomjn Nov 7, 2021
59a57cf
new dedicated site page and card based site list
tomjn Nov 7, 2021
85b7a5b
remove some packages and update others
tomjn Nov 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
2 changes: 2 additions & 0 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
exclude_paths:
- "dist/**"
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,scss,php}]
charset = utf-8
indent_style = tab

[{package.json}]
indent_style = space
indent_size = 2
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Stuff that pops up locally for me - @jeremyfelt
*.sublime*
.DS_Store
.idea
Icon?
Icon\r
Icon\r\r

/node_modules/
5 changes: 5 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"indentation": "tab"
}
}
228 changes: 196 additions & 32 deletions dashboard-default.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,205 @@
<?php

require_once 'php/yaml.php';

$version = file_get_contents( '/vagrant/version' );
$root_warning = file_exists( '/vagrant/provisioned_as_root' );

?><!DOCTYPE html>
<html>
$initial_config = [];

$config_locations = [
'/srv/vvv/config.yml',
'/vagrant/config.yml',
'/vagrant/vvv-custom.yml',
];

$config_file = false;
foreach ( $config_locations as $location ) {
if ( is_readable( $location ) ) {
$config_file = $location;
break;
}
}

if ( false !== $config_file ) {
$yaml = new Alchemy\Component\Yaml\Yaml();
$initial_config = $yaml->load( $config_file );
}

$tools = [
[
'title' => 'PHP Info',
'url' => '//vvv.test/phpinfo/',
'description' => 'View php_info() output.',
'category' => 'php',
],
[
'title' => 'PHP Status',
'url' => '//vvv.test/php-status?html&amp;full',
'description' => 'PHP FPM status page.',
'category' => 'php',
],
];

$environment = [
'version' => $version,
'provisioned_as_root' => $root_warning,
'php' => [
'debug_extensions' => [
'xdebug' => [
'name' => 'XDebug',
'description' => 'Useful for connecting a debugger',
'command' => 'vagrant ssh -c "switch_php_debugmod xdebug"'
],
'tideways_xhprof' => [
'name' => 'Tideways XHProf',
'description' => 'Used with XHGui to generate profiles',
'command' => 'vagrant ssh -c "switch_php_debugmod tideways_xhprof"'
],
'pcov' => [
'name' => 'PCov',
'description' => 'Speeds up test coverage calculation',
'command' => 'vagrant ssh -c "switch_php_debugmod pcov"'
],
'none' => [
'name' => 'No PHP Debug Extensions Loaded',
'description' => 'Vanilla PHP',
'command' => 'vagrant ssh -c "switch_php_debugmod none"',
],
],
],
];

$current_debug_ext = 'none';
foreach ( $environment['php']['debug_extensions'] as $ext => $options ) {
$environment['php']['debug_extensions'][ $ext ]['active'] = false;
if ( extension_loaded( $ext ) ) {
$environment['php']['debug_extensions'][ $ext ]['active'] = true;
$current_debug_ext = $ext;
}
}
$environment['php']['current_debug_extension'] = $current_debug_ext;

$v_free_space_mb = round( disk_free_space( '/' ) / 1024 / 1024, 1 );
$v_free_space_gb = round( $v_free_space_mb / 1024, 1 );
$v_total_space = round( disk_total_space( '/' ) / 1024 / 1024 / 1024, 0 );
$v_used_space = round( $v_total_space - ( $v_free_space_mb / 1024 ), 1 );
$v_used_percent = round( ( $v_used_space / $v_total_space ) * 100, 0 );
$v_low_space = ( 200 > $v_free_space_mb );
$v_free_space = ( $v_free_space_mb < 1024 ) ? $v_free_space_mb . ' MB' : $v_free_space_gb . ' GB';

$environment['diskspace'] = [
'free_space_mb' => $v_free_space_mb,
'free_space_gb' => $v_free_space_gb,
'total_space' => $v_total_space,
'used_space' => $v_used_space,
'used_percent' => $v_used_percent,
'low_space' => $v_low_space,
'free_space' => $v_free_space,
];

if ( is_dir( '/srv/www/default/database-admin/' ) ) {
$tools[] = [
'title' => 'phpMyAdmin',
'url' => '//vvv.test/database-admin/',
'description' => 'Popular web based database tool, use "root" as both the username and password.',
'category' => 'database',
];
}

if ( is_dir( '/srv/www/default/memcached-admin/' ) ) {
$tools[] = [
'title' => 'Memcached Admin',
'url' => '//vvv.test/memcached-admin/',
'description' => 'Graphic stand-alone administration for memcached to monitor and debug purpose. This program allows to see in real-time (top-like) or from the start of the server, stats for get, set, delete, increment, decrement, evictions, reclaimed, cas command, as well as server stats (network, items, server version) with googlecharts and server internal configuration.',
'category' => 'php',
];
}

if ( is_dir( '/srv/www/default/opcache-status/' ) ) {
$tools[] = [
'title' => 'Opcache Status',
'url' => '//vvv.test/opcache-status/opcache.php',
'description' => 'A one-page opcache status page.',
'category' => 'php',
];
}

if ( is_dir( '/srv/www/default/opcache-gui/' ) ) {
$tools[] = [
'title' => 'Opcache GUI Admin',
'url' => '//vvv.test/opcache-gui/',
'description' => 'A clean and responsive interface for Zend OPcache information, showing statistics, settings and cached files, and providing a real-time update for the information.',
'category' => 'php',
];
}

if ( file_exists( '/usr/local/bin/mailhog' ) ) {
$tools[] = [
'title' => 'MailHog',
'url' => 'http://vvv.test:8025',
'description' => 'MailHog is an email testing tool for developers.',
'category' => 'mail',
];
} elseif ( file_exists( '/usr/local/rvm/bin/mailcatcher' ) ) {
$tools[] = [
'title' => 'Mailcatcher',
'url' => 'http://vvv.test:1080',
'description' => 'Catches mail and serves it through a dream.',
'category' => 'mail',
];
}

if ( is_dir( '/srv/www/default/xhgui/' ) ) {
$tools[] = [
'title' => 'XHGui Profiler',
'url' => '//xhgui.vvv.test/',
'description' => 'A graphical interface for XHProf profiling data.',
'category' => 'php',
];
}
if ( is_dir( '/srv/www/default/webgrind/' ) ) {
$tools[] = [
'title' => 'Webgrind',
'url' => '//vvv.test/webgrind/',
'description' => 'Xdebug Profiling Web Frontend in PHP.',
'category' => 'php',
];
}

if ( extension_loaded( 'xdebug' ) && is_dir( '/srv/www/default/xdebuginfo/' ) ) {
$tools[] = [
'title' => 'XDebug Info',
'url' => '//vvv.test/xdebuginfo/',
'description' => 'View xdebug_info() output.',
'category' => 'php',
];
}

$vvv = [
'config' => $initial_config,
'config_file' => $config_file,
'config_raw' => file_get_contents( $config_file ),
'environment' => $environment,
'tools' => $tools,
];

?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>VVV Dashboard</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/dashboard/style.css?t=<?php echo intval( filemtime( __DIR__ . '/style.css' ) ); ?>">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>VVV</title>
<link rel="shortcut icon" href="/dashboard/vvv-tight.png">
<link href="https://unpkg.com/@fortawesome/[email protected]/css/all.css" rel="stylesheet" />
<link href="/dashboard/dist/css/style.css" rel="stylesheet">
<script>
window.vvv = <?php echo json_encode( $vvv ); ?>;
</script>
<script defer="defer" src="/dashboard/dist/main.js"></script>
</head>
<body class="<?php echo $root_warning ? 'root-warning' : ''; ?>">
<header>
<h2 id="vvv_logo">
<img src="/dashboard/vvv-tight.png"/> VVV v<span class="version"><?php echo strip_tags( $version ); ?></span>
</h2>
</header>
<?php
require_once( __DIR__ . '/php/notices.php' );
?>
<div class="grid">
<main class="column left-column">
<?php
require_once __DIR__ . '/php/blocks/main/sites.php';
require_once __DIR__ . '/php/blocks/main/adding-site-doc.php';
require_once __DIR__ . '/php/blocks/main/php-status.php';
?>
</main>
<aside class="column right-column">
<?php
require_once __DIR__ . '/php/blocks/sidebar/inclusivity.php';
require_once __DIR__ . '/php/blocks/sidebar/bundled-tools.php';
require_once __DIR__ . '/php/blocks/sidebar/search-docs.php';
require_once __DIR__ . '/php/blocks/sidebar/disk-info.php';
require_once __DIR__ . '/php/blocks/sidebar/find-out-more-vvv.php';
?>
</aside>
</div>
<body class="has-navbar-fixed-bottom">
<section id="container" class=""></section>
</body>
</html>
1 change: 1 addition & 0 deletions dist/css/style.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>VVV</title><link href="https://unpkg.com/@fortawesome/[email protected]/css/all.css" rel="stylesheet"/><script defer="defer" src="main.js"></script><link href="css/style.css" rel="stylesheet"></head><body class="has-navbar-fixed-bottom"><section id="container" class="section"></section></body></html>
2 changes: 2 additions & 0 deletions dist/main.js

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions dist/main.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/

/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/

/** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Loading