diff --git a/sirepo/package_data/static/css/sirepo-dark.css b/sirepo/package_data/static/css/sirepo-dark.css index 94ff74cb34..6231e25a91 100644 --- a/sirepo/package_data/static/css/sirepo-dark.css +++ b/sirepo/package_data/static/css/sirepo-dark.css @@ -152,7 +152,7 @@ .modal-backdrop.in { opacity: 0.7; } - .panel-info > .panel-heading { + .panel-info > .panel-heading, .btn-info { border-color: var(--sr-panel-border-dark-mode); background-color: var(--sr-panel-heading-bg-dark-mode); } @@ -290,4 +290,12 @@ .sr-lattice-marker > path { stroke: var(--sr-panel-text-dark-mode); } + + input[type="datetime-local"] { + color-scheme: dark; + } + + .sr-button-bar { + background-color: var(--sr-bg-dark-mode); + } } diff --git a/sirepo/package_data/static/js/raydata.js b/sirepo/package_data/static/js/raydata.js index 4e0bb386ab..c5a32af28b 100644 --- a/sirepo/package_data/static/js/raydata.js +++ b/sirepo/package_data/static/js/raydata.js @@ -5,12 +5,6 @@ var srdbg = SIREPO.srdbg; SIREPO.app.config(() => { SIREPO.appFieldEditors += ` -
-
-
-
-
-
@@ -313,34 +307,6 @@ SIREPO.app.directive('columnPicker', function() { }; }); -SIREPO.app.directive('dateTimePicker', function() { - return { - restrict: 'A', - scope: { - model: '=', - field: '=', - }, - template: ``, - controller: function($scope, timeService) { - $scope.dateTime = $scope.model[$scope.field] ? timeService.unixTimeToDate($scope.model[$scope.field]) : ''; - $scope.$watch('dateTime', function(newTime, oldTime) { - if ( - (newTime && !oldTime) || - (newTime && newTime.getTime() !== oldTime.getTime()) - ) { - $scope.model[$scope.field] = timeService.unixTime(newTime); - } - }); - - $scope.$watch('model.' + $scope.field, function(newTime, oldTime) { - if (newTime !== oldTime) { - $scope.dateTime = timeService.unixTimeToDate(newTime); - } - }); - } - }; -}); - SIREPO.app.directive('dotsAnimation', function() { return { restrict: 'A', @@ -378,52 +344,6 @@ SIREPO.app.directive('pngImage', function(plotting) { }; }); -SIREPO.app.directive('presetTimePicker', function() { - return { - restrict: 'A', - scope: { - model: '=', - modelName: '=', - }, - template: ` - - - - - `, - controller: function(appState, timeService, $scope) { - $scope.setDefaultStartStopTime = () => { - if (!$scope.model.searchStartTime && !$scope.model.searchStopTime) { - $scope.setSearchTimeLastHour(); - appState.saveChanges($scope.modelName); - } - }; - - $scope.setSearchTimeLastDay = () => { - $scope.model.searchStartTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeOneDayAgo()); - $scope.model.searchStopTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeNow()); - }; - - $scope.setSearchTimeLastHour = () => { - $scope.model.searchStartTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeOneHourAgo()); - $scope.model.searchStopTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeNow()); - }; - - $scope.setSearchTimeLastWeek = () => { - $scope.model.searchStartTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeOneWeekAgo()); - $scope.model.searchStopTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeNow()); - }; - - $scope.setSearchTimeMaxRange = () => { - $scope.model.searchStartTime = timeService.roundUnixTimeToMinutes(60); - $scope.model.searchStopTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeNow()); - }; - - $scope.setDefaultStartStopTime(); - } - }; -}); - SIREPO.app.directive('scansTable', function() { return { restrict: 'A', diff --git a/sirepo/package_data/static/js/sirepo-components.js b/sirepo/package_data/static/js/sirepo-components.js index 8551f698ff..87ee79db4b 100644 --- a/sirepo/package_data/static/js/sirepo-components.js +++ b/sirepo/package_data/static/js/sirepo-components.js @@ -305,7 +305,7 @@ SIREPO.app.directive('basicEditorPanel', function(appState, panelState) { }; }); -SIREPO.app.directive('buttons', function(appState, panelState) { +SIREPO.app.directive('buttons', function(appState, panelState, stringsService) { return { restrict: 'A', scope: { @@ -316,7 +316,7 @@ SIREPO.app.directive('buttons', function(appState, panelState) { }, template: `
- +
`, @@ -365,7 +365,11 @@ SIREPO.app.directive('buttons', function(appState, panelState) { return ctlsValid && $scope.form.$valid; }; - $scope.saveChanges = function() { + $scope.saveButtonLabel = () => { + return stringsService.saveButtonLabel($scope.modelName); + }; + + $scope.saveChanges = function() { if ($scope.form.$valid) { appState.saveChanges(Object.keys(fieldsByModel)); } @@ -847,6 +851,17 @@ SIREPO.app.directive('fieldEditor', function(appState, keypressService, panelSta
+
+
+
+
+
+
+
+ +
${SIREPO.appFieldEditors}
@@ -5592,3 +5607,77 @@ SIREPO.app.directive('srDroppable', function() { }, }; }); + +SIREPO.app.directive('dateTimePicker', function() { + return { + restrict: 'A', + scope: { + model: '=', + field: '=', + }, + template: ``, + controller: function($scope, timeService) { + $scope.dateTime = $scope.model[$scope.field] ? timeService.unixTimeToDate($scope.model[$scope.field]) : ''; + $scope.$watch('dateTime', function(newTime, oldTime) { + if ( + (newTime && !oldTime) || + (newTime && newTime.getTime() !== oldTime.getTime()) + ) { + $scope.model[$scope.field] = timeService.unixTime(newTime); + } + }); + + $scope.$watch('model.' + $scope.field, function(newTime, oldTime) { + if (newTime !== oldTime) { + $scope.dateTime = timeService.unixTimeToDate(newTime); + } + }); + } + }; +}); + +SIREPO.app.directive('presetTimePicker', function() { + return { + restrict: 'A', + scope: { + model: '=', + modelName: '=', + }, + template: ` + + + + + `, + controller: function(appState, timeService, $scope) { + $scope.setDefaultStartStopTime = () => { + if (!$scope.model.searchStartTime && !$scope.model.searchStopTime) { + $scope.setSearchTimeLastHour(); + appState.saveChanges($scope.modelName); + } + }; + + $scope.setSearchTimeLastDay = () => { + $scope.model.searchStartTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeOneDayAgo()); + $scope.model.searchStopTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeNow()); + }; + + $scope.setSearchTimeLastHour = () => { + $scope.model.searchStartTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeOneHourAgo()); + $scope.model.searchStopTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeNow()); + }; + + $scope.setSearchTimeLastWeek = () => { + $scope.model.searchStartTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeOneWeekAgo()); + $scope.model.searchStopTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeNow()); + }; + + $scope.setSearchTimeMaxRange = () => { + $scope.model.searchStartTime = timeService.roundUnixTimeToMinutes(60); + $scope.model.searchStopTime = timeService.roundUnixTimeToMinutes(timeService.unixTimeNow()); + }; + + $scope.setDefaultStartStopTime(); + } + }; +}); diff --git a/sirepo/package_data/static/js/sirepo.js b/sirepo/package_data/static/js/sirepo.js index e0602919f6..d4b9edeb80 100644 --- a/sirepo/package_data/static/js/sirepo.js +++ b/sirepo/package_data/static/js/sirepo.js @@ -932,12 +932,16 @@ SIREPO.app.factory('appDataService', function() { SIREPO.app.factory('stringsService', function(authState) { const strings = SIREPO.APP_SCHEMA.strings; - function typeOfSimulation(modelName) { + function lookup(modelName, key) { let s; - if (modelName && strings[modelName] && strings[modelName].typeOfSimulation) { - s = strings[modelName].typeOfSimulation; + if (modelName && strings[modelName] && strings[modelName][key]) { + s = strings[modelName][key]; } - return ucfirst(s || strings.typeOfSimulation); + return s || strings[key]; + } + + function typeOfSimulation(modelName) { + return ucfirst(lookup(modelName, 'typeOfSimulation')); } function ucfirst(str) { @@ -972,6 +976,9 @@ SIREPO.app.factory('stringsService', function(authState) { }, sbatchLoginServiceStatus: () => {return 'Requesting login status...';}, sbatchLoginServiceLogin: () => {return `Login to ${authState.sbatchHostDisplayName}`;}, + saveButtonLabel: (modelName) => { + return lookup(modelName, 'save') || 'Save'; + }, startButtonLabel: (modelName) => { return `Start New ${typeOfSimulation(modelName)}`; },