hub))checked @endif>
@@ -224,19 +224,19 @@
});
$('#zone_id').on('change',function() {
- $(this).parent().find('i').addClass('spinner-grow spinner-grow-sm');
- $('#region_id').prop('disabled',true);
- $('#region_id').children().remove();
+ // Hide all our other input boxes
+ if (! $('#region-select').hasClass('d-none'))
+ $('#region-select').addClass('d-none');
if (! $('#region-address').hasClass('d-none'))
$('#region-address').addClass('d-none');
- if (! $('#host-address').hasClass('d-none'))
- $('#host-address').addClass('d-none');
-
if (! $('#host-select').hasClass('d-none'))
$('#host-select').addClass('d-none');
+ if (! $('#host-address').hasClass('d-none'))
+ $('#host-address').addClass('d-none');
+
if (! $('#hub-select').hasClass('d-none'))
$('#hub-select').addClass('d-none')
@@ -246,7 +246,16 @@
if (! $('#node-address').hasClass('d-none'))
$('#node-address').addClass('d-none');
+ if (! $('#sec-level').hasClass('d-none'))
+ $('#sec-level').addClass('d-none')
+
+ var icon = $(this).parent().find('i');
+ icon.addClass('spinner-grow spinner-grow-sm');
+
$.get('{{ url('domain/api/regions') }}'+'/'+this.value,function(data) {
+ $('#region_id').prop('disabled',true);
+ $('#region_id').children().remove();
+
$('#region_id').append('
');
$('#region_id').append('
');
$('#region_id').append('
');
@@ -258,16 +267,33 @@
$('#region_id').prop('disabled',false);
$('#region_id').show();
- if (modify.responseJSON.region_id)
+ if (modify && modify.responseJSON.region_id)
$('#region_id').val(modify.responseJSON.region_id).change();
- });
- $('#region-select').removeClass('d-none');
- $(this).parent().find('i').removeClass('spinner-grow spinner-grow-sm');
+ $('#region-select').removeClass('d-none');
+ icon.removeClass('spinner-grow spinner-grow-sm');
+ });
});
$('#region_id').on('change',function() {
+ // Hide all our other input boxes
+ if (! $('#host-select').hasClass('d-none'))
+ $('#host-select').addClass('d-none');
+
+ if (! $('#host-address').hasClass('d-none'))
+ $('#host-address').addClass('d-none');
+
+ if (! $('#hub-select').hasClass('d-none'))
+ $('#hub-select').addClass('d-none');
+
+ if (! $('#hub-checkbox').hasClass('d-none'))
+ $('#hub-checkbox').addClass('d-none');
+
+ if (! $('#node-address').hasClass('d-none'))
+ $('#node-address').addClass('d-none');
+
switch(this.value) {
+ // Not selected - everything off
case '':
if (! $('#region-address').hasClass('d-none'))
$('#region-address').addClass('d-none');
@@ -275,68 +301,48 @@
if (! $('#host-select').hasClass('d-none'))
$('#host-select').addClass('d-none');
- if (! $('#host-address').hasClass('d-none'))
- $('#host-address').addClass('d-none');
+ if (! $('#sec-level').hasClass('d-none'))
+ $('#sec-level').addClass('d-none')
- if (! $('#hub-select').hasClass('d-none'))
- $('#hub-select').addClass('d-none');
-
- if (! $('#hub-checkbox').hasClass('d-none'))
- $('#hub-checkbox').addClass('d-none');
-
- if (! $('#node-address').hasClass('d-none'))
- $('#node-address').addClass('d-none');
break;
+ // New Region - ask address/security
case 'new':
- if (! $('#host-select').hasClass('d-none'))
- $('#host-select').addClass('d-none');
-
- if (! $('#host-address').hasClass('d-none'))
- $('#host-address').addClass('d-none');
-
if ($('#region-address').hasClass('d-none'))
$('#region-address').removeClass('d-none');
- if (! $('#hub-select').hasClass('d-none'))
- $('#hub-select').addClass('d-none');
-
- if (! $('#hub-checkbox').hasClass('d-none'))
- $('#hub-checkbox').addClass('d-none');
-
- if (! $('#node-address').hasClass('d-none'))
- $('#node-address').addClass('d-none');
+ if ($('#sec-level').hasClass('d-none'))
+ $('#sec-level').removeClass('d-none')
$('#action').val('region');
+
break;
+ // No region - next Host Select
case '0':
+ // Existing entry selected - next Host Select
default:
// Find Hosts
- if ($('#host-select').hasClass('d-none'))
- $('#host-select').removeClass('d-none');
-
if (! $('#region-address').hasClass('d-none'))
$('#region-address').addClass('d-none');
- if (! $('#hub-select').hasClass('d-none'))
- $('#hub-select').addClass('d-none');
-
- if (! $('#hub-checkbox').hasClass('d-none'))
- $('#hub-checkbox').addClass('d-none');
-
if (! $('#host-address').hasClass('d-none'))
$('#host-address').addClass('d-none');
if (! $('#node-address').hasClass('d-none'))
$('#node-address').addClass('d-none');
- $(this).parent().find('i').addClass('spinner-grow spinner-grow-sm');
- $('#host_id').prop('disabled',true);
- $('#host_id').children().remove();
+ if (! $('#sec-level').hasClass('d-none'))
+ $('#sec-level').addClass('d-none')
+
var that = this;
+ var icon = $(this).parent().find('i');
+ icon.addClass('spinner-grow spinner-grow-sm');
$.get('{{ url('domain/api/hosts') }}'+'/'+$('#zone_id').val()+'/'+this.value,function(data) {
+ $('#host_id').prop('disabled',true);
+ $('#host_id').children().remove();
+
$('#host_id').append('
');
if (that.value !== '0')
$('#host_id').append('
');
@@ -349,66 +355,80 @@
$('#host_id').prop('disabled',false);
$('#host_id').show();
- if (modify.responseJSON.host_id)
+ if (modify && modify.responseJSON.host_id)
$('#host_id').val(modify.responseJSON.host_id).change();
- });
- $('#host-select').removeClass('d-none');
- $(this).parent().find('i').removeClass('spinner-grow spinner-grow-sm');
+ $('#host-select').removeClass('d-none');
+ icon.removeClass('spinner-grow spinner-grow-sm');
+ });
}
});
$('#host_id').on('change',function() {
+ if (! $('#hub-select').hasClass('d-none'))
+ $('#hub-select').addClass('d-none');
+
switch(this.value) {
+ // Not selected - everything off
case '':
if (! $('#host-address').hasClass('d-none'))
$('#host-address').addClass('d-none');
- if (! $('#hub-select').hasClass('d-none'))
- $('#hub-select').addClass('d-none');
-
if (! $('#hub-checkbox').hasClass('d-none'))
$('#hub-checkbox').addClass('d-none');
if (! $('#node-address').hasClass('d-none'))
$('#node-address').addClass('d-none');
+
+ if (! $('#sec-level').hasClass('d-none'))
+ $('#sec-level').addClass('d-none')
+
break;
+ // New Host - ask address/security
case 'new':
if ($('#host-address').hasClass('d-none'))
$('#host-address').removeClass('d-none');
- if (! $('#hub-select').hasClass('d-none'))
- $('#hub-select').addClass('d-none');
-
if (! $('#hub-checkbox').hasClass('d-none'))
$('#hub-checkbox').addClass('d-none');
if (! $('#node-address').hasClass('d-none'))
$('#node-address').addClass('d-none');
+ if ($('#sec-level').hasClass('d-none'))
+ $('#sec-level').removeClass('d-none')
+
$('#action').val('host');
+
break;
+ // No host - next Hub Select
case '0':
+ // Existing entry selected - next Hub Select
default:
+ $('#node_id').prop('disabled',true);
+ $('#point_id').prop('disabled',true);
+
if (! $('#host-address').hasClass('d-none'))
$('#host-address').addClass('d-none');
- if ($('#hub-select').hasClass('d-none'))
- $('#hub-select').removeClass('d-none');
-
if ($('#hub-checkbox').hasClass('d-none'))
$('#hub-checkbox').removeClass('d-none');
if ($('#node-address').hasClass('d-none'))
$('#node-address').removeClass('d-none');
- $(this).parent().find('i').addClass('spinner-grow spinner-grow-sm');
- $('#hub_id').prop('disabled',true);
- $('#hub_id').children().remove();
+ if ($('#sec-level').hasClass('d-none'))
+ $('#sec-level').removeClass('d-none')
+
+ var icon = $(this).parent().find('i');
+ icon.addClass('spinner-grow spinner-grow-sm');
$.get('{{ url('domain/api/hubs') }}'+'/'+$('#zone_id').val()+'/'+this.value,function(data) {
+ $('#hub_id').prop('disabled',true);
+ $('#hub_id').children().remove();
+
$('#hub_id').append('
');
data.forEach(function(item) {
@@ -418,13 +438,15 @@
$('#hub_id').prop('disabled',false);
$('#hub_id').show();
- if (modify.responseJSON.hub_id)
+ if (modify && modify.responseJSON.hub_id)
$('#host_id').val(modify.responseJSON.hub_id).change();
- });
- $('#hub-select').removeClass('d-none');
- $('#sec-level').removeClass('d-none');
- $(this).parent().find('i').removeClass('spinner-grow spinner-grow-sm');
+ $('#hub-select').removeClass('d-none');
+ $('#node_id').prop('disabled',false);
+ $('#point_id').prop('disabled',false);
+
+ icon.removeClass('spinner-grow spinner-grow-sm');
+ });
if (modify && modify.responseJSON) {
$('#submit').val(id);
@@ -437,12 +459,18 @@
});
$('#hub_id').on('change',function() {
+ if ($('#sec-level').hasClass('d-none'))
+ $('#sec-level').removeClass('d-none')
+
switch(this.value) {
+ // Not selected - enter a normal node
case '':
if ($('#hub-checkbox').hasClass('d-none'))
$('#hub-checkbox').removeClass('d-none');
+
break;
+ // Existing entry selected - next Address input
default:
if (! $('#hub-checkbox').hasClass('d-none'))
$('#hub-checkbox').addClass('d-none');
diff --git a/resources/views/system/widget/system.blade.php b/resources/views/system/widget/system.blade.php
index 9c51332..78b5136 100644
--- a/resources/views/system/widget/system.blade.php
+++ b/resources/views/system/widget/system.blade.php
@@ -228,7 +228,7 @@ use App\Models\{Mailer,User};
@can($action,$o)
-
+
Active