[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bacula-commits
Subject:    [Bacula-commits] SF.net SVN: bacula: [5991] trunk/gui/bweb
From:       ricozz () users ! sourceforge ! net
Date:       2007-11-26 22:01:20
Message-ID: E1Iwm12-0000gu-1X () sc8-pr-svn2 ! sourceforge ! net
[Download RAW message or body]

Revision: 5991
          http://bacula.svn.sourceforge.net/bacula/?rev=5991&view=rev
Author:   ricozz
Date:     2007-11-26 14:01:19 -0800 (Mon, 26 Nov 2007)

Log Message:
-----------
ebl  Fix mysql things

Modified Paths:
--------------
    trunk/gui/bweb/cgi/bresto.pl
    trunk/gui/bweb/html/bresto.js
    trunk/gui/bweb/lib/Bweb.pm
    trunk/gui/bweb/technotes-2.3

Added Paths:
-----------
    trunk/gui/bweb/html/mR.png

Modified: trunk/gui/bweb/cgi/bresto.pl
===================================================================
--- trunk/gui/bweb/cgi/bresto.pl	2007-11-26 17:01:24 UTC (rev 5990)
+++ trunk/gui/bweb/cgi/bresto.pl	2007-11-26 22:01:19 UTC (rev 5991)
@@ -739,6 +739,7 @@
 
 package main;
 use strict;
+use POSIX qw/strftime/;
 use Bweb;
 
 my $conf = new Bweb::Config(config_file => $Bweb::config_file);
@@ -873,19 +874,32 @@
 
     my $u = join(" UNION ", @union);
 
-    $bvfs->dbh_do("CREATE TEMPORARY TABLE btemp AS ($u)");
+    $bvfs->dbh_do("CREATE TEMPORARY TABLE btemp AS $u");
     # TODO: remove FilenameId et PathId
-    $bvfs->dbh_do("CREATE TABLE b2$$ AS (
+
+    # now we have to choose the file with the max(jobid)
+    # for each file of btemp
+    if ($bvfs->dbh_is_mysql()) {
+       $bvfs->dbh_do("CREATE TEMPORARY TABLE btemp2 AS (
+SELECT max(JobId) as JobId, PathId, FilenameId
+  FROM btemp
+ GROUP BY PathId, FilenameId
+)");
+       $bvfs->dbh_do("CREATE TABLE b2$$ AS (
 SELECT btemp.JobId, btemp.FileIndex, btemp.FilenameId, btemp.PathId
-  FROM btemp,
-       (SELECT max(JobId) as JobId, PathId, FilenameId
-          FROM btemp
-      GROUP BY PathId, FilenameId
-      ORDER BY JobId DESC) AS a
-  WHERE a.JobId = btemp.JobId
-    AND a.PathId= btemp.PathId
-    AND a.FilenameId = btemp.FilenameId
+  FROM btemp, btemp2
+  WHERE btemp2.JobId = btemp.JobId
+    AND btemp2.PathId= btemp.PathId
+    AND btemp2.FilenameId = btemp.FilenameId
 )");
+   } else { # postgresql have distinct with more than one criteria...
+        $bvfs->dbh_do("CREATE TABLE b2$$ AS (
+SELECT DISTINCT ON (PathId, FilenameId) JobId, FileIndex
+  FROM btemp
+ ORDER BY PathId, FilenameId, JobId DESC
+)");
+    }
+
     my $bconsole = $bvfs->get_bconsole();
     # TODO: pouvoir choisir le replace et le jobname
     my $jobid = $bconsole->run(client    => $arg->{client},
@@ -918,8 +932,7 @@
 #   File.FilenameId, listfiles.id, listfiles.Name, File.LStat, File.JobId
 
     print join(',',
-	       map { "[$_->[1], $_->[0], $pathid, $_->[4], \"$_->[2]\", 10, \"2007-01-01 \
                00:00:00\"]" }
-	       @$files);
+	       map { my @p=Bvfs::parse_lstat($_->[3]); \
"[$_->[1],$_->[0],$pathid,$_->[4],\"$_->[2]\"," . $p[7] . ",'" . strftime('%Y-%m-%d \
%H:%m:%S', localtime($p[11])) .  "']" } @$files);  print "]\n";
 
 } elsif ($action eq 'list_dirs') {
@@ -944,7 +957,7 @@
     #($pathid,$fileid,$jobid, $fid, $mtime, $size, $inchanger, $md5, $volname);
     my $files = $bvfs->get_all_file_versions($args->{pathid}, $args->{filenameid}, \
$args->{client}, $vafv);  print join(',',
-	       map { "[ $_->[3], $_->[1], $_->[0], $_->[2], '$_->[8]', $_->[6], '$_->[7]', \
$_->[5], $_->[4] ]" } +	       map { "[ $_->[3], $_->[1], $_->[0], $_->[2], \
'$_->[8]', $_->[6], '$_->[7]', $_->[5],'" . strftime('%Y-%m-%d %H:%m:%S', \
localtime($_->[4])) . "']" }  @$files);
     print "]\n";
 
@@ -954,11 +967,11 @@
     my $fileid = join(',', grep { /^\d+$/ } CGI::param('fileid'));
 
     my $q="
- SELECT DISTINCT VolumeName, InChanger
+ SELECT DISTINCT VolumeName, Enabled, InChanger
    FROM File,
     ( -- Get all media from this job
       SELECT MIN(FirstIndex) AS FirstIndex, MAX(LastIndex) AS LastIndex,
-             VolumeName, Inchanger
+             VolumeName, Enabled, Inchanger
         FROM JobMedia JOIN Media USING (MediaId)
        WHERE JobId IN ($jobid)
        GROUP BY VolumeName, InChanger
@@ -969,7 +982,7 @@
 ";
     my $lst = $bvfs->dbh_selectall_arrayref($q);
     print "[";
-    print join(',', map { "[ '$_->[0]', $_->[1]]" } @$lst);
+    print join(',', map { "['$_->[0]',$_->[1]],$_->[2]]" } @$lst);
     print "]\n";
 
 }

Modified: trunk/gui/bweb/html/bresto.js
===================================================================
--- trunk/gui/bweb/html/bresto.js	2007-11-26 17:01:24 UTC (rev 5990)
+++ trunk/gui/bweb/html/bresto.js	2007-11-26 22:01:19 UTC (rev 5991)
@@ -160,7 +160,7 @@
            id:        'name', // id assigned so we can apply custom css (e.g. \
.x-grid-col-topic b { color:#333 })  header:    'File',
            dataIndex: 'name',
-           width:     100,
+           width:     200,
            css:       'white-space:normal;'
         },{
            header:    "Size",
@@ -170,6 +170,7 @@
         },{
            header:    "Date",
            dataIndex: 'mtime',
+	   renderer: Ext.util.Format.dateRenderer('Y-d-m h:i:s'),
            width:     100
         },{
            dataIndex: 'pathid',
@@ -188,7 +189,6 @@
 
     // by default columns are sortable
    cm.defaultSortable = true;
-
     // create the grid
    var files_grid = new Ext.grid.Grid('div-files', {
         ds: file_store,
@@ -198,10 +198,10 @@
         enableDragDrop: true,
         selModel: new Ext.grid.RowSelectionModel(),
         loadMask: true,
+        autoSizeColumns: true,
         enableColLock:false
         
     });
-
     // when we reload the view,
     // we clear the file version box
     file_store.on('beforeload', function(e) {
@@ -211,7 +211,7 @@
 
     // TODO: selection only when using dblclick
     files_grid.selModel.on('rowselect', function(e,i,r) { 
-        Ext.brestore.filename = r.json[3];
+        Ext.brestore.filename = r.json[4];
         file_versions_store.load({params:init_params({action: 'list_versions',
 						     vafv: Ext.brestore.option_vafv,
   	                                             pathid: r.json[2],
@@ -256,6 +256,7 @@
         },{
            header:    "Date",
            dataIndex: 'mtime',
+	   renderer: Ext.util.Format.dateRenderer('Y-d-m h:i'),
            width:     100
         },{
            dataIndex: 'pathid',
@@ -282,7 +283,6 @@
         selModel: new Ext.grid.RowSelectionModel(),
         loadMask: true,
         enableColLock:false
-        
     });
 
     var file_selection_record = Ext.data.Record.create(
@@ -348,7 +348,6 @@
            return true;
     }});
 
-
    file_selection_grid.on('enddrag', function(dd,e) { 
         alert(e) ; return true;
     });
@@ -376,7 +375,7 @@
    {name: 'inchanger' },
    {name: 'md5'       },
    {name: 'size',     type: 'int'  },
-   {name: 'mtime'} //,    type: 'date', dateFormat: 'Y-m-d h:i:s'}
+   {name: 'mtime',    type: 'date', dateFormat: 'Y-m-d h:i:s'}
         ]))
    });
 
@@ -404,18 +403,22 @@
         },{
            header:    "Date",
            dataIndex: 'mtime',
+	   renderer: Ext.util.Format.dateRenderer('Y-d-m h:i:s'),
            width:     100
         },{
            header:    "MD5",
            dataIndex: 'md5',
            width:     160
         },{
+	   header:    "pathid",
            dataIndex: 'pathid',
            hidden: true
         },{
+           header:    "filenameid",
            dataIndex: 'filenameid',
            hidden: true
         },{
+           header:    "fileid",
            dataIndex: 'fileid',
            hidden: true
         }
@@ -593,9 +596,9 @@
             menu: menu  // assign menu by instance
         },
 	{
-	    icon: '/bweb/remove.png', // icons can also be specified inline
+	    icon: '/bweb/mR.png', // icons can also be specified inline
             cls: 'x-btn-icon',
-	    text: 'restore',
+	    title: 'restore',
 	    handler: function() { 
 	        if (Ext.brestore.dlglaunch) {
 		   Ext.brestore.dlglaunch.show();

Added: trunk/gui/bweb/html/mR.png
===================================================================
(Binary files differ)


Property changes on: trunk/gui/bweb/html/mR.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/gui/bweb/lib/Bweb.pm
===================================================================
--- trunk/gui/bweb/lib/Bweb.pm	2007-11-26 17:01:24 UTC (rev 5990)
+++ trunk/gui/bweb/lib/Bweb.pm	2007-11-26 22:01:19 UTC (rev 5991)
@@ -3326,7 +3326,7 @@
     }
     my $jobt = $self->{info}->{stat_job_table} || 'Job';
     my $stime1 = $self->{sql}->{"STARTTIME_P" . $type}; # get 1,2,3
-    $stime1 =~ s/Job.StartTime/starttime/;
+    $stime1 =~ s/Job.StartTime/date/;
     my $stime2 = $self->{sql}->{"STARTTIME_" . $type}; # get 2007-01-03, 2007-01-23
 
     my ($limit, $label) = $self->get_limit('since' => $arg->{since},
@@ -3358,7 +3358,6 @@
        JobStatus AS value, joberrors, nb_job
 FROM (
   SELECT $stime2        AS date,
-         StartTime      AS starttime,
 	 Client.Name    AS name,
          MAX(severity)  AS severity,
          COUNT(1)       AS nb_job,
@@ -3396,7 +3395,6 @@
        JobStatus AS value, joberrors, nb_job
 FROM (
   SELECT $stime2        AS date, 
-         StartTime      AS starttime,
          client_group_name AS name,
          MAX(severity)  AS severity,
          COUNT(1)       AS nb_job,

Modified: trunk/gui/bweb/technotes-2.3
===================================================================
--- trunk/gui/bweb/technotes-2.3	2007-11-26 17:01:24 UTC (rev 5990)
+++ trunk/gui/bweb/technotes-2.3	2007-11-26 22:01:19 UTC (rev 5991)
@@ -1,5 +1,7 @@
 26Nov07
-ebl  fix overview to works with mysql
+ebl  Fix overview to works with mysql
+ebl  Add date support to bresto
+ebl  Make bresto works with mysql (no DISTINCT ON (c1,c2))
 
 25Nov07
 ebl  Use a automatic rediction when launching a new job


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bacula-commits mailing list
Bacula-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic