Skip to content

Commit 1fe3143

Browse files
committed
Updating CHEF-659:
* now using partials * nodes/roles both use the same jsoneditor * removed old version. Conflicts: chef-server-webui/public/javascripts/JSONeditor.js
1 parent 61adfeb commit 1fe3143

25 files changed

Lines changed: 140 additions & 1289 deletions
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
- throw_content :header_content do
2+
= css_include_tag "jsonedit_main.css"
3+
= js_include_tag "json.js"
4+
= js_include_tag "yetii-min.js"
5+
%script{:type=>"text/javascript", :src => "/javascripts/jsonedit_main.js"}
6+
7+
%script= "$(document).ready(function() { $$(\"jsonstr\").value = JSON.stringify(#{json}); if (BCJTEP.build()) { $$(\"results\").innerHTML = \" \"; $$(\"editortab\").className = \"show\"; $$(\"searchtab\").className = \"show\"; }});"
8+
%div#jsoneditor
9+
%div#treecontainer
10+
%div#div1
11+
%div#tabcontainer
12+
%div#tab-container-1.tablayout
13+
%ul#tab-container-1-nav.tablayout
14+
%li#searchtab.noshow
15+
%a{ :href => "#tab1"} search
16+
%li#editortab.noshow
17+
%a{ :href => "#tab2"} editor
18+
%li#sourcetab
19+
%a{ :href => "#tab3"} source
20+
%div#tab1.tab
21+
%table.icanhastable
22+
%tr
23+
%td
24+
%span search :
25+
%input#keyword{:type => "text"}
26+
%input#search{:type => "button", :value => "Find"}
27+
%tr
28+
%td
29+
%div#results  
30+
%div#tab2.tab
31+
%table.icanhastable
32+
%tr
33+
%td
34+
%div#add.button{:title => "Add a new attribute"}
35+
%div#delete.button{:title => "Delete current attribute"}
36+
%div#savedstatus{:style => "display:none;"}
37+
%img{ :src=> "/images/jsonedit/saved.png"}
38+
%span Saved!
39+
%div#deletedstatus{:style => "display:none;"}
40+
%img{ :src=> "/images/jsonedit/deleted.png"}
41+
%span Deleted!
42+
%td
43+
type :
44+
%select#jsontypes
45+
%option Select Type
46+
%tr
47+
%td{:colspan => "2"}
48+
%div#jsonnameinput
49+
name :
50+
%input#jsonname{:type => "text", :size=>"55", :class => ""}
51+
%tr
52+
%td{:colspan => "2"}
53+
%textarea#jsonvalue{:wrap => "virtual", :cols => "55", :rows => "5", :class => ""}
54+
%tr
55+
%td{:colspan => "2"}
56+
%div#jsonpath  
57+
%div#jsonmode  
58+
%tr
59+
%td{:style => "text-align:left !important"}
60+
%input#autodetect{:type => "checkbox", :checked=> "true"}
61+
%label{:for => "autodetect"} Autodetect type of attribute?
62+
%td
63+
%input#savebutton{:type => "button", :value => "Save Attribute"}
64+
%input#addbutton{:type => "button", :value => "Add Attribute"}
65+
%div#tab3.tab
66+
%div#tab-container-2.tablayout.nested
67+
%ul#tab-container-2-nav.tablayout
68+
%li
69+
%a{ :href => "#tab3a" } json
70+
%div#tab1a.tabn
71+
%table.icanhastable
72+
%tr
73+
%td
74+
%div#refresh.button{:title => "Reload JSON from Tree"}
75+
%div#buildbutton.button{:title => "Load JSON from Source"}
76+
%tr
77+
%td
78+
%textarea#jsonstr{:wrap => "virtual", :cols => "55", :rows => "10", :class => ""}
79+
%div#console
80+
%div#bar
81+
%a#consolebar Error Console
82+
%div#log

chef-server-webui/app/views/nodes/_form.html.haml

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -42,86 +42,8 @@
4242

4343
%div.group.form{:style => "position:relative;"}
4444
%label.label Attributes
45-
//%div.editor
46-
// %div#tree
47-
// %div#jform
48-
// %div.clear
49-
// %script= "$(document).ready(function() { JSONeditor.start('tree', 'jform', #{@node.attribute.to_json}, false); });"
50-
%script= "$(document).ready(function() { $$(\"jsonstr\").value = JSON.stringify(#{@node.attribute.to_json}); if (BCJTEP.build()) { $$(\"results\").innerHTML = \" \"; $$(\"editortab\").className = \"show\"; $$(\"searchtab\").className = \"show\"; }});"
51-
%div#treecontainer
52-
%div#div1
53-
%div#tabcontainer
54-
%div#tab-container-1.tablayout
55-
%ul#tab-container-1-nav.tablayout
56-
%li
57-
%a{ :href => "#tab1"} source
58-
%li#editortab.noshow
59-
%a{ :href => "#tab2"} editor
60-
%li#searchtab.noshow
61-
%a{ :href => "#tab3"} search
62-
%div#tab1.tab
63-
%div#tab-container-2.tablayout.nested
64-
%ul#tab-container-2-nav.tablayout
65-
%li
66-
%a{ :href => "#tab1a" } json
67-
%div#tab1a.tabn
68-
%table.icanhastable
69-
%tr
70-
%td
71-
%div#refresh.button{:title => "Reload JSON from Tree"}
72-
%div#buildbutton.button{:title => "Load JSON from Source"}
73-
%tr
74-
%td
75-
%textarea#jsonstr{:wrap => "virtual", :cols => "55", :rows => "10", :class => ""}
76-
%div#tab2.tab
77-
%table.icanhastable
78-
%tr
79-
%td
80-
%div#add.button{:title => "Add a new attribute"}
81-
%div#delete.button{:title => "Delete current attribute"}
82-
%div#savedstatus{:style => "display:none;"}
83-
%img{ :src=> "/images/jsonedit/saved.png"}
84-
%span Saved!
85-
%div#deletedstatus{:style => "display:none;"}
86-
%img{ :src=> "/images/jsonedit/deleted.png"}
87-
%span Deleted!
88-
%td
89-
type :
90-
%select#jsontypes
91-
%option Select Type
92-
%tr
93-
%td{:colspan => "2"}
94-
%div#jsonnameinput
95-
name :
96-
%input#jsonname{:type => "text", :size=>"55", :class => ""}
97-
%tr
98-
%td{:colspan => "2"}
99-
%textarea#jsonvalue{:wrap => "virtual", :cols => "55", :rows => "5", :class => ""}
100-
%div#jsonpath  
101-
%tr
102-
%td{:style => "text-align:left !important"}
103-
%input#autodetect{:type => "checkbox", :checked=> "true"}
104-
%label{:for => "autodetect"} Autodetect type of attribute?
105-
%td
106-
%input#savebutton{:type => "button", :value => "Save Attribute"}
107-
%input#addbutton{:type => "button", :value => "Add Attribute"}
108-
%div#tab3.tab
109-
%table.icanhastable
110-
%tr
111-
%td
112-
%span search :
113-
%input#keyword{:type => "text"}
114-
%input#search{:type => "button", :value => "Find"}
115-
%tr
116-
%td
117-
%div#results  
118-
%div#console
119-
%div#bar
120-
%a#consolebar Error Console
121-
%div#log
122-
45+
= partial '../layout/jsonedit', :json =>@node.attribute.to_json
12346
%div.group.form
124-
%label.label Actions
12547
%span.description A JSON hash for default attributes for nodes of this node. These attributes will only be applied if the node does not already have a value for the attributes.
12648

12749
= form(:action => form_url, :method => :post, :id => form_id, :class => 'form') do

chef-server-webui/app/views/nodes/edit.html.haml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
- throw_content :header_content do
2-
= css_include_tag "jsonedit_main.css"
3-
= js_include_tag "json.js"
4-
= js_include_tag "yetii-min.js"
5-
%script{:type=>"text/javascript", :src => "/javascripts/jsonedit_main.js"}
61
.block#block-tables
72
.content
83
%h2.title= "Node #{h @node.name}"

chef-server-webui/app/views/roles/_form.html.haml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,9 @@
3434
Drag recipes from the list of Available Recipes section on the left, and drop them
3535
in the "Recipes for this Role" section on the right. Then sort the recipes for this role list to the order you would like to see the recipes applied.
3636

37-
%div.group.form
37+
%div.group.form{:style => "position:relative;"}
3838
%label.label Default and Override Attributes
39-
%div.editor
40-
%div#tree
41-
%div#jform
42-
%div.clear
43-
%script= "$(document).ready(function() { JSONeditor.start('tree', 'jform', #{ { :defaults => @role.default_attributes, :overrides => @role.override_attributes }.to_json }, false); });"
39+
= partial '../layout/jsonedit', :json => { :defaults => @role.default_attributes, :overrides => @role.override_attributes }.to_json
4440
%span.description A JSON hash for default attributes for nodes of this role. These attributes will only be applied if the node does not already have a value for the attributes.
4541
= form(:action => form_url, :method => :post, :id => form_id, :class => 'form') do
4642
%div.group
File renamed without changes.

chef-server-slice/public/images/jsonedit/build-button.png renamed to chef-server-webui/public/images/jsonedit/build-button.png

File renamed without changes.
File renamed without changes.

chef-server-slice/public/images/jsonedit/bullet_orange.png renamed to chef-server-webui/public/images/jsonedit/bullet_orange.png

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)