Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the daemon config UI #909

Merged
merged 22 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions fapolicy_analyzer/glade/config_admin_page.glade
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<!--
Copyright Concurrent Technologies Corporation 2022

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkPaned" id="configAdminPage">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<property name="vexpand">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkBox" id="configContentArea">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<property name="vexpand">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="configStatusFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<placeholder/>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
</interface>
156 changes: 156 additions & 0 deletions fapolicy_analyzer/glade/config_difference_dialog.glade
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<!--
Copyright Concurrent Technologies Corporation 2021

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkDialog" id="configDifferenceDialog">
<property name="can-focus">False</property>
<property name="title" translatable="yes">Config Differences</property>
<property name="modal">True</property>
<property name="window-position">center-on-parent</property>
<property name="default-width">500</property>
<property name="default-height">600</property>
<property name="type-hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="okBtn">
<property name="label">Ok</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Previous Config</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="prevContent">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">New Config</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="newContent">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="1">okBtn</action-widget>
</action-widgets>
</object>
</interface>
38 changes: 38 additions & 0 deletions fapolicy_analyzer/glade/config_text_view.glade
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<!--
Copyright Concurrent Technologies Corporation 2022

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkScrolledWindow" id="configTextView">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkSourceView" id="configText">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
</child>
</object>
</interface>
19 changes: 17 additions & 2 deletions fapolicy_analyzer/glade/confirm_deployment_dialog.glade
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,35 @@
</packing>
</child>
<child>
<object class="GtkButton" id="expandButton">
<object class="GtkButton" id="expandRuleButton">
<property name="label">Rule Details</property>
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_expandButton_clicked" swapped="no"/>
<signal name="clicked" handler="on_expandRuleButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="expandConfigButton">
<property name="label">Config Details</property>
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_expandConfigButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
-->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkScrolledWindow" id="rulesTextView">
<object class="GtkScrolledWindow" id="editableTextView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="can_focus">False</property>
<child>
<object class="GtkSourceView" id="textView">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="monospace">True</property>
<property name="show_line_numbers">True</property>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.2 -->
<!-- Generated with glade 3.38.2 -->
<!--
Copyright Concurrent Technologies Corporation 2022

Expand All @@ -18,7 +18,7 @@
-->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkFrame" id="rulesStatusInfo">
<object class="GtkFrame" id="editorStatusInfo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
Expand Down
10 changes: 10 additions & 0 deletions fapolicy_analyzer/glade/main_window.glade
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@
<signal name="activate" handler="on_fapdStartMenu_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="configMenuItem">
<property name="label">Config</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_configAdminMenu_activate" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
Expand Down
4 changes: 4 additions & 0 deletions fapolicy_analyzer/tests/mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def mock_rule():
return MagicMock(id=1, text="Mock Rule Number 1", is_valid=True, info=[])


def mock_config():
return MagicMock(config_text="Config Text", is_valid=True)


class mock_System:
def ancillary_trust(self):
return [mock_trust()]
Expand Down
2 changes: 1 addition & 1 deletion fapolicy_analyzer/tests/rules/test_rules_admin_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_handles_rules_exception(mock_dispatch, mock_system_feature):
def test_populates_text_editor(mock_system_feature, mocker):
mock_text_renderer = MagicMock()
mocker.patch(
"fapolicy_analyzer.ui.rules.rules_admin_page.RulesTextView.render_rules",
"fapolicy_analyzer.ui.rules.rules_admin_page.RulesTextView.render_text",
mock_text_renderer,
)
mock_system_feature.on_next(
Expand Down
Loading