Browse Source

update php inline, add convenience nav buttons, add time to latest out page

master
Garrett Mills 6 months ago
parent
commit
daf2694c16

+ 13
- 5
app/MiscUnit.js View File

@@ -39,7 +39,7 @@ class MiscUnit extends Unit {

// do stuff here
global.devbug = {
version: '0.6.3',
version: '0.7.0',
get_inline: function(type, project){
let code = this.code[type];
if (!code) return false
@@ -73,6 +73,7 @@ function devbug_microtime($difftime = 0){
$time = explode(' ', microtime()); return ((float)$time[1]+(float)$time[0])-$difftime; }
$GLOBALS['devbug_dev_outs'] = [];
$GLOBALS['devbug_dev_out_iters'] = [];
$GLOBALS['devbug_bench_iters'] = [];
$GLOBALS['devbug_mark_time'] = devbug_microtime();
function out($key, $what, $group = null){
$dev_outs = $GLOBALS['devbug_dev_outs'];
@@ -113,17 +114,24 @@ function breakpoint($continue = false, $name = null){
if ( !$continue ) { exit(); }
}
function devbugtime($prefix = 'time: '){ $mt = explode(' ', microtime()); $mt = $mt[1].' '.$mt[0]; return $prefix.$mt; }
function outtime($key, $what, $group = null){ out(devbugtime($key), $what, $group); }
function outiter($key, $what, $group = null){
function outt($key, $what, $group = null){ out(devbugtime($key), $what, $group); }
function outi($key, $what, $group = null){
$keyname = $group ? $key.$group : $key;
if ( !$GLOBALS['devbug_dev_out_iters'][$keyname] ) $GLOBALS['devbug_dev_out_iters'][$keyname] = 0;
out($key.'_'.$GLOBALS['devbug_dev_out_iters'][$keyname], $what, $group);
$GLOBALS['devbug_dev_out_iters'][$keyname]++;
}
function outpoint($group){
function point(){
if ( !$GLOBALS['devbug_current_bench'] ) benchmark();
$bt = debug_backtrace();
$caller = array_shift($bt);
out('point: '.$caller['file'].': '.$caller['line'], devbugtime(), $group);
out('point: '.$caller['file'].': '.$caller['line'], devbugtime(), $GLOBALS['devbug_current_bench']);
}
function benchmark($name = "DevBug"){ $GLOBALS['devbug_current_bench'] = "Benchmark: ".$name; point(); }
function benchmarki($name = "DevBug"){
if ( !$GLOBALS['devbug_bench_iters'][$name] ) $GLOBALS['devbug_bench_iters'][$name] = 1;
benchmark($name.'('.$GLOBALS['devbug_bench_iters'][$name].')');
$GLOBALS['devbug_bench_iters'][$name]++;
}
function devbug_chop($string, $at=120){ return substr($string, 0, 30); }
// ===========================================================`,

+ 9
- 1
app/controllers/dash/v1.controller.js View File

@@ -217,7 +217,15 @@ class v1 {
return _flitter.error(res, 500, {reason: 'Unable to parse output data. Data contains invalid JSON.'})
}

return _flitter.view(res, 'dash_v1:out', {project, user: req.session.auth.user, out, prettyd:pretty, show_back: true, title: 'Latest output: '+out.brief, title_small: true });
return _flitter.view(res, 'dash_v1:out', {
project,
user: req.session.auth.user,
out,
prettyd:pretty,
show_back: true,
title: `Latest output: ${out.brief} <small>(${out.created.toLocaleString({timeZone: 'America/Chicago'})})</small>`,
title_small: true
});
}
async out_delete(req, res, next){

+ 4
- 1
app/views/dash_v1/editor_template.pug View File

@@ -11,7 +11,7 @@ html
- var e_project = (user && project && devbug.permission.project.sync_edit(project, user))
#pre-header-content DevBug | v#{devbug.version} #{(user ? " | User: "+user.username : "")} #{(e_project ? " | Project: "+project.name+" | API: "+project.uuid : "")} #{((_flitter.config('server.environment') === 'development') ? " | Development" : "" )} | <i>Editor Mode</i>
#title-header
#title-header-content-sm #{title ? title : 'DevBug Dashboard'}
#title-header-content-sm !{title ? title : 'DevBug Dashboard'}
.iheader
block header
.idiv
@@ -32,5 +32,8 @@ html
else if show_back && project
li.navbar-right
a#navbar-back(href='/dash/v1/project/view/'+project.id) Back to Project
if project && !hide_project_latest
li.navbar-right
a#navbar-project-latest(href="/dash/v1/out/view-latest/"+project.id) View Latest Output
script(src="/assets/dash_v1.js")
block scripts

+ 2
- 0
app/views/dash_v1/main.pug View File

@@ -15,6 +15,8 @@ block content
ul(style='list-style-type: none; margin: 0; padding: 0;')
li.action-li
a.action(href='/dash/v1/project/view/'+project.id) View
li.action-li
a.action(href='/dash/v1/out/view-latest/'+project.id) Latest Output
li.action-li
a.action(href='/dash/v1/project/share/'+project.id) Share
li.action-li

+ 3
- 0
app/views/dash_v1/template.pug View File

@@ -23,6 +23,9 @@ html
else if show_back && project
li.navbar-right
a#navbar-back(href='/dash/v1/project/view/'+project.id) Back to Project
if project && !hide_project_latest
li.navbar-right
a#navbar-project-latest(href="/dash/v1/out/view-latest/"+project.id) View Latest Output
block navbar-right
.content
block content

Loading…
Cancel
Save