Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Add service status to Index.php and update resource display in index.blade.php

Andras Bacsai408738e08def
diff --git a/app/Livewire/Project/Resource/Index.php b/app/Livewire/Project/Resource/Index.php
index 6a170ace82..718b5003cb 100644
--- a/app/Livewire/Project/Resource/Index.php
+++ b/app/Livewire/Project/Resource/Index.php
@@ -103,6 +103,7 @@ class Index extends Component
'environment_name' => data_get($service, 'environment.name'),
'service_uuid' => data_get($service, 'uuid')
]);
+ $service->status = serviceStatus($service);
}
return $service;
});
diff --git a/resources/views/livewire/project/resource/index.blade.php b/resources/views/livewire/project/resource/index.blade.php
index ca23254197..921e9c3602 100644
--- a/resources/views/livewire/project/resource/index.blade.php
+++ b/resources/views/livewire/project/resource/index.blade.php
@@ -150,6 +150,23 @@
</template>
</a>
</template>
+ <template x-for="item in filteredServices" :key="item.id">
+ <a class="relative box group" :href="item.hrefLink">
+ <div class="flex flex-col mx-6">
+ <div class="font-bold text-white" x-text="item.name"></div>
+ <div class="description" x-text="item.description"></div>
+ </div>
+ <template x-if="item.status.startsWith('running')">
+ <div class="absolute bg-success -top-1 -left-1 badge badge-xs"></div>
+ </template>
+ <template x-if="item.status.startsWith('exited')">
+ <div class="absolute bg-error -top-1 -left-1 badge badge-xs"></div>
+ </template>
+ <template x-if="item.status.startsWith('degraded')">
+ <div class="absolute bg-warning -top-1 -left-1 badge badge-xs"></div>
+ </template>
+ </a>
+ </template>
</div>
</div>
</div>
@@ -164,6 +181,7 @@
mongodbs: @js($mongodbs),
mysqls: @js($mysqls),
mariadbs: @js($mariadbs),
+ services: @js($services),
get filteredApplications() {
if (this.search === '') {
return this.applications;
@@ -225,6 +243,16 @@
item.description?.toLowerCase().includes(this.search.toLowerCase());
});
},
+ get filteredServices() {
+ if (this.search === '') {
+ return this.services;
+ }
+ this.services = Object.values(this.services);
+ return this.services.filter(item => {
+ return item.name.toLowerCase().includes(this.search.toLowerCase()) ||
+ item.description?.toLowerCase().includes(this.search.toLowerCase());
+ });
+ },
};
}