feat: simple search functionality
This commit is contained in:
parent
c82e02218f
commit
b2d111e49a
@ -5,7 +5,7 @@
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class GenerateServiceTemplates extends Command
|
||||
class ServicesGenerate extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
@ -80,6 +80,14 @@ private function process_file($file)
|
||||
$env_file = null;
|
||||
}
|
||||
|
||||
$tags = collect(preg_grep('/^# tags:/', explode("\n", $content)))->values();
|
||||
if ($tags->count() > 0) {
|
||||
$tags = str($tags[0])->after('# tags:')->trim()->explode(',')->map(function ($tag) {
|
||||
return str($tag)->trim()->lower()->value();
|
||||
})->values();
|
||||
} else {
|
||||
$tags = null;
|
||||
}
|
||||
$json = Yaml::parse($content);
|
||||
$yaml = base64_encode(Yaml::dump($json, 10, 2));
|
||||
$payload = [
|
||||
@ -87,6 +95,7 @@ private function process_file($file)
|
||||
'documentation' => $documentation,
|
||||
'slogan' => $slogan,
|
||||
'compose' => $yaml,
|
||||
'tags' => $tags,
|
||||
];
|
||||
if ($env_file) {
|
||||
$env_file_content = file_get_contents(base_path("templates/compose/$env_file"));
|
@ -21,14 +21,18 @@ class Select extends Component
|
||||
public Collection|array $swarmDockers = [];
|
||||
public array $parameters;
|
||||
public Collection|array $services = [];
|
||||
public Collection|array $allServices = [];
|
||||
|
||||
public bool $loadingServices = true;
|
||||
public bool $loading = false;
|
||||
public $environments = [];
|
||||
public ?string $selectedEnvironment = null;
|
||||
public ?string $existingPostgresqlUrl = null;
|
||||
|
||||
public ?string $search = null;
|
||||
protected $queryString = [
|
||||
'server',
|
||||
'search'
|
||||
];
|
||||
|
||||
public function mount()
|
||||
@ -41,6 +45,11 @@ public function mount()
|
||||
$this->environments = Project::whereUuid($projectUuid)->first()->environments;
|
||||
$this->selectedEnvironment = data_get($this->parameters, 'environment_name');
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
$this->loadServices();
|
||||
return view('livewire.project.new.select');
|
||||
}
|
||||
|
||||
public function updatedSelectedEnvironment()
|
||||
{
|
||||
@ -49,6 +58,7 @@ public function updatedSelectedEnvironment()
|
||||
'environment_name' => $this->selectedEnvironment,
|
||||
]);
|
||||
}
|
||||
|
||||
// public function addExistingPostgresql()
|
||||
// {
|
||||
// try {
|
||||
@ -59,19 +69,28 @@ public function updatedSelectedEnvironment()
|
||||
// }
|
||||
// }
|
||||
|
||||
public function loadThings()
|
||||
{
|
||||
$this->loadServices();
|
||||
$this->loadServers();
|
||||
}
|
||||
public function loadServices(bool $forceReload = false)
|
||||
public function loadServices(bool $force = false)
|
||||
{
|
||||
try {
|
||||
if ($forceReload) {
|
||||
Cache::forget('services');
|
||||
if (count($this->allServices) > 0 && !$force) {
|
||||
if (!$this->search) {
|
||||
$this->services = $this->allServices;
|
||||
return;
|
||||
}
|
||||
$this->services = $this->allServices->filter(function ($service, $key) {
|
||||
$tags = collect(data_get($service, 'tags', []));
|
||||
return str_contains(strtolower($key), strtolower($this->search)) || $tags->contains(function ($tag) {
|
||||
return str_contains(strtolower($tag), strtolower($this->search));
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$this->search = null;
|
||||
$this->allServices = getServiceTemplates();
|
||||
$this->services = $this->allServices->filter(function ($service, $key) {
|
||||
return str_contains(strtolower($key), strtolower($this->search));
|
||||
});;
|
||||
$this->emit('success', 'Successfully loaded services.');
|
||||
}
|
||||
$this->services = getServiceTemplates();
|
||||
$this->emit('success', 'Successfully loaded services.');
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
} finally {
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div x-data x-init="$wire.loadThings">
|
||||
<div x-data x-init="$wire.loadServers">
|
||||
<div class="flex gap-2 ">
|
||||
<h1>New Resource</h1>
|
||||
<div class="w-96">
|
||||
@ -128,12 +128,15 @@
|
||||
<div class="flex items-center gap-2">
|
||||
<h2 class="py-4">Services</h2>
|
||||
<x-forms.button wire:click='loadServices(true)'>Reload Services List</x-forms.button>
|
||||
<input
|
||||
class="w-full text-white rounded input input-sm bg-coolgray-200 disabled:bg-coolgray-200/50 disabled:border-none placeholder:text-coolgray-500 read-only:text-neutral-500 read-only:bg-coolgray-200/50"
|
||||
wire:model.debounce.200ms="search" placeholder="Search..."></input>
|
||||
</div>
|
||||
<div class="grid justify-start grid-cols-1 gap-2 text-left xl:grid-cols-3">
|
||||
@if ($loadingServices)
|
||||
<span class="loading loading-xs loading-spinner"></span>
|
||||
@else
|
||||
@foreach ($services as $serviceName => $service)
|
||||
@forelse ($services as $serviceName => $service)
|
||||
@if (data_get($service, 'disabled'))
|
||||
<button class="text-left cursor-not-allowed bg-coolgray-200/20 box-without-bg" disabled>
|
||||
<div class="flex flex-col mx-6">
|
||||
@ -158,7 +161,9 @@
|
||||
</div>
|
||||
</button>
|
||||
@endif
|
||||
@endforeach
|
||||
@empty
|
||||
<div>No service found.</div>
|
||||
@endforelse
|
||||
@endif
|
||||
</div>
|
||||
<div class="py-4 pb-10">Trademarks Policy: The respective trademarks mentioned here are owned by the
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://docs.appsmith.com
|
||||
# slogan: Appsmith is an open-source, self-hosted application development platform that enables you to build powerful web applications with ease.
|
||||
# tags: lowcode,nocode,no,low,platform
|
||||
|
||||
services:
|
||||
appsmith:
|
||||
|
@ -1,6 +1,7 @@
|
||||
# documentation: https://appwrite.io/docs
|
||||
# slogan: Appwrite is a self-hosted backend-as-a-service platform that simplifies the development of web and mobile applications by providing a range of features and APIs.
|
||||
# env_file: appwrite.env
|
||||
# tags: backend-as-a-service, platform
|
||||
|
||||
|
||||
x-logging: &x-logging
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://docs.baby-buddy.net
|
||||
# slogan: Baby Buddy is an open-source web application that helps parents track their baby's daily activities, growth, and health with ease.
|
||||
# tags: baby, parents, health, growth, activities
|
||||
|
||||
services:
|
||||
babybuddy:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://coder.com/docs/code-server/latest/guide
|
||||
# slogan: Code-Server is a self-hosted, web-based code editor that enables remote coding and collaboration from any device, anywhere.
|
||||
# tags: code, editor, remote, collaboration
|
||||
|
||||
services:
|
||||
code-server:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://www.dokuwiki.org/faq
|
||||
# slogan: A lightweight and easy-to-use wiki platform for creating and managing documentation and knowledge bases with simplicity and flexibility.
|
||||
# tags: wiki, documentation, knowledge, base
|
||||
|
||||
services:
|
||||
dokuwiki:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://fider.io/doc
|
||||
# slogan: Fider is an open-source feedback platform for collecting and managing user feedback, helping you prioritize improvements to your products and services.
|
||||
# tags: feedback, user-feedback
|
||||
|
||||
services:
|
||||
fider:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://ghost.org/docs
|
||||
# slogan: Ghost is a popular open-source content management system (CMS) and blogging platform, known for its simplicity and focus on content creation.
|
||||
# tags: cms, blog, content, management, system
|
||||
|
||||
services:
|
||||
ghost:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://github.com/linuxserver/Heimdall
|
||||
# slogan: Heimdall is a self-hosted dashboard for managing and organizing your server applications, providing a centralized and efficient interface.
|
||||
# tags: dashboard, server, applications, interface
|
||||
|
||||
services:
|
||||
heimdall:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://github.com/alexta69/metube
|
||||
# slogan: A web GUI for youtube-dl with playlist support. It enables you to effortlessly download videos from YouTube and dozens of other sites.
|
||||
# tags: youtube, download, videos, playlist
|
||||
|
||||
services:
|
||||
metube:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://docs.min.io/docs/minio-docker-quickstart-guide.html
|
||||
# slogan: MinIO is a high performance object storage server compatible with Amazon S3 APIs.
|
||||
# tags: object, storage, server, s3, api
|
||||
|
||||
services:
|
||||
minio:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://github.com/schlagmichdoch/PairDrop/blob/master/docs/faq.md
|
||||
# slogan: Pairdrop is a self-hosted file sharing and collaboration platform, offering secure file sharing and collaboration capabilities for efficient teamwork.
|
||||
# tags: file, sharing, collaboration, teamwork
|
||||
|
||||
services:
|
||||
pairdrop:
|
||||
|
@ -1,6 +1,7 @@
|
||||
# ignore: true
|
||||
# documentation: https://plausible.io/docs/self-hosting
|
||||
# slogan: "Plausible Analytics is a simple, open-source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics."
|
||||
# tags: analytics, privacy, google, alternative
|
||||
|
||||
version: "3.3"
|
||||
services:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://github.com/RobinLinus/snapdrop/blob/master/docs/faq.md
|
||||
# slogan: A self-hosted file-sharing service for secure and convenient file transfers, whether on a local network or the internet.
|
||||
# tags: file, sharing, transfer, local, network, internet
|
||||
|
||||
services:
|
||||
snapdrop:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://umami.is/docs/getting-started
|
||||
# slogan: Umami is a lightweight, self-hosted web analytics platform designed to provide website owners with insights into visitor behavior without compromising user privacy.
|
||||
# tags: analytics, insights, privacy
|
||||
|
||||
services:
|
||||
umami:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://github.com/louislam/uptime-kuma/wiki
|
||||
# slogan: Uptime Kuma is a free, self-hosted monitoring tool for tracking the status and performance of your web services and applications in real-time.
|
||||
# tags: monitoring, status, performance, web, services, applications, real-time
|
||||
|
||||
services:
|
||||
uptime-kuma:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://wordpress.org/documentation/
|
||||
# slogan: "WordPress is open source software you can use to create a beautiful website, blog, or app."
|
||||
# tags: cms, blog, content, management, mariadb
|
||||
|
||||
services:
|
||||
wordpress:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://wordpress.org/documentation/
|
||||
# slogan: "WordPress is open source software you can use to create a beautiful website, blog, or app."
|
||||
# tags: cms, blog, content, management, mysql
|
||||
|
||||
services:
|
||||
wordpress:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# documentation: https://wordpress.org/documentation/
|
||||
# slogan: "WordPress is open source software you can use to create a beautiful website, blog, or app."
|
||||
# tags: cms, blog, content, management
|
||||
|
||||
services:
|
||||
wordpress:
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user