foreman_export_hosts 0.0.1.1 → 0.0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/foreman_hosts/syhostmodeldetails_controller.rb +83 -0
- data/app/controllers/foreman_hosts/syhostmodels_controller.rb +84 -0
- data/app/models/foreman_hosts/syhostmodel.rb +8 -0
- data/app/models/foreman_hosts/syhostmodeldetail.rb +5 -0
- data/app/views/foreman_hosts/syhostmodels/_form.html.erb +30 -0
- data/app/views/foreman_hosts/syhostmodels/_list.html.erb +41 -0
- data/app/{assets/javascripts/jquery.battatech.excelexport.js → views/foreman_hosts/syhostmodels/_report.html.erb} +79 -1
- data/app/views/foreman_hosts/syhostmodels/_sub.html.erb +37 -0
- data/app/views/foreman_hosts/syhostmodels/edit.html.erb +1 -0
- data/app/views/foreman_hosts/syhostmodels/index.html.erb +5 -0
- data/app/views/foreman_hosts/syhostmodels/new.html.erb +1 -0
- data/app/views/foreman_hosts/syhostmodels/show.html.erb +72 -0
- data/config/routes.rb +2 -1
- data/db/migrate/20151015022411_create_syhostmodels.rb +10 -0
- data/db/migrate/20151015050239_create_syhostmodeldetails.rb +13 -0
- data/lib/foreman_hosts/engine.rb +8 -5
- data/lib/foreman_hosts/version.rb +1 -1
- metadata +15 -3
- data/app/assets/javascripts/application.js +0 -2
@@ -0,0 +1,83 @@
|
|
1
|
+
class ForemanHosts::SyhostmodeldetailsController < ApplicationController
|
2
|
+
# GET /syhostmodeldetails
|
3
|
+
# GET /syhostmodeldetails.json
|
4
|
+
def index
|
5
|
+
@syhostmodeldetails = ForemanHosts::Syhostmodeldetail.all.paginate(:page => params[:page])
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render json: @syhostmodeldetails }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /syhostmodeldetails/1
|
14
|
+
# GET /syhostmodeldetails/1.json
|
15
|
+
def show
|
16
|
+
@syhostmodeldetail = ForemanHosts::Syhostmodeldetail.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render json: @syhostmodeldetail }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /syhostmodeldetails/new
|
25
|
+
# GET /syhostmodeldetails/new.json
|
26
|
+
def new
|
27
|
+
@syhostmodeldetail = ForemanHosts::Syhostmodeldetail.new
|
28
|
+
respond_to do |format|
|
29
|
+
format.html # new.html.erb
|
30
|
+
format.json { render json: @syhostmodeldetail }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# GET /syhostmodeldetails/1/edit
|
35
|
+
def edit
|
36
|
+
@syhostmodeldetail = ForemanHosts::Syhostmodeldetail.find(params[:id])
|
37
|
+
end
|
38
|
+
|
39
|
+
# POST /syhostmodeldetails
|
40
|
+
# POST /syhostmodeldetails.json
|
41
|
+
def create
|
42
|
+
@syhostmodeldetail = ForemanHosts::Syhostmodeldetail.new(params[:foreman_hosts_syhostmodeldetail])
|
43
|
+
|
44
|
+
respond_to do |format|
|
45
|
+
if @syhostmodeldetail.save
|
46
|
+
format.html { redirect_to @syhostmodeldetail, notice: 'syhostmodeldetail was successfully created.' }
|
47
|
+
format.json { render json: @syhostmodeldetail, status: :created, location: @syhostmodeldetail }
|
48
|
+
else
|
49
|
+
format.html { render action: "new" }
|
50
|
+
format.json { render json: @syhostmodeldetail.errors, status: :unprocessable_entity }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# PUT /syhostmodeldetails/1
|
56
|
+
# PUT /syhostmodeldetails/1.json
|
57
|
+
def update
|
58
|
+
@syhostmodeldetail = ForemanHosts::Syhostmodeldetail.find(params[:id])
|
59
|
+
|
60
|
+
respond_to do |format|
|
61
|
+
if @syhostmodeldetail.update_attributes(params[:foreman_hosts_syhostmodeldetail])
|
62
|
+
format.html { redirect_to @syhostmodeldetail, notice: 'syhostmodeldetail was successfully updated.' }
|
63
|
+
format.json { head :no_content }
|
64
|
+
else
|
65
|
+
format.html { render action: "edit" }
|
66
|
+
format.json { render json: @syhostmodeldetail.errors, status: :unprocessable_entity }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# DELETE /syhostmodeldetails/1
|
72
|
+
# DELETE /syhostmodeldetails/1.json
|
73
|
+
def destroy
|
74
|
+
@syhostmodeldetail = ForemanHosts::Syhostmodeldetail.find(params[:id])
|
75
|
+
@syhostmodeldetail.destroy
|
76
|
+
respond_to do |format|
|
77
|
+
format.html { redirect_to foreman_hosts_syhostmodeldetails_url }
|
78
|
+
format.json { head :no_content }
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class ForemanHosts::SyhostmodelsController < ApplicationController
|
2
|
+
# GET /syhostmodels
|
3
|
+
# GET /syhostmodels.json
|
4
|
+
def index
|
5
|
+
@syhostmodels = ForemanHosts::Syhostmodel.all.paginate(:page => params[:page])
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render json: @syhostmodels }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /syhostmodels/1
|
14
|
+
# GET /syhostmodels/1.json
|
15
|
+
def show
|
16
|
+
@syhostmodel = ForemanHosts::Syhostmodel.find(params[:id])
|
17
|
+
# @syhosts = Host.all
|
18
|
+
# @syfactvalues = FactValue.all
|
19
|
+
respond_to do |format|
|
20
|
+
format.html # show.html.erb
|
21
|
+
format.json { render json: @syhostmodel }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# GET /syhostmodels/new
|
26
|
+
# GET /syhostmodels/new.json
|
27
|
+
def new
|
28
|
+
@syhostmodel = ForemanHosts::Syhostmodel.new
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render json: @syhostmodel }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /syhostmodels/1/edit
|
36
|
+
def edit
|
37
|
+
@syhostmodel = ForemanHosts::Syhostmodel.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /syhostmodels
|
41
|
+
# POST /syhostmodels.json
|
42
|
+
def create
|
43
|
+
@syhostmodel = ForemanHosts::Syhostmodel.new(params[:foreman_hosts_syhostmodel])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @syhostmodel.save
|
47
|
+
format.html { redirect_to @syhostmodel, notice: 'syhostmodel was successfully created.' }
|
48
|
+
format.json { render json: @syhostmodel, status: :created, location: @syhostmodel }
|
49
|
+
else
|
50
|
+
format.html { render action: "new" }
|
51
|
+
format.json { render json: @syhostmodel.errors, status: :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /syhostmodels/1
|
57
|
+
# PUT /syhostmodels/1.json
|
58
|
+
def update
|
59
|
+
@syhostmodel = ForemanHosts::Syhostmodel.find(params[:id])
|
60
|
+
|
61
|
+
respond_to do |format|
|
62
|
+
if @syhostmodel.update_attributes(params[:foreman_hosts_syhostmodel])
|
63
|
+
format.html { redirect_to @syhostmodel, notice: 'syhostmodel was successfully updated.' }
|
64
|
+
format.json { head :no_content }
|
65
|
+
else
|
66
|
+
format.html { render action: "edit" }
|
67
|
+
format.json { render json: @syhostmodel.errors, status: :unprocessable_entity }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# DELETE /syhostmodels/1
|
73
|
+
# DELETE /syhostmodels/1.json
|
74
|
+
def destroy
|
75
|
+
@syhostmodel = ForemanHosts::Syhostmodel.find(params[:id])
|
76
|
+
@syhostmodel.destroy
|
77
|
+
respond_to do |format|
|
78
|
+
format.html { redirect_to foreman_hosts_syhostmodels_url }
|
79
|
+
format.json { head :no_content }
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class ForemanHosts::Syhostmodel < ActiveRecord::Base
|
2
|
+
|
3
|
+
attr_accessible :name, :remark, :syhostmodeldetails_attributes
|
4
|
+
has_many :syhostmodeldetails, class_name: "ForemanHosts::Syhostmodeldetail"
|
5
|
+
accepts_nested_attributes_for :syhostmodeldetails, reject_if: proc { |attributes| attributes['no'].blank?| attributes['status'].blank? | attributes['fact_name_id'].blank? } , allow_destroy: true
|
6
|
+
|
7
|
+
|
8
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
class ForemanHosts::Syhostmodeldetail < ActiveRecord::Base
|
2
|
+
attr_accessible :no, :status, :fact_name_id, :syhostmodel_id, :syhostmodel_type
|
3
|
+
belongs_to :foreman_hosts_syhostmodel, class_name: "ForemanHosts::Syhostmodel",foreign_key: "syhostmodel_id"
|
4
|
+
#belongs_to :fact_name, class_name: "FactName", foreign_key: "fact_name_id"
|
5
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<%= javascript 'syhostmodels', 'syhostmodel_edit', 'syhostmodel_edit_interfaces', 'class_edit', 'compute_resource', 'lookup_keys'%>
|
2
|
+
|
3
|
+
<%= nested_form_for @syhostmodel, :html => {:data => {:id => @syhostmodel.try(:id), :submit => 'progress_bar'}} do |f| %>
|
4
|
+
<%= base_errors_for @syhostmodel %>
|
5
|
+
<div class="row clearfix">
|
6
|
+
<div class="row">
|
7
|
+
<div class="form-group col-md-12">
|
8
|
+
<label>name</label>
|
9
|
+
<%= f.text_field :name, :size => "col-md-12", placeholder: "填写name", class: "form-control" %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
<div class="row">
|
13
|
+
<div class="form-group col-md-12">
|
14
|
+
<label>remark</label>
|
15
|
+
<%= f.text_field :remark, :size => "col-md-12", placeholder: "填写remark", class: "form-control" %>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<div class="row">
|
19
|
+
<div class="col-md-12 column">
|
20
|
+
<%#= render partial: "foreman_hosts/syhostmodels/sub", locals: { f: f, object: @syhostmodel } %>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
<div class="row">
|
24
|
+
<div class="actions">
|
25
|
+
<%= f.submit "提交", class: "btn btn-success" %>
|
26
|
+
<%= link_to '返回', foreman_hosts_syhostmodels_path, class: "btn btn-primary" %>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<%= javascript "jquery.cookie" %>
|
2
|
+
<% title header ||= "" %>
|
3
|
+
<table class="table table-bordered table-striped table-condensed" >
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th class=''>name</th>
|
7
|
+
<th class="hidden-xs">remark</th>
|
8
|
+
<th>操作</th>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<% syhostmodels.each do |syhostmodel| %>
|
13
|
+
<tr>
|
14
|
+
<td class=''><%= syhostmodel.name %></td>
|
15
|
+
<td class="hidden-xs"><%= syhostmodel.remark %></td>
|
16
|
+
<td>
|
17
|
+
<%= link_to '查看', syhostmodel %>
|
18
|
+
<%= link_to '编辑', edit_foreman_hosts_syhostmodel_path(syhostmodel) %>
|
19
|
+
<%= link_to '删除', syhostmodel, method: :delete, data: { confirm: 'Are you sure?' } %>
|
20
|
+
</td>
|
21
|
+
</tr>
|
22
|
+
<% end %>
|
23
|
+
</tbody>
|
24
|
+
</table>
|
25
|
+
<div id="confirmation-modal" class="modal fade">
|
26
|
+
<div class="modal-dialog">
|
27
|
+
<div class="modal-content">
|
28
|
+
<div class="modal-header">
|
29
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
30
|
+
<h4 class="modal-title"><%= _('Please Confirm') %></h4>
|
31
|
+
</div>
|
32
|
+
<div class="modal-body">
|
33
|
+
</div>
|
34
|
+
<div class="modal-footer">
|
35
|
+
<button type="button" class="btn btn-default" data-dismiss="modal"><%= _('Cancel') %></button>
|
36
|
+
<button type="button" class="btn btn-primary" onclick="submit_modal_form()"><%= _('Submit') %></button>
|
37
|
+
</div>
|
38
|
+
</div><!-- /.modal-content -->
|
39
|
+
</div><!-- /.modal-dialog -->
|
40
|
+
</div><!-- /.modal -->
|
41
|
+
<%= will_paginate_with_info syhostmodels, :more => " - "+_("<b class='select_count'>0</b> selected") %>
|
@@ -1,4 +1,80 @@
|
|
1
|
-
|
1
|
+
<div class="four wide right column">
|
2
|
+
<button class='btn btn-info' type='button'><a href="javascript:void(0);" class="ui green button icon mini" id="btnExport" onclick="export_excel();">Export</a></button>
|
3
|
+
|
4
|
+
</div>
|
5
|
+
<%= javascript "jquery.cookie", "host_checkbox" %>
|
6
|
+
<% title header ||= "" %>
|
7
|
+
|
8
|
+
<table class="table table-bordered table-striped table-condensed" id="tblExport">
|
9
|
+
<thead>
|
10
|
+
<tr>
|
11
|
+
<th class=''><%= sort :name, :as => _('Name') %></th>
|
12
|
+
<% detail_name_no1 = 1 %>
|
13
|
+
<% details.each do |detail| %>
|
14
|
+
|
15
|
+
<th id="td<%= detail_name_no1 %>"><%#= detail.fact_name.name %>
|
16
|
+
<br />
|
17
|
+
<button type='button'><a href="javascript:void(0);" onclick="DeleteSignColumn(<%= detail_name_no1 %>);"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></button></th>
|
18
|
+
<% detail_name_no1 += 1 %>
|
19
|
+
<% end %>
|
20
|
+
</tr>
|
21
|
+
</thead>
|
22
|
+
<tbody>
|
23
|
+
<% #Host.all.each do |host| %>
|
24
|
+
<tr>
|
25
|
+
<td class='ellipsis'><%#= name_column(host) %></td>
|
26
|
+
|
27
|
+
<!-- <% #details.each do |detail| %> -->
|
28
|
+
<td>
|
29
|
+
<%#= FactValue.where(host_id: host.id, fact_name_id: detail.fact_name_id).last.value rescue nil%>
|
30
|
+
|
31
|
+
|
32
|
+
<%#= get_detail_value(host, detail_name) %>
|
33
|
+
</td>
|
34
|
+
<%# end %>
|
35
|
+
|
36
|
+
</tr>
|
37
|
+
<% end %>
|
38
|
+
</tbody>
|
39
|
+
</table>
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
<script type="text/javascript">
|
47
|
+
function export_excel(){
|
48
|
+
var uri = $("#tblExport").battatech_excelexport({
|
49
|
+
containerid: "tblExport",
|
50
|
+
datatype: 'table',
|
51
|
+
returnUri: true
|
52
|
+
});
|
53
|
+
$("#btnExport").attr('download', 'hosts.xlsx').attr('href', uri).attr('target', '_blank');
|
54
|
+
}
|
55
|
+
|
56
|
+
function DeleteSignColumn(tid) {
|
57
|
+
var tab = document.getElementById("tblExport");
|
58
|
+
var columnLength = tab.rows[0].cells.length;
|
59
|
+
var tr1 = tab.rows[0];
|
60
|
+
var columnId = 0;
|
61
|
+
tid= "td" + tid
|
62
|
+
for(var j=0;j<tr1.cells.length;j++)//取得第几行下面的td个数,再次循环遍历该行下面的td元素
|
63
|
+
{
|
64
|
+
var cell = tr1.cells[j];//获取某行下面的某个td元素
|
65
|
+
if (cell.id == tid) {
|
66
|
+
columnId = columnId + j;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
//删除指定单元格
|
70
|
+
if (columnId > 0){
|
71
|
+
for (var i = 0; i < tab.rows.length; i++) {
|
72
|
+
tab.rows[i].deleteCell(columnId);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
}
|
77
|
+
/*
|
2
78
|
* jQuery Client Side Excel Export Plugin Library
|
3
79
|
* http://www.battatech.com/
|
4
80
|
*
|
@@ -178,3 +254,5 @@
|
|
178
254
|
}
|
179
255
|
};
|
180
256
|
})(jQuery);
|
257
|
+
|
258
|
+
</script>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<div id="syhostmodeldetails">
|
2
|
+
<%= f.fields_for :syhostmodeldetails do |f| %>
|
3
|
+
<div class="row">
|
4
|
+
<div class="col-md-3 column form-group">
|
5
|
+
<label>no</label>
|
6
|
+
<%= f.text_field :no, class: "form_datetime form-control" %>
|
7
|
+
</div>
|
8
|
+
<div class="col-md-3 column form-group">
|
9
|
+
<label>status</label>
|
10
|
+
<%= f.select :status, [['please select', nil],"true", "false"], placeholder: "status", control_label: 'status', class: "col-md-3 column form-control"%>
|
11
|
+
<%#= f.text_field :status, class: "form_datetime form-control" %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="col-md-3 column form-group">
|
15
|
+
<label>fact_name_id</label><br />
|
16
|
+
<%#= f.select :fact_name_id, FactName.all.collect { |p| [ p.name, p.id ] }, include_blank: true , class: "col-md-3 column form-control"%>
|
17
|
+
|
18
|
+
<%#= f.text_field :fact_name_id, class: "form_datetime form-control" %>
|
19
|
+
</div>
|
20
|
+
<div class="col-md-1 column form-group">
|
21
|
+
<label>delete</label>
|
22
|
+
<%= f.link_to_remove "删除", class: "btn btn-danger" %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<%= f.hidden_field :syhostmodel_id, value: object.id %>
|
26
|
+
<%= f.hidden_field :syhostmodel_type, value: object.class.to_s %>
|
27
|
+
<% end %>
|
28
|
+
</div>
|
29
|
+
<div class="row">
|
30
|
+
<div class="col-md-9 column form-group">
|
31
|
+
|
32
|
+
</div>
|
33
|
+
<div class="col-md-1 column form-group">
|
34
|
+
<label></label>
|
35
|
+
<%= f.link_to_add "新增", :syhostmodeldetails, :data => { :target => "#syhostmodeldetails" }, class: "btn btn-primary" %>
|
36
|
+
</div>
|
37
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,72 @@
|
|
1
|
+
|
2
|
+
<div class="container">
|
3
|
+
<div class="row">
|
4
|
+
<h1 class="clearfix">
|
5
|
+
<%= link_to '返回', foreman_hosts_syhostmodels_path, class: "btn btn-primary pull-right mr1" %>
|
6
|
+
<%= link_to '编辑', edit_foreman_hosts_syhostmodel_path(@syhostmodel), class: "btn btn-warning pull-right mr1" %>
|
7
|
+
</h1>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="row col-md-12">
|
11
|
+
<table class="table table-striped table-bordered">
|
12
|
+
<thead></thead>
|
13
|
+
<tbody>
|
14
|
+
<tr>
|
15
|
+
<td><strong>name</strong></td>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<td><%= @syhostmodel.name %></td>
|
19
|
+
</tr>
|
20
|
+
|
21
|
+
<tr>
|
22
|
+
<td><strong>remark</strong></td>
|
23
|
+
</tr>
|
24
|
+
<tr>
|
25
|
+
<td><%= @syhostmodel.remark %></td>
|
26
|
+
</tr>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="row col-md-12">
|
32
|
+
<ul class="nav nav-tabs mb1">
|
33
|
+
<li class="active"><a href="#models" data-toggle="tab">Detail</a></li>
|
34
|
+
<li><a href="#previews" data-toggle="tab">Preview</a></li>
|
35
|
+
</ul>
|
36
|
+
|
37
|
+
<div class="tab-content">
|
38
|
+
<div class="tab-pane active" id="models">
|
39
|
+
<div id="models">
|
40
|
+
|
41
|
+
<div class="panel-body">
|
42
|
+
<table class="table table-striped table-bordered models">
|
43
|
+
<thead>
|
44
|
+
<th>no</th>
|
45
|
+
<th>status</th>
|
46
|
+
<th>fact_name</th>
|
47
|
+
</thead>
|
48
|
+
<tbody>
|
49
|
+
<% @syhostmodel.syhostmodeldetails.order("no Asc").each do |syhostmodeldetail|%>
|
50
|
+
<tr class="success">
|
51
|
+
<td><%= syhostmodeldetail.no %></td>
|
52
|
+
<td><%= syhostmodeldetail.status %></td>
|
53
|
+
<td><%#= syhostmodeldetail.fact_name.name rescue nil %></td>
|
54
|
+
</tr>
|
55
|
+
<% end %>
|
56
|
+
</tbody>
|
57
|
+
</table>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
<div class="tab-pane" id="previews">
|
64
|
+
<div id="previews">
|
65
|
+
<div class="panel-body">
|
66
|
+
<%#= render partial: "foreman_hosts/syhostmodels/report", locals: { details: @syhostmodel.syhostmodeldetails} %>
|
67
|
+
</div>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
</div>
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateSyhostmodeldetails < ActiveRecord::Migration
|
2
|
+
drop tables syhostmodeldetails if table_exists? :syhostmodeldetails
|
3
|
+
def change
|
4
|
+
create_table :syhostmodeldetails do |t|
|
5
|
+
t.integer :syhostmodel_id
|
6
|
+
t.string :syhostmodel_type
|
7
|
+
t.string :no
|
8
|
+
t.integer :fact_name_id
|
9
|
+
t.boolean :status
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/foreman_hosts/engine.rb
CHANGED
@@ -11,7 +11,7 @@ module ForemanHosts
|
|
11
11
|
|
12
12
|
# Add any db migrations
|
13
13
|
initializer 'foreman_hosts.load_app_instance_data' do |app|
|
14
|
-
|
14
|
+
app.config.paths['db/migrate'] += ForemanHosts::Engine.paths['db/migrate'].existent
|
15
15
|
end
|
16
16
|
|
17
17
|
initializer 'foreman_hosts.register_plugin', after: :finisher_hook do |_app|
|
@@ -22,17 +22,20 @@ module ForemanHosts
|
|
22
22
|
security_block :foreman_hosts do
|
23
23
|
permission :view_foreman_hosts, :'foreman_hosts/hosts' => [:report_index]
|
24
24
|
|
25
|
-
|
25
|
+
permission :view_foreman_syhostmodels, :'foreman_hosts/syhostmodels' => [:index, :show, :auto_complete_search]
|
26
|
+
permission :new_foreman_syhostmodels, :'foreman_hosts/syhostmodels' => [:new, :create]
|
27
|
+
permission :edit_foreman_syhostmodels, :'foreman_hosts/syhostmodels' => [:edit, :update]
|
28
|
+
permission :delete_foreman_syhostmodels, :'foreman_hosts/syhostmodels' => [:destroy]
|
26
29
|
end
|
27
30
|
|
28
31
|
# Add a new role called 'Discovery' if it doesn't exist
|
29
|
-
role 'ForemanHosts', [:view_foreman_hosts
|
32
|
+
role 'ForemanHosts', [:view_foreman_hosts, :view_foreman_syhostmodels, :new_foreman_syhostmodels, :edit_foreman_syhostmodels, :delete_foreman_syhostmodels]
|
30
33
|
|
31
34
|
# add menu entry
|
32
35
|
|
33
36
|
sub_menu :top_menu, :export_menu, :caption=> N_('Export'), :after=> :infrastructure_menu do
|
34
|
-
|
35
|
-
menu :top_menu, :
|
37
|
+
menu :top_menu, :level1, :caption=>N_('ExportTemplates'), :url_hash => { :controller => 'foreman_hosts/syhostmodels', :action => :index }
|
38
|
+
menu :top_menu, :level2, :caption=>N_('ExportHosts'), :url_hash => { :controller => 'foreman_hosts/hosts', :action => :report_index }
|
36
39
|
end
|
37
40
|
# menu :top_menu, :template,
|
38
41
|
# url_hash: { controller: :'foreman_hosts/hosts', action: :new_action },
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_export_hosts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -85,17 +85,29 @@ files:
|
|
85
85
|
- app/views/dashboard/_foreman_hosts_widget.html.erb
|
86
86
|
- app/views/foreman_hosts/layouts/layouts/new_layout.html.erb
|
87
87
|
- app/views/foreman_hosts/layouts/new_layout.html.erb
|
88
|
+
- app/views/foreman_hosts/syhostmodels/edit.html.erb
|
89
|
+
- app/views/foreman_hosts/syhostmodels/new.html.erb
|
90
|
+
- app/views/foreman_hosts/syhostmodels/_report.html.erb
|
91
|
+
- app/views/foreman_hosts/syhostmodels/show.html.erb
|
92
|
+
- app/views/foreman_hosts/syhostmodels/index.html.erb
|
93
|
+
- app/views/foreman_hosts/syhostmodels/_list.html.erb
|
94
|
+
- app/views/foreman_hosts/syhostmodels/_form.html.erb
|
95
|
+
- app/views/foreman_hosts/syhostmodels/_sub.html.erb
|
88
96
|
- app/views/foreman_hosts/hosts/export.xlsx.axlsx
|
89
97
|
- app/views/foreman_hosts/hosts/report_index.html.erb
|
90
98
|
- app/views/foreman_hosts/hosts/hosts/new_action.html.erb
|
91
|
-
- app/assets/javascripts/jquery.battatech.excelexport.js
|
92
|
-
- app/assets/javascripts/application.js
|
93
99
|
- app/overrides/dashboard/index/sample_override.html.erb.deface
|
100
|
+
- app/controllers/foreman_hosts/syhostmodeldetails_controller.rb
|
101
|
+
- app/controllers/foreman_hosts/syhostmodels_controller.rb
|
94
102
|
- app/controllers/foreman_hosts/hosts_controller.rb
|
95
103
|
- app/helpers/concerns/foreman_hosts/hosts_helper_extensions.rb
|
96
104
|
- app/models/concerns/foreman_hosts/hosts_extensions.rb
|
105
|
+
- app/models/foreman_hosts/syhostmodeldetail.rb
|
106
|
+
- app/models/foreman_hosts/syhostmodel.rb
|
97
107
|
- bin/foreman-hosts
|
98
108
|
- config/routes.rb
|
109
|
+
- db/migrate/20151015022411_create_syhostmodels.rb
|
110
|
+
- db/migrate/20151015050239_create_syhostmodeldetails.rb
|
99
111
|
- lib/tasks/foreman_hosts_tasks.rake
|
100
112
|
- lib/foreman_hosts.rb
|
101
113
|
- lib/foreman_hosts/version.rb
|