summaryrefslogtreecommitdiff
path: root/lisp/service/octopus-latest-deployments-service.lisp
blob: 4b786bd9122c0e34e44c98f822485075ef58d7da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(declaim (optimize (speed 0) (safety 3) (debug 3)))

(in-package :snow)

(defclass octopus-latest-deployments-service (rest-service)
  ()
  (:documentation ""))

(defun octopus-latest-deployments-json ()
  (with-noauth (instance octopus-latest-deployments-service)
    t))

(defclass octopus-latest-deployments/view-service (octopus-latest-deployments-service)
  ((form :initarg :form
         :initform nil
         :accessor form)
   (location-p :initform nil))
  (:documentation ""))

(defun octopus-latest-deployments-view-json ()
  (with-noauth (instance octopus-latest-deployments/view-service)
    (setf (form instance)
          (make-form "octopus-latest-deployments-form"
                     nil
                     t
                     `((:name "ode_only_p" :label "ODE only?" :field-type "checkbox")
                       (:label "Find Latest Deployments" :field-type "button" :onclick "on_octopus_latest_deployments_results_clicked()"))))))

(defclass octopus-latest-deployments/results-service (octopus-latest-deployments/view-service)
  ((results :initarg :results
            :initform nil
            :accessor results)
   (location-p :initform nil))
  (:documentation ""))

(defun octopus-latest-deployments-results-json (ode_only_p)
  (with-noauth (instance octopus-latest-deployments/results-service)
    (with-octopus (octopus)
      (let ((deployments (get-octopus-latest-deployments octopus :ode-only-p (string= "true" ode_only_p))))
        (setf (results instance) deployments)))))