Compare commits

...

11 Commits

Author SHA1 Message Date
lexx aa59e55a41 meta htmx 2025-05-15 19:18:03 +03:00
lexx 348bad80e0 Merge pull request 'Fix' (#23) from Catching-thumbnail-rebuild-error into dev
Reviewed-on: #23
2025-05-06 10:46:58 +00:00
arvanitakis f0d4686141 Fix 2025-05-06 13:46:00 +03:00
lexx a482ab3c7e login urls 2025-03-20 21:06:40 +02:00
lexx c580882ec0 fix url 2025-03-20 20:57:47 +02:00
lexx 2cf8379cbe urls update 2025-03-20 20:53:51 +02:00
lexx c39ec469df files bug 2025-01-22 20:03:12 +02:00
lexx 232fcc8845 csv render title 2024-12-18 13:02:09 +02:00
lexx 9d5d4dd930 csv relations 2024-12-14 18:56:04 +02:00
lexx c507dc6031 upload fix 2024-10-23 19:34:41 +03:00
lexx 843f560710 new build 2024-09-27 17:42:49 +03:00
14 changed files with 71 additions and 30 deletions
+2 -1
View File
@@ -14,7 +14,8 @@
"intervention/image": "^2.7",
"phpoption/phpoption": "^1.9",
"spatie/image-optimizer": "^1.6",
"staudenmeir/laravel-cte": "^1.0"
"staudenmeir/laravel-cte": "^1.0",
"mustache/mustache": "^2.14"
},
"require-dev": {
Generated
+3 -3
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "71cf4c1de3d614ce2f9607763bf5687f",
"content-hash": "e8fb1bee28ad339453d50110f7fea2f5",
"packages": [
{
"name": "brick/math",
@@ -5729,8 +5729,8 @@
"ext-zip": "*",
"ext-sqlite3": "*",
"ext-imagick": "*",
"php": "^8.3",
"ext-pdo": "*"
"ext-pdo": "*",
"php": "^8.3"
},
"platform-dev": [],
"plugin-api-version": "2.3.0"
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,11 +1,11 @@
{
"main.js": {
"file": "assets/main-BLsQ9H2G.js",
"file": "assets/main-BJyanQ7P.js",
"name": "main",
"src": "main.js",
"isEntry": true,
"css": [
"assets/main-BH4PSFwy.css"
"assets/main-Dk7njt4m.css"
]
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
<div class="form">
<h2 class="mb-5">Enter Lucent</h2>
<form hx-post="/lucent/login" >
<form hx-post="{{url('lucent/login')}}" >
@csrf
<p>Submit your email address and you will receive a <b>login link</b> to your email</p>
<p>Don't forget to check your spam folder</p>
+1 -1
View File
@@ -9,7 +9,7 @@
<div class="form">
<h2 class="mb-5">Welcome to Lucent</h2>
<form hx-post="/lucent/verify" hx-redirect="/lucent" hx-target-error=".form-errors" >
<form hx-post="{{url('lucent/verify')}}" hx-redirect="{{url('lucent')}}" hx-target-error=".form-errors" >
<input type="hidden" value="{{$email}}" name="email" />
<input type="hidden" value="{{$token}}" name="token" />
@csrf
+4 -4
View File
@@ -6,11 +6,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>@yield('title') - Lucent Data Platform</title>
<meta name="htmx-config" content='{"selfRequestsOnly": false}' />
@if(config("lucent.env") === "production")
<!-- if production -->
<link rel="stylesheet" href="/vendor/lucent/dist/{{ $manifest['main.js']["css"][0] }}"/>
<script type="module" src="/vendor/lucent/dist/{{ $manifest['main.js']["file"] }}"></script>
<link rel="stylesheet" href="{{url('vendor/lucent/dist/'.$manifest['main.js']["css"][0])}}"/>
<script type="module" src="{{url('vendor/lucent/dist/'.$manifest['main.js']["file"])}}"></script>
@else
<!-- if development -->
@php
@@ -20,7 +20,7 @@
@endif
{{-- <link rel="icon" type="image/x-icon" href="/favicon.ico"/>--}}
<link rel="icon" type="image/x-icon" href="{{url('favicon.ico')}}">
</head>
+5 -7
View File
@@ -8,8 +8,8 @@
<title>@yield('title') - Lucent Data Platform</title>
@if(config("lucent.env") == "production")
<!-- if production -->
<link rel="stylesheet" href="/vendor/lucent/dist/{{ $manifest['main.js']["css"][0] }}"/>
<script type="module" src="/vendor/lucent/dist/{{ $manifest['main.js']["file"] }}"></script>
<link rel="stylesheet" href="{{url('vendor/lucent/dist/'.$manifest['main.js']["css"][0])}}"/>
<script type="module" src="{{url('vendor/lucent/dist/'.$manifest['main.js']["file"])}}"></script>
@else
<!-- if development -->
@php
@@ -18,16 +18,14 @@
<script type="module" crossorigin src="http://127.0.0.1:5173/main.js"></script>
@endif
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="icon" type="image/x-icon" href="{{url('favicon.ico')}}">
</head>
<body>
@yield('content')
</body>
</html>
+6 -1
View File
@@ -45,7 +45,12 @@ class RebuildThumbnails extends Command
$records = $this->query->filter(["schema" => $schema->name])->run()->records;
$disk = $this->fileService->loadDisk($schema->disk);
foreach ($records as $record) {
$this->fileService->createTemplates($disk, $record->_file->path);
try{
$this->fileService->createTemplates($disk, $record->_file->path);
} catch (Exception $e) {
echo "File ". $record->_file->originalName . " could not be rebuilt \n" ;
}
}
}
+6 -2
View File
@@ -79,7 +79,10 @@ class FileService
throw new LucentException("File $filename not uploaded");
}
$this->createTemplates($disk, $path, $file);
if($this->isImage($mimetype)){
$this->createTemplates($disk, $path);
}
list($width, $height) = $this->isImage($mimetype) ? getimagesize($file) : [0, 0];
$recordFile = new RecordFile(
@@ -133,7 +136,8 @@ class FileService
{
$originalImage = $this->imageManager->make($disk->get($path));
foreach (config("lucent.imageFilters") as $preset => $filterClass) {
$image = $originalImage->filter(new $filterClass);
$imageClone = clone $originalImage;
$image = $imageClone->filter(new $filterClass);
$templateUri = "/templates/" . $preset . "/" . $path;
$disk->put($templateUri, $image->encode('webp', 75));
}
+36 -3
View File
@@ -17,8 +17,10 @@ use Lucent\Record\QueryRecord;
use Lucent\Record\RecordService;
use Lucent\Record\Status;
use Lucent\Schema\System;
use Lucent\Schema\Ui\Reference;
use Lucent\Schema\Validator\ValidatorException;
use Lucent\Svelte\Svelte;
use Lucent\ViewModel\ViewModel;
use function Lucent\Response\fail;
use function Lucent\Response\ok;
@@ -31,7 +33,8 @@ class RecordController extends Controller
private readonly Svelte $svelte,
private readonly Query $query,
private readonly Manager $recordManager,
private readonly OperatorRegistry $operatorRegistry
private readonly OperatorRegistry $operatorRegistry,
private readonly ViewModel $viewModel,
)
{
}
@@ -134,18 +137,22 @@ class RecordController extends Controller
->filter($arguments)
->limit(-1)
->status(explode(",", $arguments["status_in"]))
->childrenDepth(1)
// ->skip($skip)
->sort($sort)
->run()
->records;
->tree();
header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename="' . $schemaName . '.csv";');
$handle = fopen('php://output', 'w');
$csvRow = ["id", ...array_keys($records[0]->data->toArray())];
$relationColumns = $this->makeCsvRelationColumns($schema);
$csvRow = ["id", ...array_keys($records[0]->data->toArray()),...$relationColumns];
fputcsv($handle, $csvRow, ',');
foreach ($records as $record) {
$csvRow = [$record->id, ...$record->data->toArray()];
$csvRow = array_merge($csvRow,$this->makeCsvRelationColumnValues($schema,$record->_children));
$csvRow = array_values($csvRow);
fputcsv($handle, $csvRow, ',');
}
@@ -154,6 +161,32 @@ class RecordController extends Controller
exit;
}
private function makeCsvRelationColumns($schema):array{
return $schema->fields->filter(fn($f) => get_class($f) === Reference::class)->reduce(function($c,$f){
$c[] = $f->name." id";
$c[] = $f->name." name";
return $c;
},[]);
}
private function makeCsvRelationColumnValues($schema, $children):array{
return $schema->fields->filter(fn($f) => get_class($f) === Reference::class)->reduce(function($c,$f) use($children){
$fieldRecords = data_get($children,$f->name);
if(empty($fieldRecords)){
$c[] = "";
$c[] = "";
}elseif (count($fieldRecords) === 1){
$c[] = data_get($fieldRecords,"0.id");
$c[] = $this->viewModel->getRecordName($fieldRecords[0]);
}else{
$c[] = collect($fieldRecords)->pluck("id")->join("::");
$c[] = collect($fieldRecords)->pluck("data.name")->join("::");
}
return $c;
},[]);
}
public function new(Request $request)
{
if (!in_array($request->input("schema"), $this->accountService->currentWritableSchemas())) {
+1 -1
View File
@@ -21,7 +21,7 @@ class ViewModel
public function getRecordName(QueryRecord $record): string
{
$schema = $this->channelService->getSchema($record->schema)->get();
if (empty($schema->titleTemplate)) {
if (empty($schema->cardTitle)) {
$title = match (get_class($schema)) {
CollectionSchema::class => $record->data[$schema->fields->filter(fn(FieldInterface $f) => $f->info->name === "text")->first()->name],
FilesSchema::class => $record->_file->path,