fixes and stuff

This commit is contained in:
2024-09-11 16:21:51 +03:00
parent 8ac0567e66
commit f868219981
10 changed files with 141 additions and 115 deletions
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": { "main.js": {
"file": "assets/main-D9joEh0I.js", "file": "assets/main-BC8xx0YD.js",
"name": "main", "name": "main",
"src": "main.js", "src": "main.js",
"isEntry": true, "isEntry": true,
"css": [ "css": [
"assets/main-BnJW41Dx.css" "assets/main-BH4PSFwy.css"
] ]
} }
} }
+7
View File
@@ -83,7 +83,11 @@
{#if record._file?.path} {#if record._file?.path}
<div class="file-table-row"> <div class="file-table-row">
<Preview record={record} size={record._file?.width > 0 ? "medium" : "small"}/> <Preview record={record} size={record._file?.width > 0 ? "medium" : "small"}/>
<div> <div>
{#if record.status === "draft"}
<span style="text-transform: uppercase;font-size:10px">{record.status}</span>
{/if}
<a <a
href="{channel.lucentUrl}/records/{record.id}" href="{channel.lucentUrl}/records/{record.id}"
target={inModal ? "_blank" : "_self"} target={inModal ? "_blank" : "_self"}
@@ -109,6 +113,9 @@
href="{channel.lucentUrl}/records/{record.id}" href="{channel.lucentUrl}/records/{record.id}"
target={inModal ? "_blank" : "_self"} target={inModal ? "_blank" : "_self"}
> >
{#if record.status === "draft"}
<span style="text-transform: uppercase;font-size:10px">{record.status}</span>
{/if}
{previewTitle(channel.schemas, record, graph)} {previewTitle(channel.schemas, record, graph)}
</a> </a>
{/if} {/if}
+9
View File
@@ -16,6 +16,15 @@ class SetupDatabase extends Command
public function handle() public function handle()
{ {
$dbConnection = config("lucent.database");
$databasePath = config("database.connections.$dbConnection.database");
if(file_exists($databasePath)){
$this->error("Database already exists.");
return 0;
}
touch($databasePath);
$this->tableUsers(); $this->tableUsers();
$this->tableRecords(); $this->tableRecords();
$this->tableRevisions(); $this->tableRevisions();
+1 -1
View File
@@ -2,7 +2,7 @@
return [ return [
"env" => env("LUCENT_ENV", "production"), "env" => env("LUCENT_ENV", "production"),
"schemas_path" => env("LUCENT_SCHEMAS_PATH", "app/Lucent"), "schemas_path" => env("LUCENT_SCHEMAS_PATH", "resources/lucent/schemas"),
"database" => env('LUCENT_DB_CONNECTION', env('DB_CONNECTION', "sqlite")), "database" => env('LUCENT_DB_CONNECTION', env('DB_CONNECTION', "sqlite")),
"name" => env("LUCENT_NAME", "Lucent"), "name" => env("LUCENT_NAME", "Lucent"),
"url" => env("LUCENT_URL", env('APP_URL')), "url" => env("LUCENT_URL", env('APP_URL')),
+1
View File
@@ -9,6 +9,7 @@ class Database
{ {
public static function make(): Connection{ public static function make(): Connection{
$dbConnection = config("lucent.database"); $dbConnection = config("lucent.database");
return DB::connection($dbConnection); return DB::connection($dbConnection);
} }
-1
View File
@@ -39,7 +39,6 @@ class FileController extends Controller
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
'files.*' => 'required|file|max:100000', 'files.*' => 'required|file|max:100000',
]); ]);
if ($validator->fails()) { if ($validator->fails()) {
return fail($validator->errors()->first()); return fail($validator->errors()->first());
} }
+10
View File
@@ -17,7 +17,9 @@ class DatabaseSetupStep implements IStep
$databaseConnectionName = config("lucent.database"); $databaseConnectionName = config("lucent.database");
$databaseConfig = config('database.connections.'.$databaseConnectionName); $databaseConfig = config('database.connections.'.$databaseConnectionName);
if (empty($databaseConfig)) { if (empty($databaseConfig)) {
$instructions = <<<EOD $instructions = <<<EOD
# You need to setup a database connection for $databaseConnectionName in database.php config. You can choose either sqlite or pgsql # You need to setup a database connection for $databaseConnectionName in database.php config. You can choose either sqlite or pgsql
@@ -35,6 +37,14 @@ EOD;
return SetupStep::makeFail($name, $instructions); return SetupStep::makeFail($name, $instructions);
} }
if(!in_array($driver = $databaseConfig["driver"],["sqlite","pgsql"])){
$instructions = <<<EOD
You can choose either sqlite or pgsql. You current config is: $driver
EOD;
return SetupStep::makeFail($name, $instructions);
}
try { try {
Database::make()->table("records")->get(); Database::make()->table("records")->get();
} catch (QueryException $e) { } catch (QueryException $e) {