Skip to content

Commit

Permalink
Merge pull request #533 from DUNE-DAQ/feature_tdbe_qol
Browse files Browse the repository at this point in the history
Updates to textual based editor
  • Loading branch information
alessandrothea authored Nov 8, 2024
2 parents e681131 + 16bf7b0 commit 5d10ffb
Show file tree
Hide file tree
Showing 38 changed files with 1,017 additions and 363 deletions.
42 changes: 42 additions & 0 deletions config/textual_dbe/textual_css/add_object_layout.tcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
AddNewObjectScreen{
width: 50%;
background: grey 10%;
align: center middle;
}

AddNewObject{
width: 80%;
content-align-horizontal: center;
}

#object_add_box{
grid-size: 4 ;
grid-gutter: 1 2;
grid-rows: 1fr 3;
padding: 0 1;
width: 100%;
height: 11;
border: thick $background 80%;
align: center middle;
content-align: center middle;
background: $surface;
}

Input{
column-span: 2;
width: 50%;
}

Select{
column-span: 2;
width: 50%;
}

Button{
column-span: 1;
width: auto;
}

.buttons {
width: 100%;
}
29 changes: 29 additions & 0 deletions config/textual_dbe/textual_css/delete_screen.tcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
DeleteConfigObjectScreen {
align: center middle;
width: auto;
height: auto;
background: grey 10%;
}

#dialog {
grid-size: 2;
grid-gutter: 1 2;
grid-rows: 1fr 3;
padding: 0 1;
width: 60;
height: 11;
border: thick $background 80%;
background: $surface;
align: center middle;
}

#question {
column-span: 3;
height: 1fr;
width: 1fr;
content-align: center middle;
}

Button {
width: 100%;
}
24 changes: 24 additions & 0 deletions config/textual_dbe/textual_css/edit_cell_layout.tcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
EditCellScreen{
align: center middle;
width: 50%;
background: grey 10%;
content-align: center middle;
}

#edit_cell{
padding: 0 1;
width: 60;
height: 11;
border: thick $background 80%;
background: $surface;
align: center middle;
}

Label{
width: 100%;
content-align: center middle;
}

Input{
width: 100%;
}
8 changes: 6 additions & 2 deletions config/textual_dbe/textual_css/main_app_layout.tcss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Button{
width: 50%
}
color: blue;
}

SelectionPanel {
Expand All @@ -18,12 +19,15 @@ SelectionPanel {
}

RichLogWError{
align-vertical: bottom;
align-vertical: top;
width: 100%;
height: 60%;

}

ConfigTable{
width: 100%;
height: 50%;
height: 40%;
align-vertical: top;
}

28 changes: 28 additions & 0 deletions config/textual_dbe/textual_css/modify_object_layout.tcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ConfigObjectModifierScreen{
align: center middle;
}

SingleRelationshipModifier{
grid-size: 3;
grid-gutter: 1 2;
grid-rows: 1fr 3;
background: grey 10%;
}

Select{
column-span: 2;
width: 80%
}
#delete_rel{
column-span: 1;
}

RelationshipTypeGroup{
border: thick $background 80%;
padding: 0 1;
background: $surface;
}

RelationshipSelectPanel{
height: 80%
}
28 changes: 28 additions & 0 deletions config/textual_dbe/textual_css/quit_screen.tcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
QuitScreen {
align: center middle;
width: 80%;
background: grey 10%;
}

#dialog {
grid-size: 3;
grid-gutter: 1 2;
grid-rows: 1fr 3;
padding: 0 1;
width: 60;
height: 11;
border: thick $background 80%;
background: $surface;
align: center middle;
}

#question {
column-span: 3;
height: 1fr;
width: 1fr;
content-align: center middle;
}

Button {
width: 100%;
}
26 changes: 21 additions & 5 deletions config/textual_dbe/textual_css/save_menu_layout.tcss
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
SaveWithMessageScreen{
width: 50%;
align: center middle;
background: grey 10%;
}

RenameConfigObjectScreen{
align: center middle;
background: grey 10%;

}

OpenFileScreen{
width: 50%;
align: center middle;
content-align: center middle;
background: grey 10%;
}

__MenuWithButtons{
width: 80%;
content-align-horizontal: center;
}


#save_box{
background: $panel;
border: tall $background;
height: auto;
padding: 0 1;
width: 100%;
content-align: center middle
height: 11;
border: thick $background 80%;
align: center middle;
content-align: center middle;
background: $surface;
}

Button{
Expand All @@ -24,6 +39,7 @@ Button{
.save_message {
text-style: bold;
height: auto;
width: 100%;
content-align: center top;
}
.buttons {
Expand Down
30 changes: 15 additions & 15 deletions docs/TextualDBE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Textual Database Editor (DBE)
# CIDER
## Introduction
Textual DBE is an attempt to replicate [DBE](https://github.com/DUNE-DAQ/dbe/tree/develop) within a fully Pythonic interface. The tool allows for browsing and modification of configurations with a text-based (but mouse-navigable) interface written in Python. **This is not intended to be a full production ready solution and is purely a proof of concept!**
CIDER (Configuration Interface for Database Editing and Relational viewing) is an attempt to replicate [DBE](https://github.com/DUNE-DAQ/dbe/tree/develop) within a fully Pythonic interface. The tool allows for browsing and modification of configurations with a text-based (but mouse-navigable) interface written in Python. **This is not intended to be a full production ready solution and is purely a proof of concept!**

## Usage
Open database editor with `textual_dbe`. This will open a splash screen displaying a blank logger + footer bar which contains a list of shortcuts.
Open database editor with `textual_dbe [-f/--input-file input/file/path] `. This will open a splash screen displaying a blank logger + footer bar which contains a list of shortcuts. If input file is provided it will instead sip straight to the file file loaded screen.
![image](textual_dbe/splash_screen.png)

In order to start editing configuration databases we first need to open a file! To do this press `o` which will open the following popup. Currently the `browse` option is not implemented so the full (or relative) file path to a database file is required instead.
Expand All @@ -12,6 +12,8 @@ In order to start editing configuration databases we first need to open a file!
Once this has been loaded in the screen should update. The editor is split into 3 segments:
![image](textual_dbe/file_loaded_screen.png)

The navigator can then either be closed gracefully with `ctrl+q`

### The Navigator

#### Browsing Objects
Expand All @@ -25,26 +27,24 @@ The second "relationship" view will display the relationships between configurat
If an object in the navigator menu is selected it will be treated as `active` and its attributes will be displayed in the configuration object attribute table.

#### Disabling objects
Any objects that inherit from `component` can be disabled by selecting them + pressing `ctrl+d`.
Any objects that inherit from `component` can be disabled by selecting them + pressing d`.

### Configuration Object Attribute Table
The configuration table displays the values of attributes of the currently active configuration object. The values for these attributes can be modified by clicking on the row of the table which contains them. Type checking is very limited so this should be treated with caution
![image](textual_dbe/table_view.png)

After an object has been modified, it can then be saved by pressing `ctrl+s` or saved with an additional message with `shift+S`.

### Modifying Relationships between config objects
By pressing ctrl+m a series of dropdown menus will appear. These allow for relationships to the selected configuration object be added/removed.

### Adding New Configuration Objects
Pressing `ctrl+a` allows for a new config object to be added. This requires both the class and uid to be set. Note: This will break if you don't correctly setup required relationships and attributes!

### Deleting an object
Pressing ctrl+d will delete the currently selected object. NOTE: There is no undo button so be careful!

### Logger
Logger simply displays warnings/updates. Not everything is fully logged and there are no verbosity levels.
![image](textual_dbe/logger.png)

## Known Issues
- Currently relationships for given configuration objects cannot be modified
- Type checking is not robust at all for editing attributes
- All newly created objects are currently just saved to the active database
- No way to create new databases
- Relationship view simply displays objects rather than also displaying the name of the relationship

## To Do List
- [x] Add method to disable components
- [ ] Add more robust method for adding/modifying/deleting config objects
- [ ] Display name of relationship in relationship view
File renamed without changes.
Loading

0 comments on commit 5d10ffb

Please sign in to comment.