]> gitweb.hamatoma.de Git - worxer.git/commitdiff
V0.0.3 InitApp.sh improvements
authorWinfried Kappeler <winfried.kappeler@infeos.eu>
Thu, 28 Mar 2024 21:32:53 +0000 (22:32 +0100)
committerWinfried Kappeler <winfried.kappeler@infeos.eu>
Thu, 28 Mar 2024 21:32:53 +0000 (22:32 +0100)
- InitApp.sh improvements:
  - installing npm
  - installing vite

CHANGELOG.md
app/Http/Controllers/Word2Controller.php [deleted file]
scripts/InitApp.sh

index c9eb20853e9fd85ab76ad5d3f71370e7abc96127..19971ad17ff8d5c90c3e859ffeedfdcfab674dd3 100644 (file)
@@ -1,3 +1,12 @@
+# V0.0.3 InitApp.sh improvements
+
+## Changed
+
+- InitApp.sh improvements:
+  - installing npm
+  - installing vite
+
+
 # V0.0.2 InitApp.sh improvements
 
 ## Changed
diff --git a/app/Http/Controllers/Word2Controller.php b/app/Http/Controllers/Word2Controller.php
deleted file mode 100644 (file)
index 40c9998..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-<?php
-
-namespace App\Http\Controllers;
-
-use Illuminate\Http\Request;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Route;
-use Illuminate\Support\Facades\Validator;
-use App\Models\Word;
-use App\Models\SProperty;
-use App\Helpers\ContextLaraKnife;
-use App\Helpers\ViewHelper;
-use App\Helpers\DbHelper;
-use App\Helpers\Helper;
-use App\Helpers\Pagination;
-
-class WordController extends Controller
-{
-    /**
-     * Show the form for creating a new resource.
-     */
-    public function create(Request $request)
-    {
-        if ($request->btnSubmit === 'btnCancel') {
-            $rc = redirect('/word-index');
-        } else {
-            $fields = $request->all();
-            if (count($fields) === 0) {
-                $fields = [
-                    'name' => '',
-                    'usage' => '',
-                    'wordtype_scope' => '',
-                    'verifiedby_id' => ''
-                ];
-            }
-            $optionsWordtype = SProperty::optionsByScope('wordtype', $fields['wordtype_scope'], '-');
-            $optionsVerifiedby = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['verifiedby_id'], __('<Please select>'));
-            $context = new ContextLaraKnife($request, $fields);     
-            $rc = view('word.create', [
-                'context' => $context,
-                'optionsWordtype' => $optionsWordtype,
-                'optionsVerifiedby' => $optionsVerifiedby,
-                ]);
-        }
-        return $rc;
-    }
-    /**
-     * Show the form for editing the specified resource.
-     */
-    public function edit(Word $word, Request $request)
-    {
-        if ($request->btnSubmit === 'btnCancel') {
-            $rc = redirect('/word-index');
-        } else {
-            $fields = $request->all();
-            if (count($fields) === 0) {
-                $fields = [
-                    'name' => '',
-                    'usage' => '',
-                    'wordtype_scope' => '',
-                    'verifiedby_id' => ''
-                    ];
-            }
-            $optionsWordtype = SProperty::optionsByScope('wordtype', $word->wordtype_scope, '');
-            $optionsVerifiedby = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['verifiedby_id'], __('<Please select>'));
-            $context = new ContextLaraKnife($request, null, $word);
-            $rc = view('word.edit', [
-                'context' => $context,
-                'optionsWordtype' => $optionsWordtype,
-                'optionsVerifiedby' => $optionsVerifiedby,
-                ]);
-        }
-        return $rc;
-    }
-    /**
-     * Remove the specified resource from storage.
-     */
-    public function destroy(Word $word, Request $request)
-    {
-        if ($request->btnSubmit === 'btnDelete') {
-            $word->delete();
-        }
-        return redirect('/word-index');
-    }
-    /**
-     * Display the database records of the resource.
-     */
-    public function index(Request $request)
-    {
-        if ($request->btnSubmit === 'btnNew') {
-            return redirect('/word-create');
-        } else {
-            $sql = 'SELECT t0.*, t1.name as wordtype_scope, t2.name as verifiedby_id '
-                . ' FROM words t0'
-                . ' LEFT JOIN sproperties t1 ON t1.id=t0.wordtype_scope'
-                . ' LEFT JOIN sproperties t2 ON t2.id=t0.verifiedby_id'
-                ;
-            $parameters = [];
-            $fields = $request->all();
-            if (count($fields) == 0) {
-                $fields = [
-                'wordtype' => '',
-                'verifiedby' => '',
-                'name' => '',
-                'usage' => '',
-                '_sortParams' => 'id:asc' 
-                                . ';name:desc'
-                ];
-            } else {
-                $conditions = [];
-                ViewHelper::addConditionPattern($conditions, $parameters, 't0.name', 'name');
-                ViewHelper::addConditionComparism($conditions, $parameters, 'wordtype_scope', 'wordtype');
-                ViewHelper::addConditionComparism($conditions, $parameters, 'verifiedby_id', 'verifiedby');
-                ViewHelper::addConditionPattern($conditions, $parameters, 'usage');
-                $sql = DbHelper::addConditions($sql, $conditions);
-            }
-            $sql = DbHelper::addOrderBy($sql, $fields['_sortParams']);
-            $pagination = new Pagination($sql, $parameters, $fields);
-            $records = $pagination->records;
-            $optionsWordtype = SProperty::optionsByScope('wordtype', $fields['wordtype'], 'all');
-            $optionsVerifiedby = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['verifiedby'], __('<All>'));
-            $context = new ContextLaraKnife($request, $fields);
-            return view('word.index', [
-                'context' => $context,
-                'records' => $records,
-                'optionsWordtype' => $optionsWordtype,
-                'optionsVerifiedby' => $optionsVerifiedby,
-                'pagination' => $pagination
-            ]);
-        }
-    }
-    /**
-     * Returns the validation rules.
-     * @return array<string, string> The validation rules.
-     */
-    private function rules(bool $isCreate=false): array
-    {
-        $rc = [
-            'name' => 'required',
-            'usage' => 'required',
-            'verifiedby_id' => ''
-        ];
-        return $rc;
-    }
-    public static function routes()
-    {
-        Route::get('/word-index', [WordController::class, 'index'])->middleware('auth');
-        Route::post('/word-index', [WordController::class, 'index'])->middleware('auth');
-        Route::get('/word-create', [WordController::class, 'create'])->middleware('auth');
-        Route::put('/word-store', [WordController::class, 'store'])->middleware('auth');
-        Route::post('/word-edit/{word}', [WordController::class, 'edit'])->middleware('auth');
-        Route::get('/word-edit/{word}', [WordController::class, 'edit'])->middleware('auth');
-        Route::post('/word-update/{word}', [WordController::class, 'update'])->middleware('auth');
-        Route::get('/word-show/{word}/delete', [WordController::class, 'show'])->middleware('auth');
-        Route::delete('/word-show/{word}/delete', [WordController::class, 'destroy'])->middleware('auth');
-    }
-    /**
-     * Display the specified resource.
-     */
-    public function show(Word $word, Request $request)
-    {
-        if ($request->btnSubmit === 'btnCancel') {
-            $rc = redirect('/word-index')->middleware('auth');
-        } else {
-            $fields = $request->all();
-            $optionsWordtype = SProperty::optionsByScope('wordtype', $word->wordtype_scope, '');
-            $optionsVerifiedby = DbHelper::comboboxDataOfTable('users', 'name', 'id', $word->verifiedby_id, __('<Please select>'));
-            $context = new ContextLaraKnife($request, null, $word);
-            $rc = view('word.show', [
-                'context' => $context,
-                'optionsWordtype' => $optionsWordtype,
-                'optionsVerifiedby' => $optionsVerifiedby,
-                'mode' => 'delete'
-                ]);
-        }
-        return $rc;
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     */
-    public function store(Request $request)
-    {
-        $rc = null;
-        if ($request->btnSubmit === 'btnStore') {
-            $fields = $request->all();
-            $validator = Validator::make($fields, $this->rules(true));
-            if ($validator->fails()) {
-                $rc = back()->withErrors($validator)->withInput();
-            } else {
-                $validated = $validator->validated();
-            $validated['usage'] = strip_tags($validated['usage']);
-                Word::create($validated);
-            }
-        }
-        if ($rc == null){
-            $rc = redirect('/word-index');
-        }
-        return $rc;
-    }
-    /**
-     * Update the specified resource in storage.
-     */
-    public function update(Word $word, Request $request)
-    {
-        $rc = null;
-        $session = $request->session();
-        if ($request->btnSubmit === 'btnStore') {
-            $fields = $request->all();
-            $validator = Validator::make($fields, $this->rules(false));
-            if ($validator->fails()) {
-                $errors = $validator->errors();
-                $rc = back()->withErrors($validator)->withInput();
-            } else {
-                $validated = $validator->validated();
-                $validated['usage'] = strip_tags($validated['usage']);
-                $word->update($validated);
-            }
-        }
-        if ($rc == null){
-            $rc = redirect('/word-index');
-        }
-        return $rc;
-    }
-}
index 377a7caa681ff7d6b1f8ab9facec0f9d4d0bc41c..ad8eb050e10f148ba13327dcd33adcf086df608b 100755 (executable)
@@ -26,7 +26,7 @@ function LinkLaraknife(){
 function DoIt(){
   # get DEV_USER
   . .dev.user
-  apt update && apt install composer
+  apt update && apt install composer npm
   LinkLaraknife
   CreateStorage
   Wait
@@ -37,7 +37,10 @@ function DoIt(){
   Wait
   SeedIt
   Wait
+  egrep '"vite":' package.json && sudo -u $DEV_USER npm install vite
+  Wait
   sudo -u $DEV_USER npm run build
+  echo "see .lrv.credential for first login"
 }
 if [ ! -d ../laraknife ]; then
   echo "+++ missing ../laraknife"