bacuview 1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +2 -0
- data/ChangeLog +454 -0
- data/README.bacuview +7 -0
- data/README.rails +153 -0
- data/Rakefile +94 -0
- data/app/controllers/application.rb +11 -0
- data/app/controllers/client_controller.rb +27 -0
- data/app/controllers/job_controller.rb +100 -0
- data/app/controllers/jobmedia_controller.rb +2 -0
- data/app/controllers/media_controller.rb +44 -0
- data/app/controllers/misc_controller.rb +14 -0
- data/app/controllers/pool_controller.rb +38 -0
- data/app/helpers/application_helper.rb +88 -0
- data/app/helpers/client_finder.rb +112 -0
- data/app/helpers/client_helper.rb +45 -0
- data/app/helpers/job_helper.rb +56 -0
- data/app/helpers/jobmedia_helper.rb +2 -0
- data/app/helpers/media_helper.rb +14 -0
- data/app/helpers/misc_helper.rb +15 -0
- data/app/helpers/pool_helper.rb +2 -0
- data/app/models/client.rb +14 -0
- data/app/models/job.rb +21 -0
- data/app/models/jobmedia.rb +9 -0
- data/app/models/media.rb +23 -0
- data/app/models/pool.rb +13 -0
- data/app/views/client/_spec.rhtml +1 -0
- data/app/views/client/check.rhtml +1 -0
- data/app/views/client/index.rhtml +27 -0
- data/app/views/client/show.rhtml +8 -0
- data/app/views/job/_spec.rhtml +7 -0
- data/app/views/job/index.rhtml +38 -0
- data/app/views/job/last.rhtml +52 -0
- data/app/views/job/show.rhtml +19 -0
- data/app/views/job/spec.rhtml +38 -0
- data/app/views/layouts/bacuview-layout.rhtml +50 -0
- data/app/views/media/_spec.rhtml +1 -0
- data/app/views/media/index.rhtml +30 -0
- data/app/views/media/show.rhtml +8 -0
- data/app/views/misc/about.rhtml +2 -0
- data/app/views/misc/help.rhtml +1 -0
- data/app/views/pool/_spec.rhtml +1 -0
- data/app/views/pool/index.rhtml +29 -0
- data/app/views/pool/show.rhtml +8 -0
- data/bin/bacuview +3 -0
- data/config/bacuview.yml.template +2 -0
- data/config/boot.rb +19 -0
- data/config/database.yml.template +13 -0
- data/config/environment.rb +87 -0
- data/config/environments/development.rb +19 -0
- data/config/environments/production.rb +19 -0
- data/config/environments/test.rb +19 -0
- data/config/routes.rb +61 -0
- data/log/development.log +0 -0
- data/log/production.log +0 -0
- data/log/test.log +0 -0
- data/public/404.html +8 -0
- data/public/500.html +8 -0
- data/public/bacu-bat.png +0 -0
- data/public/bacuweb.css +7 -0
- data/public/client-sophie-thumb.png +0 -0
- data/public/client-sophie.png +0 -0
- data/public/clients-thumb.png +0 -0
- data/public/clients.png +0 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/home.html +108 -0
- data/public/images/bacu-bat.png +0 -0
- data/public/images/busy.png +0 -0
- data/public/images/dunno.png +0 -0
- data/public/images/error.png +0 -0
- data/public/images/okay.png +0 -0
- data/public/images/pool_pie.png +0 -0
- data/public/install.html +156 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/client_check.js +24 -0
- data/public/javascripts/controls.js +815 -0
- data/public/javascripts/dragdrop.js +724 -0
- data/public/javascripts/effects.js +953 -0
- data/public/javascripts/prototype.js +1985 -0
- data/public/job-1449-thumb.png +0 -0
- data/public/job-1449.png +0 -0
- data/public/job-last-thumb.png +0 -0
- data/public/job-last.png +0 -0
- data/public/jobs-thumb.png +0 -0
- data/public/jobs.png +0 -0
- data/public/media-39-thumb.png +0 -0
- data/public/media-39.png +0 -0
- data/public/media-thumb.png +0 -0
- data/public/media.png +0 -0
- data/public/news.html +144 -0
- data/public/pool-lto3-thumb.png +0 -0
- data/public/pool-lto3.png +0 -0
- data/public/pools-thumb.png +0 -0
- data/public/pools.png +0 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/bacuview.css +37 -0
- data/script/about +3 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/plugin +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/process/spinner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- metadata +168 -0
data/AUTHORS
ADDED
data/ChangeLog
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
Wed, 2006 Nov 01, 15:24
|
|
2
|
+
|
|
3
|
+
* Added a job/last page, which shows the last successful full,
|
|
4
|
+
differential, and incremental run of a job, with a count of the
|
|
5
|
+
files and amount of data backed up. This provides a way for
|
|
6
|
+
people to get a quick status check on the backups of their
|
|
7
|
+
workstations.
|
|
8
|
+
|
|
9
|
+
Thu, 2006 Aug 31, 14:25
|
|
10
|
+
|
|
11
|
+
* Modify the gruff support code to handle a failure to "require
|
|
12
|
+
gruff", and move the pie chart generation to its own action to
|
|
13
|
+
eliminate the need for a temporary file to hold the generated
|
|
14
|
+
pie chart images.
|
|
15
|
+
|
|
16
|
+
Wed, 2006 Aug 30, 16:29
|
|
17
|
+
|
|
18
|
+
* Added a bar graph to the Pool view, showing how the media are
|
|
19
|
+
distributed among pools.
|
|
20
|
+
|
|
21
|
+
Wed, 2006 Aug 23, 17:15
|
|
22
|
+
|
|
23
|
+
* Got the column sorting feature working even when using
|
|
24
|
+
My-not-quite-SQL.
|
|
25
|
+
|
|
26
|
+
Fri, 2006 Aug 04, 13:54
|
|
27
|
+
|
|
28
|
+
* Added a two-column sort feature, and trimmed a few marginally
|
|
29
|
+
useful columns from the index.rhtml pages.
|
|
30
|
+
|
|
31
|
+
Wed, 2006 Aug 02, 09:48
|
|
32
|
+
|
|
33
|
+
* Take a guess at how many autochangers are in use, and adjust the
|
|
34
|
+
display of the "slot" column accordingly.
|
|
35
|
+
|
|
36
|
+
Mon, 2006 Jul 31, 15:39
|
|
37
|
+
|
|
38
|
+
* Eliminated the "rev" URL parameter, and tacked this information
|
|
39
|
+
on the end of the sort parameter instead.
|
|
40
|
+
|
|
41
|
+
Sun, 2006 May 14, 12:32
|
|
42
|
+
|
|
43
|
+
* Scaled the size of the client status images to 1 em square, and
|
|
44
|
+
center them.
|
|
45
|
+
|
|
46
|
+
Sat, 2006 Apr 15, 10:37
|
|
47
|
+
|
|
48
|
+
* Add a misc controller, currently supporting a fairly skeletal
|
|
49
|
+
help and about page.
|
|
50
|
+
|
|
51
|
+
Sat, 2006 Apr 15, 10:04
|
|
52
|
+
|
|
53
|
+
* Added a rake clean target, and a TODAY configuration variable,
|
|
54
|
+
for test purposes.
|
|
55
|
+
|
|
56
|
+
Fri, 2006 Apr 14, 15:11
|
|
57
|
+
|
|
58
|
+
* Added the Bacuview web site to the Bacuview application
|
|
59
|
+
Subversion repository, deleted the doc/NEWS and doc/INSTALL
|
|
60
|
+
files in preference to the HTML versions, and changed the
|
|
61
|
+
installation instructions to recommend a released tar file
|
|
62
|
+
rather than a direct subversion checkout.
|
|
63
|
+
|
|
64
|
+
Tue, 2006 Apr 11, 14:16
|
|
65
|
+
|
|
66
|
+
* Changed the left nav bar to select jobs rather than clients;
|
|
67
|
+
also dropped the anomalous jobs option, and leave job table
|
|
68
|
+
capitalization alone.
|
|
69
|
+
|
|
70
|
+
Sat, 2006 Mar 18, 08:36
|
|
71
|
+
|
|
72
|
+
* Released version 1.3.
|
|
73
|
+
|
|
74
|
+
* Fix "rake dist" to simply pull from svn, clean up, and generate
|
|
75
|
+
a tar file from there.
|
|
76
|
+
|
|
77
|
+
Fri, 2006 Mar 10, 11:38
|
|
78
|
+
|
|
79
|
+
* Rename custom.yml file to bacuview.yml, and simplify the format.
|
|
80
|
+
|
|
81
|
+
Mon, 2006 Mar 06, 07:18
|
|
82
|
+
|
|
83
|
+
* Add initial MySQL support: In environment.rb set STUDLY if using
|
|
84
|
+
MySQL; In the models, add an if STUDLY section that redefines
|
|
85
|
+
the table names and overrides the column accessors; in several
|
|
86
|
+
views, use column accessor methods instead of instance
|
|
87
|
+
variables.
|
|
88
|
+
|
|
89
|
+
Sat, 2006 Mar 04, 08:06
|
|
90
|
+
|
|
91
|
+
* In job_helper, split level_name out into a seperate function to
|
|
92
|
+
resolve a conflict: 'D' => 'Admin' or 'Diff'
|
|
93
|
+
|
|
94
|
+
Thu, 2006 Mar 02, 15:28
|
|
95
|
+
|
|
96
|
+
* Added an "In Changer" column to the Media view. Rails makes
|
|
97
|
+
this type of change so easy it's almost embarrassing. Almost.
|
|
98
|
+
|
|
99
|
+
* Added code to extract an OS_LIST from a query of client uname
|
|
100
|
+
strings.
|
|
101
|
+
|
|
102
|
+
Mon, 2006 Feb 27, 18:12
|
|
103
|
+
|
|
104
|
+
* Released version 1.2.
|
|
105
|
+
|
|
106
|
+
* Fix a couple of problems with sorting by retention period in the
|
|
107
|
+
media controller.
|
|
108
|
+
|
|
109
|
+
* Add rescue blocks around the config file ingest routines. Also
|
|
110
|
+
show how many files and client/hostname mappings were found when
|
|
111
|
+
starting the application server.
|
|
112
|
+
|
|
113
|
+
Sun, 2006 Feb 26, 18:40
|
|
114
|
+
|
|
115
|
+
* Fix calculation of media expiration time.
|
|
116
|
+
|
|
117
|
+
Sun, 2006 Feb 26, 13:50
|
|
118
|
+
|
|
119
|
+
* Load customization parameters from a config/custom.yml at server
|
|
120
|
+
startup time. Initially this is used to get the path and glob
|
|
121
|
+
to the bacula configuration files so that the client to hostname
|
|
122
|
+
mapping can be extracted.
|
|
123
|
+
|
|
124
|
+
Sat, 2006 Feb 25, 12:59
|
|
125
|
+
|
|
126
|
+
* Added media expiration and retention columns to the media view.
|
|
127
|
+
Discovered what looks like two bugs in the process: Time <=>
|
|
128
|
+
Fixnum doesn't work as specified in Ruby, and there seems to be
|
|
129
|
+
a problem with using ORDER BY in conjunction with a JOIN in
|
|
130
|
+
Rails.
|
|
131
|
+
|
|
132
|
+
Mon, 2006 Feb 20, 11:00
|
|
133
|
+
|
|
134
|
+
* Eliminated a few more uses of 'style=' attributes in favor of
|
|
135
|
+
'class=' attributes with the corresponding CSS class
|
|
136
|
+
definitions. Added an HTML 4.01 Transitional DOCTYPE to the
|
|
137
|
+
standard layout.
|
|
138
|
+
|
|
139
|
+
Sat, 2006 Feb 18, 11:14
|
|
140
|
+
|
|
141
|
+
* Add "session :disabled => true" to controllers/application.rb to
|
|
142
|
+
avoid setting cookies so as to not upset the powers that be.
|
|
143
|
+
|
|
144
|
+
Wed, 2006 Feb 15, 19:38
|
|
145
|
+
|
|
146
|
+
* Started work on a Job Specification page, an option-laden
|
|
147
|
+
hodge-podge of job specification options.
|
|
148
|
+
|
|
149
|
+
Wed, 2006 Feb 15, 10:42
|
|
150
|
+
|
|
151
|
+
* Released version 1.1, corresponding to Subversion revision 19.
|
|
152
|
+
|
|
153
|
+
Fri, 2006 Feb 10, 18:57
|
|
154
|
+
|
|
155
|
+
* Added a nowrap style to the client, media, and pool index
|
|
156
|
+
tables, and colorized the media volume status fields.
|
|
157
|
+
|
|
158
|
+
Thu, 2006 Feb 09, 14:53
|
|
159
|
+
|
|
160
|
+
* Added a paragraph to the end of the client view noting that a
|
|
161
|
+
file daemon status check can be performed by enabling
|
|
162
|
+
Javascript, and a Javascript mechanism to hide this note if
|
|
163
|
+
Javascript is already enabled.
|
|
164
|
+
|
|
165
|
+
Wed, 2006 Feb 08, 18:13
|
|
166
|
+
|
|
167
|
+
* Got the server side client checking working. Some cleanup is
|
|
168
|
+
still required, but it all works.
|
|
169
|
+
|
|
170
|
+
Mon, 2006 Feb 06, 18:19
|
|
171
|
+
|
|
172
|
+
* Added the AJAX support required to provide an on-demand client
|
|
173
|
+
connectivity report from the client view.
|
|
174
|
+
|
|
175
|
+
Sun, 2006 Feb 05, 18:43
|
|
176
|
+
|
|
177
|
+
* Changed the phrasing in the "No jobs" page.
|
|
178
|
+
|
|
179
|
+
Sun, 2006 Feb 05, 10:43
|
|
180
|
+
|
|
181
|
+
* Define human_size_if_nz, and use it in job/index.rhtml to
|
|
182
|
+
display the job rate and size as '-' if these values are zero,
|
|
183
|
+
and as human sizes otherwise.
|
|
184
|
+
|
|
185
|
+
Sun, 2006 Feb 05, 10:26
|
|
186
|
+
|
|
187
|
+
* Modify job_link to delete csort, msort, and psort options from
|
|
188
|
+
jobs links in order to tidy up the URLs.
|
|
189
|
+
|
|
190
|
+
Sat, 2006 Feb 04, 20:25
|
|
191
|
+
|
|
192
|
+
* Added a :joins clause to pull the pool name and type into each
|
|
193
|
+
media record. Updated media/index.rhtml to match.
|
|
194
|
+
|
|
195
|
+
Sun, 2006 Jan 29, 10:30
|
|
196
|
+
|
|
197
|
+
* Released version 1.0 to RubyForge.
|
|
198
|
+
|
|
199
|
+
Fri, 2006 Jan 20, 21:12
|
|
200
|
+
|
|
201
|
+
* Added the 'underline the selected sort field' feature to the
|
|
202
|
+
client, media, and pool index pages.
|
|
203
|
+
|
|
204
|
+
Fri, 2006 Jan 20, 20:22
|
|
205
|
+
|
|
206
|
+
* Changed the select by date code to use the 'days.ago' routines.
|
|
207
|
+
|
|
208
|
+
Wed, 2006 Jan 11, 23:10
|
|
209
|
+
|
|
210
|
+
* Before putting this into something resembling production
|
|
211
|
+
mode, I've created a 'bacuview' database user account to
|
|
212
|
+
provide read-only access to the tables used by the bacuview
|
|
213
|
+
application:
|
|
214
|
+
|
|
215
|
+
# create user bacuview password 'bacuview';
|
|
216
|
+
# grant select on job, jobmedia, client, media, pool to bacuview;
|
|
217
|
+
|
|
218
|
+
Then add the magic to pg_hba.conf to allow the bacuview user
|
|
219
|
+
to connect to the bacula database:
|
|
220
|
+
|
|
221
|
+
host bacula bacuview 128.183.190.0/23 md5
|
|
222
|
+
|
|
223
|
+
Tue, 2006 Jan 10, 19:13
|
|
224
|
+
|
|
225
|
+
* Spent the morning tweeking CSS rendering rules and adding a
|
|
226
|
+
message describing the exact type of jobs that have not been
|
|
227
|
+
found rather than simply displaying a blank page under these
|
|
228
|
+
circumstances.
|
|
229
|
+
|
|
230
|
+
Sun, 2006 Jan 08, 10:56
|
|
231
|
+
|
|
232
|
+
* Prettied up the job media list. Nulled out the id and
|
|
233
|
+
action settings in the job controllers so that these
|
|
234
|
+
wouldn't bleed through to other views. Corrected the job
|
|
235
|
+
status strings to reflect what's shown in the bacula
|
|
236
|
+
database.
|
|
237
|
+
|
|
238
|
+
Fri, 2006 Jan 06, 19:06
|
|
239
|
+
|
|
240
|
+
* Used find_by_sql to add an ugly list of the media used by
|
|
241
|
+
any one job to the job/show page. I'll pretty it up later.
|
|
242
|
+
|
|
243
|
+
Fri, 2006 Jan 06, 18:40
|
|
244
|
+
|
|
245
|
+
* Merged all of the munge_kay and munge_val methods into a
|
|
246
|
+
single pair of pretty_key and pretty_val methods in the
|
|
247
|
+
application_helper module.
|
|
248
|
+
|
|
249
|
+
Thu, 2006 Jan 05, 20:38
|
|
250
|
+
|
|
251
|
+
* Tableized and munged the media/show page. And the pool/show
|
|
252
|
+
page. And the client/show page. And finally, the job/show
|
|
253
|
+
page.
|
|
254
|
+
|
|
255
|
+
Wed, 2006 Jan 04, 19:39
|
|
256
|
+
|
|
257
|
+
* Figured out that I had actually broken the link stickiness
|
|
258
|
+
yesterday and just hadn't noticed. That drove me crazy when
|
|
259
|
+
I tried to figure out what it was about the job status
|
|
260
|
+
selection that caused this problem.
|
|
261
|
+
|
|
262
|
+
Wed, 2006 Jan 04, 19:31
|
|
263
|
+
|
|
264
|
+
* Sometime in the near future, I hope to use this bit of SQL:
|
|
265
|
+
select mediaid,volumename from media where mediaid in
|
|
266
|
+
(select distinct mediaid from jobmedia where jobid = 381);
|
|
267
|
+
|
|
268
|
+
Wed, 2006 Jan 04, 21:34
|
|
269
|
+
|
|
270
|
+
* Added support for the "list jobs with anomalous job
|
|
271
|
+
completion status" feature that Bobby requested. It sort of
|
|
272
|
+
works, but the parameter list stickiness isn't quite right
|
|
273
|
+
yet.
|
|
274
|
+
|
|
275
|
+
Tue, 2006 Jan 03, 19:39
|
|
276
|
+
|
|
277
|
+
* Massively simplified the page_link routines, and made the
|
|
278
|
+
corresponding changes to the .rhtml files for the various
|
|
279
|
+
views.
|
|
280
|
+
|
|
281
|
+
Tue, 2006 Jan 03, 18:48
|
|
282
|
+
|
|
283
|
+
* Showed the application off to Bobby. He seemed quite
|
|
284
|
+
impressed.
|
|
285
|
+
|
|
286
|
+
Mon, 2006 Jan 02, 18:47
|
|
287
|
+
|
|
288
|
+
* Styled the header line and fixed the sorting for the client,
|
|
289
|
+
pool, and media views.
|
|
290
|
+
|
|
291
|
+
Mon, 2006 Jan 02, 15:09
|
|
292
|
+
|
|
293
|
+
* Moved the CSS stuff into its own file. All dozen lines of it.
|
|
294
|
+
|
|
295
|
+
Mon, 2006 Jan 02, 14:16
|
|
296
|
+
|
|
297
|
+
* Added a time column showing how long a job took, to go with
|
|
298
|
+
the rate column.
|
|
299
|
+
|
|
300
|
+
Mon, 2006 Jan 02, 13:22
|
|
301
|
+
|
|
302
|
+
* Alright, so it'll never really be done. I've added a rate
|
|
303
|
+
column, and hooked up a sort function. This took a bit of
|
|
304
|
+
work, since there's no rate column for the DB to sort on.
|
|
305
|
+
|
|
306
|
+
Sun, 2006 Jan 01, 14:49
|
|
307
|
+
|
|
308
|
+
* Done. Job selection by client, interval, sort field and
|
|
309
|
+
direction are all working. The URL routing is set up to
|
|
310
|
+
start with a listing of the days jobs, and to minimize the
|
|
311
|
+
length of job URLs. I'll make a few more cosmetic changes,
|
|
312
|
+
but the application itself is fully functional.
|
|
313
|
+
|
|
314
|
+
Sat, 2005 Dec 31, 14:40
|
|
315
|
+
|
|
316
|
+
* I colorized the job status entries, and added a red Bacula
|
|
317
|
+
Bat logo in the top left corner. I couldn't resist.
|
|
318
|
+
|
|
319
|
+
Sat, 2005 Dec 31, 13:24
|
|
320
|
+
|
|
321
|
+
* Almost done. The job pages now accumulate the client,
|
|
322
|
+
interval, and sort column specifications. The sort
|
|
323
|
+
direction still needs work, but I don't expect that to be a
|
|
324
|
+
big deal.
|
|
325
|
+
|
|
326
|
+
Fri, 2005 Dec 30, 17:13
|
|
327
|
+
|
|
328
|
+
* Alright, the client, pool, and media views and controllers
|
|
329
|
+
have been purged of their sort_by methods.
|
|
330
|
+
|
|
331
|
+
Fri, 2005 Dec 30, 16:36
|
|
332
|
+
|
|
333
|
+
* Eliminated the use of the sort_by method in the Job class by
|
|
334
|
+
getting the database to handle the sorting. I'll do the
|
|
335
|
+
same for the other views later.
|
|
336
|
+
|
|
337
|
+
Thu, 2005 Dec 29, 20:34
|
|
338
|
+
|
|
339
|
+
* Eliminated the use of the scaffolding in the controllers.
|
|
340
|
+
This required the highly non-obvious inclusion of a method
|
|
341
|
+
"def index; list; end". I also got rid of the use of the
|
|
342
|
+
debug statements that I was so fond of this morning, and
|
|
343
|
+
stole a simple three-line show.rhtml file instead.
|
|
344
|
+
|
|
345
|
+
Thu, 2005 Dec 29, 19:47
|
|
346
|
+
|
|
347
|
+
* I killed the /new and /edit pages by defining empty
|
|
348
|
+
methods. This causes a "Template is missing" error when an
|
|
349
|
+
attempt is made to get at these functions by hand-tuning the
|
|
350
|
+
URL, but it does make things less trivially hackable. I
|
|
351
|
+
think that the real solution here is to drop the :scaffold
|
|
352
|
+
stuff that gets auto-generated, and do what I need manually.
|
|
353
|
+
|
|
354
|
+
Thu, 2005 Dec 29, 19:37
|
|
355
|
+
|
|
356
|
+
* I wanted to get rid of the "Edit" and "Back" entries
|
|
357
|
+
provided by the scaffolding, so I created a set of
|
|
358
|
+
show.rhtml pages that each contain a line of the form:
|
|
359
|
+
|
|
360
|
+
<%= debug(@job) %>
|
|
361
|
+
|
|
362
|
+
This is enough to generate a fairly legible page. Damn,
|
|
363
|
+
this RoR stuff can be simple at times.
|
|
364
|
+
|
|
365
|
+
Thu, 2005 Dec 29, 18:35
|
|
366
|
+
|
|
367
|
+
* Thanks to Chris Henley, I've discovered the magic of the
|
|
368
|
+
"white-space: nowrap" CSS tag. My tables look just a little
|
|
369
|
+
less ugly as a result.
|
|
370
|
+
|
|
371
|
+
Tue, 2005 Dec 27, 22:10
|
|
372
|
+
|
|
373
|
+
* Made good progress over the holiday weekend. All of the
|
|
374
|
+
pages can now be sorted by column, although in only one
|
|
375
|
+
direction. There's now a standard layout with a page
|
|
376
|
+
selector on the left and the actual content on the right.
|
|
377
|
+
It's quite ugly, but the information is all there.
|
|
378
|
+
|
|
379
|
+
Wed, 2005 Dec 21, 19:07
|
|
380
|
+
|
|
381
|
+
* Alright, that's enough ugly table display pages. Now the
|
|
382
|
+
fun job will be to pull these together through a menu of
|
|
383
|
+
some type. Maybe tomorrow.
|
|
384
|
+
|
|
385
|
+
Wed, 2005 Dec 21, 21:44
|
|
386
|
+
|
|
387
|
+
* Oops, I really meant to create a Media page. I hope I can
|
|
388
|
+
get the pluralization right on this one.
|
|
389
|
+
|
|
390
|
+
Wed, 2005 Dec 21, 20:22
|
|
391
|
+
|
|
392
|
+
* Let's set up a Pool page. That ought to be enough different
|
|
393
|
+
pages that I can start setting up a menu to choose between
|
|
394
|
+
them.
|
|
395
|
+
|
|
396
|
+
$ ruby script/generate model Pool
|
|
397
|
+
$ ruby script/generate controller Pool
|
|
398
|
+
|
|
399
|
+
Wed, 2005 Dec 21, 20:05
|
|
400
|
+
|
|
401
|
+
* I got unstuck. The type value is available as
|
|
402
|
+
job.attributes['type']. Quirky, but I can live with it.
|
|
403
|
+
I've also added code to select based on client name. It
|
|
404
|
+
seems like it would be better to use an SQL select rather
|
|
405
|
+
than screening rows that don't match, but the performance
|
|
406
|
+
doesn't suffer, so I'll worry about that later.
|
|
407
|
+
|
|
408
|
+
Tue, 2005 Dec 20, 19:04
|
|
409
|
+
|
|
410
|
+
* I'm stuck. The job page would have been done in a flash,
|
|
411
|
+
except that I can't get at the type column in the job table.
|
|
412
|
+
I've overridden the table name (def self.table_name() "job"
|
|
413
|
+
end) and get an error saying that "The STI mechanism failed
|
|
414
|
+
to locate the subclass: 'B'.", where the 'B' is the value of
|
|
415
|
+
the first type field. I can get beyond this by adding
|
|
416
|
+
"Job.inheritance_column = 'ruby_type'" to the job model, but
|
|
417
|
+
then I'm unable to access the type field using the same
|
|
418
|
+
"<td><%= job.type %></td>" construct that works for all the
|
|
419
|
+
other fields.
|
|
420
|
+
|
|
421
|
+
Tue, 2005 Dec 20, 18:22
|
|
422
|
+
|
|
423
|
+
* Amazing. I got connected to the database and can generate a
|
|
424
|
+
web page with a list of all the clients, their uname and
|
|
425
|
+
retention periods. It's rough but serviceable, and very
|
|
426
|
+
encouraging.
|
|
427
|
+
|
|
428
|
+
Next, a Job page...
|
|
429
|
+
|
|
430
|
+
$ ruby script/generate model Job
|
|
431
|
+
$ ruby script/generate controller Job
|
|
432
|
+
|
|
433
|
+
Tue, 2005 Dec 20, 17:55
|
|
434
|
+
|
|
435
|
+
* And so, the Bacurail project commences. I've followed the
|
|
436
|
+
recommendations on the http://rubyonrails.org/ web page and
|
|
437
|
+
have downloaded a copy of the Ruby Gems package manager tar
|
|
438
|
+
file, extracted the contents, then as root have run "ruby
|
|
439
|
+
setup" and "gem install rails --include-dependencies" to get
|
|
440
|
+
the basic rails installation set up. Back as myself again,
|
|
441
|
+
I used "rails bacurail" to create a basic rails directory
|
|
442
|
+
structure, and plopped this into the doc directory.
|
|
443
|
+
|
|
444
|
+
Given the rubygems-0.8.11.tgz file...
|
|
445
|
+
$ tar xzf rubygems-0.8.11.tgz
|
|
446
|
+
# cd rubygems-0.8.11
|
|
447
|
+
# ruby setup.rb
|
|
448
|
+
# gem install rails --include-dependencies
|
|
449
|
+
# gem install postgres
|
|
450
|
+
$ rails bacurail
|
|
451
|
+
$ cd bacurail
|
|
452
|
+
$ ruby script/generate controller Menu
|
|
453
|
+
$ ruby script/generate controller Client
|
|
454
|
+
$ ruby script/generate model Client
|
data/README.bacuview
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
The Bacuview application provides a web-based view into the status of
|
|
2
|
+
a Bacula backup system, as recorded in the Bacula database. Bacuview
|
|
3
|
+
has been developed and tested against both Postgres and MySQL databases.
|
|
4
|
+
|
|
5
|
+
The Bacuview documentation is located in the public directory as a
|
|
6
|
+
series of web pages, beginning with the Bacuview home page in
|
|
7
|
+
public/home.html.
|
data/README.rails
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
== Welcome to Rails
|
|
2
|
+
|
|
3
|
+
Rails is a web-application and persistence framework that includes everything
|
|
4
|
+
needed to create database-backed web-applications according to the
|
|
5
|
+
Model-View-Control pattern of separation. This pattern splits the view (also
|
|
6
|
+
called the presentation) into "dumb" templates that are primarily responsible
|
|
7
|
+
for inserting pre-built data in between HTML tags. The model contains the
|
|
8
|
+
"smart" domain objects (such as Account, Product, Person, Post) that holds all
|
|
9
|
+
the business logic and knows how to persist themselves to a database. The
|
|
10
|
+
controller handles the incoming requests (such as Save New Account, Update
|
|
11
|
+
Product, Show Post) by manipulating the model and directing data to the view.
|
|
12
|
+
|
|
13
|
+
In Rails, the model is handled by what's called an object-relational mapping
|
|
14
|
+
layer entitled Active Record. This layer allows you to present the data from
|
|
15
|
+
database rows as objects and embellish these data objects with business logic
|
|
16
|
+
methods. You can read more about Active Record in
|
|
17
|
+
link:files/vendor/rails/activerecord/README.html.
|
|
18
|
+
|
|
19
|
+
The controller and view are handled by the Action Pack, which handles both
|
|
20
|
+
layers by its two parts: Action View and Action Controller. These two layers
|
|
21
|
+
are bundled in a single package due to their heavy interdependence. This is
|
|
22
|
+
unlike the relationship between the Active Record and Action Pack that is much
|
|
23
|
+
more separate. Each of these packages can be used independently outside of
|
|
24
|
+
Rails. You can read more about Action Pack in
|
|
25
|
+
link:files/vendor/rails/actionpack/README.html.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
== Getting started
|
|
29
|
+
|
|
30
|
+
1. Run the WEBrick servlet: <tt>ruby script/server</tt> (run with --help for options)
|
|
31
|
+
...or if you have lighttpd installed: <tt>ruby script/lighttpd</tt> (it's faster)
|
|
32
|
+
2. Go to http://localhost:3000/ and get "Congratulations, you've put Ruby on Rails!"
|
|
33
|
+
3. Follow the guidelines on the "Congratulations, you've put Ruby on Rails!" screen
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
== Example for Apache conf
|
|
37
|
+
|
|
38
|
+
<VirtualHost *:80>
|
|
39
|
+
ServerName rails
|
|
40
|
+
DocumentRoot /path/application/public/
|
|
41
|
+
ErrorLog /path/application/log/server.log
|
|
42
|
+
|
|
43
|
+
<Directory /path/application/public/>
|
|
44
|
+
Options ExecCGI FollowSymLinks
|
|
45
|
+
AllowOverride all
|
|
46
|
+
Allow from all
|
|
47
|
+
Order allow,deny
|
|
48
|
+
</Directory>
|
|
49
|
+
</VirtualHost>
|
|
50
|
+
|
|
51
|
+
NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
|
|
52
|
+
should be on and ".cgi" should respond. All requests from 127.0.0.1 go
|
|
53
|
+
through CGI, so no Apache restart is necessary for changes. All other requests
|
|
54
|
+
go through FCGI (or mod_ruby), which requires a restart to show changes.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
== Debugging Rails
|
|
58
|
+
|
|
59
|
+
Have "tail -f" commands running on both the server.log, production.log, and
|
|
60
|
+
test.log files. Rails will automatically display debugging and runtime
|
|
61
|
+
information to these files. Debugging info will also be shown in the browser
|
|
62
|
+
on requests from 127.0.0.1.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
== Breakpoints
|
|
66
|
+
|
|
67
|
+
Breakpoint support is available through the script/breakpointer client. This
|
|
68
|
+
means that you can break out of execution at any point in the code, investigate
|
|
69
|
+
and change the model, AND then resume execution! Example:
|
|
70
|
+
|
|
71
|
+
class WeblogController < ActionController::Base
|
|
72
|
+
def index
|
|
73
|
+
@posts = Post.find_all
|
|
74
|
+
breakpoint "Breaking out from the list"
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
So the controller will accept the action, run the first line, then present you
|
|
79
|
+
with a IRB prompt in the breakpointer window. Here you can do things like:
|
|
80
|
+
|
|
81
|
+
Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
|
|
82
|
+
|
|
83
|
+
>> @posts.inspect
|
|
84
|
+
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
|
85
|
+
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
|
86
|
+
>> @posts.first.title = "hello from a breakpoint"
|
|
87
|
+
=> "hello from a breakpoint"
|
|
88
|
+
|
|
89
|
+
...and even better is that you can examine how your runtime objects actually work:
|
|
90
|
+
|
|
91
|
+
>> f = @posts.first
|
|
92
|
+
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
|
93
|
+
>> f.
|
|
94
|
+
Display all 152 possibilities? (y or n)
|
|
95
|
+
|
|
96
|
+
Finally, when you're ready to resume execution, you press CTRL-D
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
== Console
|
|
100
|
+
|
|
101
|
+
You can interact with the domain model by starting the console through script/console.
|
|
102
|
+
Here you'll have all parts of the application configured, just like it is when the
|
|
103
|
+
application is running. You can inspect domain models, change values, and save to the
|
|
104
|
+
database. Starting the script without arguments will launch it in the development environment.
|
|
105
|
+
Passing an argument will specify a different environment, like <tt>console production</tt>.
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
== Description of contents
|
|
109
|
+
|
|
110
|
+
app
|
|
111
|
+
Holds all the code that's specific to this particular application.
|
|
112
|
+
|
|
113
|
+
app/controllers
|
|
114
|
+
Holds controllers that should be named like weblog_controller.rb for
|
|
115
|
+
automated URL mapping. All controllers should descend from
|
|
116
|
+
ActionController::Base.
|
|
117
|
+
|
|
118
|
+
app/models
|
|
119
|
+
Holds models that should be named like post.rb.
|
|
120
|
+
Most models will descend from ActiveRecord::Base.
|
|
121
|
+
|
|
122
|
+
app/views
|
|
123
|
+
Holds the template files for the view that should be named like
|
|
124
|
+
weblog/index.rhtml for the WeblogController#index action. All views use eRuby
|
|
125
|
+
syntax. This directory can also be used to keep stylesheets, images, and so on
|
|
126
|
+
that can be symlinked to public.
|
|
127
|
+
|
|
128
|
+
app/helpers
|
|
129
|
+
Holds view helpers that should be named like weblog_helper.rb.
|
|
130
|
+
|
|
131
|
+
config
|
|
132
|
+
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
|
133
|
+
|
|
134
|
+
components
|
|
135
|
+
Self-contained mini-applications that can bundle together controllers, models, and views.
|
|
136
|
+
|
|
137
|
+
lib
|
|
138
|
+
Application specific libraries. Basically, any kind of custom code that doesn't
|
|
139
|
+
belong under controllers, models, or helpers. This directory is in the load path.
|
|
140
|
+
|
|
141
|
+
public
|
|
142
|
+
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
|
143
|
+
and javascripts. Also contains the dispatchers and the default HTML files.
|
|
144
|
+
|
|
145
|
+
script
|
|
146
|
+
Helper scripts for automation and generation.
|
|
147
|
+
|
|
148
|
+
test
|
|
149
|
+
Unit and functional tests along with fixtures.
|
|
150
|
+
|
|
151
|
+
vendor
|
|
152
|
+
External libraries that the application depends on. Also includes the plugins subdirectory.
|
|
153
|
+
This directory is in the load path.
|