Skip to content

Commit

Permalink
Merge branch 'ControlSystemStudio:master' into advancedConverter
Browse files Browse the repository at this point in the history
  • Loading branch information
katysaintin authored Sep 17, 2024
2 parents aaf1d8b + 8c43a2f commit 5f3db70
Show file tree
Hide file tree
Showing 84 changed files with 1,287 additions and 382 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 @@ -204,7 +204,7 @@ public void setMode(final boolean maintenance) throws Exception {
try {
final String json = new String(JsonModelWriter.commandToBytes(cmd));
final ProducerRecord<String, String> record = new ProducerRecord<>(command_topic, AlarmSystem.COMMAND_PREFIX + root.getPathName(), json);
producer.send(record).get(KAFKA_CLIENT_TIMEOUT, TimeUnit.SECONDS);
producer.send(record);
} catch (final Exception ex) {
logger.log(Level.WARNING, "Cannot set mode for " + root + " to " + cmd, ex);
throw ex;
Expand All @@ -222,7 +222,7 @@ public void setNotify(final boolean disable_notify) throws Exception {
try {
final String json = new String(JsonModelWriter.commandToBytes(cmd));
final ProducerRecord<String, String> record = new ProducerRecord<>(command_topic, AlarmSystem.COMMAND_PREFIX + root.getPathName(), json);
producer.send(record).get(KAFKA_CLIENT_TIMEOUT, TimeUnit.SECONDS);
producer.send(record);
} catch (final Exception ex) {
logger.log(Level.WARNING, "Cannot set mode for " + root + " to " + cmd, ex);
throw ex;
Expand Down Expand Up @@ -525,7 +525,7 @@ private void sendNewItemInfo(String path_name, final String new_name, final Alar
public void sendItemConfigurationUpdate(final String path, final AlarmTreeItem<?> config) throws Exception {
final String json = new String(JsonModelWriter.toJsonBytes(config));
final ProducerRecord<String, String> record = new ProducerRecord<>(config_topic, AlarmSystem.CONFIG_PREFIX + path, json);
producer.send(record).get(KAFKA_CLIENT_TIMEOUT, TimeUnit.SECONDS);
producer.send(record);
}

/**
Expand Down Expand Up @@ -570,7 +570,7 @@ public void acknowledge(final AlarmTreeItem<?> item, final boolean acknowledge)
final String cmd = acknowledge ? "acknowledge" : "unacknowledge";
final String json = new String(JsonModelWriter.commandToBytes(cmd));
final ProducerRecord<String, String> record = new ProducerRecord<>(command_topic, AlarmSystem.COMMAND_PREFIX + item.getPathName(), json);
producer.send(record).get(KAFKA_CLIENT_TIMEOUT, TimeUnit.SECONDS);
producer.send(record);
} catch (final Exception ex) {
logger.log(Level.WARNING, "Cannot acknowledge component " + item, ex);
throw ex;
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 @@ -28,6 +28,7 @@
public class ExecuteCommandAction extends ActionInfoBase {

public static final String EXECUTE_COMMAND = "command";
private static final Integer PRIORITY = 40;
private String command;
private ExecuteCommandActionController executeCommandActionController;

Expand All @@ -51,6 +52,10 @@ public Image getImage() {
return ImageCache.getImage(ActionsDialog.class, "/icons/execute_script.png");
}

@Override
public Integer getPriority() {
return PRIORITY;
}

@Override
public void readFromXML(ModelReader modelReader, Element actionXml) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class ExecuteScriptAction extends ActionInfoBase {
public static final String EXECUTE_PYTHONSCRIPT = "EXECUTE_PYTHONSCRIPT";
public static final String EXECUTE_JAVASCRIPT = "EXECUTE_JAVASCRIPT";

private static final Integer PRIORITY = 30;

private ScriptInfo scriptInfo;
private String text;
private String path;
Expand Down Expand Up @@ -186,4 +188,9 @@ public ActionInfo commit(){
description = executeScriptController.getDescription();
return this;
}

@Override
public Integer getPriority() {
return PRIORITY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class OpenDisplayAction extends ActionInfoBase {

public static final String OPEN_DISPLAY = "open_display";

private static final Integer PRIORITY = 10;

private OpenDisplayActionController openDisplayActionController;

private static final Logger logger = Logger.getLogger(OpenDisplayAction.class.getName());
Expand Down Expand Up @@ -259,6 +261,11 @@ public Image getImage() {
return ImageCache.getImage(ActionsDialog.class, "/icons/open_display.png");
}

@Override
public Integer getPriority() {
return PRIORITY;
}

@Override
public Node getEditor(Widget widget) {
if (editorUi != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
public class OpenFileAction extends ActionInfoBase {

public static final String OPEN_FILE = "open_file";
private static final Integer PRIORITY = 50;
private String file;

private OpenFileActionController openFileActionController;
Expand Down Expand Up @@ -77,6 +78,11 @@ public Image getImage() {
return ImageCache.getImage(ActionsDialog.class, "/icons/open_file.png");
}

@Override
public Integer getPriority() {
return PRIORITY;
}

public String getFile() {
return file;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
public class OpenWebPageAction extends ActionInfoBase {

public static final String OPEN_WEBPAGE = "open_webpage";
private static final Integer PRIORITY = 60;
private String url;
private OpenWebPageActionController openWebPageController;

Expand Down Expand Up @@ -65,6 +66,11 @@ public Image getImage() {
return ImageCache.getImage(ActionsDialog.class, "/icons/web_browser.png");
}

@Override
public Integer getPriority() {
return PRIORITY;
}

public String getURL() {
return url;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class WritePVAction extends ActionInfoBase {
private String value = "0";

public static final String WRITE_PV = "write_pv";
private static final Integer PRIORITY = 20;
private final Logger logger = Logger.getLogger(WritePVAction.class.getName());

private WritePVActionController writePVActionController;
Expand Down Expand Up @@ -86,6 +87,16 @@ public Image getImage() {
return ImageCache.getImage(ActionsDialog.class, "/icons/write_pv.png");
}

@Override
public Integer getPriority() {
return PRIORITY;
}

@Override
public boolean matchesAction(String actionId) {
return actionId.equalsIgnoreCase(WRITE_PV);
}

public String getPV() {
return pv;
}
Expand Down
Loading

0 comments on commit 5f3db70

Please sign in to comment.