diff --git a/app/Models/Server.php b/app/Models/Server.php index 81d790fc6..3b0c26436 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -59,10 +59,10 @@ class Server extends BaseModel return Server::where('team_id', session('currentTeam')->id)->whereRelation('settings', 'is_validated', true)->get(); } - static public function destinations(string|null $server_uuid = null) + static public function destinations(string|null $server_id = null) { - if ($server_uuid) { - $server = Server::where('team_id', session('currentTeam')->id)->where('uuid', $server_uuid)->firstOrFail(); + if ($server_id) { + $server = Server::where('team_id', session('currentTeam')->id)->where('id', $server_id)->firstOrFail(); $standaloneDocker = collect($server->standaloneDockers->all()); $swarmDocker = collect($server->swarmDockers->all()); return $standaloneDocker->concat($swarmDocker); diff --git a/resources/css/app.css b/resources/css/app.css index b8ef2468b..df2a15c2a 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -3,7 +3,7 @@ @tailwind utilities; .scrollbar { - @apply scrollbar-thumb-coollabs-100 scrollbar-track-coolgray-200 scrollbar-w-1; + @apply scrollbar-thumb-coollabs-100 scrollbar-track-coolgray-200 scrollbar-w-1; } html { @@ -11,10 +11,10 @@ html { } body { - @apply scrollbar min-h-screen bg-coolgray-100 text-neutral-400 antialiased ; + @apply scrollbar min-h-screen bg-coolgray-100 text-neutral-400 antialiased; } main { - @apply px-32 xl:px-14 mx-auto max-w-screen-xl pt-10; + @apply px-32 xl:px-14 mx-auto max-w-screen-xl; } input[type="checkbox"] { @@ -23,10 +23,14 @@ input[type="checkbox"] { input { @apply input input-sm h-7 outline-none placeholder:text-neutral-700 text-white rounded-none; } -input[type="text"],[type="number"],[type="email"],[type="password"] { +input[type="text"], +[type="number"], +[type="email"], +[type="password"] { @apply read-only:opacity-40; } -.label-text, label { +.label-text, +label { @apply text-neutral-400 text-sm; } @@ -104,33 +108,32 @@ a { @apply bg-coolgray-400 text-white; } - .lds-heart { - animation: lds-heart 1.2s infinite cubic-bezier(0.215, 0.61, 0.355, 1); + animation: lds-heart 1.2s infinite cubic-bezier(0.215, 0.61, 0.355, 1); } @keyframes lds-heart { - 0% { - transform: scale(1); - } - 5% { - transform: scale(1.2); - } - 39% { - transform: scale(0.85); - } - 45% { - transform: scale(1); - } - 60% { - transform: scale(0.95); - } - 100% { - transform: scale(0.9); - } + 0% { + transform: scale(1); + } + 5% { + transform: scale(1.2); + } + 39% { + transform: scale(0.85); + } + 45% { + transform: scale(1); + } + 60% { + transform: scale(0.95); + } + 100% { + transform: scale(0.9); + } } .bg-coollabs-gradient { - @apply text-transparent bg-clip-text bg-gradient-to-r from-purple-500 via-pink-500 to-red-500; + @apply text-transparent bg-clip-text bg-gradient-to-r from-purple-500 via-pink-500 to-red-500; } .text-helper { - @apply inline-block font-bold text-warning -} \ No newline at end of file + @apply inline-block font-bold text-warning; +} diff --git a/resources/js/app.js b/resources/js/app.js index f3e69f44f..2dc18bf8c 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,9 +1,10 @@ import Alpine from "alpinejs"; -// import { createApp } from "vue"; -// import MagicSearchBar from "./components/MagicSearchBar.vue"; + +import { createApp } from "vue"; +import MagicBar from "./components/MagicBar.vue"; window.Alpine = Alpine; Alpine.start(); -// const app = createApp({}); -// app.component('magic-search-bar', MagicSearchBar); -// app.mount('#vue'); +const app = createApp({}); +app.component("magic-bar", MagicBar); +app.mount("#vue"); diff --git a/resources/js/components/MagicBar.vue b/resources/js/components/MagicBar.vue new file mode 100644 index 000000000..d574561e5 --- /dev/null +++ b/resources/js/components/MagicBar.vue @@ -0,0 +1,199 @@ + + diff --git a/resources/views/components/layout.blade.php b/resources/views/components/layout.blade.php index 9c2ed7464..68ea42fd0 100644 --- a/resources/views/components/layout.blade.php +++ b/resources/views/components/layout.blade.php @@ -29,8 +29,9 @@ @auth @endauth -
- +
+ {{-- --}} +
{{ $slot }} diff --git a/routes/web.php b/routes/web.php index 2f329e016..9c91e84ca 100644 --- a/routes/web.php +++ b/routes/web.php @@ -27,7 +27,35 @@ use Illuminate\Support\Str; +Route::prefix('magic2')->middleware(['auth'])->group(function () { + Route::get('/servers', function () { + $id = session('currentTeam')->id; + return response()->json([ + 'servers' => Server::where('team_id', $id)->get()->sortBy('name') + ]); + }); + Route::get('/destinations', function () { + $server_id = request()->query('server_id'); + return response()->json([ + 'destinations' => Server::destinations($server_id)->sortBy('name') + ]); + }); + Route::get('/projects', function () { + $id = session('currentTeam')->id; + return response()->json([ + 'projects' => Project::where('team_id', $id)->get()->sortBy('name') + ]); + }); + Route::get('/environments', function () { + $id = session('currentTeam')->id; + $project_id = request()->query('project_id'); + return response()->json([ + 'environments' => Project::where('team_id', $id)->where('id', $project_id)->first()->environments + ]); + }); +}); Route::middleware(['auth'])->group(function () { + Route::get('/magic', function () { try { $id = session('currentTeam')->id;