Skip to content
1 change: 1 addition & 0 deletions ApplicationLibCode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ list(
ProjectDataModel/CellFilters/CMakeLists_files.cmake
ProjectDataModel/ProcessControl/CMakeLists_files.cmake
ProjectDataModel/Polygons/CMakeLists_files.cmake
ProjectDataModel/Workflow/CMakeLists_files.cmake
ProjectDataModel/WellLog/CMakeLists_files.cmake
ProjectDataModel/WellLog/WellLogTrack/CMakeLists_files.cmake
ProjectDataModel/WellMeasurement/CMakeLists_files.cmake
Expand Down
1 change: 1 addition & 0 deletions ApplicationLibCode/Commands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ set(COMMAND_REFERENCED_CMAKE_FILES
FractureCommands/CMakeLists_files.cmake
PlotBuilderCommands/CMakeLists_files.cmake
PolygonCommands/CMakeLists_files.cmake
WorkflowCommands/CMakeLists_files.cmake
Sumo/CMakeLists_files.cmake
ToolCommands/CMakeLists_files.cmake
3dView/CMakeLists_files.cmake
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewWorkflowJobFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRunWorkflowJobFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCancelWorkflowJobFeature.h
)

set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewWorkflowJobFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRunWorkflowJobFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCancelWorkflowJobFeature.cpp
)

list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
list(APPEND COMMAND_CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////

#include "RicCancelWorkflowJobFeature.h"

#include "Workflow/RimWorkflowJob.h"

#include "cafSelectionManagerTools.h"

#include <QAction>

CAF_CMD_SOURCE_INIT( RicCancelWorkflowJobFeature, "RicCancelWorkflowJobFeature" );

void RicCancelWorkflowJobFeature::onActionTriggered( bool isChecked )
{
auto jobs = caf::selectedObjectsByType<RimWorkflowJob*>();
if ( jobs.size() != 1 ) return;
jobs.front()->cancelJob();
}

void RicCancelWorkflowJobFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Cancel Job" );
actionToSetup->setIcon( QIcon( ":/stop.svg" ) );
}

bool RicCancelWorkflowJobFeature::isCommandEnabled() const
{
auto jobs = caf::selectedObjectsByType<RimWorkflowJob*>();
return jobs.size() == 1 && jobs.front()->isRunning();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "cafCmdFeature.h"

class RicCancelWorkflowJobFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;

protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
bool isCommandEnabled() const override;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////

#include "RicNewWorkflowJobFeature.h"

#include "Workflow/RimWorkflow.h"
#include "Workflow/RimWorkflowJob.h"

#include "RiaLogging.h"

#include "cafPdmDefaultObjectFactory.h"
#include "cafSelectionManagerTools.h"

#include <QAction>

CAF_CMD_SOURCE_INIT( RicNewWorkflowJobFeature, "RicNewWorkflowJobFeature" );

void RicNewWorkflowJobFeature::onActionTriggered( bool isChecked )
{
auto workflows = caf::selectedObjectsByType<RimWorkflow*>();
if ( workflows.size() != 1 ) return;

RimWorkflow* workflow = workflows.front();
auto jobs = workflow->jobs();
if ( jobs.empty() )
{
RiaLogging::warning( "Cannot create a new job: workflow has no template job to clone." );
return;
}

auto* clone =
dynamic_cast<RimWorkflowJob*>( jobs.front()->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
if ( !clone ) return;

clone->setJobName( QString( "Job %1" ).arg( jobs.size() + 1 ) );
workflow->addJob( clone );
clone->resolveReferencesRecursively();
workflow->uiCapability()->updateAllRequiredEditors();
}

void RicNewWorkflowJobFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New Job" );
actionToSetup->setIcon( QIcon( ":/caf/duplicate.svg" ) );
}

bool RicNewWorkflowJobFeature::isCommandEnabled() const
{
return caf::selectedObjectsByType<RimWorkflow*>().size() == 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "cafCmdFeature.h"

class RicNewWorkflowJobFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;

protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
bool isCommandEnabled() const override;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////

#include "RicRunWorkflowJobFeature.h"

#include "Workflow/RimWorkflowJob.h"

#include "cafSelectionManagerTools.h"

#include <QAction>

CAF_CMD_SOURCE_INIT( RicRunWorkflowJobFeature, "RicRunWorkflowJobFeature" );

void RicRunWorkflowJobFeature::onActionTriggered( bool isChecked )
{
auto jobs = caf::selectedObjectsByType<RimWorkflowJob*>();
if ( jobs.size() != 1 ) return;
jobs.front()->runJob();
}

void RicRunWorkflowJobFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Run" );
actionToSetup->setIcon( QIcon( ":/Play.svg" ) );
}

bool RicRunWorkflowJobFeature::isCommandEnabled() const
{
auto jobs = caf::selectedObjectsByType<RimWorkflowJob*>();
return jobs.size() == 1 && !jobs.front()->isRunning();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "cafCmdFeature.h"

class RicRunWorkflowJobFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;

protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
bool isCommandEnabled() const override;
};
8 changes: 8 additions & 0 deletions ApplicationLibCode/ProjectDataModel/RimProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
#include "Tools/RimAutomationSettings.h"
#include "VerticalFlowPerformance/RimVfpDataCollection.h"
#include "VerticalFlowPerformance/RimVfpPlotCollection.h"
#include "Workflow/RimWorkflowCollection.h"

#include "RiuPlotMainWindow.h"

Expand Down Expand Up @@ -136,6 +137,9 @@ RimProject::RimProject()
CAF_PDM_InitFieldNoDefault( &scriptCollection, "ScriptCollection", "Octave Scripts", ":/octave.png" );
scriptCollection.xmlCapability()->disableIO();

CAF_PDM_InitFieldNoDefault( &workflowCollection, "WorkflowCollection", "Workflows", ":/Folder.png" );
workflowCollection.xmlCapability()->disableIO();

CAF_PDM_InitFieldNoDefault( &m_jobCollection, "JobCollection", "Jobs", ":/gear.png" );

CAF_PDM_InitFieldNoDefault( &m_mainPlotCollection, "MainPlotCollection", "Plots" );
Expand Down Expand Up @@ -200,6 +204,9 @@ RimProject::RimProject()
scriptCollection->uiCapability()->setUiName( "Scripts" );
scriptCollection->uiCapability()->setUiIconFromResourceString( ":/octave.png" );

workflowCollection = new RimWorkflowCollection();
workflowCollection->uiCapability()->setUiName( "Workflows" );

m_mainPlotCollection = new RimMainPlotCollection();
m_pinnedFieldCollection = new RimQuickAccessCollection();
m_jobCollection = new RimJobCollection();
Expand Down Expand Up @@ -1484,6 +1491,7 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
{
uiTreeOrdering.add( scriptCollection() );
uiTreeOrdering.add( jobCollection() );
uiTreeOrdering.add( workflowCollection() );
}
else if ( uiConfigName == "PlotWindow.Templates" )
{
Expand Down
2 changes: 2 additions & 0 deletions ApplicationLibCode/ProjectDataModel/RimProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class RimObservedSummaryData;
class RimOilField;
class RimColorLegendCollection;
class RimScriptCollection;
class RimWorkflowCollection;
class RimSummaryCase;
class RimSummaryEnsemble;
class RimSummaryCaseMainCollection;
Expand Down Expand Up @@ -99,6 +100,7 @@ class RimProject : public caf::PdmDocument
caf::PdmChildArrayField<RimOilField*> oilFields;
caf::PdmChildField<RimColorLegendCollection*> colorLegendCollection;
caf::PdmChildField<RimScriptCollection*> scriptCollection;
caf::PdmChildField<RimWorkflowCollection*> workflowCollection;
caf::PdmChildField<RimViewLinkerCollection*> viewLinkerCollection;
caf::PdmChildField<RimSummaryCalculationCollection*> calculationCollection;
caf::PdmChildField<RimGridCalculationCollection*> gridCalculationCollection;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimWorkflow.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowJob.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowTaskInput.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowFieldBinding.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowStringBinding.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowFloatBinding.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowIntBinding.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowBoolBinding.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowCaseBinding.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowWellPathBinding.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowViewBinding.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowDateBinding.h
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowFilePathBinding.h
)

set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimWorkflow.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowJob.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowTaskInput.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowFieldBinding.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowStringBinding.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowFloatBinding.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowIntBinding.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowBoolBinding.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowCaseBinding.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowWellPathBinding.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowViewBinding.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowDateBinding.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWorkflowFilePathBinding.cpp
)

list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})

source_group(
"ProjectDataModel\\Workflow"
FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES}
${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake
)
Loading
Loading