Skip to content

Commit

Permalink
Merge branch 'ControlSystemStudio:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
katysaintin authored Sep 3, 2024
2 parents e4a4c4f + 5570e37 commit 1e5450c
Show file tree
Hide file tree
Showing 59 changed files with 1,013 additions and 318 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build_swagger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: build Swagger documentation

on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Maven and Java Action
uses: s4u/[email protected]
with:
java-version: '17'
maven-version: '3.9.6'
- name: Get swagger.json
run: |
cd ./services/alarm-logger
mvn spring-boot:run &
export jobpid="$!"
sleep 30
curl http://localhost:8080/v3/api-docs --output ../../docs/swagger.json
kill "$jobpid"
- name: Archive swagger.json
uses: actions/upload-artifact@v4
with:
name: swagger.json
path: docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ else if(clazz.isAssignableFrom(AdvancedSearchViewController.class)){
});
tab = new DockItem(this, loader.load());
controller = loader.getController();
tab.setOnClosed(event -> {
tab.addClosedNotification(() -> {
controller.shutdown();
});
if (resource != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.phoebus.framework.spi.AppInstance;
import org.phoebus.framework.util.ResourceParser;
import org.phoebus.ui.dialog.ExceptionDetailsErrorDialog;
import org.phoebus.ui.docking.DockItem;
import org.phoebus.ui.docking.DockItemWithInput;
import org.phoebus.ui.docking.DockPane;

Expand Down Expand Up @@ -160,6 +161,10 @@ public DataBrowserInstance(final DataBrowserApp app, final boolean minimal)
perspective.getModel().addListener(model_listener);
}

public DockItem getDockItem() {
return dock_item;
}

@Override
public AppDescriptor getAppDescriptor()
{
Expand All @@ -178,7 +183,7 @@ public void raise()
dock_item.select();
}

void loadResource(final URI input)
public void loadResource(final URI input)
{
// Set input ASAP so that other requests to open this
// resource will find this instance and not start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public class Messages
FormulaTabTT,
Grid,
GridLbl,
HideAll,
HideTraceWarning,
HideTraceWarningDetail,
ImportActionLabelFmt,
Expand Down Expand Up @@ -269,6 +270,7 @@ public class Messages
SelectTrace,
SeverityColumn,
SeverityStatusFmt,
ShowAll,
StartEndDialogBtn,
StartEndDialogTT,
StartTimeLbl,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018 Oak Ridge National Laboratory.
* Copyright (c) 2018-2024 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -10,14 +10,15 @@
import org.phoebus.framework.workbench.ApplicationService;
import org.phoebus.ui.javafx.ImageCache;
import org.phoebus.ui.spi.MenuEntry;
import org.phoebus.ui.spi.ToolbarEntry;

import javafx.scene.image.Image;

/** Menu entry for opening data browser
/** Menu and toolbar entry for opening data browser
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
public class OpenDataBrowser implements MenuEntry
public class OpenDataBrowser implements MenuEntry, ToolbarEntry
{
@Override
public String getName()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*******************************************************************************
* Copyright (c) 2024 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/
package org.csstudio.trends.databrowser3.ui.properties;

import org.csstudio.trends.databrowser3.Activator;
import org.csstudio.trends.databrowser3.Messages;
import org.csstudio.trends.databrowser3.model.AxisConfig;
import org.csstudio.trends.databrowser3.model.Model;
import org.csstudio.trends.databrowser3.model.ModelItem;
import org.phoebus.ui.undo.UndoableAction;
import org.phoebus.ui.undo.UndoableActionManager;

import javafx.scene.control.MenuItem;

/** MenuItem to show or hide all items
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
public class ShowHideAllAction extends MenuItem
{
private class ShowHideAll extends UndoableAction
{
final private Model model;
final private boolean show;

ShowHideAll(final UndoableActionManager operations_manager,
final Model model, final boolean show)
{
super(show ? Messages.ShowAll : Messages.HideAll);
this.model = model;
this.show = show;
operations_manager.execute(this);
}

@Override
public void run()
{
for (ModelItem item : model.getItems())
item.setVisible(show);
for (AxisConfig axis : model.getAxes())
axis.setVisible(model.hasAxisActiveItems(axis));
}

@Override
public void undo()
{
for (ModelItem item : model.getItems())
item.setVisible(!show);
for (AxisConfig axis : model.getAxes())
axis.setVisible(model.hasAxisActiveItems(axis));
}
}

/** @param model Model
* @param undo Undo manager
* @param show Show all, or hide all?
*/
public ShowHideAllAction(final Model model, final UndoableActionManager undo, final boolean show)
{
super(show ? Messages.ShowAll : Messages.HideAll,
Activator.getIcon(show ? "checkbox" : "checkbox_unchecked"));
setOnAction(event -> new ShowHideAll(undo, model, show));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018-2020 Oak Ridge National Laboratory.
* Copyright (c) 2018-2024 Oak Ridge National Laboratory.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -733,6 +733,12 @@ private void createContextMenu()
items.add(new EditMultipleItemsAction(trace_table, model, undo, selection));

items.add(new SeparatorMenuItem());


items.add(new ShowHideAllAction(model, undo, true));
items.add(new ShowHideAllAction(model, undo, false));

items.add(new SeparatorMenuItem());

// Add PV-based entries
final List<ProcessVariable> pvs = selection.stream()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.csstudio.trends.databrowser3.OpenDataBrowser
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ FormulaTabVariable=Variable
FormulaTabTT=Double-click input to add to formula, or edit variable name
Grid=Grid
GridLbl=Grid:
HideAll=Hide All
HideTraceWarning=Hide Trace?
HideTraceWarningDetail=Hiding a trace can be useful to...\na) temporarily reduce the number of traces on the plot\nb) hide formula input PVs where you are interested in the formula,\n but not the individual inputs\n\nNote however that the Databrowser will still sample data for the hidden trace and request archived data for it so that it's 'ready' when you want to show it again.\n\nIf you don't need this item at all, you should delete it instead of hiding it.\n\nHide trace?
ImportActionLabelFmt=Import {0}
Expand Down Expand Up @@ -249,6 +250,7 @@ SearchTT=Start the channel name search
SelectTrace=Select trace to see data sources
SeverityColumn=Severity
SeverityStatusFmt={0} / {1}
ShowAll=Show All
StartEndDialogBtn=...
StartEndDialogTT=Open start/end time dialog box
StartTimeLbl=Start Time:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public OlogAttachment deserialize(JsonParser jp, DeserializationContext ctxt)
String fileMetadataDescription = node.get("fileMetadataDescription").asText();
OlogAttachment a = new OlogAttachment();
a.setFileName(filename);
a.setId(id);
a.setContentType(fileMetadataDescription);
return a;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ else if(clazz.isAssignableFrom(AdvancedSearchViewController.class)){
log.log(Level.SEVERE, "Failed to acquire a valid logbook client");
}
tab = new DockItem(this, loader.getRoot());
tab.setOnClosed(event -> {
controller.shutdown();
});
tab.addClosedNotification(()-> controller.shutdown());
DockPane.getActiveDockPane().addTab(tab);
} catch (IOException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ChangeListener;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToolBar;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import org.phoebus.logbook.LogEntry;
import org.phoebus.logbook.olog.ui.write.LogEntryEditorStage;
import org.phoebus.olog.es.api.model.LogGroupProperty;
import org.phoebus.olog.es.api.model.OlogLog;
import org.phoebus.ui.javafx.ImageCache;


public class LogEntryDisplayController {
Expand All @@ -52,12 +58,23 @@ public class LogEntryDisplayController {
@FXML
private Button replyButton;
@FXML
private Region spring;
@FXML
private Button goBackButton;
@FXML
private Button goForwardButton;
@FXML
private BorderPane emptyPane;
@FXML
private Node singleLogEntryDisplay;
@FXML
private Node mergedLogEntryDisplay;

ImageView goBackButtonIcon = ImageCache.getImageView(LogEntryDisplayController.class, "/icons/backward_nav.png");
ImageView goBackButtonIconDisabled = ImageCache.getImageView(LogEntryDisplayController.class, "/icons/backward_disabled.png");
ImageView goForwardButtonIcon = ImageCache.getImageView(LogEntryDisplayController.class, "/icons/forward_nav.png");
ImageView goForwardButtonIconDisabled = ImageCache.getImageView(LogEntryDisplayController.class, "/icons/forward_disabled.png");

private final SimpleObjectProperty<LogEntry> logEntryProperty =
new SimpleObjectProperty<>();

Expand All @@ -82,6 +99,19 @@ public void initialize() {
.bind(Bindings.createBooleanBinding(() -> currentViewProperty.get() == SINGLE, currentViewProperty));
mergedLogEntryDisplay.visibleProperty()
.bind(Bindings.createBooleanBinding(() -> currentViewProperty.get() == MERGED, currentViewProperty));
HBox.setHgrow(spring, Priority.ALWAYS); // Spring to make subsequent elements right-aligned in the toolbar.

{
ChangeListener<Boolean> goBackButtonDisabledPropertyChangeListener = (property, oldValue, newValue) -> goBackButton.setGraphic(newValue ? goBackButtonIconDisabled : goBackButtonIcon);
goBackButton.disableProperty().addListener(goBackButtonDisabledPropertyChangeListener);
goBackButtonDisabledPropertyChangeListener.changed(goBackButton.disableProperty(), false, true);
}

{
ChangeListener<Boolean> goForwardButtonDisabledPropertyChangeListener = (property, oldValue, newValue) -> goForwardButton.setGraphic(newValue ? goForwardButtonIconDisabled : goForwardButtonIcon);
goForwardButton.disableProperty().addListener(goForwardButtonDisabledPropertyChangeListener);
goForwardButtonDisabledPropertyChangeListener.changed(goForwardButton.disableProperty(), false, true);
}
}

@FXML
Expand Down Expand Up @@ -116,6 +146,20 @@ public void newLogEntry(){
new LogEntryEditorStage(new OlogLog(), null, null).show();
}

@FXML
public void goBack() {
if (logEntryTableViewController.goBackAndGoForwardActions.isPresent()) {
logEntryTableViewController.goBackAndGoForwardActions.get().goBack();
}
}

@FXML
public void goForward() {
if (logEntryTableViewController.goBackAndGoForwardActions.isPresent()) {
logEntryTableViewController.goBackAndGoForwardActions.get().goForward();
}
}

public void setLogEntry(LogEntry logEntry) {
if(logEntry == null){
currentViewProperty.set(EMPTY);
Expand Down Expand Up @@ -147,5 +191,9 @@ public void updateLogEntry(LogEntry logEntry){

public void setLogEntryTableViewController(LogEntryTableViewController logEntryTableViewController){
this.logEntryTableViewController = logEntryTableViewController;
if (logEntryTableViewController.goBackAndGoForwardActions.isPresent()) {
goBackButton.disableProperty().bind(Bindings.isEmpty(logEntryTableViewController.goBackAndGoForwardActions.get().goBackActions));
goForwardButton.disableProperty().bind(Bindings.isEmpty(logEntryTableViewController.goBackAndGoForwardActions.get().goForwardActions));
}
}
}
Loading

0 comments on commit 1e5450c

Please sign in to comment.