summaryrefslogtreecommitdiff
path: root/src/bgpview
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2009-08-21 16:47:09 +0200
committerLinus Nordberg <linus@nordu.net>2009-08-21 16:47:09 +0200
commit373afd140a28eb706282fd4891e2e75b507b18aa (patch)
tree9b0cb9e70871936cbc94511df8401c3d460741d6 /src/bgpview
parentc64ce57afa8700c52937cfbfd2669a383804e01b (diff)
Restructure and add bgpview.
There's one package, BGP-LOGGER, defined in src/package.lisp. There are two systems, BGPSTORE and BGPVIEW, defined in bgpstore.asd and bgpview.asd respectively. The package exports START-BGPSTORE, START-BGPVIEW and their STOP- counterparts.
Diffstat (limited to 'src/bgpview')
-rw-r--r--src/bgpview/bgpview.lisp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/bgpview/bgpview.lisp b/src/bgpview/bgpview.lisp
new file mode 100644
index 0000000..d6adce4
--- /dev/null
+++ b/src/bgpview/bgpview.lisp
@@ -0,0 +1,41 @@
+(in-package :bgp-logger)
+
+(defwebapp bgpview-app
+ :prefix "/bgpview"
+ :description "FIXME: description of bgpview app"
+ :autostart nil
+ :debug t)
+
+(defstore *bgpview-store* :prevalence
+ (merge-pathnames (make-pathname :directory '(:relative "data"))
+ (asdf-system-directory :bgpview)))
+
+(defun db-test (&rest args)
+ (declare (ignore args))
+ (with-connection *db-spec*
+ (let ((msgs (query-dao 'bgp-message
+ (:limit
+ (:select 'timestamp 'prefix 'label 'path 'nexthop
+ :from 'bgp-message)
+ 20))))
+ ;(dolist (m msgs) (make-instance 'dataform :data m)))))
+ (render-object-view msgs '(table bgp-message)))))
+
+(defun init-user-session (comp)
+ (setf (composite-widgets comp)
+ (list "Welcome to BGP View"
+ (make-instance 'composite
+ :widgets (list "First widget."
+ (lambda (&rest args)
+ (declare (ignore args))
+ (with-html
+ (:p "Second widget.")))
+ #'db-test)))))
+
+(defun start-bgpview (&rest args)
+ (apply #'start-weblocks args)
+ (start-webapp 'bgpview-app))
+
+(defun stop-bgpview ()
+ (stop-webapp 'bgpview-app)
+ (stop-weblocks))