;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.presentation) ;;;;;; ;;; Debug menu (def (function e) toggle-profile-request-processing/server (&optional (server *server*)) (notf (profile-request-processing? server))) (def (function e) toggle-running-in-test-mode/application (&optional (application *application*)) (notf (running-in-test-mode? application))) (def (function e) toggle-debug-server-side/application (&optional (application *application*)) (if (slot-boundp application 'debug-on-error) (notf (slot-value application 'debug-on-error)) (setf (slot-value application 'debug-on-error) (not *debug-on-error*)))) (def (function e) toggle-ajax-enabled/application (&optional (application *application*)) (notf (ajax-enabled? application))) (def (function e) toggle-debug-component-hierarchy/frame (&optional (frame *frame*)) (notf (debug-component-hierarchy? frame))) (def (function e) toggle-debug-client-side/frame (&optional (frame *frame*)) (notf (debug-client-side? (root-component-of frame)))) (def (function e) clear-root-component (&optional (frame *frame*)) (setf (root-component-of frame) nil)) (def (function e) make-debug-menu () (when (authorize-operation *application* '(make-debug-menu)) (menu-item/widget () "Debug" (menu-item/widget () (command/widget (:js (lambda () `js(hdws.reload-css))) "Reload CSS")) (menu-item/widget () "Invalidate" (menu-item/widget () (command/widget (:ajax #f :send-client-state #f) "Invalidate session" (make-action (mark-session-invalid)))) (menu-item/widget () (command/widget (:ajax #f :send-client-state #f) "Invalidate frame" (make-action (mark-frame-invalid)))) (menu-item/widget () (command/widget (:ajax #f :send-client-state #f) "Clear the frame's root component" (make-action (clear-root-component))))) (menu-item/widget () "Inspect" (menu-item/widget () (replace-target-place/widget () "Server" (make-value-inspector *server*))) (menu-item/widget () (replace-target-place/widget () "Application" (make-value-inspector *application*))) (menu-item/widget () (replace-target-place/widget () "Session" (make-value-inspector *session*))) (menu-item/widget () (replace-target-place/widget () "Frame" (make-value-inspector *frame*))) (menu-item/widget () (replace-target-place/widget () "Request" (make-value-inspector *request*))) (menu-item/widget () (replace-target-place/widget () "Response" (make-value-inspector *response*))) ;; #+sbcl ;; (menu-item/widget () ;; (replace-target-place/widget () ;; "Frame size breakdown" ;; (make-instance 'frame-size-breakdown/widget))) (menu-item/widget () (replace-target-place/widget () "User agent breakdown" (make-value-inspector (make-http-user-agent-breakdown *server*))))) (menu-item/widget () (replace-target-place/widget () "Debugging state" (vertical-list/layout () (make-instance 'debugging-state/widget)))) (menu-item/widget () (replace-target-place/widget () "Error handling tests" (vertical-list/layout () (make-instance 'debugging-state/widget) (make-instance 'error-handling-test/widget))))))) ;;;;;; ;;; Debug menu (def (component e) debugging-state/widget (standard/widget) ()) (def render-xhtml debugging-state/widget (with-render-style/component (-self-) (labels ((command (action content &rest args) (apply 'render-command/xhtml action content :style-class "command" args)) (replace-target-place-command (component replacement-component content &rest args) (apply 'render-replace-target-place-command/xhtml component replacement-component content :style-class "command" args)) (boolean-to-status-string (value &optional inherited-value) (if (eq value :inherited) (string+ (boolean-to-status-string inherited-value) " (inherited)") (if value "enabled" "disabled")))) (macrolet ((render-inherited-boolean-status (scope object slot-name default-value &key (ajax #t)) (once-only (object slot-name) `
> |