do not use hash routing for tabs

add empty project creation
if local image is found, we only refresh the configuration
This commit is contained in:
Andras Bacsai
2023-04-26 14:29:33 +02:00
parent 9f32730714
commit 2c68eed072
13 changed files with 138 additions and 109 deletions

View File

@@ -15,7 +15,7 @@
@livewireStyles
</head>
<body x-data="confirmModal" x-on:keydown.escape="toggleConfirmModal">
<body x-data="confirmModal">
<x-navbar />
<main>
{{ $slot }}

View File

@@ -5,15 +5,14 @@
@if ($application->status === 'running')
<button wire:click='start'>Restart</button>
<button wire:click='forceRebuild'>Force Rebuild</button>
<button wire:click='stop'>Stop</button>
@else
<button wire:click='start'>Start</button>
<button wire:click='forceRebuild'>Start (no cache)</button>
@endif
<button wire:click='kill'>Kill</button>
<button wire:click='stop'>Stop</button>
<span wire:poll.5000ms='pollingStatus'>
@if ($application->status === 'running')
@if (!data_get($application, 'settings.is_bot') && data_get($application, 'fqdn'))
@if (data_get($application, 'fqdn'))
<a target="_blank" href="{{ data_get($application, 'fqdn') }}">Open URL</a>
@endif

View File

@@ -28,7 +28,7 @@
@if ($application->settings->is_static)
<x-form-input id="application.ports_exposes" label="Ports Exposes" disabled />
@else
<x-form-input id="application.ports_exposes" label="Ports Exposes" />
<x-form-input id="application.ports_exposes" label="Ports Exposes" required />
@endif
<x-form-input id="application.ports_mappings" label="Ports Mappings" />
@@ -43,7 +43,6 @@
<x-form-input instantSave type="checkbox" id="is_auto_deploy" label="Auto Deploy?" />
<x-form-input instantSave type="checkbox" id="is_dual_cert" label="Dual Certs?" />
<x-form-input instantSave type="checkbox" id="is_previews" label="Previews?" />
<x-form-input instantSave type="checkbox" id="is_bot" label="Is Bot?" />
<x-form-input instantSave type="checkbox" id="is_custom_ssl" label="Is Custom SSL?" />
<x-form-input instantSave type="checkbox" id="is_http2" label="Is Http2?" />
<x-form-input instantSave type="checkbox" id="is_git_submodules_allowed" label="Git Submodules Allowed?" />

View File

@@ -0,0 +1 @@
<button wire:click='createEmptyProject'>Empty Project</button>

View File

@@ -1,29 +1,34 @@
<x-layout>
<h1>Configuration</h1>
<x-applications.navbar :applicationId="$application->id" />
<div x-data="{ tab: window.location.hash ? window.location.hash.substring(1) : 'general' }">
<div x-data="{ activeTab: 'general' }">
<div class="flex gap-4">
<a @click.prevent="tab = 'general'; window.location.hash = 'general'" href="#">General</a>
<a @click.prevent="tab = 'envs'; window.location.hash = 'envs'" href="#">Environment Variables</a>
<a @click.prevent="tab = 'source'; window.location.hash = 'source'" href="#">Source</a>
<a @click.prevent="tab = 'destination'; window.location.hash = 'destination'" href="#">Destination
<a :class="activeTab === 'general' && 'text-green-500'" @click.prevent="activeTab = 'general'"
href="#">General</a>
<a :class="activeTab === 'envs' && 'text-green-500'" @click.prevent="activeTab = 'envs'"
href="#">Environment Variables</a>
<a :class="activeTab === 'source' && 'text-green-500'" @click.prevent="activeTab = 'source'"
href="#">Source</a>
<a :class="activeTab === 'destination' && 'text-green-500'" @click.prevent="activeTab = 'destination'"
href="#">Destination
</a>
<a @click.prevent="tab = 'storages'; window.location.hash = 'storages'" href="#">Storage
<a :class="activeTab === 'storages' && 'text-green-500'" @click.prevent="activeTab = 'storages'"
href="#">Storage
</a>
</div>
<div x-cloak x-show="tab === 'general'">
<div x-cloak x-show="activeTab === 'general'">
<livewire:project.application.general :applicationId="$application->id" />
</div>
<div x-cloak x-show="tab === 'envs'">
<div x-cloak x-show="activeTab === 'envs'">
<livewire:project.application.environment-variables />
</div>
<div x-cloak x-show="tab === 'source'">
<div x-cloak x-show="activeTab === 'source'">
<livewire:project.application.source :applicationId="$application->id" />
</div>
<div x-cloak x-show="tab === 'destination'">
<div x-cloak x-show="activeTab === 'destination'">
<livewire:project.application.destination :destination="$application->destination" />
</div>
<div x-cloak x-show="tab === 'storages'">
<div x-cloak x-show="activeTab === 'storages'">
<livewire:project.application.storages :storages="$application->persistentStorages" />
</div>
</div>

View File

@@ -4,28 +4,22 @@
@elseif ($type === 'resource')
<h1>New Resource</h1>
@endif
<div x-data="{ tab: window.location.hash ? window.location.hash.substring(1) : 'choose' }">
<div x-data="{ activeTab: 'choose' }">
<div class="flex flex-col w-64 gap-2 mb-10">
<button @click.prevent="tab = 'public-repo'; window.location.hash = 'public-repo'">Public Repository
</button>
<button @click.prevent="tab = 'github-private-repo'; window.location.hash = 'github-private-repo'">Private
Repository (GitHub App)</button>
<button @click.prevent="activeTab = 'public-repo'">Public Repository</button>
<button @click.prevent="activeTab = 'github-private-repo'">Private Repository (GitHub App)</button>
@if ($type === 'project')
<button @click.prevent="tab = 'empty-project'; window.location.hash = 'empty-project'">Empty
Project</button>
<livewire:project.new.empty-project />
@endif
</div>
<div x-cloak x-show="tab === 'public-repo'">
<div x-cloak x-show="activeTab === 'public-repo'">
<livewire:project.new.public-git-repository :type="$type" />
</div>
<div x-cloak x-show="tab === 'github-private-repo'">
<div x-cloak x-show="activeTab === 'github-private-repo'">
github-private-repo
</div>
<div x-cloak x-show="tab === 'empty-project'">
empty-project
</div>
<div x-cloak x-show="tab === 'choose'">
<div x-cloak x-show="activeTab === 'choose'">
Choose any option
</div>
</div>