From 5d18523ca2e2e6ac207282bee9be0c805fa7cb9d Mon Sep 17 00:00:00 2001 From: archey347 Date: Thu, 24 May 2018 09:55:23 +0100 Subject: [PATCH 01/30] Added Database Migrations and Models for Zones and Entries --- src/Database/Migrations/v000/ZonesTable.php | 46 +++++++++++++++++++++ src/Database/Models/ZoneEntries.php | 27 ++++++++++++ src/Database/Models/Zones.php | 31 ++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 src/Database/Migrations/v000/ZonesTable.php create mode 100644 src/Database/Models/ZoneEntries.php create mode 100644 src/Database/Models/Zones.php diff --git a/src/Database/Migrations/v000/ZonesTable.php b/src/Database/Migrations/v000/ZonesTable.php new file mode 100644 index 0000000..132272e --- /dev/null +++ b/src/Database/Migrations/v000/ZonesTable.php @@ -0,0 +1,46 @@ +schema->hasTable('zones')) { + $this->schema->create('zones', function (Blueprint $table) { + $table->increments('id'); + $table->string('type', 100); + $table->integer('ttl'); + $table->string('primary_dns', 500); + $table->string('admin_domain', 500); + $table->integer('serial_number'); + $table->string("serial_number_mode", 100); + $table->integer('refresh'); + $table->integer('retry'); + $table->integer('expiry'); + + }); + } + } + /** + * {@inheritDoc} + */ + public function down() + { + $this->schema->drop('zones'); + } +} diff --git a/src/Database/Models/ZoneEntries.php b/src/Database/Models/ZoneEntries.php new file mode 100644 index 0000000..e76fcf7 --- /dev/null +++ b/src/Database/Models/ZoneEntries.php @@ -0,0 +1,27 @@ +hasMany('UserFrosting\Sprinkle\Dnsadmin\Database\Models\ZoneEntries'); + } +} From 8cf7c9c699b2fe01ea508ec0e53fb474fa29c327 Mon Sep 17 00:00:00 2001 From: archey347 Date: Thu, 24 May 2018 17:53:34 +0100 Subject: [PATCH 02/30] Added PHP File Template --- PHPFileTemplate.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 PHPFileTemplate.md diff --git a/PHPFileTemplate.md b/PHPFileTemplate.md new file mode 100644 index 0000000..b943a8d --- /dev/null +++ b/PHPFileTemplate.md @@ -0,0 +1,14 @@ +# PHP File template + +Use this template at the start of any PHP file + +```PHP + Date: Thu, 24 May 2018 17:53:52 +0100 Subject: [PATCH 03/30] Added api and admin routes --- routes/admin.php | 5 +++++ routes/api.php | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 routes/admin.php create mode 100644 routes/api.php diff --git a/routes/admin.php b/routes/admin.php new file mode 100644 index 0000000..396ce0b --- /dev/null +++ b/routes/admin.php @@ -0,0 +1,5 @@ +group('/dnsadmin', function () use ($app) { + $app->get('', 'UserFrosting\Sprinkle\Dnsadmin\Controller\AdminController:pageAdmin'); +}); diff --git a/routes/api.php b/routes/api.php new file mode 100644 index 0000000..357e4c3 --- /dev/null +++ b/routes/api.php @@ -0,0 +1,19 @@ +group('/api/dns', function () use ($app) { + $app->get('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); + $app->post('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); + $app->put('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); + $app->delete('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); + + + + $app->get('/lookup/{lookup_type}/{lookup_value}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); + + $app->get('/a/{lookup_value}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); + $app->get('/aaaa/{lookup_value}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); + $app->get('/mx/{lookup_value}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); + + + +}); From ac52da5b14e8d30a4fabf9141055c88ba6ed1068 Mon Sep 17 00:00:00 2001 From: archey347 Date: Thu, 24 May 2018 17:54:20 +0100 Subject: [PATCH 04/30] Added Documentation to Zones DB Model --- src/Database/Models/Zones.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Database/Models/Zones.php b/src/Database/Models/Zones.php index a16d0b9..9b9082c 100644 --- a/src/Database/Models/Zones.php +++ b/src/Database/Models/Zones.php @@ -4,6 +4,13 @@ use UserFrosting\Sprinkle\Core\Database\Models\Model; +/** + * Zones Table Model + * Version 0.0.0 + * + * @extends Model + * @author Archey Barrell + */ class Zones extends Model { public $timestamps = true; From 879bb5c55bd5aa99f7dcf0e844509ebf73ce89c9 Mon Sep 17 00:00:00 2001 From: archey347 Date: Thu, 24 May 2018 21:36:16 +0100 Subject: [PATCH 05/30] Added DNS Admin page --- routes/admin.php | 2 +- src/Controller/AdminController.php | 34 +++++++++++++++++++++ templates/navigation/sidebar-menu.html.twig | 8 +++++ templates/pages/dnsadmin-zones.html.twig | 8 +++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 src/Controller/AdminController.php create mode 100644 templates/navigation/sidebar-menu.html.twig create mode 100644 templates/pages/dnsadmin-zones.html.twig diff --git a/routes/admin.php b/routes/admin.php index 396ce0b..6840a16 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -1,5 +1,5 @@ group('/dnsadmin', function () use ($app) { - $app->get('', 'UserFrosting\Sprinkle\Dnsadmin\Controller\AdminController:pageAdmin'); + $app->get('', 'UserFrosting\Sprinkle\Dnsadmin\Controller\AdminController:pageZonesAdmin'); }); diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php new file mode 100644 index 0000000..24be06f --- /dev/null +++ b/src/Controller/AdminController.php @@ -0,0 +1,34 @@ +ci->view->render($response, 'pages/dnsadmin-zones.html.twig'); + } +} diff --git a/templates/navigation/sidebar-menu.html.twig b/templates/navigation/sidebar-menu.html.twig new file mode 100644 index 0000000..c52b8ac --- /dev/null +++ b/templates/navigation/sidebar-menu.html.twig @@ -0,0 +1,8 @@ +{% extends '@admin/navigation/sidebar-menu.html.twig' %} + +{% block navigation %} + {{ parent() }} +
  • + DNS +
  • +{% endblock %} diff --git a/templates/pages/dnsadmin-zones.html.twig b/templates/pages/dnsadmin-zones.html.twig new file mode 100644 index 0000000..293c522 --- /dev/null +++ b/templates/pages/dnsadmin-zones.html.twig @@ -0,0 +1,8 @@ +{% extends 'pages/abstract/dashboard.html.twig' %} + +{% block page_title %}DNS Zones{% endblock %} + +{% block page_description %}Manage the DNS Zones{% endblock %} + +{% block body_matter %} +{% endblock %} From 68ae1eb25c0f7df76a93365d8d18de7a67332eac Mon Sep 17 00:00:00 2001 From: archey347 Date: Thu, 24 May 2018 21:54:01 +0100 Subject: [PATCH 06/30] Renamed the Models --- src/Database/Models/{Zones.php => Zone.php} | 2 +- src/Database/Models/{ZoneEntries.php => ZoneEntry.php} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/Database/Models/{Zones.php => Zone.php} (91%) rename src/Database/Models/{ZoneEntries.php => ZoneEntry.php} (89%) diff --git a/src/Database/Models/Zones.php b/src/Database/Models/Zone.php similarity index 91% rename from src/Database/Models/Zones.php rename to src/Database/Models/Zone.php index 9b9082c..3fabb03 100644 --- a/src/Database/Models/Zones.php +++ b/src/Database/Models/Zone.php @@ -11,7 +11,7 @@ * @extends Model * @author Archey Barrell */ -class Zones extends Model +class Zone extends Model { public $timestamps = true; diff --git a/src/Database/Models/ZoneEntries.php b/src/Database/Models/ZoneEntry.php similarity index 89% rename from src/Database/Models/ZoneEntries.php rename to src/Database/Models/ZoneEntry.php index e76fcf7..eef4559 100644 --- a/src/Database/Models/ZoneEntries.php +++ b/src/Database/Models/ZoneEntry.php @@ -4,7 +4,7 @@ use UserFrosting\Sprinkle\Core\Database\Models\Model; -class Zones extends Model +class ZoneEntry extends Model { public $timestamps = true; From 70399c23cfd37cbf90e4133b68c4c7511bb65421 Mon Sep 17 00:00:00 2001 From: archey347 Date: Thu, 24 May 2018 22:34:13 +0100 Subject: [PATCH 07/30] Added Documentation and Added missing function --- src/Database/Models/Zone.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Database/Models/Zone.php b/src/Database/Models/Zone.php index 3fabb03..8bc7d1e 100644 --- a/src/Database/Models/Zone.php +++ b/src/Database/Models/Zone.php @@ -20,6 +20,9 @@ class Zone extends Model */ protected $table = 'zones'; + /** + * @var array The fieds which are writeable? + */ protected $fillable = [ 'type', 'ttl', @@ -32,7 +35,10 @@ class Zone extends Model 'expiry' ]; - public entries() { + /** + * @method enteries() Gets all of the zone entries + */ + public function entries() { return $this->hasMany('UserFrosting\Sprinkle\Dnsadmin\Database\Models\ZoneEntries'); } } From 5f4fcdc38cda228e7f7637add006cf7e60b33134 Mon Sep 17 00:00:00 2001 From: archey347 Date: Thu, 24 May 2018 22:35:54 +0100 Subject: [PATCH 08/30] Added Zones Sprunje with API route --- routes/api.php | 2 ++ src/Controller/ApiController.php | 44 ++++++++++++++++++++++++++++++++ src/Sprunje/ZonesSprunje.php | 31 ++++++++++++++++++++++ templates/tables/zones.html.twig | 0 4 files changed, 77 insertions(+) create mode 100644 src/Controller/ApiController.php create mode 100644 src/Sprunje/ZonesSprunje.php create mode 100644 templates/tables/zones.html.twig diff --git a/routes/api.php b/routes/api.php index 357e4c3..33c94c7 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,6 +1,8 @@ group('/api/dns', function () use ($app) { + $app->get('/zones', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController:getZones'); + $app->get('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); $app->post('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); $app->put('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); diff --git a/src/Controller/ApiController.php b/src/Controller/ApiController.php new file mode 100644 index 0000000..8a5fb9d --- /dev/null +++ b/src/Controller/ApiController.php @@ -0,0 +1,44 @@ +getQueryParams(); + + /** @var UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */ + $classMapper = $this->ci->classMapper; + + $sprunje = new ZonesSprunje($classMapper, $params); + + return $sprunje->toResponse($response); + } +} diff --git a/src/Sprunje/ZonesSprunje.php b/src/Sprunje/ZonesSprunje.php new file mode 100644 index 0000000..98846d8 --- /dev/null +++ b/src/Sprunje/ZonesSprunje.php @@ -0,0 +1,31 @@ +newQuery(); + } +} diff --git a/templates/tables/zones.html.twig b/templates/tables/zones.html.twig new file mode 100644 index 0000000..e69de29 From e0e7d29a60da36b699a13556642660b41831f056 Mon Sep 17 00:00:00 2001 From: archey347 Date: Fri, 25 May 2018 21:55:36 +0100 Subject: [PATCH 09/30] Added DNS Zones page --- asset-bundles.json | 16 +++++++ assets/userfrosting/js/widgets/zones-admin.js | 3 ++ .../Migrations/v000/ZoneEntriesTable.php | 46 +++++++++++++++++++ src/Database/Migrations/v000/ZonesTable.php | 1 + src/Database/Models/Zone.php | 16 +++++++ src/Sprunje/ZonesSprunje.php | 7 +++ templates/pages/dnsadmin-zones.html.twig | 18 ++++++++ templates/tables/zones.html.twig | 26 +++++++++++ 8 files changed, 133 insertions(+) create mode 100644 asset-bundles.json create mode 100644 assets/userfrosting/js/widgets/zones-admin.js create mode 100644 src/Database/Migrations/v000/ZoneEntriesTable.php diff --git a/asset-bundles.json b/asset-bundles.json new file mode 100644 index 0000000..58b82e7 --- /dev/null +++ b/asset-bundles.json @@ -0,0 +1,16 @@ +{ + "bundle": { + "js/pages/zones-admin": { + "scripts": [ + "userfrosting/js/widgets/zones-admin.js" + ], + "options": { + "result": { + "type": { + "scripts": "plain" + } + } + } + } + } +} diff --git a/assets/userfrosting/js/widgets/zones-admin.js b/assets/userfrosting/js/widgets/zones-admin.js new file mode 100644 index 0000000..986207b --- /dev/null +++ b/assets/userfrosting/js/widgets/zones-admin.js @@ -0,0 +1,3 @@ +$('#zones-table').ufTable({ + dataUrl: site.uri.public + '/api/dns/zones' +}); diff --git a/src/Database/Migrations/v000/ZoneEntriesTable.php b/src/Database/Migrations/v000/ZoneEntriesTable.php new file mode 100644 index 0000000..8409c3e --- /dev/null +++ b/src/Database/Migrations/v000/ZoneEntriesTable.php @@ -0,0 +1,46 @@ +schema->hasTable('zones')) { + $this->schema->create('zones', function (Blueprint $table) { + $table->increments('id'); + $table->string('type', 100); + $table->integer('ttl'); + $table->string('primary_dns', 500); + $table->string('admin_domain', 500); + $table->integer('serial_number'); + $table->string("serial_number_mode", 100); + $table->integer('refresh'); + $table->integer('retry'); + $table->integer('expiry'); + + }); + }*/ + } + /** + * {@inheritDoc} + */ + public function down() + { + //$this->schema->drop('zones'); + } +} diff --git a/src/Database/Migrations/v000/ZonesTable.php b/src/Database/Migrations/v000/ZonesTable.php index 132272e..6760c36 100644 --- a/src/Database/Migrations/v000/ZonesTable.php +++ b/src/Database/Migrations/v000/ZonesTable.php @@ -23,6 +23,7 @@ public function up() if(!$this->schema->hasTable('zones')) { $this->schema->create('zones', function (Blueprint $table) { $table->increments('id'); + $table->string('name', 1000); $table->string('type', 100); $table->integer('ttl'); $table->string('primary_dns', 500); diff --git a/src/Database/Models/Zone.php b/src/Database/Models/Zone.php index 8bc7d1e..ce3e358 100644 --- a/src/Database/Models/Zone.php +++ b/src/Database/Models/Zone.php @@ -25,6 +25,7 @@ class Zone extends Model */ protected $fillable = [ 'type', + 'name', 'ttl', 'primary_dns', 'admin_domain', @@ -35,10 +36,25 @@ class Zone extends Model 'expiry' ]; + /** + * @var array All of the calculated fields + */ + protected $appends = [ + 'is_normal' + ]; + + /** * @method enteries() Gets all of the zone entries */ public function entries() { return $this->hasMany('UserFrosting\Sprinkle\Dnsadmin\Database\Models\ZoneEntries'); } + + /** + * @method getIsNormalAttribute() Checks if the zone is a normal one + */ + public function getIsNormalAttribute() { + return $this->type == "normal"; + } } diff --git a/src/Sprunje/ZonesSprunje.php b/src/Sprunje/ZonesSprunje.php index 98846d8..265360d 100644 --- a/src/Sprunje/ZonesSprunje.php +++ b/src/Sprunje/ZonesSprunje.php @@ -19,6 +19,13 @@ */ class ZonesSprunje extends Sprunje { + /** + * @var array The fieds which are sortable + */ + protected $sortable = [ + 'name', + ]; + /** * Set the initial query used by the sprunje */ diff --git a/templates/pages/dnsadmin-zones.html.twig b/templates/pages/dnsadmin-zones.html.twig index 293c522..03c0388 100644 --- a/templates/pages/dnsadmin-zones.html.twig +++ b/templates/pages/dnsadmin-zones.html.twig @@ -5,4 +5,22 @@ {% block page_description %}Manage the DNS Zones{% endblock %} {% block body_matter %} +
    +
    +

    Zones

    + {% include "tables/table-tool-menu.html.twig" %} +
    +
    + {% include "tables/zones.html.twig" with { + "table" : { + "id" : "table-zones" + } + } + %} +
    + +{% endblock %} +{% block scripts_page %} + {{ assets.js('js/pages/zones-admin') | raw }} {% endblock %} diff --git a/templates/tables/zones.html.twig b/templates/tables/zones.html.twig index e69de29..fdc8946 100644 --- a/templates/tables/zones.html.twig +++ b/templates/tables/zones.html.twig @@ -0,0 +1,26 @@ +{% extends "tables/table-paginated.html.twig" %} + +{% block table %} + + + + + + + +
    Zone Name
    +{% endblock %} + +{% block table_cell_templates %} + {% verbatim %} + + {% endverbatim %} +{% endblock %} From 168d4ecea7099c633b4eef2d004f5688f3179aaa Mon Sep 17 00:00:00 2001 From: archey347 Date: Sun, 27 May 2018 23:24:52 +0100 Subject: [PATCH 10/30] Added Zone Entry Migration and model --- .../Migrations/v000/ZoneEntriesTable.php | 22 ++++++++----------- src/Database/Models/Zone.php | 3 ++- src/Database/Models/ZoneEntry.php | 12 +++------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/Database/Migrations/v000/ZoneEntriesTable.php b/src/Database/Migrations/v000/ZoneEntriesTable.php index 8409c3e..f0a3ae3 100644 --- a/src/Database/Migrations/v000/ZoneEntriesTable.php +++ b/src/Database/Migrations/v000/ZoneEntriesTable.php @@ -20,27 +20,23 @@ class ZoneEntriesTable extends Migration */ public function up() { - /*if(!$this->schema->hasTable('zones')) { - $this->schema->create('zones', function (Blueprint $table) { + if(!$this->schema->hasTable('zone_entries')) { + $this->schema->create('zone_entries', function (Blueprint $table) { $table->increments('id'); - $table->string('type', 100); - $table->integer('ttl'); - $table->string('primary_dns', 500); - $table->string('admin_domain', 500); - $table->integer('serial_number'); - $table->string("serial_number_mode", 100); - $table->integer('refresh'); - $table->integer('retry'); - $table->integer('expiry'); + $table->integer('zone_id'); + $table->string('type'); + $table->string('name', 1000); + $table->string('value', 1000); + $table->index('zone_id'); }); - }*/ + } } /** * {@inheritDoc} */ public function down() { - //$this->schema->drop('zones'); + $this->schema->drop('zone_entries'); } } diff --git a/src/Database/Models/Zone.php b/src/Database/Models/Zone.php index ce3e358..74b33a6 100644 --- a/src/Database/Models/Zone.php +++ b/src/Database/Models/Zone.php @@ -48,7 +48,7 @@ class Zone extends Model * @method enteries() Gets all of the zone entries */ public function entries() { - return $this->hasMany('UserFrosting\Sprinkle\Dnsadmin\Database\Models\ZoneEntries'); + return $this->hasMany('UserFrosting\Sprinkle\Dnsadmin\Database\Models\ZoneEntry'); } /** @@ -57,4 +57,5 @@ public function entries() { public function getIsNormalAttribute() { return $this->type == "normal"; } + } diff --git a/src/Database/Models/ZoneEntry.php b/src/Database/Models/ZoneEntry.php index eef4559..8bcb8e9 100644 --- a/src/Database/Models/ZoneEntry.php +++ b/src/Database/Models/ZoneEntry.php @@ -11,17 +11,11 @@ class ZoneEntry extends Model /** * @var string The name of the table for the current model. */ - protected $table = 'zones'; + protected $table = 'zone_entries'; protected $fillable = [ 'type', - 'ttl', - 'primary_dns', - 'admin_domain', - 'serial_number', - 'serial_number_mode', - 'refresh', - 'retry', - 'expiry' + 'name', + 'value' ]; } From 248d5c29352e783e901e580753c320846e99883e Mon Sep 17 00:00:00 2001 From: archey347 Date: Sun, 27 May 2018 23:25:24 +0100 Subject: [PATCH 11/30] Added more columns to the zones table --- templates/pages/dnsadmin-zones.html.twig | 4 ++ templates/tables/zones.html.twig | 50 +++++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/templates/pages/dnsadmin-zones.html.twig b/templates/pages/dnsadmin-zones.html.twig index 03c0388..e07107f 100644 --- a/templates/pages/dnsadmin-zones.html.twig +++ b/templates/pages/dnsadmin-zones.html.twig @@ -19,6 +19,10 @@ %}
    {% endblock %} {% block scripts_page %} diff --git a/templates/tables/zones.html.twig b/templates/tables/zones.html.twig index fdc8946..20edb9c 100644 --- a/templates/tables/zones.html.twig +++ b/templates/tables/zones.html.twig @@ -4,6 +4,12 @@ + + + + + + @@ -19,7 +25,49 @@

    {{row.name}}

    - Type: {{#if row.is_normal }}Normal{{else}}Reverse{{/if}} + Type: {{#if row.is_normal }}Normal{{else}}Reverse{{/if}} + + + + + + {% endverbatim %} From 187e3c56dd20355d7f8faa26981eea49d10d6b47 Mon Sep 17 00:00:00 2001 From: archey347 Date: Mon, 28 May 2018 12:30:48 +0100 Subject: [PATCH 12/30] Added vue.js to all pages --- templates/pages/abstract/base.html.twig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 templates/pages/abstract/base.html.twig diff --git a/templates/pages/abstract/base.html.twig b/templates/pages/abstract/base.html.twig new file mode 100644 index 0000000..24eb2f8 --- /dev/null +++ b/templates/pages/abstract/base.html.twig @@ -0,0 +1,9 @@ +{% extends "@core/pages/abstract/base.html.twig" %} + +{% block scripts_site %} + + + +{{parent()}} + +{% endblock %} From 045316b280560866a9b187a192693c7dd44143e9 Mon Sep 17 00:00:00 2001 From: archey347 Date: Wed, 6 Jun 2018 15:30:54 +0100 Subject: [PATCH 13/30] Added Timestamps to Migrations --- src/Database/Migrations/v000/ZoneEntriesTable.php | 2 ++ src/Database/Migrations/v000/ZonesTable.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Database/Migrations/v000/ZoneEntriesTable.php b/src/Database/Migrations/v000/ZoneEntriesTable.php index f0a3ae3..18b226d 100644 --- a/src/Database/Migrations/v000/ZoneEntriesTable.php +++ b/src/Database/Migrations/v000/ZoneEntriesTable.php @@ -28,6 +28,8 @@ public function up() $table->string('name', 1000); $table->string('value', 1000); + $table->timestamps(); + $table->index('zone_id'); }); } diff --git a/src/Database/Migrations/v000/ZonesTable.php b/src/Database/Migrations/v000/ZonesTable.php index 6760c36..0f5f9a7 100644 --- a/src/Database/Migrations/v000/ZonesTable.php +++ b/src/Database/Migrations/v000/ZonesTable.php @@ -34,6 +34,8 @@ public function up() $table->integer('retry'); $table->integer('expiry'); + $table->timestamps(); + }); } } From dddb11d26e5c0282d89bfbf97cf1af06dc50d995 Mon Sep 17 00:00:00 2001 From: archey347 Date: Wed, 6 Jun 2018 15:31:58 +0100 Subject: [PATCH 14/30] Added Create Zone Form --- assets/userfrosting/js/widgets/zones-admin.js | 89 ++++++++++++++++- routes/admin.php | 4 + routes/api.php | 16 +--- schema/requests/zone-create.yaml | 61 ++++++++++++ src/Controller/AdminController.php | 39 +++++++- src/Controller/ApiController.php | 78 +++++++++++++++ templates/forms/zone.html.twig | 96 +++++++++++++++++++ templates/modals/zone.html.twig | 7 ++ templates/pages/dnsadmin-zones.html.twig | 6 +- 9 files changed, 376 insertions(+), 20 deletions(-) create mode 100644 schema/requests/zone-create.yaml create mode 100644 templates/forms/zone.html.twig create mode 100644 templates/modals/zone.html.twig diff --git a/assets/userfrosting/js/widgets/zones-admin.js b/assets/userfrosting/js/widgets/zones-admin.js index 986207b..aef2423 100644 --- a/assets/userfrosting/js/widgets/zones-admin.js +++ b/assets/userfrosting/js/widgets/zones-admin.js @@ -1,3 +1,88 @@ -$('#zones-table').ufTable({ - dataUrl: site.uri.public + '/api/dns/zones' + +function fInt(num, length) { + var r = "" + num; + while (r.length < length) { + r = "0" + r; + } + return r; +} + +function bindZoneTableButtons(el) { + +} + +function getTimestamp() { + now = new Date(); + + return fInt(now.getFullYear(), 4) + fInt(now.getMonth(), 2) + fInt(now.getDate().toString(), 2) + fInt(now.getHours(), 2) + fInt(now.getMinutes(), 2) + fInt(now.getSeconds(), 2) +} + +$(document).ready(function() { + $('#zones-table').ufTable({ + dataUrl: site.uri.public + '/api/dns/zones' + }); + + $("#zones-table").on("pagerComplete.ufTable", function () { + bindZoneTableButtons($(this)); + }); + + $("#btn-create-zone").click(function() { + $('body').ufModal({ + sourceUrl : site.uri.public + '/modals/dnsadmin/create-zone', + msgTarget: $('#alerts-page') + }); + + $('body').on("renderSuccess.ufModal", function (data) { + var modal = $(this).ufModal('getModal'); + + var form = new Vue({ + el: '#form-zone-create', + data: { + "zone_type" : "normal", + "show_examples" : false, + "domain" : "", + "serial_number_mode" : "timestamp", + "serial_number" : getTimestamp(), + "ip_examples" : [ + { + "start" : "192.168.0.1", + "end" : "192.168.0.254", + "subnet" : "255.255.255.0 /24", + "input" : "192.168.0" + }, + { + "start" : "74.0.0.0", + "end" : "74.15.254.254", + "subnet" : "255.240.0.0 /12", + "input" : "74" + }, + { + "start": "2001:0db8::1", + "end" : " 2001:db8:ffff:ffff:ffff:ffff:ffff:ffff", + "subnet" : "/32", + "input" : " 2001:db8" + } + ] + }, + methods: { + updateSerialNumber: function () { + if (this.serial_number_mode == "timestamp") { + this.serial_number = getTimestamp(); + } else { + this.serial_number = 1; + } + } + } + }); + + $('#form-zone-create').ufForm({ + msgTarget: $('#form-zone-alerts'), + validator: page.validators.createZone + }).on("submitSuccess.ufForm", function(event, data, textStatus, jqXHR) { + window.location.reload(); + }); + }); + }); + + }); diff --git a/routes/admin.php b/routes/admin.php index 6840a16..bfe8be2 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -3,3 +3,7 @@ $app->group('/dnsadmin', function () use ($app) { $app->get('', 'UserFrosting\Sprinkle\Dnsadmin\Controller\AdminController:pageZonesAdmin'); }); + +$app->group('/modals/dnsadmin', function () use ($app) { + $app->get('/create-zone', 'UserFrosting\Sprinkle\Dnsadmin\Controller\AdminController:modalCreateZone'); +}); diff --git a/routes/api.php b/routes/api.php index 33c94c7..f45e14c 100644 --- a/routes/api.php +++ b/routes/api.php @@ -2,20 +2,6 @@ $app->group('/api/dns', function () use ($app) { $app->get('/zones', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController:getZones'); - - $app->get('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); - $app->post('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); - $app->put('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); - $app->delete('/z/{zone_name}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); - - - - $app->get('/lookup/{lookup_type}/{lookup_value}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); - - $app->get('/a/{lookup_value}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); - $app->get('/aaaa/{lookup_value}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); - $app->get('/mx/{lookup_value}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController'); - - + $app->post('/zones', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController:createZone'); }); diff --git a/schema/requests/zone-create.yaml b/schema/requests/zone-create.yaml new file mode 100644 index 0000000..6c1c706 --- /dev/null +++ b/schema/requests/zone-create.yaml @@ -0,0 +1,61 @@ +type: + validators: + required: + message: Please select a zone type. + member_of: + values: + - normal + - reverse + message: Zone type must either be 'normal' or 'reverse'. +name: + validators: + required: + message: Please enter the zone name. +ttl: + validators: + required: + message: Please enter in the TTL. + numeric: + message: The TTL value must be a number. +primary_dns: + validators: + required: + message: Please enter in the name of the primary DNS server. +admin_domain: + validators: + required: + message: Please enter in the name of the admin domain. +serial_number_mode: + validators: + required: + message: Please select the serial number mode. + member_of: + values: + - counter + - timestamp + - manual + message: The serial number mode must either be 'counter', 'timestamp', 'manual'. +serial_number: + validators: + required: + message: Please enter in a serial number or select a different serial number mode. + numeric: + message: The serial number must be a number. +refresh: + validators: + required: + message: Please enter in a refresh value. + numeric: + message: The refresh value must be a number. +retry: + validators: + required: + message: Please enter in a retry value. + numeric: + message: The retry value must be a number. +expire: + validators: + required: + message: Please enter in an expire value. + numeric: + message: The expire value must be a number. diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 24be06f..322d6fc 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -10,6 +10,8 @@ use UserFrosting\Sprinkle\Core\Controller\SimpleController; use Slim\Http\Request; use Slim\Http\Response; +use UserFrosting\Fortress\RequestSchema; +use UserFrosting\Fortress\Adapter\JqueryValidationAdapter; /** * Controller class that manages all of the DNS Admin front end UI @@ -25,10 +27,43 @@ class AdminController extends SimpleController * @param Request $request * @param Response $response * @param array $args - * @return void + * @return Response */ public function pageZonesAdmin(Request $request, Response $response, $args) { - return $this->ci->view->render($response, 'pages/dnsadmin-zones.html.twig'); + // Get the zone create validation rules + $schema = new RequestSchema('schema://requests/zone-create.yaml'); + $validator = new JqueryValidationAdapter($schema, $this->ci->translator); + + return $this->ci->view->render($response, 'pages/dnsadmin-zones.html.twig', [ + 'page' => [ + 'validators' => [ + 'createZone' => $validator->rules() + ] + ] + ]); } + + /** + * Generates the modal form for creating a zone + * + * @param Request $request + * @param Response $response + * @param array $args + * @return Response + */ + public function modalCreateZone(Request $request, Response $response, $args) + { + return $this->ci->view->render($response, 'modals/zone.html.twig', [ + "form" => [ + "id" => "form-zone-create", + "method" => "POST", + "action" => "api/dns/zones", + "submit" => "Create Zone" + ] + ]); + + } + + } diff --git a/src/Controller/ApiController.php b/src/Controller/ApiController.php index 8a5fb9d..9ebcc25 100644 --- a/src/Controller/ApiController.php +++ b/src/Controller/ApiController.php @@ -11,6 +11,12 @@ use Slim\Http\Request; use Slim\Http\Response; use UserFrosting\Sprinkle\Dnsadmin\Sprunje\ZonesSprunje; +use UserFrosting\Fortress\RequestDataTransformer; +use UserFrosting\Fortress\RequestSchema; +use UserFrosting\Fortress\ServerSideValidator; +use UserFrosting\Sprinkle\Dnsadmin\Database\Models\Zone; +use Illuminate\Database\Capsule\Manager as Capsule; + /** * Controller class which handles all of the API calls for the dns config @@ -20,6 +26,14 @@ */ class ApiController extends SimpleController { + /** + * Adds a "." to a domain name if there isn't one already present + */ + public function domainTransformer($domain) + { + return substr($domain, -1) == "." ? $domain : $domain . "."; + } + /** * Gets a list of all of the zones through the Zones sprunje * Method Type: GET @@ -41,4 +55,68 @@ public function getZones(Request $request, Response $response, $args) return $sprunje->toResponse($response); } + + /** + * Creates a zone + * + * @param Request $request + * @param Response $response + * @param array $args + * @return void + */ + public function createZone(Request $request, Response $response, $args) { + $params = $request->getParsedBody(); + + // Start off by checking to make sure that the zone type is correct + $schema = new RequestSchema('schema://requests/zone-create.yaml'); + + $transformer = new RequestDataTransformer($schema); + $data = $transformer->transform($params); + + $ms = $this->ci->alerts; + + $validator = new ServerSideValidator($schema, $this->ci->translator); + + if(!$validator->validate($data)) { + $ms->addValidationErrors($validator); + return $response->withStatus(400); + } + + if($data['type'] == "normal") { + $data['name'] = $this->domainTransformer($data['name']); + } + + // Make sure that this zone doesn't already exist + $zone = Zone::where('name', $data['name'])->first(); + + if($zone) { + $ms->addMessage('danger', 'A zone with that name already exists.'); + return $response->withStatus(400); + } + + // Then add the zone to the Database + + Capsule::transaction(function() use($data) { + $zone = new Zone(); + + $zone->name = $data['name']; + $zone->type = $data['type']; + $zone->ttl = $data['ttl']; + + $zone->primary_dns = $this->domainTransformer($data['primary_dns']); + $zone->admin_domain = $this->domainTransformer($data['admin_domain']); + + $zone->serial_number_mode = $data['serial_number_mode']; + $zone->serial_number = $data['serial_number']; + + $zone->refresh = $data['refresh']; + $zone->retry = $data['retry']; + $zone->expiry = $data['expire']; + + $zone->save(); + }); + + $ms->addMessage('success', "Successfully added zone '{$data['name']}'"); + + } } diff --git a/templates/forms/zone.html.twig b/templates/forms/zone.html.twig new file mode 100644 index 0000000..e95d465 --- /dev/null +++ b/templates/forms/zone.html.twig @@ -0,0 +1,96 @@ +
    + + {% include "forms/csrf.html.twig" %} + {% verbatim %} +
    +
    +
    +
    +
    + + + + +
    + +
    +
    + +

    This is the domain name of the zone. For example, if you wanted to create domain name such as ftp.example.com, then you would type in here example.com.

    + +
    +
    +
    +
    + + +

    Put in here just the subnet identifier of the network that you are configuring reverse lookups for. +

    + +
    +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    +
    + +
    + + +

    + Timestamp: Serial number is generated from the current date and time.
    + Counter: The serial number is incremented by one every time there is a change.
    + Manual: You'll be asked to enter in a serial number every time. +

    +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    +
    +
    +{% endverbatim %} +
    +
    + +
    + + + diff --git a/templates/modals/zone.html.twig b/templates/modals/zone.html.twig new file mode 100644 index 0000000..12cd8ee --- /dev/null +++ b/templates/modals/zone.html.twig @@ -0,0 +1,7 @@ +{% extends "modals/modal.html.twig" %} + +{% block modal_title %}Zone{% endblock %} + +{% block modal_body %} + {% include "forms/zone.html.twig" %} +{% endblock %} diff --git a/templates/pages/dnsadmin-zones.html.twig b/templates/pages/dnsadmin-zones.html.twig index e07107f..ef0d206 100644 --- a/templates/pages/dnsadmin-zones.html.twig +++ b/templates/pages/dnsadmin-zones.html.twig @@ -19,12 +19,16 @@ %}
    {% endblock %} {% block scripts_page %} + + {{ assets.js('js/pages/zones-admin') | raw }} {% endblock %} From 132ea28b017eeecefb9bd46910f6470d01bec654 Mon Sep 17 00:00:00 2001 From: archey347 Date: Wed, 6 Jun 2018 22:21:05 +0100 Subject: [PATCH 15/30] Added Edit Zone modal --- assets/userfrosting/js/widgets/zones-admin.js | 84 ++++++++++++++----- routes/admin.php | 1 + routes/api.php | 1 + schema/requests/zone-edit.yaml | 52 ++++++++++++ src/Controller/AdminController.php | 48 ++++++++++- src/Controller/ApiController.php | 69 ++++++++++++++- src/Database/Migrations/v000/ZonesTable.php | 2 +- templates/forms/zone.html.twig | 51 +++++++---- templates/tables/zones.html.twig | 11 ++- 9 files changed, 274 insertions(+), 45 deletions(-) create mode 100644 schema/requests/zone-edit.yaml diff --git a/assets/userfrosting/js/widgets/zones-admin.js b/assets/userfrosting/js/widgets/zones-admin.js index aef2423..1d1e26f 100644 --- a/assets/userfrosting/js/widgets/zones-admin.js +++ b/assets/userfrosting/js/widgets/zones-admin.js @@ -1,3 +1,24 @@ +var ip_examples = [ + { + "start" : "192.168.0.1", + "end" : "192.168.0.254", + "subnet" : "255.255.255.0 /24", + "input" : "192.168.0" + }, + { + "start" : "74.0.0.0", + "end" : "74.15.254.254", + "subnet" : "255.240.0.0 /12", + "input" : "74" + }, + { + "start": "2001:0db8::1", + "end" : " 2001:db8:ffff:ffff:ffff:ffff:ffff:ffff", + "subnet" : "/32", + "input" : " 2001:db8" + } +]; + function fInt(num, length) { var r = "" + num; @@ -8,7 +29,49 @@ function fInt(num, length) { } function bindZoneTableButtons(el) { + el.find('.js-zone-settings').click(function() { + $('body').ufModal({ + sourceUrl : site.uri.public + '/modals/dnsadmin/edit-zone', + ajaxParams : { + id : $(this).data('zone') + }, + msgTarget: $('#alerts-page') + }); + + $('body').on("renderSuccess.ufModal", function (data) { + var modal = $(this).ufModal('getModal'); + + form = new Vue({ + el: '#form-zone-edit', + data: { + "zone_type" : zone.type, + "show_examples" : false, + "domain" : zone.name, + "serial_number_mode" : zone.serial_number_mode, + "serial_number" : getTimestamp(), + "old_serial_number" : zone.serial_number, + ip_examples + }, + methods: { + updateSerialNumber: function () { + if (this.serial_number_mode == "timestamp") { + this.old_serial_number = this.serial_number + this.serial_number = getTimestamp(); + } else { + this.serial_number = this.old_serial_number; + } + } + } + }); + $('#form-zone-edit').ufForm({ + msgTarget: $('#form-zone-alerts'), + validator: page.validators.editZone + }).on("submitSuccess.ufForm", function(event, data, textStatus, jqXHR) { + window.location.reload(); + }); + }); + }); } function getTimestamp() { @@ -43,26 +106,7 @@ $(document).ready(function() { "domain" : "", "serial_number_mode" : "timestamp", "serial_number" : getTimestamp(), - "ip_examples" : [ - { - "start" : "192.168.0.1", - "end" : "192.168.0.254", - "subnet" : "255.255.255.0 /24", - "input" : "192.168.0" - }, - { - "start" : "74.0.0.0", - "end" : "74.15.254.254", - "subnet" : "255.240.0.0 /12", - "input" : "74" - }, - { - "start": "2001:0db8::1", - "end" : " 2001:db8:ffff:ffff:ffff:ffff:ffff:ffff", - "subnet" : "/32", - "input" : " 2001:db8" - } - ] + ip_examples }, methods: { updateSerialNumber: function () { diff --git a/routes/admin.php b/routes/admin.php index bfe8be2..198d1f6 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -6,4 +6,5 @@ $app->group('/modals/dnsadmin', function () use ($app) { $app->get('/create-zone', 'UserFrosting\Sprinkle\Dnsadmin\Controller\AdminController:modalCreateZone'); + $app->get('/edit-zone', 'UserFrosting\Sprinkle\Dnsadmin\Controller\AdminController:modalEditZone'); }); diff --git a/routes/api.php b/routes/api.php index f45e14c..82c13d7 100644 --- a/routes/api.php +++ b/routes/api.php @@ -3,5 +3,6 @@ $app->group('/api/dns', function () use ($app) { $app->get('/zones', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController:getZones'); $app->post('/zones', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController:createZone'); + $app->put('/zones/z/{id}', 'UserFrosting\Sprinkle\Dnsadmin\Controller\ApiController:editZone'); }); diff --git a/schema/requests/zone-edit.yaml b/schema/requests/zone-edit.yaml new file mode 100644 index 0000000..35a8481 --- /dev/null +++ b/schema/requests/zone-edit.yaml @@ -0,0 +1,52 @@ +name: + validators: + required: + message: Please enter the zone name. +ttl: + validators: + required: + message: Please enter in the TTL. + numeric: + message: The TTL value must be a number. +primary_dns: + validators: + required: + message: Please enter in the name of the primary DNS server. +admin_domain: + validators: + required: + message: Please enter in the name of the admin domain. +serial_number_mode: + validators: + required: + message: Please select the serial number mode. + member_of: + values: + - counter + - timestamp + - manual + message: The serial number mode must either be 'counter', 'timestamp', 'manual'. +serial_number: + validators: + required: + message: Please enter in a serial number or select a different serial number mode. + numeric: + message: The serial number must be a number. +refresh: + validators: + required: + message: Please enter in a refresh value. + numeric: + message: The refresh value must be a number. +retry: + validators: + required: + message: Please enter in a retry value. + numeric: + message: The retry value must be a number. +expire: + validators: + required: + message: Please enter in an expire value. + numeric: + message: The expire value must be a number. diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 322d6fc..8070c25 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -12,6 +12,7 @@ use Slim\Http\Response; use UserFrosting\Fortress\RequestSchema; use UserFrosting\Fortress\Adapter\JqueryValidationAdapter; +use UserFrosting\Sprinkle\Dnsadmin\Database\Models\Zone; /** * Controller class that manages all of the DNS Admin front end UI @@ -32,13 +33,18 @@ class AdminController extends SimpleController public function pageZonesAdmin(Request $request, Response $response, $args) { // Get the zone create validation rules - $schema = new RequestSchema('schema://requests/zone-create.yaml'); - $validator = new JqueryValidationAdapter($schema, $this->ci->translator); + $schema_create = new RequestSchema('schema://requests/zone-create.yaml'); + $validator_create = new JqueryValidationAdapter($schema_create, $this->ci->translator); + + // Get the zone edit validation rules + $schema_edit = new RequestSchema('schema://requests/zone-edit.yaml'); + $validator_edit = new JqueryValidationAdapter($schema_edit, $this->ci->translator); return $this->ci->view->render($response, 'pages/dnsadmin-zones.html.twig', [ 'page' => [ 'validators' => [ - 'createZone' => $validator->rules() + 'createZone' => $validator_create->rules(), + "editZone" => $validator_edit->rules() ] ] ]); @@ -62,7 +68,43 @@ public function modalCreateZone(Request $request, Response $response, $args) "submit" => "Create Zone" ] ]); + } + + /** + * Generates the modal form for editing a zone + * + * @param Request $request + * @param Response $response + * @param array $args + * @return Response + */ + public function modalEditZone(Request $request, Response $response, $args) + { + $ms = $this->ci->alerts; + + $zone_id = $request->getQueryParam('id'); + + if($zone_id == null) { + $ms->addMessage('danger', "No Zone ID specified."); + return $response->withStatus(400); + } + + $zone = Zone::find($zone_id); + if(!$zone) { + $ms->addMessage('danger', 'Invalid Zone ID.'); + return $response->withStatus(400); + } + + return $this->ci->view->render($response, 'modals/zone.html.twig', [ + "form" => [ + "id" => "form-zone-edit", + "method" => "PUT", + "action" => "api/dns/zones/z/" . $zone_id, + "submit" => "Submit Changes" + ], + "zone" => $zone->toArray() + ]); } diff --git a/src/Controller/ApiController.php b/src/Controller/ApiController.php index 9ebcc25..62126b4 100644 --- a/src/Controller/ApiController.php +++ b/src/Controller/ApiController.php @@ -64,7 +64,8 @@ public function getZones(Request $request, Response $response, $args) * @param array $args * @return void */ - public function createZone(Request $request, Response $response, $args) { + public function createZone(Request $request, Response $response, $args) + { $params = $request->getParsedBody(); // Start off by checking to make sure that the zone type is correct @@ -119,4 +120,70 @@ public function createZone(Request $request, Response $response, $args) { $ms->addMessage('success', "Successfully added zone '{$data['name']}'"); } + + /** + * Edits a zone + * + * @param Request $request + * @param Response $response + * @param array $args + * @return void + */ + public function editZone(Request $request, Response $response, $args) + { + if(!isset($args['id'])) { + $ms->addMessage('danger', 'Zone Not Found.'); + return $response->withStatus(404); + } + + $zone = Zone::find($args['id']); + + if(!$zone) { + $ms->addMessage('danger', 'Zone Not Found.'); + return $response->withStatus(404); + } + + $params = $request->getParsedBody(); + + // Start off by checking to make sure that the zone type is correct + $schema = new RequestSchema('schema://requests/zone-edit.yaml'); + + $transformer = new RequestDataTransformer($schema); + $data = $transformer->transform($params); + + $ms = $this->ci->alerts; + + $validator = new ServerSideValidator($schema, $this->ci->translator); + + if(!$validator->validate($data)) { + $ms->addValidationErrors($validator); + return $response->withStatus(400); + } + + if($zone->type == "normal") { + $data['name'] = $this->domainTransformer($data['name']); + } + + Capsule::transaction(function() use($data, $zone) { + + $zone->name = $data['name']; + + $zone->ttl = $data['ttl']; + + $zone->primary_dns = $this->domainTransformer($data['primary_dns']); + $zone->admin_domain = $this->domainTransformer($data['admin_domain']); + + $zone->serial_number_mode = $data['serial_number_mode']; + $zone->serial_number = $data['serial_number']; + + $zone->refresh = $data['refresh']; + $zone->retry = $data['retry']; + $zone->expiry = $data['expire']; + + $zone->save(); + }); + + $ms->addMessage('success', "Successfully modified zone '{$data['name']}'"); + + } } diff --git a/src/Database/Migrations/v000/ZonesTable.php b/src/Database/Migrations/v000/ZonesTable.php index 0f5f9a7..f3ee733 100644 --- a/src/Database/Migrations/v000/ZonesTable.php +++ b/src/Database/Migrations/v000/ZonesTable.php @@ -28,7 +28,7 @@ public function up() $table->integer('ttl'); $table->string('primary_dns', 500); $table->string('admin_domain', 500); - $table->integer('serial_number'); + $table->bigInteger('serial_number'); $table->string("serial_number_mode", 100); $table->integer('refresh'); $table->integer('retry'); diff --git a/templates/forms/zone.html.twig b/templates/forms/zone.html.twig index e95d465..5c3649d 100644 --- a/templates/forms/zone.html.twig +++ b/templates/forms/zone.html.twig @@ -1,7 +1,7 @@
    {% include "forms/csrf.html.twig" %} - {% verbatim %} +
    @@ -9,9 +9,9 @@
    - + +
    @@ -20,7 +20,7 @@

    This is the domain name of the zone. For example, if you wanted to create domain name such as ftp.example.com, then you would type in here example.com.

    - +
    @@ -29,23 +29,23 @@

    Put in here just the subnet identifier of the network that you are configuring reverse lookups for.

    - +
    - +
    - +
    - +
    @@ -53,7 +53,7 @@
    - @@ -67,30 +67,47 @@
    - +
    - +
    - +
    - +
    -{% endverbatim %} +
    - +
    - +
    + diff --git a/templates/tables/zones.html.twig b/templates/tables/zones.html.twig index 20edb9c..1a54122 100644 --- a/templates/tables/zones.html.twig +++ b/templates/tables/zones.html.twig @@ -30,8 +30,8 @@ + + {{ assets.js('js/pages/zone-entries-admin') | raw }} +{% endblock %} diff --git a/templates/tables/zone-entries.html.twig b/templates/tables/zone-entries.html.twig new file mode 100644 index 0000000..c5c6375 --- /dev/null +++ b/templates/tables/zone-entries.html.twig @@ -0,0 +1,69 @@ +{% extends "tables/table-paginated.html.twig" %} + +{% block table %} +
    Zone NameSerial NumberDomainsDetailsActions
    + + + + + + + + + + + + + +
    NameTypeValueUpdated AtActions
    +{% endblock %} + +{% block table_cell_templates %} + {% verbatim %} + + + + + + + {% endverbatim %} +{% endblock %} diff --git a/templates/tables/zones.html.twig b/templates/tables/zones.html.twig index 1a54122..ac9687f 100644 --- a/templates/tables/zones.html.twig +++ b/templates/tables/zones.html.twig @@ -23,7 +23,7 @@ +