|
@@ -23,29 +23,29 @@
|
|
|
(restas:with-context context
|
|
(restas:with-context context
|
|
|
(cl-mongo:mongo :host "10.8.0.6")
|
|
(cl-mongo:mongo :host "10.8.0.6")
|
|
|
(cl-mongo:db.use "timeline")
|
|
(cl-mongo:db.use "timeline")
|
|
|
- (when *run-cron*
|
|
|
|
|
- (restas:context-add-variable
|
|
|
|
|
- context '*import-events-timer*
|
|
|
|
|
- (clon:schedule-function #'import-events
|
|
|
|
|
- (clon:make-scheduler (clon:make-typed-cron-schedule
|
|
|
|
|
- :minute 10 :hour 0))
|
|
|
|
|
- :name "import-events"
|
|
|
|
|
- :thread t))
|
|
|
|
|
- (restas:context-add-variable
|
|
|
|
|
- context '*import-finance-timer*
|
|
|
|
|
- (clon:schedule-function #'import-finance
|
|
|
|
|
- (clon:make-scheduler (clon:make-typed-cron-schedule
|
|
|
|
|
- :minute 0 :hour 7))
|
|
|
|
|
- :name "import-finance"
|
|
|
|
|
- :thread t)))))
|
|
|
|
|
|
|
+ (restas:context-add-variable context '*import-places-timer*)
|
|
|
|
|
+ (restas:context-add-variable context '*import-finance-timer*)
|
|
|
|
|
+ (restas:with-context context
|
|
|
|
|
+ (when *run-cron*
|
|
|
|
|
+ (setf *import-places-timer*
|
|
|
|
|
+ (clon:schedule-function #'import-events
|
|
|
|
|
+ (clon:make-scheduler (clon:make-typed-cron-schedule
|
|
|
|
|
+ :minute 10 :hour 0))
|
|
|
|
|
+ :name "import-places"
|
|
|
|
|
+ :thread t))
|
|
|
|
|
+ (setf *import-finance-timer*
|
|
|
|
|
+ (clon:schedule-function #'import-finance
|
|
|
|
|
+ (clon:make-scheduler (clon:make-typed-cron-schedule
|
|
|
|
|
+ :minute 0 :hour 7))
|
|
|
|
|
+ :name "import-finance"
|
|
|
|
|
+ :thread t))))))
|
|
|
|
|
|
|
|
(defmethod restas:finalize-module-instance :after ((module (eql #.*package*)) context)
|
|
(defmethod restas:finalize-module-instance :after ((module (eql #.*package*)) context)
|
|
|
- (let ((events-timer (restas:context-symbol-value context '*import-events-timer*))
|
|
|
|
|
- (finance-timer (restas:context-symbol-value context '*import-finance-timer*)))
|
|
|
|
|
- (when events-timer
|
|
|
|
|
- (trivial-timers::unschedule-timer events-timer))
|
|
|
|
|
- (when finance-timer
|
|
|
|
|
- (trivial-timers::unschedule-timer finance-timer))))
|
|
|
|
|
|
|
+ (restas:with-context context
|
|
|
|
|
+ (when *import-places-timer*
|
|
|
|
|
+ (trivial-timers::unschedule-timer *import-places-timer*))
|
|
|
|
|
+ (when *import-finance-timer*
|
|
|
|
|
+ (trivial-timers::unschedule-timer *import-finance-timer*))))
|
|
|
|
|
|
|
|
;; Static file path
|
|
;; Static file path
|
|
|
(defparameter *resources*
|
|
(defparameter *resources*
|
|
@@ -190,6 +190,13 @@
|
|
|
(cl-mongo:db.sort "events" ($between "ts" start end) :field "ts" :limit 2000))
|
|
(cl-mongo:db.sort "events" ($between "ts" start end) :field "ts" :limit 2000))
|
|
|
stream))))
|
|
stream))))
|
|
|
|
|
|
|
|
|
|
+(restas:define-route api/events/delete ("api/events/:id"
|
|
|
|
|
+ :method :DELETE
|
|
|
|
|
+ :content-type "application/json")
|
|
|
|
|
+ (cl-mongo:db.delete "events" (cl-mongo:$ "_id" (cl-mongo::make-bson-oid
|
|
|
|
|
+ :oid (crypto:hex-string-to-byte-array id))))
|
|
|
|
|
+ "OK")
|
|
|
|
|
+
|
|
|
(defparameter +timeliner.css+
|
|
(defparameter +timeliner.css+
|
|
|
(css-lite:css
|
|
(css-lite:css
|
|
|
(("body") (:padding-top "70px" :padding-bottom "30px"))
|
|
(("body") (:padding-top "70px" :padding-bottom "30px"))
|
|
@@ -213,7 +220,7 @@
|
|
|
*models (create)
|
|
*models (create)
|
|
|
*collections (create)
|
|
*collections (create)
|
|
|
*views (create)
|
|
*views (create)
|
|
|
- dispatcher (chain _ (clone (@ *backbone *events)))
|
|
|
|
|
|
|
+ dispatcher (! _ (clone (@ *backbone *events)))
|
|
|
:start (lambda (date)
|
|
:start (lambda (date)
|
|
|
(var router (new ((@ *timeliner *router))))
|
|
(var router (new ((@ *timeliner *router))))
|
|
|
(var events (new ((@ *timeliner *collections *events))))
|
|
(var events (new ((@ *timeliner *collections *events))))
|
|
@@ -281,6 +288,9 @@
|
|
|
class-name "list-group-item"
|
|
class-name "list-group-item"
|
|
|
:events (create
|
|
:events (create
|
|
|
"click" "select")
|
|
"click" "select")
|
|
|
|
|
+ initialize (lambda ()
|
|
|
|
|
+ (! this (listen-to (@ this model) "change" (@ this render)))
|
|
|
|
|
+ (! this (listen-to (@ this model) "destroy" (@ this remove))))
|
|
|
icon-class (lambda ()
|
|
icon-class (lambda ()
|
|
|
(case (! this model (get :type))
|
|
(case (! this model (get :type))
|
|
|
(:place "glyphicon glyphicon-map-marker")
|
|
(:place "glyphicon glyphicon-map-marker")
|
|
@@ -370,6 +380,12 @@
|
|
|
(@ this events-layer))))))
|
|
(@ this events-layer))))))
|
|
|
(! this (listen-to (@ this collection) "reset"
|
|
(! this (listen-to (@ this collection) "reset"
|
|
|
(@ this render)))
|
|
(@ this render)))
|
|
|
|
|
+ (! this (listen-to (@ this collection) "change"
|
|
|
|
|
+ (@ this render)))
|
|
|
|
|
+ (! this (listen-to (@ this collection) "add"
|
|
|
|
|
+ (@ this render)))
|
|
|
|
|
+ (! this (listen-to (@ this collection) "remove"
|
|
|
|
|
+ (@ this render)))
|
|
|
(! this (listen-to (@ *timeliner dispatcher) "event:selected"
|
|
(! this (listen-to (@ *timeliner dispatcher) "event:selected"
|
|
|
(@ this highlight))))
|
|
(@ this highlight))))
|
|
|
render (lambda ()
|
|
render (lambda ()
|
|
@@ -388,7 +404,7 @@
|
|
|
:color "#000"
|
|
:color "#000"
|
|
|
fill-color "#F00"
|
|
fill-color "#F00"
|
|
|
fill-opacity 1))))
|
|
fill-opacity 1))))
|
|
|
- (! e (set "_layer" marker))
|
|
|
|
|
|
|
+ (setf (@ e "_layer") marker)
|
|
|
(! this path-layer (add-lat-lng
|
|
(! this path-layer (add-lat-lng
|
|
|
(! marker (get-lat-lng))))
|
|
(! marker (get-lat-lng))))
|
|
|
(! this events-layer (add-layer marker))))
|
|
(! this events-layer (add-layer marker))))
|
|
@@ -403,7 +419,7 @@
|
|
|
200))
|
|
200))
|
|
|
this)
|
|
this)
|
|
|
highlight (lambda (event)
|
|
highlight (lambda (event)
|
|
|
- (var layer (! event (get "_layer")))
|
|
|
|
|
|
|
+ (var layer (@ event "_layer"))
|
|
|
(! this events-layer
|
|
(! this events-layer
|
|
|
(set-style (create fill-color "#F00")))
|
|
(set-style (create fill-color "#F00")))
|
|
|
(if layer
|
|
(if layer
|