Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a482ab3c7e | |||
| c580882ec0 | |||
| 2cf8379cbe | |||
| c39ec469df | |||
| 232fcc8845 | |||
| 9d5d4dd930 |
+2
-1
@@ -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
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
@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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -80,7 +80,7 @@ class FileService
|
||||
}
|
||||
|
||||
if($this->isImage($mimetype)){
|
||||
$this->createTemplates($disk, $path, $file);
|
||||
$this->createTemplates($disk, $path);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,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));
|
||||
}
|
||||
|
||||
@@ -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())) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user