aboutsummaryrefslogtreecommitdiffstats
path: root/web/api/public/switches
diff options
context:
space:
mode:
authorOle Mathias Aa. Heggem <olemathias.aa.heggem@gmail.com>2025-04-13 07:18:45 +0200
committerGitHub <noreply@github.com>2025-04-13 07:18:45 +0200
commit4ea3a099b05fa910498bfbf1b2d7387118355472 (patch)
treec248cf6764412471ee3e0d1218761bee19fb396a /web/api/public/switches
parent09710c061d5b8ae86b3dfe49f4b8936c13a10535 (diff)
Upgrade bootstrap and rewrite API (#230)HEADmaster
Diffstat (limited to 'web/api/public/switches')
-rwxr-xr-xweb/api/public/switches32
1 files changed, 0 insertions, 32 deletions
diff --git a/web/api/public/switches b/web/api/public/switches
deleted file mode 100755
index 9bb63d8..0000000
--- a/web/api/public/switches
+++ /dev/null
@@ -1,32 +0,0 @@
-#! /usr/bin/perl
-# vim:ts=8:sw=8
-
-use CGI qw(fatalsToBrowser);
-use DBI;
-use lib '/opt/gondul/include';
-use nms;
-use nms::web;
-use strict;
-use warnings;
-use Data::Dumper;
-
-$nms::web::cc{'max-age'} = "5";
-$nms::web::cc{'stale-while-revalidate'} = "30";
-
-my $q2 = $nms::web::dbh->prepare('select switch, sysname, tags, distro_name, placement, last_updated from switches where placement is not null and deleted = false');
-
-$q2->execute();
-while (my $ref = $q2->fetchrow_hashref()) {
- $ref->{'placement'} =~ /\((-?\d+),(-?\d+)\),\((-?\d+),(-?\d+)\)/;
- my ($x1, $y1, $x2, $y2) = ($1, $2, $3, $4);
- my $sysname = $ref->{'sysname'};
- $nms::web::json{'switches'}{$ref->{'sysname'}}{'placement'}{'x'} = $x2;
- $nms::web::json{'switches'}{$ref->{'sysname'}}{'placement'}{'y'} = $y2;
- $nms::web::json{'switches'}{$ref->{'sysname'}}{'placement'}{'width'} = $x1 - $x2;
- $nms::web::json{'switches'}{$ref->{'sysname'}}{'placement'}{'height'} = $y1 - $y2;
- $nms::web::json{'switches'}{$ref->{'sysname'}}{'distro_name'} = $ref->{'distro_name'};
- my $data = JSON::XS::decode_json($ref->{'tags'});
- $nms::web::json{'switches'}{$ref->{'sysname'}}{'tags'} = $data;
-}
-
-finalize_output();