From 27d6faf14da3c4a54165b3eb42492e263399d8d7 Mon Sep 17 00:00:00 2001 From: Amin Date: Mon, 30 Sep 2024 18:25:10 -0700 Subject: [PATCH 1/3] Editing M9 gui to get user and pass for the tapis app --- .../physicsBasedSimulation/M9SingleSite.cpp | 56 +++++++++++++++++-- EVENTS/physicsBasedSimulation/M9SingleSite.h | 2 + 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/EVENTS/physicsBasedSimulation/M9SingleSite.cpp b/EVENTS/physicsBasedSimulation/M9SingleSite.cpp index 9ec17ba9..aee7ecc4 100644 --- a/EVENTS/physicsBasedSimulation/M9SingleSite.cpp +++ b/EVENTS/physicsBasedSimulation/M9SingleSite.cpp @@ -34,15 +34,15 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS. *************************************************************************** */ -// Written: fmckenna - +// Written: fmckenna, Amin Pakzad +#include "MainWindow.h" #include "M9SingleSite.h" #include #include #include #include #include - +#include #include #include #include @@ -51,7 +51,6 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS. #include #include #include -#include #include #include @@ -63,6 +62,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS. #include #include #include +#include M9SingleSite::M9SingleSite(QWidget *parent) :SimCenterAppWidget(parent), count(0), downloadedMotions(false), motionsDownloading(false) @@ -191,6 +191,50 @@ M9SingleSite::downloadMotions(void) { qDebug() << "M9SingleSite::downloadMotions called"; + // if user has not checked + if (!useAPI->isChecked()) { + // pop up a window to ask for username and password + QDialog *dialog = new QDialog(); + dialog->setWindowTitle("Login to Tapis"); + QVBoxLayout *layout = new QVBoxLayout(dialog); + QLineEdit *usernameEdit = new QLineEdit(dialog); + usernameEdit->setPlaceholderText("Username"); + layout->addWidget(usernameEdit); + QLineEdit *passwordEdit = new QLineEdit(dialog); + passwordEdit->setPlaceholderText("Password"); + passwordEdit->setEchoMode(QLineEdit::Password); + layout->addWidget(passwordEdit); + QPushButton *loginButton = new QPushButton("Login", dialog); + layout->addWidget(loginButton); + dialog->setLayout(layout); + connect(loginButton, &QPushButton::clicked, [=]() { + // check if the username and password are not empty + if (usernameEdit->text().isEmpty() || passwordEdit->text().isEmpty()) { + errorMessage("Error: Username and password cannot be empty"); + return; + } + // close the dialog + dialog->accept(); + + }); + // make the dialog appear in the center of the screen i nstead of the top left corner + // keep the dialog dimensions the same + QScreen *screen = qApp->primaryScreen(); + QRect screenGeometry = screen->availableGeometry(); + int x = (screenGeometry.width() - dialog->width()) / 2; + int y = (screenGeometry.height() - dialog->height()) / 2; + dialog->move(x, y); + dialog->exec(); + // save the username and password + username = usernameEdit->text(); + password = passwordEdit->text(); + + } + + + + + // // get tmp directory to store motions, if it exists remove // @@ -230,7 +274,9 @@ M9SingleSite::downloadMotions(void) << QString("-g") << currentGrid << QString("-n") << QString::number(numMotion) << QString("-o") << destDir - << QString("--API") << QString::number(useAPI->isChecked()); + << QString("--API") << QString::number(useAPI->isChecked()) + << "--username" << username + << "--password" << password; /* QJsonObject information; diff --git a/EVENTS/physicsBasedSimulation/M9SingleSite.h b/EVENTS/physicsBasedSimulation/M9SingleSite.h index 50c8b263..bd5f36a3 100644 --- a/EVENTS/physicsBasedSimulation/M9SingleSite.h +++ b/EVENTS/physicsBasedSimulation/M9SingleSite.h @@ -91,6 +91,8 @@ public slots: QPushButton *getMotions; bool downloadedMotions; bool motionsDownloading; + QString username; + QString password; }; #endif // M9_SINGLE_SITE_WIDGET_H From 8817f220af8130bc360a97648d3d5367c4af7b21 Mon Sep 17 00:00:00 2001 From: Amin Date: Mon, 30 Sep 2024 18:39:22 -0700 Subject: [PATCH 2/3] Adding DRM model to EEUQ tool --- WorkflowAppEE_UQ.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/WorkflowAppEE_UQ.cpp b/WorkflowAppEE_UQ.cpp index 604b4ac4..6a7a6ce3 100644 --- a/WorkflowAppEE_UQ.cpp +++ b/WorkflowAppEE_UQ.cpp @@ -87,6 +87,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS. #include #include #include +#include #include #include "CustomizedItemModel.h" @@ -245,6 +246,15 @@ WorkflowAppEE_UQ::setMainWindow(MainWindowWorkflowApp* window) { theDialog->showTool("ShakerMaker"); }); + // DRM Model + DRM_Model *theDRM_Model = new DRM_Model(); + theToolDialog->addTool(theDRM_Model, "Domain Reduction Method Analysis"); + QAction *showDRM_Model = toolsMenu->addAction("&Domain Reduction Method Analysis"); + connect(showDRM_Model, &QAction::triggered, this,[this, theDialog=theToolDialog, theEmp = theDRM_Model] { + theDialog->showTool("Domain Reduction Method Analysis"); + }); + + // opensees@designsafe RemoteOpenSeesApp *theOpenSeesApp = new RemoteOpenSeesApp(); From 33be67ef2edd39c0d18ec823c49498272856d74c Mon Sep 17 00:00:00 2001 From: yisangriB Date: Mon, 30 Sep 2024 19:38:24 -0700 Subject: [PATCH 3/3] sy - fixing broken signal-slots in EE for surrogate --- EVENTS/EarthquakeEventSelection.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EVENTS/EarthquakeEventSelection.cpp b/EVENTS/EarthquakeEventSelection.cpp index e58ae5a1..c4ef895a 100644 --- a/EVENTS/EarthquakeEventSelection.cpp +++ b/EVENTS/EarthquakeEventSelection.cpp @@ -91,7 +91,8 @@ EarthquakeEventSelection::~EarthquakeEventSelection() void EarthquakeEventSelection::replyEventType(void) { - qDebug() << "EarthquakeEventSelection::replyEventType(void)- HUH"; + emit typeEVT("EQ"); + //qDebug() << "EarthquakeEventSelection::replyEventType(void)- HUH"; }