- Still WIP on storage and a new Update function also started
This commit is contained in:
parent
689120dd44
commit
bf1bec644b
|
@ -6,7 +6,7 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Dave Mc Nicoll",
|
"name": "Dave Mc Nicoll",
|
||||||
"email": "mcndave@gmail.com"
|
"email": "info@mcnd.ca"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"lean": {
|
"lean": {
|
||||||
"label": "Lean",
|
"label": "Lean",
|
||||||
"dashboard": "Dashboard"
|
"dashboard": "Dashboard",
|
||||||
|
"update": "Update(s)"
|
||||||
},
|
},
|
||||||
|
|
||||||
"storage": {
|
"storage": {
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"title" : "Console -- LEAN",
|
||||||
|
"page-title": "Console",
|
||||||
|
"breadcrumb" : {
|
||||||
|
"index" : "Negundo"
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
namespace Lean\Console\Controller;
|
namespace Lean\Console\Controller;
|
||||||
|
|
||||||
|
use Picea\Ui\Method\FormHandler;
|
||||||
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||||
|
|
||||||
use Notes\Tell\Attribute\Language, Notes\Route\Attribute\Method\Route;
|
use Notes\Tell\Attribute\Language, Notes\Route\Attribute\Method\Route;
|
||||||
|
|
||||||
use \Lean\Console\Lib;
|
use \Lean\Console\{ Lib, Form };
|
||||||
|
|
||||||
#[Language("lean.console")]
|
#[Language("lean.console")]
|
||||||
class Console {
|
class Console {
|
||||||
|
@ -19,4 +20,14 @@ class Console {
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route(route: "/update", name: "lean.console:update")]
|
||||||
|
public function update(ServerRequestInterface $request, array $arguments) : ResponseInterface
|
||||||
|
{
|
||||||
|
new FormHandler($request, $git = new Form\Update\Git(getenv('PROJECT_PATH')));
|
||||||
|
|
||||||
|
$status = iterator_to_array($git->run("/usr/bin/git status -s"));
|
||||||
|
|
||||||
|
return $this->renderView("lean-console/page/update/index", get_defined_vars());
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean\Console\Form\Update;
|
||||||
|
|
||||||
|
use Picea\Ui\Method\{ FormInterface, FormContext, FormContextInterface };
|
||||||
|
|
||||||
|
use \Lean\Console\{ Lib, Entity };
|
||||||
|
|
||||||
|
use Picea\Compiler\Context;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
use Ulmus\{ EntityCollection };
|
||||||
|
|
||||||
|
class Git implements FormInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public string $projectPath = "",
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initialize(FormContextInterface $context) : void
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validate(FormContextInterface $context) : bool
|
||||||
|
{
|
||||||
|
return $context->valid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function execute(FormContextInterface $context) : void
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run(string $command) : \Generator
|
||||||
|
{
|
||||||
|
$command = escapeshellcmd($command);
|
||||||
|
|
||||||
|
$handle = popen("$command", 'r');
|
||||||
|
|
||||||
|
while ( false !== $output = fgets($handle, 2096) ){
|
||||||
|
yield trim($output);
|
||||||
|
}
|
||||||
|
|
||||||
|
pclose($handle);
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,21 +8,21 @@
|
||||||
|
|
||||||
.text-center{text-align:center;}.text-right{text-align:right}.text-left{text-align:left;}
|
.text-center{text-align:center;}.text-right{text-align:right}.text-left{text-align:left;}
|
||||||
|
|
||||||
[class^="btn-"], [class~=" btn-"] { display: inline-block; font-weight: 400; text-align: center; white-space: nowrap; vertical-align: middle; user-select: none; border: 1px solid transparent; padding: .375rem .75rem; font-size: 1rem; line-height: 1.5; border-radius: .25rem; cursor:pointer; transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; background:rgba(0,0,0,0.3); color:rgba(255,255,255,0.8); }
|
[class^="btn-"], [class~=" btn-"] { display: inline-block; font-weight: 400; text-align: center; white-space: nowrap; vertical-align: middle; user-select: none; border: 1px solid transparent; padding: .375rem .75rem; line-height: 1.5; border-radius: .25rem; cursor:pointer; transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; background:rgba(0,0,0,0.3); color:rgba(255,255,255,0.8); }
|
||||||
[class^="btn-"]:hover, [class~=" btn-"]:hover {border-color: rgba(0, 0, 0, 0.5);text-decoration: underline;}
|
[class^="btn-"]:hover, [class~=" btn-"]:hover {border-color: rgba(0, 0, 0, 0.5);text-decoration: underline;}
|
||||||
.btn-red {background: rgba(155,0,0,0.5);color: rgba(255, 255, 255, 0.9);}
|
.btn-red {background: rgba(155,0,0,0.5);color: rgba(255, 255, 255, 0.9);}
|
||||||
.btn-green {background: rgba(0,155,0,0.5);color: rgba(255, 255, 255, 0.9);}
|
.btn-green {background: rgba(0,155,0,0.5);color: rgba(255, 255, 255, 0.9);}
|
||||||
.btn-blue {background: rgba(0,0,155,0.5);color: rgba(255, 255, 255, 0.9);}
|
.btn-blue {background: rgba(0,0,155,0.5);color: rgba(255, 255, 255, 0.9);}
|
||||||
|
|
||||||
code {white-space:pre;font-family:monospace;color: #e6e6e6;background: #343537;display: block;padding: 1rem;line-height: 1.5em;border: 1px solid #2e2e30;}
|
code {white-space:pre-line;font-family:monospace;color: #e6e6e6;background: #343537;display: block;padding: 1rem;line-height: 1.5em;border: 1px solid #2e2e30;}
|
||||||
h1 {font-size:2rem;color:#525960}
|
h1 {font-size:2rem;color:#525960}
|
||||||
body {font-family:Helvetica Neue, Helvetica, Arial, sans-serif;}
|
body {font-family:Helvetica Neue, Helvetica, Arial, sans-serif;}
|
||||||
summary {cursor:pointer;}
|
summary {cursor:pointer;}
|
||||||
|
|
||||||
#body-main {background:#ccc;min-height:calc(100vh - 90px);display:flex}
|
#body-main {background:#dfe3f9;min-height:calc(100vh - 90px);display:flex}
|
||||||
|
|
||||||
/* Header */
|
/* Header */
|
||||||
#body-header {background: #5e5e5e; color:#fff; min-height:60px;line-height:60px;padding:0 1rem}
|
#body-header {background: #5e5e5e; color:#fff; min-height:60px;line-height:60px;padding:0 1rem;border-bottom: 2px solid #9b9595;}
|
||||||
#body-header .page-title {font-size:1.5rem}
|
#body-header .page-title {font-size:1.5rem}
|
||||||
#body-header .page-title:before {content:"🔳"; margin-right:10px}
|
#body-header .page-title:before {content:"🔳"; margin-right:10px}
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ summary {cursor:pointer;}
|
||||||
/* Main content */
|
/* Main content */
|
||||||
#main-content {padding:4vh 2vw;border-top:2px solid #7d7d7d;width:100%;}
|
#main-content {padding:4vh 2vw;border-top:2px solid #7d7d7d;width:100%;}
|
||||||
#main-content section {border-radius:4px;box-shadow: 1px 1px 3px rgba(0,0,0,0.5)}
|
#main-content section {border-radius:4px;box-shadow: 1px 1px 3px rgba(0,0,0,0.5)}
|
||||||
#main-content section article {background:#fff;padding:2vh 1vw;}
|
#main-content section article {font-family: Courier New , Courier, monospace;font-size: 0.8em;background:#fff;padding:2vh 1vw;}
|
||||||
#main-content section header {background:#e8e8e8;padding:2vh 1vw;font-size:1.4em;color: #4b4848
|
#main-content section header {background:#e8e8e8;padding:2vh 1vw;font-size:1.4em;color: #4b4848;border-top-left-radius: 4px;border-top-right-radius: 4px;}
|
||||||
}
|
#main-content section footer {background:#f9f9f9;padding:2vh 1vw;border-bottom-left-radius: 4px;bottom: 4px;}
|
||||||
#main-content section footer {background:#f9f9f9;padding:2vh 1vw;}
|
|
|
@ -2,6 +2,7 @@
|
||||||
<label>{% lang "lean.nav.lean.label" %}</label>
|
<label>{% lang "lean.nav.lean.label" %}</label>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{% route 'lean.console:home' %}">{% lang "lean.nav.lean.dashboard" %}</a></li>
|
<li><a href="{% route 'lean.console:home' %}">{% lang "lean.nav.lean.dashboard" %}</a></li>
|
||||||
|
<li><a href="{% route 'lean.console:update' %}">{% lang "lean.nav.lean.update" %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<label>{% lang "lean.nav.request.label" %}</label>
|
<label>{% lang "lean.nav.request.label" %}</label>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
{% extends "lean-console/base/layout" %}
|
||||||
|
|
||||||
|
{% language.set "lean.update" %}
|
||||||
|
|
||||||
|
{% title _("title") %}
|
||||||
|
|
||||||
|
{% section "header" %}
|
||||||
|
<div class="page-title">{% _ "page-title" %}</div>
|
||||||
|
{% endsection %}
|
||||||
|
|
||||||
|
{% section "content" %}
|
||||||
|
<section>
|
||||||
|
<header>
|
||||||
|
<h1>{% _ 'git.header' %}</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<article class="updates">
|
||||||
|
<div class="git-status">
|
||||||
|
<strong style="display:block;margin-bottom:7px">'git status' output</strong>
|
||||||
|
|
||||||
|
<code>
|
||||||
|
{% foreach $status as $line %}
|
||||||
|
<div>
|
||||||
|
{% if $line %}
|
||||||
|
{{ $line }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endforeach %}
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
{% endsection %}
|
Loading…
Reference in New Issue