1
0
Fork 0
mirror of synced 2024-06-01 10:29:48 +12:00

Updated UI with dynamic data

This commit is contained in:
Eldad Fux 2020-07-14 21:55:44 +03:00
parent 51f919c905
commit d64ac11f88
7 changed files with 54 additions and 18 deletions

View file

@ -1,6 +1,7 @@
<?php
use Utopia\App;
use Utopia\Config\Config;
App::init(function ($utopia, $request, $response, $layout) {
/** @var Utopia\App $utopia */
@ -26,7 +27,8 @@ App::init(function ($utopia, $request, $response, $layout) {
['type' => 'developer', 'label' => 'Developer'],
['type' => 'admin', 'label' => 'Admin'],
])
->setParam('env', App::getMode())
->setParam('environments', Config::getParam('environments'))
->setParam('mode', App::getMode())
;
$time = (60 * 60 * 24 * 45); // 45 days cache

View file

@ -44,10 +44,9 @@ $events = array_keys($this->getParam('events', []));
<div class="box margin-bottom-large">
<div class="text-align-center">
<img src="" data-ls-attrs="src=/images/environments/nodejs.png" alt="Function Env." class="avatar huge margin-top-negative-xxl" />
<img src="" data-ls-attrs="src=/images/environments/{{project-function.env|envLogo}}" alt="Function Env." class="avatar huge margin-top-negative-xxl" />
<p class="text-fade margin-bottom">
Node.js 14.2
<p class="text-fade margin-bottom" data-ls-bind="{{project-function.env|envName}} {{project-function.env|envVersion}}">
</p>
<button class="margin-bottom-small">Execute Now</button> &nbsp; <button class="reverse">View Logs</button>

View file

@ -1,15 +1,16 @@
<?php
$protocol = $this->getParam('protocol', '');
$domain = $this->getParam('domain', '');
$platforms = $this->getParam('platforms', []);
$version = $this->getParam('version', '0.0.0');
$isDev = $this->getParam('isDev', false);
$litespeed = $this->getParam('litespeed', true);
$analytics = $this->getParam('analytics', 'UA-26264668-9');
$env = $this->getParam('env', '');
$canonical = $this->getParam('canonical', '');
$locale = $this->getParam('locale', null);
$protocol = $this->getParam('protocol', '');
$domain = $this->getParam('domain', '');
$platforms = $this->getParam('platforms', []);
$version = $this->getParam('version', '0.0.0');
$isDev = $this->getParam('isDev', false);
$litespeed = $this->getParam('litespeed', true);
$analytics = $this->getParam('analytics', 'UA-26264668-9');
$mode = $this->getParam('mode', '');
$canonical = $this->getParam('canonical', '');
$locale = $this->getParam('locale', null);
$environments = $this->getParam('environments', null);
if(!empty($platforms)) {
$platforms = array_map(function($platform) {
@ -31,7 +32,7 @@ if(!empty($platforms)) {
?><!DOCTYPE html><!--
<?php echo $locale->getText('settings.inspire'); ?>
--><html lang="<?php echo $locale->getText('settings.locale'); ?>" class="<?php echo $this->getParam('class', 'none'); ?> <?php echo $env; ?>">
--><html lang="<?php echo $locale->getText('settings.locale'); ?>" class="<?php echo $this->getParam('class', 'none'); ?> <?php echo $mode; ?>">
<head>
<link rel="manifest" href="/manifest.json">
<title><?php echo $this->getParam('title', ''); ?></title>
@ -74,10 +75,11 @@ if(!empty($platforms)) {
SETUP: '<?php echo $this->escape($this->getParam('setup')); ?>',
API: '/v1',
PROJECT: 'console',
ENVIRONMENTS: <?php echo json_encode($environments); ?>,
PLATFORMS: <?php echo json_encode($platforms); ?>,
LOCALE: '<?php echo $this->escape($locale->getText('settings.locale')); ?>',
PREFIX: '<?php echo $this->escape($this->getParam('prefix')); ?>',
ROLES: <?PHP echo json_encode($this->getParam('roles', [])); ?>,
ROLES: <?php echo json_encode($this->getParam('roles', [])); ?>,
PAGING_LIMIT: <?PHP echo APP_PAGING_LIMIT; ?>
};

View file

@ -2628,7 +2628,10 @@ return result.length;}).add("documentAction",function(container){let collection=
return'database.updateDocument';}).add("documentSuccess",function(container){let document=container.get('project-document');if(document&&!document.$id){return',redirect';}
return'';}).add("firstElement",function($value){if($value&&$value[0]){return $value[0];}
return $value;}).add("platformsLimit",function($value){return $value;}).add("limit",function($value){let postfix=($value.length>=50)?'...':'';return $value.substring(0,50)+postfix;;}).add("arraySentence",function($value){if(!Array.isArray($value)){return'';}
return $value.join(", ").replace(/,\s([^,]+)$/,' and $1');});function abbreviate(number,maxPlaces,forcePlaces,forceLetter){number=Number(number);forceLetter=forceLetter||false;if(forceLetter!==false){return annotate(number,maxPlaces,forcePlaces,forceLetter);}
return $value.join(", ").replace(/,\s([^,]+)$/,' and $1');}).add("envName",function($value,env){console.log('env',env);if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].name;}
return'';}).add("envLogo",function($value,env){console.log('env',env);if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].logo;}
return'';}).add("envVersion",function($value,env){console.log('env',env);if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].version;}
return'';});function abbreviate(number,maxPlaces,forcePlaces,forceLetter){number=Number(number);forceLetter=forceLetter||false;if(forceLetter!==false){return annotate(number,maxPlaces,forcePlaces,forceLetter);}
let abbr;if(number>=1e12){abbr="T";}else if(number>=1e9){abbr="B";}else if(number>=1e6){abbr="M";}else if(number>=1e3){abbr="K";}else{abbr="";}
return annotate(number,maxPlaces,forcePlaces,abbr);}
function annotate(number,maxPlaces,forcePlaces,abbr){let rounded=0;switch(abbr){case"T":rounded=number/1e12;break;case"B":rounded=number/1e9;break;case"M":rounded=number/1e6;break;case"K":rounded=number/1e3;break;case"":rounded=number;break;}

View file

@ -266,7 +266,10 @@ return result.length;}).add("documentAction",function(container){let collection=
return'database.updateDocument';}).add("documentSuccess",function(container){let document=container.get('project-document');if(document&&!document.$id){return',redirect';}
return'';}).add("firstElement",function($value){if($value&&$value[0]){return $value[0];}
return $value;}).add("platformsLimit",function($value){return $value;}).add("limit",function($value){let postfix=($value.length>=50)?'...':'';return $value.substring(0,50)+postfix;;}).add("arraySentence",function($value){if(!Array.isArray($value)){return'';}
return $value.join(", ").replace(/,\s([^,]+)$/,' and $1');});function abbreviate(number,maxPlaces,forcePlaces,forceLetter){number=Number(number);forceLetter=forceLetter||false;if(forceLetter!==false){return annotate(number,maxPlaces,forcePlaces,forceLetter);}
return $value.join(", ").replace(/,\s([^,]+)$/,' and $1');}).add("envName",function($value,env){console.log('env',env);if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].name;}
return'';}).add("envLogo",function($value,env){console.log('env',env);if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].logo;}
return'';}).add("envVersion",function($value,env){console.log('env',env);if(env&&env.ENVIRONMENTS&&env.ENVIRONMENTS[$value]){return env.ENVIRONMENTS[$value].version;}
return'';});function abbreviate(number,maxPlaces,forcePlaces,forceLetter){number=Number(number);forceLetter=forceLetter||false;if(forceLetter!==false){return annotate(number,maxPlaces,forcePlaces,forceLetter);}
let abbr;if(number>=1e12){abbr="T";}else if(number>=1e9){abbr="B";}else if(number>=1e6){abbr="M";}else if(number>=1e3){abbr="K";}else{abbr="";}
return annotate(number,maxPlaces,forcePlaces,abbr);}
function annotate(number,maxPlaces,forcePlaces,abbr){let rounded=0;switch(abbr){case"T":rounded=number/1e12;break;case"B":rounded=number/1e9;break;case"M":rounded=number/1e6;break;case"K":rounded=number/1e3;break;case"":rounded=number;break;}

View file

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View file

@ -161,6 +161,33 @@ window.ls.filter
return $value.join(", ").replace(/,\s([^,]+)$/, ' and $1');
})
.add("envName", function($value, env) {
console.log('env', env);
if(env && env.ENVIRONMENTS && env.ENVIRONMENTS[$value]) {
return env.ENVIRONMENTS[$value].name;
}
return '';
})
.add("envLogo", function($value, env) {
console.log('env', env);
if(env && env.ENVIRONMENTS && env.ENVIRONMENTS[$value]) {
return env.ENVIRONMENTS[$value].logo;
}
return '';
})
.add("envVersion", function($value, env) {
console.log('env', env);
if(env && env.ENVIRONMENTS && env.ENVIRONMENTS[$value]) {
return env.ENVIRONMENTS[$value].version;
}
return '';
})
;
function abbreviate(number, maxPlaces, forcePlaces, forceLetter) {