Fixed single page bugs
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/a594c062 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/a594c062 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/a594c062 Branch: refs/heads/master Commit: a594c062b6986492c1f3bf853b3e1cc49e776cd5 Parents: cfa914d Author: Duncan Godwin <duncan.god...@cloudsoftcorp.com> Authored: Fri Mar 4 14:25:11 2016 +0000 Committer: Duncan Godwin <duncan.god...@cloudsoftcorp.com> Committed: Mon Mar 7 16:54:43 2016 +0000 ---------------------------------------------------------------------- _plugins/page_structure.rb | 65 +++++++++++++++++----------- guide/index.md | 4 +- guide/start/policies.md | 95 ++++++++++++++++++++++++++++++++++------- style/css/singlePage.css | 12 ++++++ 4 files changed, 134 insertions(+), 42 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/a594c062/_plugins/page_structure.rb ---------------------------------------------------------------------- diff --git a/_plugins/page_structure.rb b/_plugins/page_structure.rb index 2833be3..4e01559 100644 --- a/_plugins/page_structure.rb +++ b/_plugins/page_structure.rb @@ -10,6 +10,12 @@ require "kramdown" module PageStructureUtils + class MyHash < Hash + def to_s + "cheese" + end + end + class ChildPage def initialize(yaml, content) @yaml=yaml @@ -48,33 +54,42 @@ module PageStructureUtils # Sorts a list of yaml children, if there's no numbering, use the YAML order to create a numbering # def self.sortYAMLSectionPositions(yaml) -# puts "a > "+yaml.to_s - hashArray = [] - $major = "1" - $minor = 1 - # first check all the child pages are numbered, if not, number them in the order they are - yaml.each do |i| - hash = {} - # if it's a string, convert it to a hash - if i.instance_of? String - hash = { "path" => i } - else - hash = i - end - if i['section_position'] == nil - hash['section_position'] = $major+"."+$minor.to_s - $minor += 1 - else - # Store any major, start incrementing minor - $major = i['section_position'].to_s + position = Hash.new + $major = "1" $minor = 1 + # go through and generate a position for each + yaml.each do |i| + if i.instance_of? String + position[i] = $major+"."+$minor.to_s + else + if i['section_position'] == nil + position[i['path']] = $major+"."+$minor.to_s + $minor += 1 + else + # Store any major, start incrementing minor + position[i['path']] = i['section_position'].to_s + $major = i['section_position'].to_s + $minor = 1 + end + end + end + # sort on the position (NB: sort! for in-place sorting) + yaml.sort!{ |x,y| + $pos_x = nil + $pos_y = nil + if x.instance_of? String + $pos_x = position[x] + else + $pos_x = position[x['path']] + end + if y.instance_of? String + $pos_y = position[y] + else + $pos_y = position[y['path']] + end + Gem::Version.new($pos_x.to_s) <=> Gem::Version.new($pos_y.to_s) + } end - hashArray << hash - end - # return the comparison between the versions (NB: sort! for in-place sorting) - hashArray.sort!{ |x,y| Gem::Version.new(x['section_position'].to_s) <=> Gem::Version.new(y['section_position'].to_s) } -# puts "2 > "+hashArray.to_s - end ## # This function looks at all the *.md files at the YAML in the headers and produces a list of children ordered by section_position http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/a594c062/guide/index.md ---------------------------------------------------------------------- diff --git a/guide/index.md b/guide/index.md index cdb3b46..5c7ced3 100644 --- a/guide/index.md +++ b/guide/index.md @@ -5,12 +5,12 @@ breadcrumbs: - /website/documentation/index.md - index.md children: -- { path: /guide/start/index.md } +- { path: /guide/start/index.md, section_position: 3.1.2 } - { path: /guide/misc/download.md } - { path: /guide/concepts/index.md } - { path: /guide/yaml/index.md } - { path: /guide/java/index.md } -- { path: /guide/ops/index.md } +- { path: /guide/ops/index.md, section_position: 2 } - { path: /guide/misc/index.md } --- http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/a594c062/guide/start/policies.md ---------------------------------------------------------------------- diff --git a/guide/start/policies.md b/guide/start/policies.md index edef90c..a12e77f 100644 --- a/guide/start/policies.md +++ b/guide/start/policies.md @@ -16,6 +16,69 @@ review and/or change the the location where the application will be deployed. You will need four machines for this example: one for the load-balancer (nginx), and three for the Tomcat cluster (but you can reduce this by changing the `maxPoolSize` below). +<div class="usermanual-pdf-include" style="display: none;"> +{% highlight yaml %} +name: Tomcat Cluster + +location: + byon: + user: vagrant + password: vagrant + hosts: + - 10.10.10.101 + - 10.10.10.102 + - 10.10.10.103 + - 10.10.10.104 + +services: +- type: org.apache.brooklyn.entity.group.DynamicCluster + name: Cluster + id: cluster + brooklyn.config: + initialSize: 1 + memberSpec: + $brooklyn:entitySpec: + type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer + name: Tomcat Server + brooklyn.config: + wars.root: http://search.maven.org/remotecontent?filepath=org/apache/brooklyn/example/brooklyn-example-hello-world-webapp/0.8.0-incubating/brooklyn-example-hello-world-webapp-0.8.0-incubating.war + + brooklyn.policies: + - type: org.apache.brooklyn.policy.ha.ServiceRestarter + brooklyn.config: + failOnRecurringFailuresInThisDuration: 5m + brooklyn.enrichers: + - type: org.apache.brooklyn.policy.ha.ServiceFailureDetector + brooklyn.config: + entityFailed.stabilizationDelay: 30s + + brooklyn.policies: + - type: org.apache.brooklyn.policy.ha.ServiceReplacer + + - type: org.apache.brooklyn.policy.autoscaling.AutoScalerPolicy + brooklyn.config: + metric: webapp.reqs.perSec.perNode + metricUpperBound: 3 + metricLowerBound: 1 + resizeUpStabilizationDelay: 2s + resizeDownStabilizationDelay: 1m + maxPoolSize: 3 + + brooklyn.enrichers: + - type: org.apache.brooklyn.enricher.stock.Aggregator + brooklyn.config: + enricher.sourceSensor: $brooklyn:sensor("webapp.reqs.perSec.windowed") + enricher.targetSensor: $brooklyn:sensor("webapp.reqs.perSec.perNode") + enricher.aggregating.fromMembers: true + transformation: average + +- type: org.apache.brooklyn.entity.proxy.nginx.NginxController + name: Load Balancer (nginx) + brooklyn.config: + loadbalancer.serverpool: $brooklyn:entity("cluster") + nginx.sticky: false +{% endhighlight %} +</div> <!-- WARNING: if modifying either mycluster.yaml or the yaml below, be sure to keep them both in-sync --> @@ -194,21 +257,23 @@ Tomcat cluster (but you can reduce this by changing the `maxPoolSize` below). See blueprint-tour.md for where this CSS/javascript was copied from. {% endcomment %} -$(function() { - maxCodeWidth = Math.max.apply(Math, $(".annotated_blueprint div.block > div:last-child").map(function(){ return this.scrollWidth; }).get()); - $(".annotated_blueprint div.block").width(maxCodeWidth); -}) - -$(".annotated_blueprint .code_scroller .initial_notice > div").height($(".annotated_blueprint .code_scroller .code_viewer").height()); -$(".annotated_blueprint .code_scroller .initial_notice > div").width($(".annotated_blueprint .code_scroller").width()); -$(".annotated_blueprint .code_scroller").hover(function() { - $(".annotated_blueprint .initial_notice").css("display", "none"); -}); -$(function() { - setTimeout(function() { $(".annotated_blueprint .initial_notice").hide(400); }, 3000); - setTimeout(function() { $(".annotated_blueprint #countdown").text("2s"); }, 1000); - setTimeout(function() { $(".annotated_blueprint #countdown").text("1s"); }, 2000); -}); +if (window.$ != null) { + $(function() { + maxCodeWidth = Math.max.apply(Math, $(".annotated_blueprint div.block > div:last-child").map(function(){ return this.scrollWidth; }).get()); + $(".annotated_blueprint div.block").width(maxCodeWidth); + }) + + $(".annotated_blueprint .code_scroller .initial_notice > div").height($(".annotated_blueprint .code_scroller .code_viewer").height()); + $(".annotated_blueprint .code_scroller .initial_notice > div").width($(".annotated_blueprint .code_scroller").width()); + $(".annotated_blueprint .code_scroller").hover(function() { + $(".annotated_blueprint .initial_notice").css("display", "none"); + }); + $(function() { + setTimeout(function() { $(".annotated_blueprint .initial_notice").hide(400); }, 3000); + setTimeout(function() { $(".annotated_blueprint #countdown").text("2s"); }, 1000); + setTimeout(function() { $(".annotated_blueprint #countdown").text("1s"); }, 2000); + }); + } </script> http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/a594c062/style/css/singlePage.css ---------------------------------------------------------------------- diff --git a/style/css/singlePage.css b/style/css/singlePage.css index 9c87950..8c3a639 100644 --- a/style/css/singlePage.css +++ b/style/css/singlePage.css @@ -43,6 +43,9 @@ pre, pre code{ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ } +pre { + font-family: "Lucida Console", Monaco, monospace; +} .goToTop{ padding-right: 25px; padding-top: 75px; @@ -53,4 +56,13 @@ pre, pre code{ #content_container h1{ display: inline-block; width: 90%; +} +.jumobotron.annotated_blueprint{ + display: none; +} +.usermanual-pdf-include{ + display: inline !important; +} +.usermanual-pdf-exclude{ + display: none !important; } \ No newline at end of file