Skip to content

Commit

Permalink
Fix #7074: impactt app (#7081)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Moeller <moeller@radiasoft.net>
  • Loading branch information
gurhar1133 and moellep authored May 30, 2024
1 parent 2c660bb commit dc6ad1e
Show file tree
Hide file tree
Showing 14 changed files with 1,146 additions and 58 deletions.
1 change: 1 addition & 0 deletions sirepo/feature_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
_NON_PROD_FOSS_CODES = frozenset(
(
"epicsllrf",
"impactt",
"myapp",
"hellweg",
)
Expand Down
2 changes: 2 additions & 0 deletions sirepo/package_data/static/html/impactt-source.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<div class="container-fluid">
</div>
8 changes: 8 additions & 0 deletions sirepo/package_data/static/html/impactt-visualization.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="container-fluid">
<div class="row">
<div class="col-md-6 col-xl-4">
<div data-simple-panel="simulationStatus">
<div data-sim-status-panel="visualization.simState"></div>
</div>
</div>
</div>
103 changes: 103 additions & 0 deletions sirepo/package_data/static/js/impactt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
'use strict';

var srlog = SIREPO.srlog;
var srdbg = SIREPO.srdbg;

SIREPO.app.config(function() {
SIREPO.appFieldEditors += ``;
SIREPO.lattice = {
elementColor: {
MULTIPOLE: 'yellow',
QUADRUPOLE: 'red',
DIPOLE: 'lightgreen',
SOLENOID: 'red',
DRIFT: 'grey',
},
elementPic: {
drift: ['DRIFT'],
lens: ['ROTATIONALLY_SYMMETRIC_TO_3D'],
magnet: ['MULTIPOLE', 'QUADRUPOLE', 'DIPOLE'],
solenoid: ['SOLENOID', 'SOLENOIDRF'],
watch: ['WRITE_BEAM'],
zeroLength: [
'CHANGE_TIMESTEP',
'SPACECHARGE',
'WAKEFIELD',
'STOP',
],
},
};
});

SIREPO.app.factory('impacttService', function(appState) {
const self = {};

self.computeModel = () => 'impacttReport';

appState.setAppService(self);
return self;
});


SIREPO.app.controller('SourceController', function(appState, $scope) {
var self = this;
});

SIREPO.app.controller('VisualizationController', function (appState, panelState, persistentSimulation, impacttService, $scope) {
const self = this;
self.simScope = $scope;

self.simHandleStatus = data => {};
self.simState = persistentSimulation.initSimulationState(self);
});

SIREPO.app.controller('LatticeController', function(latticeService, appState) {
var self = this;
self.latticeService = latticeService;

self.advancedNames = SIREPO.APP_SCHEMA.constants.advancedElementNames;
self.basicNames = SIREPO.APP_SCHEMA.constants.basicElementNames;

self.titleForName = function(name) {
return SIREPO.APP_SCHEMA.view[name].description;
};

});

SIREPO.app.directive('appFooter', function() {
return {
restrict: 'A',
scope: {
nav: '=appFooter',
},
template: `
<div data-common-footer="nav"></div>
`,
};
});

SIREPO.app.directive('appHeader', function(appState, panelState) {
return {
restrict: 'A',
scope: {
nav: '=appHeader',
},
template: `
<div data-app-header-brand="nav"></div>
<div data-app-header-left="nav"></div>
<div data-app-header-right="nav">
<app-header-right-sim-loaded>
<div data-sim-sections="">
<li class="sim-section" data-ng-class="{active: nav.isActive('lattice')}"><a href data-ng-click="nav.openSection('lattice')"><span class="glyphicon glyphicon-flash"></span> Lattice</a></li>
<li class="sim-section" data-ng-class="{active: nav.isActive('source')}"><a href data-ng-click="nav.openSection('source')"><span class="glyphicon glyphicon-flash"></span> Source</a></li>
<li class="sim-section" data-ng-class="{active: nav.isActive('visualization')}"><a href data-ng-click="nav.openSection('visualization')"><span class="glyphicon glyphicon-flash"></span> Visualization</a></li>
</div>
</app-header-right-sim-loaded>
<app-settings>
</app-settings>
<app-header-right-sim-list>
</app-header-right-sim-list>
</div>
`,
};
});
4 changes: 2 additions & 2 deletions sirepo/package_data/static/js/sirepo-lattice.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ SIREPO.app.factory('latticeService', function(appState, panelState, rpnService,

if ((SIREPO.lattice && SIREPO.lattice.useBeamlineListeners)
//TODO(pjm): change DRIFT apps to use lattice.useBeamlineListeners
|| SIREPO.APP_SCHEMA.model.DRIFT || SIREPO.APP_SCHEMA.model.DRIF) {
|| SIREPO.APP_SCHEMA.model.DRIFT || SIREPO.APP_SCHEMA.model.DRIF || SIREPO.APP_SCHEMA.model.DRIFTTUBE) {
appState.whenModelsLoaded($rootScope, function() {
self.activeBeamlineId = appState.models.simulation.activeBeamlineId;
});
Expand Down Expand Up @@ -1702,7 +1702,7 @@ SIREPO.app.directive('lattice', function(appState, latticeService, panelState, p
groupItem.width = 0.3;
groupItem.x -= 0.15;
}
groupItem.height = groupItem.width;
groupItem.height = 0.5;
groupItem.y = pos.y - groupItem.height / 2;
groupItem.color = getPicColor(item, 'lightblue');
}
Expand Down
Loading

0 comments on commit dc6ad1e

Please sign in to comment.