blob: b9bf74f9926bb16c5b102e0a8112f3b48ff86bf5 (
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
42
|
;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(declaim (optimize (speed 0) (safety 3) (debug 3)))
(in-package :snow)
(defclass octopus-machines-with-roles-service (rest-service)
()
(:documentation ""))
(defun octopus-machines-with-roles-json ()
(with-noauth (instance octopus-machines-with-roles-service)
t))
(defclass octopus-machines-with-roles/view-service (octopus-machines-with-roles-service)
((form :initarg :form
:initform nil
:accessor form)
(location-p :initform nil))
(:documentation ""))
(defun octopus-machines-with-roles-view-json ()
(with-noauth (instance octopus-machines-with-roles/view-service)
(setf (form instance)
(make-form "octopus-machines-with-roles-form"
nil
t
`((:name "roles" :label "Roles (comma or space separated)" :field-type "text" :required "required" :value ,(or (session-value :octopus-roles) ""))
(:label "Find Machines With Roles" :field-type "button" :onclick "on_octopus_machines_with_roles_results_clicked()"))))))
(defclass octopus-machines-with-roles/results-service (octopus-machines-with-roles/view-service)
((results :initarg :results
:initform nil
:accessor results)
(location-p :initform nil))
(:documentation ""))
(defun octopus-machines-with-roles-results-json (roles)
(with-noauth (instance octopus-machines-with-roles/results-service)
(with-octopus (octopus)
(let ((machines (get-octopus-machines-with-roles octopus (remove-if (lambda (x) (org-ckons-core::null-or-empty-p x)) (cl-ppcre:split "[, ]" roles)))))
(setf (results instance) (loop for machine in machines collect (sanitize machine)))
(setf (session-value :octopus-roles) roles)))))
|