This commit is contained in:
Dennis
2022-04-01 10:50:05 +02:00
parent fb40b450b6
commit 7bd2917ec4
12 changed files with 301 additions and 2 deletions

22
app/Casts/SiteAlias.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
namespace App\Casts;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
class SiteAlias implements CastsAttributes
{
public function get($model, string $key, $value, array $attributes)
{
if (!$value) {
return [];
}
return json_decode($value, true);
}
public function set($model, string $key, $value, array $attributes)
{
return json_encode($value);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SiteAliasController extends Controller
{
public function index($id)
{
$site = auth()->user()->sites()->findOrFail($id);
return inertia('Sites/Aliases', [
'site' => $site,
]);
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use App\Casts\SiteAlias;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
@@ -24,6 +25,10 @@ class Site extends Model
'project'
];
public $casts = [
'aliases' => SiteAlias::class,
];
public function setDnsIdAttribute($value)
{
if (!$value) {

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('sites', function (Blueprint $table) {
$table->json('aliases')->nullable()->after('php_version');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('sites', function (Blueprint $table) {
$table->dropColumn('aliases');
});
}
};

15
public/css/app.css vendored
View File

@@ -1636,6 +1636,7 @@ select {
padding-top: 2rem;
padding-bottom: 2rem;
}
<<<<<<< Updated upstream
.px-2\.5 {
padding-left: 0.625rem;
padding-right: 0.625rem;
@@ -1648,6 +1649,8 @@ select {
padding-top: 0px;
padding-bottom: 0px;
}
=======
>>>>>>> Stashed changes
.pr-16 {
padding-right: 4rem;
}
@@ -1715,9 +1718,12 @@ select {
.leading-6 {
line-height: 1.5rem;
}
<<<<<<< Updated upstream
.leading-4 {
line-height: 1rem;
}
=======
>>>>>>> Stashed changes
.text-high-emphasis {
color: var(--color-text-high-emphasis);
}
@@ -1824,6 +1830,7 @@ select {
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-text-decoration-color, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
<<<<<<< Updated upstream
.transition-transform {
transition-property: transform;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
@@ -1831,6 +1838,8 @@ select {
.delay-150 {
transition-delay: 150ms;
}
=======
>>>>>>> Stashed changes
.duration-fast {
transition-duration: 200ms;
}
@@ -2134,20 +2143,26 @@ button[aria-label][data-balloon-pos] {
color: var(--text-medium-emphasis);
border: 1px solid var(--color-surface-3);
}
<<<<<<< Updated upstream
.hover\:-translate-y-1:hover {
--tw-translate-y: -0.25rem;
transform: var(--tw-transform);
}
=======
>>>>>>> Stashed changes
.hover\:scale-95:hover {
--tw-scale-x: .95;
--tw-scale-y: .95;
transform: var(--tw-transform);
}
<<<<<<< Updated upstream
.hover\:scale-110:hover {
--tw-scale-x: 1.1;
--tw-scale-y: 1.1;
transform: var(--tw-transform);
}
=======
>>>>>>> Stashed changes
.hover\:scale-125:hover {
--tw-scale-x: 1.25;
--tw-scale-y: 1.25;

15
public/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,180 @@
<template>
<Page>
<TopBar :breadcrumbs="breadcrumbs"/>
<Content>
<Container>
<PageHeader>
<template #start>
<PageHeaderTitle>{{ __('Aliases') }}</PageHeaderTitle>
</template>
</PageHeader>
<PageBody>
<SettingsLayout>
<template #nav>
<Tabs :site="site"/>
</template>
<template #segments>
<SettingsSegment>
<template #title>{{ __('Create') }}</template>
<template #form>
<form class="space-y-4" @submit.prevent="submit">
<FormInput v-if="form.type === 'letsencrypt'" :label="__('Domain')" :errors="$page.props.errors.domain" v-model="form.domain"/>
<FormActions>
<Button>{{ __('Save changes') }}</Button>
</FormActions>
</form>
</template>
</SettingsSegment>
<EmptyImage v-if="false" />
<SettingsSegment>
<template #title>{{ __('Aliases') }}</template>
<template #content>
<div>
<Table caption="Cronjob list overview">
<TableHead>
<TableRow>
<TableHeader></TableHeader>
<TableHeader>{{ __('Alias') }}</TableHeader>
<TableHeader></TableHeader>
</TableRow>
</TableHead>
</Table>
</div>
</template>
</SettingsSegment>
</template>
</SettingsLayout>
</PageBody>
</Container>
</Content>
</Page>
</template>
<script>
import TopBar from './components/TopBar'
import Container from '@/components/Container'
import Content from '@/components/Content'
import Page from '@/components/Page'
import PageHeader from '@/components/PageHeader'
import PageHeaderTitle from '@/components/PageHeaderTitle'
import PageBody from '@/components/PageBody'
import Button from '@/components/Button'
import List from '@/components/List'
import ListItem from '@/components/ListItem'
import StatusBubble from '@/components/StatusBubble'
import NotificationBadge from '@/components/NotificationBadge'
import MainLayout from '@/Layouts/MainLayout'
import SettingsLayout from '@/components/layouts/SettingsLayout'
import SettingsSegment from '@/components/SettingsSegment'
import FormInput from '@/components/forms/FormInput'
import FormSelect from '@/components/forms/FormSelect'
import FormTextarea from '@/components/forms/FormTextarea'
import Form from '@/components/Form'
import Pagination from '@/components/Pagination'
import EmptyImage from '@/components/EmptyImage'
import FormActions from '@/components/FormActions'
import {useConfirmDelete} from '@/hooks/confirm-delete'
import Tabs from './Tabs'
import Table from '@/components/Table'
import TableHead from '@/components/TableHead'
import TableHeader from '@/components/TableHeader'
import TableRow from '@/components/TableRow'
import TableBody from '@/components/TableBody'
import TableData from '@/components/TableData'
export default {
metaInfo() {
return {
title: `${this.__('Certificates')} - ${this.site.domain}`,
}
},
layout: MainLayout,
components: {
TopBar,
Container,
Content,
Page,
PageHeader,
PageHeaderTitle,
PageBody,
Button,
List,
ListItem,
StatusBubble,
NotificationBadge,
FormInput,
FormSelect,
FormTextarea,
SettingsLayout,
SettingsSegment,
Form,
FormActions,
Pagination,
Tabs,
Table,
TableHead,
TableHeader,
TableRow,
TableBody,
TableData,
EmptyImage,
},
data() {
return {
sending: false,
form: {
domain: null,
type: 'letsencrypt',
certificate: null,
private: null,
},
breadcrumbs: [
{
title: this.$page.props.settings.name,
to: '/',
},
{
title: this.__('Sites'),
to: this.route('sites.index'),
},
{
title: this.site.domain,
to: this.route('sites.show', this.site.id),
},
{
title: this.__('Aliases'),
to: this.route('sites.aliases.index', this.site.id),
},
],
}
},
mounted() {
},
watch: {
},
computed: {
},
props: {
site: Object,
certificates: Object,
},
methods: {
},
}
</script>

View File

@@ -177,7 +177,7 @@
},
{
title: this.__('Certificates'),
to: this.route('sites.cronjobs.index', this.site.id),
to: this.route('sites.certificates.index', this.site.id),
},
],
}

View File

@@ -47,7 +47,7 @@
{{ site.domain }}
</inertia-link>
</template>
<template v-if="site.project === 'wordpress'" #subtitle>WordPress installed</template>
<template v-if="site.project === 'wordpress'" #subtitle>{{ __('WordPress installed') }}</template>
<template #suffix>
<Dropdown v-slot="{ isOpen, toggle, position }">
<IconButton @click="toggle">

View File

@@ -51,6 +51,11 @@
to: this.route('sites.certificates.index', this.site.id),
active: this.route().current('sites.certificates.index')
},
{
title: this.__('Aliases'),
to: this.route('sites.aliases.index', this.site.id),
active: this.route().current('sites.aliases.index')
},
this.site.dns_id ? {
title: this.__('DNS'),
to: this.route('sites.dns.index', this.site.id),

View File

@@ -104,6 +104,8 @@
"Dark": "Donker",
"Auto": "Automatisch",
"site|sites": "website|websites",
"WordPress installed": "WordPress geïnstalleerd",
"Aliases": "Aliassen",
"Support requests": "Support aanvragen",
"Open support requests": "Openstaande aanvragen",

View File

@@ -65,6 +65,13 @@ Route::group(['middleware' => ['auth', 'auth.blocked']], function () {
Route::delete('{certificate}', 'SiteCertificateController@destroy')->name('delete');
});
// Site aliases
Route::group(['prefix' => '{site}/aliases', 'as' => 'aliases.'], function () {
Route::get('/', 'SiteAliasController@index')->name('index');
Route::post('/', 'SiteAliasController@store')->name('store');
Route::delete('{alias}', 'SiteAliasController@destroy')->name('delete');
});
// Site DNS
Route::group(['prefix' => '{site}/dns', 'as' => 'dns.'], function () {
Route::get('/', 'SiteDnsController@index')->name('index');