Code Monkey home page Code Monkey logo

hodur-org / hodur-visualizer-schema Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 7.0 73 KB

Hodur is a domain modeling approach and collection of libraries to Clojure. By using Hodur you can define your domain model as data, parse and validate it, and then either consume your model via an API or use one of the many plugins to help you achieve mechanical results faster and in a purely functional manner.

License: MIT License

HTML 4.97% JavaScript 48.94% CSS 6.65% Clojure 39.45%
clojure data modeling schema visualization

hodur-visualizer-schema's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hodur-visualizer-schema's Issues

Cant get basic vizualizer to work

I have created a new project but when I jack in I can require visualizer but none of the functions are available I get.

No such var: visualizer/schema

This is the code which is mainly from the readme, I have downgraded hodour as well from one of the issues bit this did not help.


(ns my-design.core
  (:require [hodur-engine.core :as hodur]
            [hodur-visualizer-schema.core :as visualizer]))

(def meta-db (hodur/init-schema
              '[Person
                [^String first-name
                 ^String last-name]]))

(-> meta-db
    visualizer/schema
    visualizer/apply-diagram!)

Is it just me doing something silly or does this no longer work ?

Can't make visualizer-schema to work

Hi!

I can't make schema visualizer-schema to work

[hodur/engine "0.1.8"]
[hodur/visualizer-schema "0.1.1"]

in my case
1 I build lein project
2 add go script in resources
3 make my index.html like below

   <!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Welcome to cjhike2</title>
</head>
<body onload="">
<div id="app" class="container">
    <div id="infoBoxHolder">
        <!-- Initially Empty, it is populated when updateInfoBox is called -->
    </div>
    <div id="myDiagramDiv" class="diagramDiv"></div>
</div>
<!--<script src="cljs-out/main.js" type="text/javascript"></script>-->
</body>

<!-- scripts and styles -->
{% style "/assets/bulma/css/bulma.min.css" %}
{% style "/assets/material-icons/css/material-icons.min.css" %}
{% style "/css/screen.css" %}

<script type="text/javascript">
        var csrfToken = "{{csrf-token}}";

</script>
{% script "/scripts/go.js" %} 
{% script "/scripts/my_diagram.js" %} << script from your lib
{% script "/cljs-out/dev-main.js" %} << my main with `visualizer/apply-diagram!`

</body>
</html>

4 main.cljs as below

(def meta-db (engine/init-schema
               '[Person
                 [^String first-name
                  ^String last-name
                  ^Gender gender]

                 ^:enum
                 Gender
                 [MALE FEMALE IRRELEVANT]]))

(defn show [] 
  (-> meta-db
    visualizer/schema
    visualizer/apply-diagram!))

(show)

so, when I open browser window I don't have any console issues and logs, but nothing shows.
when I call (show) from cljs console again I get #object[Error Error: Invalid div id; div already has a Diagram associated with it.] and actually the canvas appeared, but it is empty.

Is it possible that I need specific version of GoJS? I have GoJS v2.1.38

Originally posted by @evilsneer in #10 (comment)

Browser client can't find dev-main.js

Hi, @luchiniatwork — thank you for writing Hodur, as it's what made me brave enough to even try Datomic Cloud! (I loved gushing about it at Clojure/conj last year! https://www.youtube.com/watch?v=5mbp3SEha38&t=19s :).

it's been about a year I've used Hodur Visualizer, and I'm eager to jump into a new project. But when I tried to run the visualizer for an older project I did in January, the browser comes up blank, unable to find the dev-main.js.

I'm now getting some warnings during the execution, and I'm wondering if it has to do with this issue: #6, about how figwheel can't find the bootstrap cljs file if it's put in a "dev like path."

I even made a symbolic link from "main.js" to "dev-main.js" inside of the "target/public" directory, but now I'm getting this error:

core.cljc:208 Uncaught ReferenceError: initialized is not defined
    at hodur_visualizer_schema$core$apply_diagram_BANG_ (core.cljc:208)
    at viz.cljc:12
hodur_visualizer_schema$core$apply_diagram_BANG_ @ core.cljc:208
(anonymous) @ viz.cljc:12
console.js:203  [goog.net.WebSocket] Opening the WebSocket on ws://localhost:9500/figwheel-connect?fwprocess=c0cd53&fwbuild=dev&fwsid=61ac7501-fa5f-4d32-91cd-4d6f95fd8959&fwsname=Elmo
console.js:203  [goog.net.WebSocket] WebSocket opened on ws://localhost:9500/figwheel-connect?fwprocess=c0cd53&fwbuild=dev&fwsid=61ac7501-fa5f-4d32-91cd-4d6f95fd8959&fwsname=Elmo
console.js:203  [Figwheel REPL] Session ID: 61ac7501-fa5f-4d32-91cd-4d6f95fd8959

Do you have any tips on getting the classpaths/paths set up correctly? Here's my current alias map in deps.edn.


{:dev  {:viz  {:extra-paths ["config/dev" "target"]
                    :resource-paths ["target/public" "resources"]
                    :extra-deps  {
                                  ;com.bhauman/figwheel-main                     {:mvn/version "0.2.12"}
                                  gnl/ghostwheel                                {:mvn/version "0.3.9"}
                                  hodur/engine                                  {:mvn/version "0.1.6"}
                                  hodur/visualizer-schema                       {:mvn/version "0.1.1"}
                                  hodur/datomic-schema                          {:mvn/version "0.1.0"}}}

And here's the output:

make vizbooks
clojure -A:dev -m hodur-visualizer-schema.main books/viz
WARNING: When invoking clojure.main, use -M
[Figwheel:WARNING] Attempting to dynamically add "target" to classpath!
[Figwheel:WARNING] Target directory "target" is not on the classpath
[Figwheel:WARNING] Please fix this by adding "target" to your classpath
 I.E.
 For Clojure CLI Tools in your deps.edn file:
    ensure "target" is in your :paths key

 For Leiningen in your project.clj:
   add it to the :resource-paths key

[Figwheel] Compiling build dev to "target/public/cljs-out/main.js"
[Figwheel] Successfully compiled build dev to "target/public/cljs-out/main.js" in 0.895 seconds.
[Figwheel] Watching paths: ("src") to compile build - dev
[Figwheel] Starting Server at http://localhost:9500
[Figwheel] Starting REPL
Prompt will show when REPL connects to evaluation environment (i.e. a REPL hosting webpage)

Here's the initial error I got from the browser at it searched for the "wrong" bootstrap CLJS file:

localhost_9500_and_hodur-schemas_—_-bash_—_86×40

Figwheel: Unable to dynamicly load figwheel.server.jetty-websocket/run-server

When starting up hodur-visualizer-schema I get:

Exception in thread "main" clojure.lang.ExceptionInfo: Figwheel: Unable to dynamicly load figwheel.server.jetty-websocket/run-server {:not-loaded figwheel.server.jetty-websocket/run-server}

This looks like it could be related to Figwheel Jetty Conflicts. hodur-visualizer-schema uses figwheel-main 0.1.9 but the issue is fixed from 0.2.1 on. I will try with latest version 0.2.3 and open pull request if it fixes the issue

Visually discriminate between domain entities and mechanics-related entities

Visually separate entities of the domain and implementation-specific mechanics. The seperation should be visually so that a developer and domain expert can see inter-dependencies between domain and mechanic-related entities easily and maybe hide detail by collapsing all entities into one high level component-grouping.

Visualization Alternatives

Model Alternatives

  • A :visualizer-tag :visualizer/background "#123456" for an entity
  • A :visualizer-tag for domain and mechanics: :visualizer/component :domain, :visualizer/component :lacinia-query, :visualizer/component :lacinia-pagination.
  • Provide domain / mechanic tag in hodors model definition :component :domain, :component :lacinia-query
  • (I have no idea which might be the best choice in the long term)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.