mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 00:18:25 +00:00
commit
29d448c690
31 changed files with 81 additions and 105 deletions
|
|
@ -486,8 +486,8 @@ App::post('/v1/databases/:databaseId/collections')
|
|||
->param('databaseId', '', new UID(), 'Database ID.')
|
||||
->param('collectionId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
|
||||
->param('name', '', new Text(128), 'Collection name. Max length: 128 chars.')
|
||||
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permissions strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).')
|
||||
->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).')
|
||||
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permissions strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).', true)
|
||||
->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).', true)
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->inject('events')
|
||||
|
|
@ -740,7 +740,7 @@ App::put('/v1/databases/:databaseId/collections/:collectionId')
|
|||
->param('collectionId', '', new UID(), 'Collection ID.')
|
||||
->param('name', null, new Text(128), 'Collection name. Max length: 128 chars.')
|
||||
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default the current permission are inherited. [Learn more about permissions](/docs/permissions).', true)
|
||||
->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).')
|
||||
->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).', true)
|
||||
->param('enabled', true, new Boolean(), 'Is collection enabled?', true)
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
|
|
|
|||
|
|
@ -358,7 +358,9 @@ App::get('/v1/functions/usage')
|
|||
$requestDocs = $dbForProject->find('stats', [
|
||||
Query::equal('period', [$period]),
|
||||
Query::equal('metric', [$metric]),
|
||||
], $limit, 0, ['time'], [Database::ORDER_DESC]);
|
||||
Query::limit($limit),
|
||||
Query::orderDesc('time'),
|
||||
]);
|
||||
|
||||
$stats[$metric] = [];
|
||||
foreach ($requestDocs as $requestDoc) {
|
||||
|
|
@ -378,7 +380,7 @@ App::get('/v1/functions/usage')
|
|||
};
|
||||
$stats[$metric][] = [
|
||||
'value' => 0,
|
||||
'date' => ($stats[$metric][$last]['date'] ?? \time()) - $diff, // time of last metric minus period
|
||||
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
||||
];
|
||||
$backfill--;
|
||||
}
|
||||
|
|
@ -1371,7 +1373,8 @@ App::get('/v1/functions/:functionId/variables')
|
|||
}
|
||||
|
||||
// Get cursor document if there was a cursor query
|
||||
$cursor = reset(Query::getByType($queries, Query::TYPE_CURSORAFTER, Query::TYPE_CURSORBEFORE));
|
||||
$cursor = Query::getByType($queries, Query::TYPE_CURSORAFTER, Query::TYPE_CURSORBEFORE);
|
||||
$cursor = reset($cursor);
|
||||
if ($cursor) {
|
||||
/** @var Query $cursor */
|
||||
$variableId = $cursor->getValue();
|
||||
|
|
|
|||
|
|
@ -194,7 +194,8 @@ App::get('/v1/projects')
|
|||
}
|
||||
|
||||
// Get cursor document if there was a cursor query
|
||||
$cursor = reset(Query::getByType($queries, Query::TYPE_CURSORAFTER, Query::TYPE_CURSORBEFORE));
|
||||
$cursor = Query::getByType($queries, Query::TYPE_CURSORAFTER, Query::TYPE_CURSORBEFORE);
|
||||
$cursor = reset($cursor);
|
||||
if ($cursor) {
|
||||
/** @var Query $cursor */
|
||||
$projectId = $cursor->getValue();
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ App::post('/v1/storage/buckets')
|
|||
->param('bucketId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
|
||||
->param('name', '', new Text(128), 'Bucket name')
|
||||
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).', true)
|
||||
->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).')
|
||||
->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).', true)
|
||||
->param('enabled', true, new Boolean(true), 'Is bucket enabled?', true)
|
||||
->param('maximumFileSize', (int) App::getEnv('_APP_STORAGE_LIMIT', 0), new Range(1, (int) App::getEnv('_APP_STORAGE_LIMIT', 0)), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(App::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '. For self-hosted setups you can change the max limit by changing the `_APP_STORAGE_LIMIT` environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)', true)
|
||||
->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true)
|
||||
|
|
@ -230,7 +230,7 @@ App::put('/v1/storage/buckets/:bucketId')
|
|||
->param('bucketId', '', new UID(), 'Bucket unique ID.')
|
||||
->param('name', null, new Text(128), 'Bucket name', false)
|
||||
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default the current permissions are inherited. [Learn more about permissions](/docs/permissions).', true)
|
||||
->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).')
|
||||
->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).', true)
|
||||
->param('enabled', true, new Boolean(true), 'Is bucket enabled?', true)
|
||||
->param('maximumFileSize', null, new Range(1, (int) App::getEnv('_APP_STORAGE_LIMIT', 0)), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human((int)App::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '. For self hosted version you can change the limit by changing _APP_STORAGE_LIMIT environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)', true)
|
||||
->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true)
|
||||
|
|
@ -1595,6 +1595,7 @@ App::get('/v1/storage/:bucketId/usage')
|
|||
foreach ($metrics as $metric) {
|
||||
$limit = $periods[$range]['limit'];
|
||||
$period = $periods[$range]['period'];
|
||||
|
||||
$requestDocs = $dbForProject->find('stats', [
|
||||
Query::equal('period', [$period]),
|
||||
Query::equal('metric', [$metric]),
|
||||
|
|
|
|||
|
|
@ -408,7 +408,8 @@ Database::addFilter(
|
|||
return $database
|
||||
->find('variables', [
|
||||
Query::equal('functionInternalId', [$document->getInternalId()]),
|
||||
], APP_LIMIT_SUBQUERY);
|
||||
Query::limit(APP_LIMIT_SUBQUERY),
|
||||
]);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -109,8 +109,9 @@ $cli
|
|||
|
||||
$certificates = $dbForConsole->find('certificates', [
|
||||
Query::lessThanEqual('attempts', 5), // Maximum 5 attempts
|
||||
Query::lessThanEqual('renewDate', $time) // includes 60 days cooldown (we have 30 days to renew)
|
||||
], 200); // Limit 200 comes from LetsEncrypt (300 orders per 3 hours, keeping some for new domains)
|
||||
Query::lessThanEqual('renewDate', $time), // includes 60 days cooldown (we have 30 days to renew)
|
||||
Query::limit(200), // Limit 200 comes from LetsEncrypt (300 orders per 3 hours, keeping some for new domains)
|
||||
]);
|
||||
|
||||
|
||||
if (\count($certificates) > 0) {
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ $escapedPermissions = \array_map(function ($perm) {
|
|||
<?php endif; ?>
|
||||
:value="rawPermissions"/>
|
||||
|
||||
<table data-ls-attrs="x-init=load({{<?php if (!empty($data)) echo $data . '.$permissions' ?>}})">
|
||||
<table class="u-table-layout-normal" data-ls-attrs="x-init=load({{<?php if (!empty($data)) echo $data . '.$permissions' ?>}})">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Role</th>
|
||||
<?php foreach ($permissions as $permission): ?>
|
||||
<th><?php echo \ucfirst($permission); ?></th>
|
||||
<th class="u-no-trim"><?php echo \ucfirst($permission); ?></th>
|
||||
<?php endforeach; ?>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ sort($patterns);
|
|||
</div>
|
||||
|
||||
<ul class="chart-notes margin-bottom-large">
|
||||
<li class="orange">CPU Time <span data-ls-bind="({{usage.executionsTime|statsGetLast|seconds2hum}})"></span></li>
|
||||
<li class="orange">CPU Time <span data-ls-bind="({{usage.executionsTime|statsGetLast|ms2hum}})"></span></li>
|
||||
</ul>
|
||||
|
||||
<div class="box margin-bottom-small">
|
||||
|
|
@ -730,36 +730,6 @@ sort($patterns);
|
|||
<input type="text" id="function-schedule" class="full-width" name="schedule" autocomplete="off" data-ls-bind="{{project-function.schedule}}" placeholder="* * * * *" />
|
||||
<div class="text-size-small text-fade margin-bottom margin-top-negative-small">Leave blank for no schedule</div>
|
||||
|
||||
<label class="margin-bottom-small">Variables <span class="tooltip small" data-tooltip="Set variables or secret keys that will be passed as env vars to your function at runtime."><i class="icon-info-circled"></i></span></label>
|
||||
<div data-ls-if="(!{{project-function.vars.length}})">
|
||||
<fieldset name="vars" data-cast-to="object">
|
||||
<div data-ls-loop="project-function.vars" data-ls-as="var" id="project-vars" style="visibility: visible;">
|
||||
<div class="margin-bottom-small">
|
||||
<div data-forms-remove class="row thin">
|
||||
<div class="col span-10">
|
||||
<input type="hidden" data-forms-key-value data-ls-attrs="name={{$index}}" data-ls-bind="{{var}}" />
|
||||
</div>
|
||||
<div class="col span-2">
|
||||
<button type="button" data-remove class="close pull-end is-margin-top-10"><i class="icon-trash"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-forms-clone="" data-target="project-vars" data-label="Add Variable" data-first="0">
|
||||
<div class="margin-bottom-small">
|
||||
<div data-forms-remove class="row thin">
|
||||
<div class="col span-10">
|
||||
<input type="hidden" data-ls-attrs="data-forms-key-value"/>
|
||||
</div>
|
||||
<div class="col span-2">
|
||||
<button type="button" data-remove class="close pull-end is-margin-top-10"><i class="icon-trash"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<hr class="margin-bottom margin-top-small" />
|
||||
|
||||
<button>Update</button>
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
|
|||
</div>
|
||||
|
||||
<ul class="chart-notes margin-bottom-large">
|
||||
<li class="orange">CPU Time <span data-ls-bind="({{usage.executionsTime|statsGetLast|seconds2hum}})"></span></li>
|
||||
<li class="orange">CPU Time <span data-ls-bind="({{usage.executionsTime|statsGetLast|ms2hum}})"></span></li>
|
||||
</ul>
|
||||
|
||||
<div class="box margin-bottom-small">
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
|
|||
<div class="margin-top-small"><b class="text-size-small unit">Users</b></div>
|
||||
</div>
|
||||
<div class="col span-3">
|
||||
<div class="value"><span class="sum" data-ls-bind="{{usage.functions|statsGetLast|statsTotal}}" data-default="0">0</span></div>
|
||||
<div class="value"><span class="sum" data-ls-bind="{{usage.executions|statsGetLast|statsTotal}}" data-default="0">0</span></div>
|
||||
<div class="margin-top-small"><b class="text-size-small unit">Executions</b></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -195,10 +195,10 @@ class BuildsV1 extends Worker
|
|||
$function->setAttribute('scheduleNext', $next);
|
||||
$function = $dbForProject->updateDocument('functions', $function->getId(), $function);
|
||||
} catch (\Throwable $th) {
|
||||
$endtime = DateTime::now();
|
||||
$interval = (new \DateTime($endtime))->diff(new \DateTime($startTime));
|
||||
$build->setAttribute('endTime', $endtime);
|
||||
$build->setAttribute('duration', $interval->format('%s'));
|
||||
$endTime = DateTime::now();
|
||||
$interval = (new \DateTime($endTime))->diff(new \DateTime($startTime));
|
||||
$build->setAttribute('endTime', $endTime);
|
||||
$build->setAttribute('duration', $interval->format('%s') + 0);
|
||||
$build->setAttribute('status', 'failed');
|
||||
$build->setAttribute('stderr', $th->getMessage());
|
||||
Console::error($th->getMessage());
|
||||
|
|
|
|||
2
composer.lock
generated
2
composer.lock
generated
|
|
@ -5384,5 +5384,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "8.0"
|
||||
},
|
||||
"plugin-api-version": "2.2.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
|
|
|||
7
public/dist/scripts/app-all.js
vendored
7
public/dist/scripts/app-all.js
vendored
|
|
@ -3973,12 +3973,7 @@ else if(seconds>=86400){value=Math.floor(seconds/86400);unit="day";}
|
|||
else if(seconds>=3600){value=Math.floor(seconds/3600);unit="hour";}
|
||||
else if(seconds>=60){value=Math.floor(seconds/60);unit="minute";}
|
||||
if(value!=1){unit=unit+"s";}
|
||||
return value+" "+unit+" "+direction;}).add("ms2hum",function($value){let temp=$value;const years=Math.floor(temp/31536000),days=Math.floor((temp%=31536000)/86400),hours=Math.floor((temp%=86400)/3600),minutes=Math.floor((temp%=3600)/60),seconds=temp%60;if(days||hours||seconds||minutes){return((years?years+"y ":"")+
|
||||
(days?days+"d ":"")+
|
||||
(hours?hours+"h ":"")+
|
||||
(minutes?minutes+"m ":"")+
|
||||
Number.parseFloat(seconds).toFixed(0)+"s");}
|
||||
return"< 1s";}).add("seconds2hum",function($value){var seconds=($value).toFixed(3);var minutes=($value/(60)).toFixed(1);var hours=($value/(60*60)).toFixed(1);var days=($value/(60*60*24)).toFixed(1);if(seconds<60){return seconds+"s";}else if(minutes<60){return minutes+"m";}else if(hours<24){return hours+"h";}else{return days+"d"}}).add("markdown",function($value,markdown){return markdown.render($value);}).add("pageCurrent",function($value,env){return Math.ceil(parseInt($value||0)/env.PAGING_LIMIT)+1;}).add("pageTotal",function($value,env){let total=Math.ceil(parseInt($value||0)/env.PAGING_LIMIT);return total?total:1;}).add("humanFileSize",function($value){if(!$value){return 0;}
|
||||
return value+" "+unit+" "+direction;}).add("ms2hum",function($value){$value=$value/1000;var seconds=($value).toFixed(3);var minutes=($value/(60)).toFixed(1);var hours=($value/(60*60)).toFixed(1);var days=($value/(60*60*24)).toFixed(1);if(seconds<1){return"< 1s";}else if(seconds<60){return seconds+"s";}else if(minutes<60){return minutes+"m";}else if(hours<24){return hours+"h";}else{return days+"d";}}).add("seconds2hum",function($value){var seconds=($value).toFixed(3);var minutes=($value/(60)).toFixed(1);var hours=($value/(60*60)).toFixed(1);var days=($value/(60*60*24)).toFixed(1);if(seconds<60){return seconds+"s";}else if(minutes<60){return minutes+"m";}else if(hours<24){return hours+"h";}else{return days+"d";}}).add("markdown",function($value,markdown){return markdown.render($value);}).add("pageCurrent",function($value,env){return Math.ceil(parseInt($value||0)/env.PAGING_LIMIT)+1;}).add("pageTotal",function($value,env){let total=Math.ceil(parseInt($value||0)/env.PAGING_LIMIT);return total?total:1;}).add("humanFileSize",function($value){if(!$value){return 0;}
|
||||
let thresh=1000;if(Math.abs($value)<thresh){return $value;}
|
||||
let units=["kB","MB","GB","TB","PB","EB","ZB","YB"];let u=-1;do{$value/=thresh;++u;}while(Math.abs($value)>=thresh&&u<units.length-1);return $value.toFixed(1);}).add("humanFileUnit",function($value){if(!$value){return'';}
|
||||
let thresh=1000;if(Math.abs($value)<thresh){return'B';}
|
||||
|
|
|
|||
7
public/dist/scripts/app.js
vendored
7
public/dist/scripts/app.js
vendored
|
|
@ -561,12 +561,7 @@ else if(seconds>=86400){value=Math.floor(seconds/86400);unit="day";}
|
|||
else if(seconds>=3600){value=Math.floor(seconds/3600);unit="hour";}
|
||||
else if(seconds>=60){value=Math.floor(seconds/60);unit="minute";}
|
||||
if(value!=1){unit=unit+"s";}
|
||||
return value+" "+unit+" "+direction;}).add("ms2hum",function($value){let temp=$value;const years=Math.floor(temp/31536000),days=Math.floor((temp%=31536000)/86400),hours=Math.floor((temp%=86400)/3600),minutes=Math.floor((temp%=3600)/60),seconds=temp%60;if(days||hours||seconds||minutes){return((years?years+"y ":"")+
|
||||
(days?days+"d ":"")+
|
||||
(hours?hours+"h ":"")+
|
||||
(minutes?minutes+"m ":"")+
|
||||
Number.parseFloat(seconds).toFixed(0)+"s");}
|
||||
return"< 1s";}).add("seconds2hum",function($value){var seconds=($value).toFixed(3);var minutes=($value/(60)).toFixed(1);var hours=($value/(60*60)).toFixed(1);var days=($value/(60*60*24)).toFixed(1);if(seconds<60){return seconds+"s";}else if(minutes<60){return minutes+"m";}else if(hours<24){return hours+"h";}else{return days+"d"}}).add("markdown",function($value,markdown){return markdown.render($value);}).add("pageCurrent",function($value,env){return Math.ceil(parseInt($value||0)/env.PAGING_LIMIT)+1;}).add("pageTotal",function($value,env){let total=Math.ceil(parseInt($value||0)/env.PAGING_LIMIT);return total?total:1;}).add("humanFileSize",function($value){if(!$value){return 0;}
|
||||
return value+" "+unit+" "+direction;}).add("ms2hum",function($value){$value=$value/1000;var seconds=($value).toFixed(3);var minutes=($value/(60)).toFixed(1);var hours=($value/(60*60)).toFixed(1);var days=($value/(60*60*24)).toFixed(1);if(seconds<1){return"< 1s";}else if(seconds<60){return seconds+"s";}else if(minutes<60){return minutes+"m";}else if(hours<24){return hours+"h";}else{return days+"d";}}).add("seconds2hum",function($value){var seconds=($value).toFixed(3);var minutes=($value/(60)).toFixed(1);var hours=($value/(60*60)).toFixed(1);var days=($value/(60*60*24)).toFixed(1);if(seconds<60){return seconds+"s";}else if(minutes<60){return minutes+"m";}else if(hours<24){return hours+"h";}else{return days+"d";}}).add("markdown",function($value,markdown){return markdown.render($value);}).add("pageCurrent",function($value,env){return Math.ceil(parseInt($value||0)/env.PAGING_LIMIT)+1;}).add("pageTotal",function($value,env){let total=Math.ceil(parseInt($value||0)/env.PAGING_LIMIT);return total?total:1;}).add("humanFileSize",function($value){if(!$value){return 0;}
|
||||
let thresh=1000;if(Math.abs($value)<thresh){return $value;}
|
||||
let units=["kB","MB","GB","TB","PB","EB","ZB","YB"];let u=-1;do{$value/=thresh;++u;}while(Math.abs($value)>=thresh&&u<units.length-1);return $value.toFixed(1);}).add("humanFileUnit",function($value){if(!$value){return'';}
|
||||
let thresh=1000;if(Math.abs($value)<thresh){return'B';}
|
||||
|
|
|
|||
2
public/dist/styles/default-ltr.css
vendored
2
public/dist/styles/default-ltr.css
vendored
File diff suppressed because one or more lines are too long
2
public/dist/styles/default-rtl.css
vendored
2
public/dist/styles/default-rtl.css
vendored
File diff suppressed because one or more lines are too long
|
|
@ -89,34 +89,28 @@ window.ls.filter
|
|||
return value + " " + unit + " " + direction;
|
||||
})
|
||||
.add("ms2hum", function ($value) {
|
||||
let temp = $value;
|
||||
const years = Math.floor(temp / 31536000),
|
||||
days = Math.floor((temp %= 31536000) / 86400),
|
||||
hours = Math.floor((temp %= 86400) / 3600),
|
||||
minutes = Math.floor((temp %= 3600) / 60),
|
||||
seconds = temp % 60;
|
||||
$value = $value / 1000;
|
||||
var seconds = ($value).toFixed(3);
|
||||
var minutes = ($value / (60)).toFixed(1);
|
||||
var hours = ($value / (60 * 60)).toFixed(1);
|
||||
var days = ($value / (60 * 60 * 24)).toFixed(1);
|
||||
|
||||
if (days || hours || seconds || minutes) {
|
||||
return (
|
||||
(years ? years + "y " : "") +
|
||||
(days ? days + "d " : "") +
|
||||
(hours ? hours + "h " : "") +
|
||||
(minutes ? minutes + "m " : "") +
|
||||
Number.parseFloat(seconds).toFixed(0) +
|
||||
"s"
|
||||
);
|
||||
if(seconds < 1) {
|
||||
return "< 1s";
|
||||
} else if (seconds < 60) {
|
||||
return seconds + "s";
|
||||
} else if (minutes < 60) {
|
||||
return minutes + "m";
|
||||
} else if (hours < 24) {
|
||||
return hours + "h";
|
||||
} else {
|
||||
return days + "d";
|
||||
}
|
||||
|
||||
return "< 1s";
|
||||
})
|
||||
.add("seconds2hum", function ($value) {
|
||||
|
||||
var seconds = ($value).toFixed(3);
|
||||
|
||||
var minutes = ($value / (60)).toFixed(1);
|
||||
|
||||
var hours = ($value / (60 * 60)).toFixed(1);
|
||||
|
||||
var days = ($value / (60 * 60 * 24)).toFixed(1);
|
||||
|
||||
if (seconds < 60) {
|
||||
|
|
@ -126,7 +120,7 @@ window.ls.filter
|
|||
} else if (hours < 24) {
|
||||
return hours + "h";
|
||||
} else {
|
||||
return days + "d"
|
||||
return days + "d";
|
||||
}
|
||||
})
|
||||
.add("markdown", function ($value, markdown) {
|
||||
|
|
|
|||
|
|
@ -1 +1,7 @@
|
|||
.u-margin-inline-end-16{margin-inline-end:16px!important;}
|
||||
.u-table-layout-normal {
|
||||
table-layout:revert!important;
|
||||
}
|
||||
|
||||
.u-margin-inline-end-16 {
|
||||
margin-inline-end:16px!important;
|
||||
}
|
||||
|
|
@ -38,6 +38,7 @@ class Attribute extends Model
|
|||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Is attribute an array?',
|
||||
'default' => false,
|
||||
'required' => false,
|
||||
'example' => false,
|
||||
])
|
||||
;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class AttributeBoolean extends Attribute
|
|||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => false
|
||||
])
|
||||
;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ class AttributeDatetime extends Attribute
|
|||
'default' => APP_DATABASE_ATTRIBUTE_DATETIME,
|
||||
'example' => APP_DATABASE_ATTRIBUTE_DATETIME,
|
||||
'array' => false,
|
||||
'require' => true,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_STRING,
|
||||
|
|
@ -37,7 +36,7 @@ class AttributeDatetime extends Attribute
|
|||
'default' => null,
|
||||
'example' => self::TYPE_DATETIME_EXAMPLE,
|
||||
'array' => false,
|
||||
'require' => false,
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ class AttributeEmail extends Attribute
|
|||
->addRule('format', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'String format.',
|
||||
'default' => 'email',
|
||||
'example' => 'email',
|
||||
'required' => true,
|
||||
'default' => APP_DATABASE_ATTRIBUTE_EMAIL,
|
||||
'example' => APP_DATABASE_ATTRIBUTE_EMAIL,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 'default@example.com',
|
||||
])
|
||||
;
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@ class AttributeEnum extends Attribute
|
|||
->addRule('format', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'String format.',
|
||||
'default' => 'enum',
|
||||
'example' => 'enum',
|
||||
'required' => true,
|
||||
'default' => APP_DATABASE_ATTRIBUTE_ENUM,
|
||||
'example' => APP_DATABASE_ATTRIBUTE_ENUM,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 'element',
|
||||
])
|
||||
;
|
||||
|
|
|
|||
|
|
@ -28,18 +28,21 @@ class AttributeFloat extends Attribute
|
|||
'type' => self::TYPE_FLOAT,
|
||||
'description' => 'Minimum value to enforce for new documents.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 1.5,
|
||||
])
|
||||
->addRule('max', [
|
||||
'type' => self::TYPE_FLOAT,
|
||||
'description' => 'Maximum value to enforce for new documents.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 10.5,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_FLOAT,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 2.5,
|
||||
])
|
||||
;
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ class AttributeIP extends Attribute
|
|||
->addRule('format', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'String format.',
|
||||
'default' => 'ip',
|
||||
'example' => 'ip',
|
||||
'required' => true,
|
||||
'default' => APP_DATABASE_ATTRIBUTE_IP,
|
||||
'example' => APP_DATABASE_ATTRIBUTE_IP,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => '192.0.2.0',
|
||||
])
|
||||
;
|
||||
|
|
|
|||
|
|
@ -28,18 +28,21 @@ class AttributeInteger extends Attribute
|
|||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Minimum value to enforce for new documents.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 1,
|
||||
])
|
||||
->addRule('max', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Maximum value to enforce for new documents.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 10,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 10,
|
||||
])
|
||||
;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class AttributeString extends Attribute
|
|||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 'default',
|
||||
])
|
||||
;
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ class AttributeURL extends Attribute
|
|||
->addRule('format', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'String format.',
|
||||
'default' => 'url',
|
||||
'example' => 'url',
|
||||
'required' => true,
|
||||
'default' => APP_DATABASE_ATTRIBUTE_URL,
|
||||
'example' => APP_DATABASE_ATTRIBUTE_URL,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 'http://example.com',
|
||||
])
|
||||
;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class Bucket extends Model
|
|||
->addRule('compression', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Compression algorithm choosen for compression. Will be one of ' . COMPRESSION_TYPE_NONE . ', [' . COMPRESSION_TYPE_GZIP . '](https://en.wikipedia.org/wiki/Gzip), or [' . COMPRESSION_TYPE_ZSTD . '](https://en.wikipedia.org/wiki/Zstd).',
|
||||
'default' => [],
|
||||
'default' => '',
|
||||
'example' => 'gzip',
|
||||
'array' => false
|
||||
])
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class Index extends Model
|
|||
'default' => [],
|
||||
'example' => [],
|
||||
'array' => true,
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ trait DatabasesBase
|
|||
]), [
|
||||
'collectionId' => ID::unique(),
|
||||
'name' => 'Response Models',
|
||||
'permissions' => [],
|
||||
// 'permissions' missing on purpose to make sure it's optional
|
||||
'documentSecurity' => true,
|
||||
]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue