Changeset 806 for trunk


Ignore:
Timestamp:
03/07/16 18:05:24 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Promote VRFs to top-level entities. See #54.

1 of mumble; convert index page to list VRFs instead of master blocks.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r799 r806  
    2929        &initIPDBGlobals &connectDB &finish &checkDBSanity
    3030        &addMaster &touchMaster
    31         &listSummary &listSubs &listContainers &listAllocations &listForMerge &listFree &listPool
     31        &listVRF &listSummary &listSubs &listContainers &listAllocations &listForMerge &listFree &listPool
    3232        &getMasterList &getTypeList &getPoolSelect &findAllocateFrom
    3333        &ipParent &subParent &blockParent &getBreadCrumbs &getRoutedCity
     
    4545                &initIPDBGlobals &connectDB &finish &checkDBSanity
    4646                &addMaster &touchMaster
    47                 &listSummary &listSubs &listContainers &listAllocations &listForMerge &listFree &listPool
     47                &listVRF &listSummary &listSubs &listContainers &listAllocations &listForMerge &listFree &listPool
    4848                &getMasterList &getTypeList &getPoolSelect &findAllocateFrom
    4949                &ipParent &subParent &blockParent &getBreadCrumbs &getRoutedCity
     
    843843  return ('OK','OK');
    844844} # end touchMaster()
     845
     846
     847## IPDB::listVRF()
     848# Get summary list of all VRFs
     849# Returns an arrayref to a list of hashrefs with the VRF name, comment
     850sub listVRF {
     851  my $dbh = shift;
     852  my $vrflist = $dbh->selectall_arrayref("SELECT vrf,comment FROM vrfs ORDER BY vrf", { Slice => {} });
     853  return $vrflist;
     854} # end listVRF()
    845855
    846856
  • trunk/cgi-bin/main.cgi

    r800 r806  
    259259
    260260
    261 # Initial display:  Show master blocks with total allocated subnets, total free subnets
     261# Initial display:  Show list of VRFs
    262262sub showSummary {
    263   my $masterlist = listSummary($ip_dbh);
    264   $page->param(masterlist => $masterlist);
    265 
    266   $page->param(addmaster => ($IPDBacl{$authuser} =~ /a/) );
     263  my $vrflist = listVRF($ip_dbh);
     264  $page->param(vrflist => $vrflist);
     265
     266  # Only systems/network should be allowed to add VRFs - or maybe higher?
     267  $page->param(addvrf => ($IPDBacl{$authuser} =~ /s/) );
    267268} # showSummary
    268269
  • trunk/templates/index.tmpl

    r687 r806  
    22<div class="center">
    33<table class="center altrows" width="98%" cellspacing="0">
    4 <TMPL_IF masterlist>
     4<TMPL_IF vrflist>
    55<tr class="heading">
    6 <td>Master netblock</td>
    7 <td>Primary VRF</td>
    8 <td>Aggregation/Containers</td>
    9 <td>Allocated netblocks</td>
    10 <td>Free netblocks</td>
    11 <td>Largest free block</td>
     6<td>VRF</td>
     7<td>Comment</td>
    128</tr>
    13 <TMPL_LOOP NAME=masterlist>
     9<TMPL_LOOP NAME=vrflist>
    1410<tr>
    15 <td><a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=showsubs&amp;parent=<TMPL_VAR NAME=id>"><TMPL_VAR NAME=master></a></td>
    16 <td><TMPL_VAR NAME=vrf></td>
    17 <td><TMPL_VAR NAME=routed></td>
    18 <td><TMPL_VAR NAME=allocated></td>
    19 <td><TMPL_VAR NAME=free></td>
    20 <td><TMPL_VAR ESCAPE=HTML NAME=bigfree></td>
     11<td><a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=showvrf&amp;vrf=<TMPL_VAR NAME=vrf>"><TMPL_VAR NAME=vrf></a></td>
     12<td><TMPL_VAR comment></td>
    2113</tr>
    2214</TMPL_LOOP>
    2315<TMPL_ELSE>
    2416<tr class="heading">
    25 <td>No netblock data</td>
     17<td>No VRFs defined</td>
    2618</tr>
    2719</TMPL_IF>
    2820</table>
    29 <TMPL_IF addmaster>
     21<TMPL_IF addvrf>
    3022<br>
    31 <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=addmaster">Add new master block</a>
     23<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=addvrf">Add new VRF</a>
    3224</TMPL_IF>
    33 <br><br>
    34 Note:  Free blocks noted here include both routed and unrouted blocks.
    3525</div>
    36 
Note: See TracChangeset for help on using the changeset viewer.