diff --git a/.gitattributes b/.gitattributes index 967315d..42782b7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,6 @@ *.scss linguist-vendored *.js linguist-vendored CHANGELOG.md export-ignore + +/public/css/* -diff +/public/js/* -diff diff --git a/.gitignore b/.gitignore index 80c27a5..3de754b 100644 --- a/.gitignore +++ b/.gitignore @@ -57,7 +57,7 @@ fabric.properties # .idea/misc.xml # *.ipr storage/clockwork/ -public/css/ -public/js/ -public/fonts/ -public/webfonts/ +#public/css/ +#public/js/ +#public/fonts/ +#public/webfonts/ diff --git a/README.md b/README.md index fa66e05..e4f17b3 100644 --- a/README.md +++ b/README.md @@ -18,20 +18,9 @@ GeekBench 5 scores to do easier comparing and sorting. ## Project sponsor -[Cloud Five Limited](https://cloud-v.net/) for providing the hosting for demo installation. +Currently seeking a project sponsor -## 2.1.8 changes (20th October 2022): - -#### You can no longer use the form to submit YABS results -yabs.sh now has JSON formatted response and can POST the output directly from calling the script. - -With My idlers you can use your API key and the server id to directly POST the benchmark result - -`http://domain.com/api/yabs/tnSJLyhz/USERAPIKEYISHERE` - -Example yabs.sh call to POST the result - -`curl -sL yabs.sh | bash -s -- -s "http://domain.com/api/yabs/tnSJLyhz/USERAPIKEYISHERE"` +## 2.1.9 changes (2nd December 2022): ### NPM / Laravel mix now in use @@ -43,18 +32,15 @@ npm run prod #### Please run the following if updating from existing install: ```shell +php artisan migrate php artisan route:cache php artisan cache:clear ``` -* Added & implemented details footer blade component -* Added new index layout -* Updated domains, misc, reseller, seedboxes and shared use new index layout -* Updated validation for store and update -* Updated `updatePricing()` to not need `$as_usd` parameter -* Updated labels assigned insert -* Updated order/sort by methods for pricing related columns -* Removed add YABS button on servers index page +* Added & implemented NPM webpack +* Added compiled assets +* Added notes (Servers, shared, reseller, domains, DNS and IPs) +* Fixed create views default provider is no longer the former sponsor ## Requires @@ -78,6 +64,7 @@ php artisan cache:clear * Assign labels * Assign server type (KVM, OVZ, LXC & dedi) * Easy to edit values +* Assign notes ## Install @@ -120,6 +107,18 @@ Run with a single click on [PikaPods.com](https://www.pikapods.com/) [![PikaPods](https://www.pikapods.com/static/run-button.svg)](https://www.pikapods.com/pods?run=my-idlers) +## Adding a YABS benchmark + +yabs.sh now has JSON formatted response and can POST the output directly from calling the script. + +With My idlers you can use your API key and the server id to directly POST the benchmark result + +`https://yourdomain.com/api/yabs/SERVERID/USERAPIKEYISHERE` + +Example yabs.sh call to POST the result: + +`curl -sL yabs.sh | bash -s -- -s "https://yourdomain.com/api/yabs/SERVERID/USERAPIKEYISHERE"` + ## API endpoints For GET requests the header must have `Accept: application/json` and your API token (found at `/account`) diff --git a/app/Http/Controllers/NoteController.php b/app/Http/Controllers/NoteController.php new file mode 100644 index 0000000..038b84d --- /dev/null +++ b/app/Http/Controllers/NoteController.php @@ -0,0 +1,124 @@ +validate([ + 'service_id' => 'required|string|size:8', + 'note' => 'required|string', + ]); + + try { + $note_id = Str::random(8); + + $a = Note::create([ + 'id' => $note_id, + 'service_id' => $request->service_id, + 'note' => $request->note + ]); + + } catch (\Exception $e) { + + if ($e->getCode() === "23000") { + $message = "A note already exists for this service"; + } else { + $message = "Error inserting note"; + } + + return redirect()->route('notes.create') + ->withInput($request->input())->with('error', $message); + } + + Cache::forget('all_notes'); + + return redirect()->route('notes.index') + ->with('success', 'Note created successfully.'); + } + + public function edit(Note $note) + { + $note = Note::note($note->service_id); + $servers = Server::all(); + $shareds = Shared::all(); + $resellers = Reseller::all(); + $domains = Domains::all(); + $dns = DNS::all(); + $ips = IPs::all(); + + return view('notes.edit', compact(['note', 'servers', 'shareds', 'resellers', 'domains', 'dns', 'ips'])); + } + + public function update(Request $request, Note $note) + { + $request->validate([ + 'service_id' => 'required|string|size:8', + 'note' => 'required|string' + ]); + + $note->update([ + 'service_id' => $request->service_id, + 'note' => $request->note + ]); + + Cache::forget('all_notes'); + Cache::forget("note.$note->service_id"); + + return redirect()->route('notes.index') + ->with('success', 'Note was updated successfully.'); + } + + public function show(Note $note) + { + $note = Note::note($note->service_id); + return view('notes.show', compact(['note'])); + } + + public function destroy(Note $note) + { + if ($note->delete()) { + Cache::forget("all_notes"); + Cache::forget("note.$note->service_id"); + + return redirect()->route('notes.index') + ->with('success', 'Note was deleted successfully.'); + } + + return redirect()->route('notes.index') + ->with('error', 'Note was not deleted.'); + + } + +} diff --git a/app/Models/DNS.php b/app/Models/DNS.php index 6cb1df2..ac52e82 100644 --- a/app/Models/DNS.php +++ b/app/Models/DNS.php @@ -25,4 +25,10 @@ class DNS extends Model return DB::table('d_n_s')->count(); }); } + + public function note(): \Illuminate\Database\Eloquent\Relations\HasOne + { + return $this->hasOne(Note::class, 'service_id', 'id'); + } + } diff --git a/app/Models/Domains.php b/app/Models/Domains.php index 5172992..59127eb 100644 --- a/app/Models/Domains.php +++ b/app/Models/Domains.php @@ -56,4 +56,9 @@ class Domains extends Model return $this->hasMany(LabelsAssigned::class, 'service_id', 'id'); } + public function note(): \Illuminate\Database\Eloquent\Relations\HasOne + { + return $this->hasOne(Note::class, 'service_id', 'id'); + } + } diff --git a/app/Models/IPs.php b/app/Models/IPs.php index 1dbb5eb..c5beddb 100644 --- a/app/Models/IPs.php +++ b/app/Models/IPs.php @@ -47,4 +47,9 @@ class IPs extends Model }); } + public function note(): \Illuminate\Database\Eloquent\Relations\HasOne + { + return $this->hasOne(Note::class, 'service_id', 'id'); + } + } diff --git a/app/Models/Note.php b/app/Models/Note.php new file mode 100644 index 0000000..6ab7d6d --- /dev/null +++ b/app/Models/Note.php @@ -0,0 +1,66 @@ +addMonth(1), function () use ($service_id) { + return self::where('service_id', $service_id)->with(['server', 'shared', 'reseller', 'domain', 'dns', 'ip'])->first(); + }); + } + + public static function allNotes() + { + return Cache::remember("all_notes", now()->addMonth(1), function () { + return self::with(['server', 'shared', 'reseller', 'domain', 'dns', 'ip'])->orderBy('created_at', 'desc')->get(); + }); + } + + public function server(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Server::class, 'service_id', 'id'); + } + + public function shared(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Shared::class, 'service_id', 'id'); + } + + public function reseller(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Reseller::class, 'service_id', 'id'); + } + + public function domain(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(Domains::class, 'service_id', 'id'); + } + + public function dns(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(DNS::class, 'service_id', 'id'); + } + + public function ip(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(IPs::class, 'service_id', 'id'); + } + +} diff --git a/app/Models/Reseller.php b/app/Models/Reseller.php index fb5c6c6..54c9d47 100644 --- a/app/Models/Reseller.php +++ b/app/Models/Reseller.php @@ -78,4 +78,9 @@ class Reseller extends Model return $this->hasMany(LabelsAssigned::class, 'service_id', 'id'); } + public function note(): \Illuminate\Database\Eloquent\Relations\HasOne + { + return $this->hasOne(Note::class, 'service_id', 'id'); + } + } diff --git a/app/Models/Server.php b/app/Models/Server.php index 16ad201..e424358 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -234,4 +234,9 @@ class Server extends Model return $this->hasMany(LabelsAssigned::class, 'service_id', 'id'); } + public function note(): \Illuminate\Database\Eloquent\Relations\HasOne + { + return $this->hasOne(Note::class, 'service_id', 'id'); + } + } diff --git a/app/Models/Shared.php b/app/Models/Shared.php index 3cca635..f26e86b 100644 --- a/app/Models/Shared.php +++ b/app/Models/Shared.php @@ -78,4 +78,9 @@ class Shared extends Model return $this->hasMany(LabelsAssigned::class, 'service_id', 'id'); } + public function note(): \Illuminate\Database\Eloquent\Relations\HasOne + { + return $this->hasOne(Note::class, 'service_id', 'id'); + } + } diff --git a/database/migrations/2022_12_02_000007_create_notes_table.php b/database/migrations/2022_12_02_000007_create_notes_table.php new file mode 100644 index 0000000..8dce8d7 --- /dev/null +++ b/database/migrations/2022_12_02_000007_create_notes_table.php @@ -0,0 +1,23 @@ +char('id', 8)->primary(); + $table->char('service_id', 8)->unique(); + $table->text('note'); + $table->timestamps(); + }); + } + + public function down() + { + Schema::dropIfExists('notes'); + } +}; diff --git a/public/css/app.css b/public/css/app.css index 36aae37..7a2263d 100644 Binary files a/public/css/app.css and b/public/css/app.css differ diff --git a/public/css/dark.css b/public/css/dark.css new file mode 100644 index 0000000..665d32d Binary files /dev/null and b/public/css/dark.css differ diff --git a/public/css/light.css b/public/css/light.css new file mode 100644 index 0000000..b0add7c Binary files /dev/null and b/public/css/light.css differ diff --git a/public/js/app.js b/public/js/app.js index 56c33b1..fc0b997 100644 Binary files a/public/js/app.js and b/public/js/app.js differ diff --git a/public/js/app.js.LICENSE.txt b/public/js/app.js.LICENSE.txt new file mode 100644 index 0000000..2c9b099 Binary files /dev/null and b/public/js/app.js.LICENSE.txt differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 2d60117..21c4155 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,6 @@ { "/js/app.js": "/js/app.js", - "/css/app.css": "/css/app.css" + "/css/app.css": "/css/app.css", + "/css/dark.css": "/css/dark.css", + "/css/light.css": "/css/light.css" } diff --git a/resources/views/dns/show.blade.php b/resources/views/dns/show.blade.php index 57329e9..0d267e1 100644 --- a/resources/views/dns/show.blade.php +++ b/resources/views/dns/show.blade.php @@ -88,6 +88,12 @@ +
Note:
+{{$dns->note->note}}
+ @endif +Note:
+{{$domain_info->note->note}}
+ @endif +Service | +Type | +Note Preview | +Actions | +
---|---|---|---|
+ @if(!is_null($n->server)) + {{$n->server->hostname}} + @elseif(!is_null($n->shared)) + {{$n->shared->main_domain}} + @elseif(!is_null($n->reseller)) + {{$n->reseller->main_domain}} + @elseif(!is_null($n->domain)) + {{$n->domain->domain}}.{{$n->domain->extension}} + @elseif(!is_null($n->dns)) + {{$n->dns->dns_type}} {{$n->dns->hostname}} + @elseif(!is_null($n->ip)) + {{$n->ip->address}} + @endif + | ++ @if(!is_null($n->server)) + SERVER + @elseif(!is_null($n->shared)) + SHARED + @elseif(!is_null($n->reseller)) + RESELLER + @elseif(!is_null($n->domain)) + DOMAIN + @elseif(!is_null($n->dns)) + DNS + @elseif(!is_null($n->ip)) + IP + @endif + | +{{strlen($n->note) > 80 ? substr($n->note,0,80)."…" : $n->note}} | ++ + | +
No notes found. | ++ | + | + |
{{$note->note}}
+ curl -sL yabs.sh | bash -s -- -s "{{route('api.store-yabs', [$server_data->id, \Illuminate\Support\Facades\Auth::user()->api_token])}}"
Note:
+{{$server_data->note->note}}
+ @endifFTP Limit | {{$shared->ftp_limit}} |
Note: | +{{$shared->note->note}} | +