foreman_ipam 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6797d82ac9313e2bd3b3d9e0046be15bee50e7e0cf51862914e4b075a97b69e5
4
- data.tar.gz: cf896c8815cfe2ce8d45905df096a40098856bde35fc931b6f4ae8f62fe8deab
3
+ metadata.gz: 2f31c5336e7af5c2bbd55e985c0ed650882bebbe7fde5a3f8db6b8a3a09bc0e8
4
+ data.tar.gz: 113734549fb60d8757154856f0ba060ea5444de7548efc0613764f62ad75e443
5
5
  SHA512:
6
- metadata.gz: a6392cdc2dc829d6a3d95b2c07fe249eb4577d3101dcbb5e733b20eed7d7fbc67cc4c51c257b24dda96ff25c96d70fe6bd3c1b97561b37d395953ebc2db858e7
7
- data.tar.gz: 8156d9c6003b273e6da8b2e6f76104d631f0856528bf854d62e725a8af7510fda78ad49a346cc50289f6da4f98b7e17125a49510acc0386668ea04ef96723e21
6
+ metadata.gz: f9116369232448ab4a74bfebff5b84024bf738953a18a9673c463abee542bbef33623cb8586575b0ec2eb0e4db553b58ee2e64a32cf6e54e0e7109bef510a953
7
+ data.tar.gz: 034a3883b57626c0925878e874e07605a83b7dc2220ad3fc577e81f1eda910c4a530174ca24773f20365c2f0b248c2e8d4300637c39901ce41cb1762381901bc
@@ -2,11 +2,19 @@
2
2
  module ForemanIpam
3
3
  class DashboardController < ::DashboardController
4
4
  def ipam
5
- @response = Phpipam.proxy.get_sections
5
+ begin
6
+ @response = Phpipam.proxy.get_sections
7
+ rescue
8
+ @response = nil
9
+ end
6
10
  end
7
11
 
8
12
  def subnets
9
- @subnets = Phpipam.proxy.get_subnets_by_section(params[:section_name])
13
+ begin
14
+ @subnets = Phpipam.proxy.get_subnets_by_section(params[:section_name])
15
+ rescue
16
+ @subnets = nil
17
+ end
10
18
  render :json => @subnets.to_json, :status => :ok
11
19
  end
12
20
  end
@@ -1,6 +1,11 @@
1
1
  <h1>IPAM Integration Dashboard</h1>
2
2
 
3
- <% if @response['data'] && @response['data'].length > 0 %>
3
+ <% if @response.nil? %>
4
+ <div class="alert alert-warning ">
5
+ <span class="pficon pficon-warning-triangle-o "></span>
6
+ <span class="text"><%= _("Cannot connect to External IPAM.") %></span>
7
+ </div>
8
+ <% elsif @response['data'] && @response['data'].length > 0 %>
4
9
  <h2>phpIPAM</h2>
5
10
  <h3>Sections:</h3>
6
11
  <table class="<%= table_css_classes 'table-fixed' %>">
@@ -41,20 +46,31 @@
41
46
  type: "GET", url: "/ipam/phpipam/subnets",
42
47
  data: {"section_name": encodeURI(section_name)},
43
48
  success: function(data) {
44
- if (data.message === 'No subnets found')
45
- subnet_container.innerHTML += data.message;
46
- else
47
- displaySubnets(data);
49
+ if (!data) {
50
+ subnet_container.innerHTML += 'Cannot connect to External IPAM';
51
+ }
52
+ else {
53
+ if (data.message === 'No subnets found')
54
+ subnet_container.innerHTML += data.message;
55
+ else
56
+ displaySubnets(data);
57
+ }
48
58
  }
49
59
  });
50
60
  }
51
61
 
52
62
  function displaySubnets(data) {
53
63
  var subnets = data;
54
- subnet_container.innerHTML += `
55
- <div class='col-md-2'><strong>Subnet</strong></div>
56
- <div class='col-md-6'><strong>Description</strong></strong></div><br />
57
- `;
64
+
65
+ if (subnets['data'].length == 0) {
66
+ subnet_container.innerHTML += "<div class='col-md-2'><strong>No Subnets</strong></div>"
67
+ }
68
+ else {
69
+ subnet_container.innerHTML += `
70
+ <div class='col-md-2'><strong>Subnet</strong></div>
71
+ <div class='col-md-6'><strong>Description</strong></strong></div><br />
72
+ `;
73
+ }
58
74
 
59
75
  subnets['data'].forEach(function(item) {
60
76
  subnet_container.innerHTML += `
@@ -1,3 +1,3 @@
1
1
  module ForemanIpam
2
- VERSION = '0.0.8'.freeze
2
+ VERSION = '0.0.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_ipam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-30 00:00:00.000000000 Z
11
+ date: 2019-12-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Plugin for IPAM integration with various IPAM providers
14
14
  email: