Osdu Well Paths: add search field.

This commit is contained in:
Kristian Bendiksen 2024-06-12 10:32:04 +02:00
parent ea2bf3887f
commit 61f59e72f6
2 changed files with 36 additions and 6 deletions

View File

@ -74,10 +74,10 @@ RiuWellImportWizard::~RiuWellImportWizard()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellImportWizard::downloadFields() void RiuWellImportWizard::downloadFields( const QString& fieldName )
{ {
// TODO: filter by user input // TODO: filter by user input
m_osduConnector->requestFieldsByName( "CASTBERG" ); m_osduConnector->requestFieldsByName( fieldName );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -238,6 +238,16 @@ FieldSelectionPage::FieldSelectionPage( RimWellPathImport* wellPathImport, RiaOs
QVBoxLayout* layout = new QVBoxLayout; QVBoxLayout* layout = new QVBoxLayout;
setLayout( layout ); setLayout( layout );
QHBoxLayout* searchLayout = new QHBoxLayout;
m_searchTextEdit = new QLineEdit( this );
searchLayout->addWidget( m_searchTextEdit );
m_searchButton = new QPushButton( "Search", this );
m_searchButton->setEnabled( false );
searchLayout->addWidget( m_searchButton );
layout->addLayout( searchLayout );
QLabel* label = new QLabel( "Select fields" ); QLabel* label = new QLabel( "Select fields" );
layout->addWidget( label ); layout->addWidget( label );
@ -259,6 +269,10 @@ FieldSelectionPage::FieldSelectionPage( RimWellPathImport* wellPathImport, RiaOs
m_osduConnector = osduConnector; m_osduConnector = osduConnector;
connect( m_osduConnector, SIGNAL( fieldsFinished() ), SLOT( fieldsFinished() ) ); connect( m_osduConnector, SIGNAL( fieldsFinished() ), SLOT( fieldsFinished() ) );
connect( m_searchTextEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSearchTextChanged( const QString& ) ) );
connect( m_searchButton, SIGNAL( clicked() ), this, SLOT( searchForFields() ) );
connect( m_tableView->selectionModel(), connect( m_tableView->selectionModel(),
SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ),
SLOT( selectField( const QItemSelection&, const QItemSelection& ) ) ); SLOT( selectField( const QItemSelection&, const QItemSelection& ) ) );
@ -271,10 +285,20 @@ FieldSelectionPage::FieldSelectionPage( RimWellPathImport* wellPathImport, RiaOs
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void FieldSelectionPage::initializePage() void FieldSelectionPage::onSearchTextChanged( const QString& text )
{
m_searchButton->setEnabled( text.length() >= MINIMUM_CHARACTERS_FOR_SEARCH );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void FieldSelectionPage::searchForFields()
{ {
RiuWellImportWizard* wiz = dynamic_cast<RiuWellImportWizard*>( wizard() ); RiuWellImportWizard* wiz = dynamic_cast<RiuWellImportWizard*>( wizard() );
wiz->downloadFields();
QString text = m_searchTextEdit->text();
if ( text.length() >= MINIMUM_CHARACTERS_FOR_SEARCH ) wiz->downloadFields( text );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -19,6 +19,7 @@
#pragma once #pragma once
#include <QItemSelection> #include <QItemSelection>
#include <QLineEdit>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
#include <QString> #include <QString>
@ -245,9 +246,14 @@ public:
private slots: private slots:
void fieldsFinished(); void fieldsFinished();
void selectField( const QItemSelection& newSelection, const QItemSelection& oldSelection ); void selectField( const QItemSelection& newSelection, const QItemSelection& oldSelection );
void onSearchTextChanged( const QString& );
void searchForFields();
private: private:
// caf::PdmUiPropertyView* m_propertyView; static const int MINIMUM_CHARACTERS_FOR_SEARCH = 3;
QLineEdit* m_searchTextEdit;
QPushButton* m_searchButton;
RiaOsduConnector* m_osduConnector; RiaOsduConnector* m_osduConnector;
QTableView* m_tableView; QTableView* m_tableView;
OsduFieldTableModel* m_osduFieldsModel; OsduFieldTableModel* m_osduFieldsModel;
@ -336,7 +342,7 @@ public:
public slots: public slots:
void downloadWellPaths( const QString& wellboreId ); void downloadWellPaths( const QString& wellboreId );
void downloadWells( const QString& fieldId ); void downloadWells( const QString& fieldId );
void downloadFields(); void downloadFields( const QString& fieldName );
void slotAuthenticationRequired( QNetworkReply* networkReply, QAuthenticator* authenticator ); void slotAuthenticationRequired( QNetworkReply* networkReply, QAuthenticator* authenticator );