summaryrefslogtreecommitdiff
path: root/lisp/service/octopus-projects-with-roles-service.lisp
diff options
context:
space:
mode:
authorckonstanski <carlos.konstanski@olo.com>2025-10-07 06:53:09 -0600
committerckonstanski <carlos.konstanski@olo.com>2025-10-07 06:53:09 -0600
commit50273c110856e18e3ba563b0f62b7273a4dc022b (patch)
treecc58541bb299c659c5fd98774d3693aa99ff092a /lisp/service/octopus-projects-with-roles-service.lisp
parent9adba239b937df2830a5110adaa1dae17b7dd7d7 (diff)
initial commit
Diffstat (limited to 'lisp/service/octopus-projects-with-roles-service.lisp')
-rw-r--r--lisp/service/octopus-projects-with-roles-service.lisp44
1 files changed, 44 insertions, 0 deletions
diff --git a/lisp/service/octopus-projects-with-roles-service.lisp b/lisp/service/octopus-projects-with-roles-service.lisp
new file mode 100644
index 0000000..c3d9a67
--- /dev/null
+++ b/lisp/service/octopus-projects-with-roles-service.lisp
@@ -0,0 +1,44 @@
+;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+(declaim (optimize (speed 0) (safety 3) (debug 3)))
+
+(in-package :snow)
+
+(defclass octopus-projects-with-roles-service (rest-service)
+ ()
+ (:documentation ""))
+
+(defun octopus-projects-with-roles-json ()
+ (with-noauth (instance octopus-projects-with-roles-service)
+ t))
+
+(defclass octopus-projects-with-roles/view-service (octopus-projects-with-roles-service)
+ ((form :initarg :form
+ :initform nil
+ :accessor form)
+ (location-p :initform nil))
+ (:documentation ""))
+
+(defun octopus-projects-with-roles-view-json ()
+ (with-noauth (instance octopus-projects-with-roles/view-service)
+ (setf (form instance)
+ (make-form "octopus-projects-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 Projects With Roles" :field-type "button" :onclick "on_octopus_projects_with_roles_results_clicked()"))))))
+
+(defclass octopus-projects-with-roles/results-service (octopus-projects-with-roles/view-service)
+ ((stdout :initarg :stdout
+ :initform nil
+ :accessor stdout)
+ (location-p :initform nil))
+ (:documentation ""))
+
+(defun octopus-projects-with-roles-results-json (roles)
+ (with-noauth (instance octopus-projects-with-roles/results-service)
+ (cl-fad:with-output-to-temporary-file (f :template "/tmp/snow/temp-%")
+ (get-octopus-projects-with-roles (make-instance 'octopus-process-step
+ :target-roles (remove-if (lambda (x) (org-ckons-core::null-or-empty-p x)) (cl-ppcre:split "[, ]" roles))
+ :stdout (pathname f)))
+ (setf (stdout instance) (uiop:native-namestring (pathname f))))
+ (setf (session-value :octopus-roles) roles)))