fix modal, add env variables, etc

This commit is contained in:
Andras Bacsai
2023-05-04 22:29:14 +02:00
parent d5b332fc59
commit c4a4801414
27 changed files with 379 additions and 102 deletions

View File

@@ -26,7 +26,8 @@
@if ($type === 'textarea')
<textarea {{ $attributes }} type={{ $type }} id={{ $id }} wire:model.defer={{ $id }}></textarea>
@else
<input {{ $attributes }} type={{ $type }} id={{ $id }}
<input wire:dirty.class="text-black bg-amber-300" {{ $attributes }} type={{ $type }}
id={{ $id }}
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
@endif

View File

@@ -76,6 +76,9 @@
Livewire.on('reloadWindow', () => {
window.location.reload();
})
Livewire.on('error', (message) => {
alert(message);
})
</script>
@endauth
</body>

View File

@@ -0,0 +1,19 @@
@props([
'show' => null,
'message' => 'Are you sure you want to delete this?',
'action' => 'delete',
])
<div x-cloak x-show="{{ $show }}" x-transition.opacity class="fixed inset-0 bg-slate-900/75"></div>
<div x-cloak x-show="{{ $show }}" x-transition class="fixed inset-0 z-50 flex items-center justify-center">
<div @click.away="{{ $show }} = false" class="w-screen h-20 max-w-xl mx-auto bg-black rounded-lg">
<div class="flex flex-col items-center justify-center h-full">
<div class="pb-5 text-white">{{ $message }}</div>
<div>
<x-inputs.button isWarning wire:click='{{ $action }}'>
Yes
</x-inputs.button>
<x-inputs.button x-on:click="{{ $show }} = false">No</x-inputs.button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,5 @@
@extends('errors::minimal')
@section('title', __('Unauthorized'))
@section('code', '401')
@section('message', __('Unauthorized'))

View File

@@ -0,0 +1,5 @@
@extends('errors::minimal')
@section('title', __('Payment Required'))
@section('code', '402')
@section('message', __('Payment Required'))

View File

@@ -0,0 +1,5 @@
@extends('errors::minimal')
@section('title', __('Forbidden'))
@section('code', '403')
@section('message', __($exception->getMessage() ?: 'Forbidden'))

View File

@@ -0,0 +1,5 @@
@extends('errors::minimal')
@section('title', __('Not Found'))
@section('code', '404')
@section('message', __('Not Found'))

View File

@@ -0,0 +1,5 @@
@extends('errors::minimal')
@section('title', __('Page Expired'))
@section('code', '419')
@section('message', __('Page Expired'))

View File

@@ -0,0 +1,5 @@
@extends('errors::minimal')
@section('title', __('Too Many Requests'))
@section('code', '429')
@section('message', __('Too Many Requests'))

View File

@@ -0,0 +1,5 @@
@extends('errors::minimal')
@section('title', __('Server Error'))
@section('code', '500')
@section('message', __('Server Error'))

View File

@@ -0,0 +1,5 @@
@extends('errors::minimal')
@section('title', __('Service Unavailable'))
@section('code', '503')
@section('message', __('Service Unavailable'))

View File

@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@yield('title')</title>
<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-weight: 100;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.content {
text-align: center;
}
.title {
font-size: 36px;
padding: 20px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
<div class="content">
<div class="title">
@yield('message')
</div>
</div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -1,28 +0,0 @@
<div>
@if ($isNewEnv === true)
<form wire:submit.prevent='submit' class="flex gap-2 p-4">
@else
<form wire:submit.prevent='updateEnv' class="flex gap-2 p-4">
@endif
<input type="text" wire:model.defer="keyName" />
<input type="text" wire:model.defer="value" />
<div class="flex flex-col">
<div class="flex items-center gap-2">
<input type="checkbox" wire:model.defer="isBuildOnly" />
<label>Used during build?</label>
</div>
</div>
<x-inputs.button type="submit">
@if ($isNewEnv)
Add
@else
Update
@endif
</x-inputs.button>
@if ($isNewEnv === false)
<x-inputs.button isWarning wire:click.prevent='delete'>
Delete
</x-inputs.button>
@endif
</form>
</div>

View File

@@ -0,0 +1,13 @@
<form wire:submit.prevent='submit' class="flex gap-2 p-4">
<input type="text" wire:model.defer="key" wire:dirty.class="text-black bg-amber-300" />
<input type="text" wire:model.defer="value" wire:dirty.class="text-black bg-amber-300" />
<div class="flex flex-col">
<div class="flex items-center gap-2">
<input type="checkbox" wire:model.defer="is_build_time" />
<label>Used during build?</label>
</div>
</div>
<x-inputs.button type="submit">
Add
</x-inputs.button>
</form>

View File

@@ -0,0 +1,19 @@
<div x-data="{ deleteEnvironment: false }">
<form wire:submit.prevent='submit' class="flex gap-2 p-4">
<input type="text" wire:model.defer="env.key" wire:dirty.class="text-black bg-amber-300" />
<input type="text" wire:model.defer="env.value" wire:dirty.class="text-black bg-amber-300" />
<div class="flex flex-col">
<div class="flex items-center gap-2">
<input type="checkbox" wire:model.defer="env.is_build_time" />
<label>Used during build?</label>
</div>
</div>
<x-inputs.button type="submit">
Update
</x-inputs.button>
<x-inputs.button x-on:click="deleteEnvironment = true" isWarning>
Delete
</x-inputs.button>
</form>
<x-naked-modal show="deleteEnvironment" message="Are you sure you want to delete {{ $env->key }}?" />
</div>

View File

@@ -25,12 +25,13 @@
</div>
<div x-cloak x-show="activeTab === 'environment-variables'" class="flex flex-col gap-2">
<h3>Environment Variables</h3>
@forelse ($application->environment_variables->all() as $keyName => $env)
<livewire:project.application.environment-variable :keyName="$keyName" :env="$env" />
@forelse ($application->environment_variables as $env)
<livewire:project.application.environment-variable.show :env="$env" />
@empty
<p>There are no environment variables for this application.</p>
@endforelse
<livewire:project.application.environment-variable />
<h4>Add new environment variable</h4>
<livewire:project.application.environment-variable.add />
</div>
<div x-cloak x-show="activeTab === 'source'">
<h3>Source</h3>