Coder Social home page Coder Social logo

tckz / redmine-wiki_graphviz_plugin Goto Github PK

View Code? Open in Web Editor NEW
58.0 10.0 13.0 104 KB

Wiki macro for redmine. The macro render graph-image from wiki contents as dot.

Home Page: https://passing.breeze.cc/mt/

License: Other

Ruby 82.58% HTML 17.21% CSS 0.21%
redmine graphviz redmine-wiki redmine-plugin wiki-macro

redmine-wiki_graphviz_plugin's Introduction

Redmine Wiki Graphviz-macro plugin

Redmine Wiki Graphviz-macro plugin make Redmine's wiki able to render graph image.

sample

Features

  • Add wiki macro {{graphviz}}, {{graphviz_link}} and {{graphviz_me}}
  • Write wiki page as dot format, and the macros make it graph image.

{{graphviz}} macro

  • This macro render graph image from other wiki page's content.

     {{graphviz(Foo)}}
     {{graphviz(option=value,Foo)}}
     {{graphviz(layout=neato,target=_blank,with_source,Foo)}}
    
  • format={png|jpg|svg}

  • layout={dot|neato|fdp|twopi|circo}

  • inline={true|false}

    • If svg format is specified, Its default output is inline SVG. If inline is false, img tag will be used.
  • target={_blank|any} (*1)

  • with_source : Display both image and its source(dot) (*1)

  • no_map : Disable clickable map. (*1)

  • wiki=page : Link image to specified wiki page. (*1)

  • link_to_image : Link image to itself. (*1)

  • align=value : Additional attr for IMG. (*1)
    e.g.) right, left

  • width=value : Additional attr for IMG.

    • It is recommended to use no_map option together.
      e.g.) 100px, 200%
  • height=value : Additional attr for IMG.

    • It is recommended to use no_map option together.
      e.g.) 100px, 200%
  • (*1): These options do not affect to the inline SVG.

{{graphviz_me}} macro

  • This macro render graph image from the wiki page which includes this macro.

  • Use this macro commented out like below. If it is not commented out, renderer fails syntax error.

     // {{graphviz_me()}}
     // {{graphviz_me(option=value)}}
    
  • options: See {{graphviz}} macro.

  • When previewing, this macro output the image into img@src with data scheme. Thus, old browsers can't render it.

{{graphviz_link}} macro

  • This macro render graph image having passing the dot description inline.

     {{graphviz_link()
     digraph G {...}
     }}
     {{graphviz_link(option=value)
     digraph G {...}
     }}
    
  • options: See {{graphviz}} macro.

Tips

  • Example

     {{graphviz_link()
     digraph G {
       subgraph cluster_se {
         graph [label="Search Engine"]
         y [label="Yahoo!", URL="http://www.yahoo.com/"]
         g [label="Google", URL="http://www.google.com/"]
       }
       p [label="Page"]
       g -> p
     }
     }}
    

Requirement

  • Redmine 4.0.0 or later.
  • ruby 2.6
  • Graphviz http://www.graphviz.org
    • There are 2ways about setting up graphviz for this plugin.

    • The one is using Gv which is ruby binding of graphviz.

      • Recommended for unix system.
      • The plugin uses fork() and IO.pipe to capture STDERR which holds error message output from Gv.
    • The other one is using external dot command which is on the PATH.

      • For Windows system, Only this way of setting is available.
      • The dot command is executed twice by the plugin when one graph is rendered. First one to render the image. Second one to create clickable map.
    • Example of installed graphviz package.

      e.g.) CentOS 5.5 using Gv.
        graphviz-2.26.3-1.el5
        graphviz-gd-2.26.3-1.el5
        graphviz-ruby-2.26.3-1.el5
      e.g.) Ubuntu (10.04) using Gv.
        graphviz
        graphviz-dev
        libgv-ruby
      
  • memcached (optional)

Getting the plugin

https://github.com/tckz/redmine-wiki_graphviz_plugin

e.g.)

git clone https://github.com/tckz/redmine-wiki_graphviz_plugin.git wiki_graphviz_plugin

Install

  1. Copy the plugin tree into #{RAILS_ROOT}/plugins/

    #{RAILS_ROOT}/plugins/
        wiki_graphviz_plugin/
    
  2. Make sure the temporary directory writable by the process of redmine.

    #{RAILS_ROOT}/tmp/
    

    This plugin try to create follwing directory and create tmporary file under it.

    #{RAILS_ROOT}/tmp/wiki_graphviz_plugin/
    
  3. Restart Redmine.

Optional

  • If you want to use caching feature for rendered images, must configure your cache_store.
  • This plugin expects the store like ActiveSupport::Cache::DalliStore which provides marshaling when set/get the value.
  1. Setup caching environment, like memcached.
  2. Install gem for caching.
    # e.g.) cd $RAILS_ROOT
    $ bundle add dalli
    
  3. Configure cache_store.
    e.g.) config/environments/production.rb
    config.action_controller.perform_caching = true
    config.action_controller.cache_store = :dalli_cache_store, "localhost"
    
  4. Restart Redmine.
  5. Login to Redmine as an Administrator.
  6. Setup wiki graphviz-macro settings in the Plugin settings panel.

License

This plugin is licensed under the GNU GPL v2.
See COPYRIGHT.txt and GPL.txt for details.

Contribution

  • graphviz_link macro by rsilvestri.

My environment

redmine-wiki_graphviz_plugin's People

Contributors

benoitg avatar rsilvestri avatar sayuan avatar scout3r avatar tckz avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redmine-wiki_graphviz_plugin's Issues

Error with PDF export

Hello,

I've just installed the Graphviz plugin and it's working very well.

When trying to do a PDF export of the Wiki page, I get the following error message in the PDF document:
Error executing the graphviz_link macro (Missing template wiki_graphviz/macro with {:locale=>[:de, :en], :formats=>[:pdf], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :rsb]}...)

The HTML export is working fine. Is there anything missing in my setup or in the configuration?

Regards
David

Redmine r3215 permissions problem

In recent version of redmine there seems to be problem with premissions. I got

Filter chain halted as [:authorize] rendered_or_redirected.

and after I remove authorize check I got 404

URL examples

Hello, thank you for Graphviz plugin.

Please add to ReadMe examples, how to create links (the URL attribute) to Redmine

  • wiki page,
  • issue.

Regards,
Hans

PDF export not working

PDF export of graphviz not working.
Produce following content in pdf file:

Error executing the graphviz_link macro (Missing template wiki_graphviz/macro with {:locale=>[:ru, :en], :formats=>[:pdf],
:variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :haml, :rsb]}. Searched in: *
"/usr/share/redmine/plugins/wiki_graphviz_plugin/app/views" *
"/usr/share/redmine/plugins/redmine_more_previews/converters/nil_text/app/views" *
"/usr/share/redmine/plugins/redmine_more_previews/converters/cliff/app/views" *
"/usr/share/redmine/plugins/redmine_more_previews/app/views" * "/usr/share/redmine/plugins/redmine_ldap_sync/app/views" *
"/usr/share/redmine/plugins/redmine_latex_mathjax/app/views" * "/usr/share/redmine/plugins/redmine_issues_tree/app/views" *
"/usr/share/redmine/plugins/redmine_issue_templates/app/views" * "/usr/share/redmine/plugins/redmine_gemavatar/app/views" *
"/usr/share/redmine/plugins/microsoft_project_connector/app/views" * "/usr/share/redmine/app/views" )

Environment:
Redmine version 4.0.7.stable
Ruby version 2.5.5-p157 (2019-03-15) [x86_64-linux-gnu]
Rails version 5.2.3
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp
SCM:
Git 2.20.1
Filesystem
Redmine plugins:
microsoft_project_connector 1.0.7
redmine_gemavatar 1.1
redmine_impersonate 2.0.0
redmine_issue_templates 1.0.4
redmine_issues_tree 0.0.14
redmine_latex_mathjax 0.4.0
redmine_ldap_sync 2.2.0
redmine_more_previews 2.0.2
redmine_static_link 0.1.0
wiki_graphviz_plugin 0.8.0

tested on redmine 2.2 with some adaptions

Redmine routes.rb causes problems to access the generated graph files. I created a ticket with redmine:
http://www.redmine.org/issues/12749

Further I extended your plugin by adding one more macro:

graphviz_in
Render graph image from text within the macro command.

!{{graphviz_in()
graphviz commands
}}
!{{graphviz_in(option=value...,foo)
graphviz commands
}}

It's working nicely for me while it has some limitations on the size of the graph since I pass the dot command via URL to the graphviz-controller.

Let me know if you like to add to your plugin.

Error executing the graphviz_link macro (page=Wiki, error=sh: 1: dot: not found)

We have recently updated to Redmine 5.1.2 and I've discovered this bug:
Error executing the graphviz_link macro (page=Wiki, error=sh: 1: dot: not found)
(Redmine error code error_can_not_execute_macro_html)

This message appears when I add the sample code (https://github.com/tckz/redmine-wiki_graphviz_plugin#tips) into a Wiki page.
Is this an issue of our Redmine installation/update or are we missing some settings? I would really appreciate some feedback on this.

Does it work on RM 1.2.1?

When I try

//{{graphviz_me()}}

I get

Error executing the graphviz_me macro (page=XYZ, error=Error: :1: syntax error near line 1 context: >>> h1 <<< . XYZ)

Any ideas?

Unable to load graphs and images in wiki

Hi,
Greetings. I am upgrading our redmine from 2.5.2 to 3.4.5 on a different VM (RHEL 7). While I have configured most of the plugins, I am stuck with wiki page that loads a graph and image. For some reason I am not able to efficiently use or configure wiki_graphviz_plugin. Could someone please help, I guess I am missing some configurations here.

I had asked the IT team to install graphviz software as I did not have root access and I could not install the software because of permission issues.

Attahced are the screenshots of wiki page in old redmine (where it works fine) and new server where it is not.

Redmine Info:
Environment:
Redmine version 3.4.5.stable
Ruby version 2.4.4-p296 (2018-03-28) [x86_64-linux]
Rails version 4.2.8
Environment production
Database adapter Mysql2
SCM:
Darcs 2.8.4
Bazaar 2.5.1
Git 1.8.3.1
Filesystem
Redmine plugins:
clipboard_image_paste 1.12
forward_to_diffs 0.1
progressive_projects_list 3.0.1
redmine_all_files 0.0.3
redmine_checklists 3.1.11
redmine_ckeditor 1.1.5
redmine_didyoumean 1.2.0
redmine_favourite_projects 0.10
redmine_information 1.0.2
redmine_issue_templates 0.2.0
redmine_issues_macros 0.0.1
redmine_landing_page 0.1.1
redmine_login_audit 0.3.3
redmine_monitoring_controlling 0.1.1
redmine_private_wiki 0.2.0
redmine_silencer 0.4.3
redmine_theme_changer 0.3.1
redmine_wiki_issue_fields 0.5.9
redmine_wiki_toc 0.0.4
scrum 0.18.0
sidebar_hide 0.0.8
wiki_graphviz_plugin 0.7.0

Graphviz: graphviz-2.40.1

Best regards,
Nitish Hombal

Redmine 2.0 compatibility

Doesn't start with error message:
uninitialized constant RAILS_DEFAULT_LOGGER

And installation guide is outdated too (vendor/plugins is not used anymore)

run on ubuntu14.04 , cpu 100%

step:

1: sudo apt-get install graphviz graphviz-dev libgv-ruby
2:

{{graphviz_link()
   digraph G {
      server1 -> server2;
   }
}}

redmine 5.x support

it would be great to get redmine 5.x support into this plugin.

I'm not a ruby developer, so I can't really help. but let me know if it's possible to contribute financially.

For redmine 2.x, directory name must equal 'wiki_graphviz_plugin'

For redmine-2.0 and redmine-2.1,
the directory name of the plugin installed MUST BE equal to 'wiki_graphviz_plugin'.

Otherwise the plugin does not work with the following possible errors:

  • Missing template 'wiki_graphviz/macro'
  • uninitialized constant 'WikiGraphvizHelper'

I have experienced this issue because git cloning

git clone https://github.com/tckz/redmine-wiki_graphviz_plugin.git 

creates a directory named 'redmine-wiki_graphviz_plugin' by default.

Please emphasize this constraint in README, or make the plugin throws an error telling us what to do, or works even if this constraint is not satisfied.

Thanks.

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.