Changeset c246252


Ignore:
Timestamp:
05/15/14 07:27:00 (16 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, enter/10, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2, releng/10.2
Children:
76295fb
Parents:
9d5cf20
Message:

Fix LP gui to work with snapshot comments. Works on remove menus,
still need comments to show up on listing

Location:
src-qt4/life-preserver/lp-gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/life-preserver/lp-gui/LPBackend.cpp

    r194a5d3 rc246252  
    5959} 
    6060 
    61 QStringList LPBackend::listLPSnapshots(QString dataset){ 
     61QStringList LPBackend::listLPSnapshots(QString dataset, QStringList &comments){ 
    6262  QString cmd = "lpreserver listsnap "+dataset; 
    6363  QStringList out = LPBackend::getCmdOutput(cmd); 
     
    6666  for(int i=0; i<out.length(); i++){ //oldest ->newest 
    6767    if(out[i].startsWith(dataset+"@")){ 
    68       QString snap = out[i].section("@",1,3).section(" ",0,0).simplified();; 
    69       if(!snap.isEmpty()){ list << snap; } 
     68      QString snap = out[i].simplified().section(" ", 0, 0).section("@",1,3).section(" ",0,0).simplified(); 
     69      QString comment = out[i].simplified().section(" ", 1, -1); 
     70      if(!snap.isEmpty()){ list << snap; comments << comment; } 
    7071    } 
    7172  } 
  • src-qt4/life-preserver/lp-gui/LPBackend.h

    r0ecb8f7 rc246252  
    1818        static QStringList listDatasetSubsets(QString dataset); //list all subsets of the main dataset 
    1919        static QStringList listSnapshots(QString dsmountpoint); //list all snapshots for a particular dataset mountpoint 
    20         static QStringList listLPSnapshots(QString dataset); //list all snapshots created by life preserver 
     20        static QStringList listLPSnapshots(QString dataset, QStringList &comments); //list all snapshots created by life preserver 
    2121        static QStringList listReplicationTargets(); //list all datasets with replication enabled 
    2222        static QStringList listCurrentStatus(); //list the current snapshot/replication status 
  • src-qt4/life-preserver/lp-gui/LPGUtils.cpp

    r65e10ad5 rc246252  
    88  qDebug() << "[DEBUG] list snapshots"; 
    99  QStringList subsets = LPBackend::listDatasetSubsets(zpool); 
    10   QStringList lpsnaps = LPBackend::listLPSnapshots(zpool); 
     10  QStringList lpsnapcomments; 
     11  QStringList lpsnaps = LPBackend::listLPSnapshots(zpool, lpsnapcomments); 
    1112  //populate the list of snapshots available for each mountpoint 
    1213  for(int i=0; i<subsets.length(); i++){ 
  • src-qt4/life-preserver/lp-gui/LPMain.cpp

    ra710d85f rc246252  
    258258     
    259259    //Now update the snapshot removal menu list 
    260     QStringList snaps = LPBackend::listLPSnapshots(ui->combo_pools->currentText()); 
     260    QStringList snapComments; 
     261    QStringList snaps = LPBackend::listLPSnapshots(ui->combo_pools->currentText(), snapComments); 
    261262    ui->menuDelete_Snapshot->clear(); 
    262263    for(int i=0; i<snaps.length(); i++){ 
    263        ui->menuDelete_Snapshot->addAction(snaps[i]); 
     264       ui->menuDelete_Snapshot->addAction(snaps[i] + " (" + snapComments[i] + ")" ); 
    264265    } 
    265266    ui->menuDelete_Snapshot->setEnabled( !ui->menuDelete_Snapshot->isEmpty() ); 
     
    477478    if( QMessageBox::Yes == QMessageBox::question(this,tr("Verify Dataset Backup Removal"),tr("Are you sure that you wish to cancel automated snapshots and/or replication of the following dataset?")+"\n\n"+ds,QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){             
    478479      //verify the removal of all the snapshots for this dataset 
    479       QStringList snaps = LPBackend::listLPSnapshots(ds); 
     480      QStringList snapComments; 
     481      QStringList snaps = LPBackend::listLPSnapshots(ds, snapComments); 
    480482      if(!snaps.isEmpty()){ 
    481483        if( QMessageBox::Yes == QMessageBox::question(this,tr("Verify Snapshot Deletion"),tr("Do you wish to remove the local snapshots for this dataset?")+"\n"+tr("WARNING: This is a permanant change that cannot be reversed"),QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){ 
     
    745747 
    746748void LPMain::menuRemoveSnapshot(QAction *act){ 
    747   QString snapshot = act->text(); 
     749  QString snapshot = act->text().section(" ", 0, 0); 
     750  QString comment = act->text().section(" ", 1, -1); 
    748751  QString pool = ui->combo_pools->currentText(); 
    749752  qDebug() << "Remove Snapshot:" << snapshot; 
    750753  //verify snapshot removal 
    751   if( QMessageBox::Yes == QMessageBox::question(this,tr("Verify Snapshot Deletion"),QString(tr("Do you wish to delete this snapshot? %1")).arg(pool+"/"+snapshot)+"\n"+tr("WARNING: This is a permanant change that cannot be reversed"),QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){ 
     754  if( QMessageBox::Yes == QMessageBox::question(this,tr("Verify Snapshot Deletion"),QString(tr("Do you wish to delete this snapshot? %1 (%2)")).arg(pool+"/"+snapshot).arg(comment)+"\n"+tr("WARNING: This is a permanant change that cannot be reversed"),QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){ 
    752755    bool ok = LPBackend::removeSnapshot(ui->combo_pools->currentText(), snapshot); 
    753756    if(ok){ 
Note: See TracChangeset for help on using the changeset viewer.