mirror of
https://github.com/czhu12/canine.git
synced 2026-05-07 20:29:49 -05:00
stuff
This commit is contained in:
@@ -12,7 +12,10 @@ class ProjectsController < ApplicationController
|
||||
end
|
||||
|
||||
# GET /projects/1 or /projects/1.json
|
||||
def show; end
|
||||
def show
|
||||
@pagy, @builds = pagy(@project.builds.order(created_at: :desc))
|
||||
render "projects/deployments/index"
|
||||
end
|
||||
|
||||
# GET /projects/new
|
||||
def new
|
||||
|
||||
@@ -24,4 +24,8 @@ module ApplicationHelper
|
||||
'<iconify-icon icon="lucide:chevron-right" height="16"></iconify-icon>' +
|
||||
"</a>"
|
||||
end
|
||||
|
||||
def in_namespace?(namespace)
|
||||
controller.controller_path.start_with?("#{namespace}/")
|
||||
end
|
||||
end
|
||||
|
||||
+6
-10
@@ -2,19 +2,15 @@
|
||||
#
|
||||
# Table name: domains
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# domain_name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# project_service_id :bigint not null
|
||||
# id :bigint not null, primary key
|
||||
# domain_name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# service_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_domains_on_project_service_id (project_service_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (project_service_id => project_services.id)
|
||||
# index_domains_on_service_id (service_id)
|
||||
#
|
||||
class Domain < ApplicationRecord
|
||||
belongs_to :service
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class K8::Stateless::CronJob
|
||||
class K8::Stateless::CronJob < K8::Base
|
||||
attr_accessor :service, :project
|
||||
def initialize(service)
|
||||
@service = service
|
||||
|
||||
@@ -21,15 +21,30 @@
|
||||
<div class="simplebar-content">
|
||||
<div class="menu mb-6">
|
||||
<li class="mb-0.5">
|
||||
<%= link_to projects_path, class: "hover:bg-base-content/15", starts_with: projects_path do %>
|
||||
<div class="flex items-center gap-2">
|
||||
<iconify-icon icon="lucide:sparkles" height="18"></iconify-icon>
|
||||
Projects
|
||||
</div>
|
||||
<% end %>
|
||||
<details <%= 'open' if in_namespace?('projects') %>>
|
||||
<summary>
|
||||
<%= link_to projects_path, class: "hover:bg-base-content/15 #{'active' if current_page?(projects_path)}" do %>
|
||||
<div class="flex items-center gap-2">
|
||||
<iconify-icon icon="lucide:sparkles" height="18"></iconify-icon>
|
||||
Projects
|
||||
</div>
|
||||
<% end %>
|
||||
</summary>
|
||||
<ul>
|
||||
<% current_user.projects.each do |project| %>
|
||||
<li>
|
||||
<%= link_to root_projects_path(project), class: "hover:bg-base-content/15 #{'active' if current_page?(root_projects_path(project))}" do %>
|
||||
<div class="flex items-center gap-2">
|
||||
<%= project.name %>
|
||||
</div>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</details>
|
||||
</li>
|
||||
<li class="mb-0.5">
|
||||
<%= link_to clusters_path, class: "hover:bg-base-content/15", starts_with: clusters_path do %>
|
||||
<%= link_to clusters_path, class: "hover:bg-base-content/15 #{'active' if current_page?(clusters_path)}", starts_with: clusters_path do %>
|
||||
<div class="flex items-center gap-2">
|
||||
<iconify-icon icon="lucide:boxes" height="18"></iconify-icon>
|
||||
Clusters
|
||||
@@ -37,7 +52,7 @@
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="mb-0.5">
|
||||
<%= link_to add_ons_path, class: "hover:bg-base-content/15", starts_with: add_ons_path do %>
|
||||
<%= link_to add_ons_path, class: "hover:bg-base-content/15 #{'active' if current_page?(add_ons_path)}", starts_with: add_ons_path do %>
|
||||
<div class="flex items-center gap-2">
|
||||
<iconify-icon icon="lucide:package" height="18"></iconify-icon>
|
||||
Add Ons
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
<%= turbo_stream_from @project %>
|
||||
|
||||
<%= project_layout(@project) do %>
|
||||
<% if @builds.empty? %>
|
||||
<% if !@project.deployable? %>
|
||||
<div>
|
||||
<p class="text-gray-500">Please <%= link_to "add a service", project_services_path(@project), class: "link" %> before deploying.</p>
|
||||
</div>
|
||||
<% elsif @builds.empty? %>
|
||||
<div>
|
||||
<p class="text-gray-500">No deployments yet</p>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,15 @@
|
||||
<%= form.label :command %>
|
||||
<%= form.text_field :command, class: "input input-bordered", required: false %>
|
||||
</div>
|
||||
<% if service.cron_job? %>
|
||||
<div class="form-group">
|
||||
<%= form.fields_for :cron_schedule do |cron_schedule_form| %>
|
||||
<%= cron_schedule_form.label :schedule %>
|
||||
<%= cron_schedule_form.text_field :schedule, class: "input input-bordered", placeholder: "0 0 * * *", value: service.cron_schedule.schedule %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= form.submit class: "btn btn-primary" %>
|
||||
<% end %>
|
||||
<% if service.web_service? %>
|
||||
<div class="my-8">
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
<h3 class="text-lg font-bold">Networking</h3>
|
||||
<div class="form-group">
|
||||
<%= form.label :container_port %>
|
||||
<%= form.number_field :container_port, class: "input input-bordered", required: true, placeholder: "3000" %>
|
||||
<%= form.number_field :container_port, class: "input input-bordered", placeholder: "3000" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<h3 class="text-lg font-bold">Cron job</h3>
|
||||
<%= form.fields_for :cron_schedule do |cron_schedule_form| %>
|
||||
<%= cron_schedule_form.label :schedule %>
|
||||
<%= cron_schedule_form.text_field :schedule, class: "input input-bordered", required: true, placeholder: "0 0 * * *" %>
|
||||
<%= cron_schedule_form.text_field :schedule, class: "input input-bordered", placeholder: "0 0 * * *" %>
|
||||
<% end %>
|
||||
<label class="label">
|
||||
<span class="label-text-alt">Use <a href="https://crontab.guru/" target="_blank">crontab.guru</a> to schedule your cron job</span>
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
resources :projects, except: [ :show ] do
|
||||
resources :projects do
|
||||
collection do
|
||||
get "/:project_id/deployments", to: "projects/deployments#index", as: :root
|
||||
end
|
||||
|
||||
Generated
+37
-4
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_09_25_212903) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_10_07_042556) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@@ -85,6 +85,12 @@ ActiveRecord::Schema[7.2].define(version: 2024_09_25_212903) do
|
||||
t.index ["user_id"], name: "index_clusters_on_user_id"
|
||||
end
|
||||
|
||||
create_table "cron_schedules", force: :cascade do |t|
|
||||
t.bigint "service_id", null: false
|
||||
t.string "schedule", null: false
|
||||
t.index ["service_id"], name: "index_cron_schedules_on_service_id"
|
||||
end
|
||||
|
||||
create_table "deployments", force: :cascade do |t|
|
||||
t.bigint "build_id", null: false
|
||||
t.integer "status", default: 0, null: false
|
||||
@@ -93,6 +99,14 @@ ActiveRecord::Schema[7.2].define(version: 2024_09_25_212903) do
|
||||
t.index ["build_id"], name: "index_deployments_on_build_id"
|
||||
end
|
||||
|
||||
create_table "domains", force: :cascade do |t|
|
||||
t.bigint "service_id", null: false
|
||||
t.string "domain_name", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["service_id"], name: "index_domains_on_service_id"
|
||||
end
|
||||
|
||||
create_table "environment_variables", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.text "value"
|
||||
@@ -114,6 +128,13 @@ ActiveRecord::Schema[7.2].define(version: 2024_09_25_212903) do
|
||||
t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id"
|
||||
end
|
||||
|
||||
create_table "inbound_webooks", force: :cascade do |t|
|
||||
t.text "body"
|
||||
t.integer "status", default: 0
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "log_outputs", force: :cascade do |t|
|
||||
t.bigint "loggable_id", null: false
|
||||
t.string "loggable_type", null: false
|
||||
@@ -172,7 +193,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_09_25_212903) do
|
||||
t.index ["name"], name: "index_projects_on_name", unique: true
|
||||
end
|
||||
|
||||
create_table "services", force: :cascade do |t|
|
||||
create_table "providers", force: :cascade do |t|
|
||||
t.bigint "user_id", null: false
|
||||
t.string "provider"
|
||||
t.string "uid"
|
||||
@@ -183,7 +204,18 @@ ActiveRecord::Schema[7.2].define(version: 2024_09_25_212903) do
|
||||
t.text "auth"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["user_id"], name: "index_services_on_user_id"
|
||||
t.index ["user_id"], name: "index_providers_on_user_id"
|
||||
end
|
||||
|
||||
create_table "services", force: :cascade do |t|
|
||||
t.bigint "project_id", null: false
|
||||
t.integer "service_type", null: false
|
||||
t.string "command"
|
||||
t.string "name", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "container_port", default: 3000
|
||||
t.index ["project_id"], name: "index_services_on_project_id"
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
@@ -213,5 +245,6 @@ ActiveRecord::Schema[7.2].define(version: 2024_09_25_212903) do
|
||||
add_foreign_key "project_add_ons", "add_ons"
|
||||
add_foreign_key "project_add_ons", "projects"
|
||||
add_foreign_key "projects", "clusters"
|
||||
add_foreign_key "services", "users"
|
||||
add_foreign_key "providers", "users"
|
||||
add_foreign_key "services", "projects"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user