From d429ff5876418e62c6a174b30d50235e668c5ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Elian=20Be=CC=81gin?= Date: Fri, 20 Jun 2014 12:09:26 +0200 Subject: [PATCH] Initial development --- index.html | 38 ++++++++++++++++++++++++ project.clj | 20 +++++++++++++ src/lamp/core.cljs | 72 ++++++++++++++++++++++++++++++++++++++++++++++ style.css | 15 ++++++++++ 4 files changed, 145 insertions(+) create mode 100644 index.html create mode 100644 project.clj create mode 100644 src/lamp/core.cljs create mode 100644 style.css diff --git a/index.html b/index.html new file mode 100644 index 0000000..bb7fdcf --- /dev/null +++ b/index.html @@ -0,0 +1,38 @@ + + + + LAMP++ + + + +
+

LAMP++ deployed by SlipStream

+
+ This test page allows you to issue read and write requests to the Apache/PHP layer + which in turn gets persisted in the MongoDB layer. The read request retrieve routing + information, such that you can check correct routing as elements of the LAMP stack + are disabled and re-enabled. For this simply SSH into the corresponding machine and + stop services. +
+
+
+ + +
+
+
+ +
+
+ + + + +
+ + + + + + diff --git a/project.clj b/project.clj new file mode 100644 index 0000000..b168225 --- /dev/null +++ b/project.clj @@ -0,0 +1,20 @@ +(defproject lamp "0.1.0-SNAPSHOT" + :description "FIXME: write this!" + :url "http://example.com/FIXME" + + :dependencies [[org.clojure/clojure "1.5.1"] + [org.clojure/clojurescript "0.0-2173"] + [org.clojure/core.async "0.1.256.0-1bf8cf-alpha"]] + + :plugins [[lein-cljsbuild "1.0.2"]] + + :source-paths ["src"] + + :cljsbuild { + :builds [{:id "lamp" + :source-paths ["src"] + :compiler { + :output-to "lamp.js" + :output-dir "out" + :optimizations :none + :source-map true}}]}) diff --git a/src/lamp/core.cljs b/src/lamp/core.cljs new file mode 100644 index 0000000..d60bd0f --- /dev/null +++ b/src/lamp/core.cljs @@ -0,0 +1,72 @@ +(ns lamp.core + (:require-macros [cljs.core.async.macros :refer [go]]) + (:require [goog.dom :as dom] + [goog.events :as events] + [cljs.core.async :refer [clj res)))) + out)) + +(defn render-db + [result] + (let [db (result "db")] + (set! + (.-innerHTML + (dom/getElement "db")) + (str "Database instance: " db)))) + +(defn render-read + [result] + (let [writers (result "writers") + sorted (sort writers) + filtered (filter #(> (val %) 0) writers)] + (render-db result) + (set! + (.-innerHTML + (dom/getElement "writers")) + (apply str + (for [[k v] filtered] + (str "
  • " k ": " v "
  • ")))))) + +(defn render-write + [result] + (render-db result) + (set! + (.-innerHTML + (dom/getElement "writers")) + "")) + +(defn init [] + (let [read (listen (dom/getElement "read") "click") + write (listen (dom/getElement "write") "click")] + (go (while true + (