Skip to content

Commit

Permalink
Fix #6677 - hide inactive field and validate total
Browse files Browse the repository at this point in the history
  • Loading branch information
git-user committed Jan 26, 2024
1 parent bad43d1 commit 73d1d45
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
32 changes: 27 additions & 5 deletions sirepo/package_data/static/js/cloudmc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2069,25 +2069,47 @@ SIREPO.app.directive('tallyAspects', function() {
};
});

SIREPO.viewLogic('settingsView', function(appState, panelState, $scope) {
SIREPO.viewLogic('settingsView', function(appState, panelState, validationService, $scope) {

function updateEditor() {
const m = appState.models[$scope.modelName];
const isRunModeEigenvalue = m.run_mode === 'eigenvalue';

function activeBatches() {
return m.batches - (isRunModeEigenvalue ? m.inactive : 0);
}

panelState.showFields('reflectivePlanes', [
['plane1a', 'plane1b', 'plane2a', 'plane2b'],
appState.models.reflectivePlanes.useReflectivePlanes === '1',
]);

panelState.showField(
panelState.showFields(
$scope.modelName,
[
['eigenvalueHistory', 'inactive'], isRunModeEigenvalue,
],
);

validationService.validateField(
$scope.modelName,
'eigenvalueHistory',
appState.models[$scope.modelName].run_mode === 'eigenvalue'
'batches',
'input',
activeBatches() > 0,
`Must have at least one active batch (currently ${activeBatches()})`
);

}

$scope.whenSelected = updateEditor;

$scope.watchFields = [
[`${$scope.modelName}.run_mode`, 'reflectivePlanes.useReflectivePlanes'], updateEditor,
[
`${$scope.modelName}.run_mode`,
`${$scope.modelName}.batches`,
`${$scope.modelName}.inactive`,
'reflectivePlanes.useReflectivePlanes'
], updateEditor,
];

});
Expand Down
4 changes: 2 additions & 2 deletions sirepo/package_data/static/json/cloudmc-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,9 +978,9 @@
"plane2b": ["Plane 2 B", "Float", 0]
},
"settings": {
"batches": ["Number of batches to simulation", "Integer", 1],
"batches": ["Number of batches to simulate", "Integer", 1, "", 1],
"eigenvalueHistory": ["Eigenvalue History", "Integer", 5],
"inactive": ["Number of inactive batches", "Integer", 0],
"inactive": ["Number of inactive batches", "Integer", 0, "These batches will be used to converge the eigenvalue before calculations begin"],
"particles": ["Number of particles per generation", "Integer", 5000],
"photon_transport": ["Photon transport", "Boolean", "0", "Simulate the passage of photons through matter"],
"sources": ["", "SourcesOrTallies", []],
Expand Down

0 comments on commit 73d1d45

Please sign in to comment.