From ff0bf7b20fe26c139c3131c6bce0a354c3120b0e Mon Sep 17 00:00:00 2001 From: Roy Wiggins Date: Fri, 27 Sep 2024 18:52:14 +0000 Subject: [PATCH] search, pagination in ui --- common/types.py | 34 +++++- dispatch/target_types/base.py | 4 + webinterface/statics/css/custom.css | 4 +- webinterface/templates/base.html | 112 +++++++++++++++--- .../templates/dashboards/dashboards.html | 6 +- webinterface/templates/modules.html | 39 ++++-- webinterface/templates/rules.html | 86 ++++++++------ webinterface/templates/targets.html | 40 +++++-- webinterface/templates/targets/dicom-tls.html | 14 +-- webinterface/templates/targets/dicom.html | 8 +- webinterface/templates/targets/dicomweb.html | 8 +- webinterface/templates/targets/folder.html | 6 +- webinterface/templates/targets/rsync.html | 8 +- webinterface/templates/targets/s3.html | 4 +- webinterface/templates/targets/sftp.html | 6 +- webinterface/templates/targets/xnat.html | 6 +- webinterface/templates/users.html | 29 +++-- 17 files changed, 298 insertions(+), 116 deletions(-) diff --git a/common/types.py b/common/types.py index 4f13a72a..33b400c2 100755 --- a/common/types.py +++ b/common/types.py @@ -26,6 +26,9 @@ class Target(BaseModel, Compat): contact: Optional[str] = "" comment: str = "" + @property + def short_description(self) -> str: + return "" @classmethod def __get_validators__(cls): # one or more validators may be yielded which will be called in the @@ -59,6 +62,10 @@ class DicomTarget(Target): aet_target: str aet_source: Optional[str] = "" + @property + def short_description(self) -> str: + return f"{self.ip}:{self.port}" + class DicomTLSTarget(Target): target_type: Literal["dicomtls"] = "dicomtls" @@ -70,6 +77,9 @@ class DicomTLSTarget(Target): tls_cert: str ca_cert: str + @property + def short_description(self) -> str: + return f"{self.ip}:{self.port}" class SftpTarget(Target): target_type: Literal["sftp"] = "sftp" @@ -78,6 +88,10 @@ class SftpTarget(Target): host: str password: Optional[str] + @property + def short_description(self) -> str: + return f"{self.folder}:{self.host}" + class RsyncTarget(Target): target_type: Literal["rsync"] = "rsync" @@ -86,7 +100,10 @@ class RsyncTarget(Target): host: str password: Optional[str] run_on_complete: bool = False - + + @property + def short_description(self) -> str: + return f"{self.host}:{self.folder}" class XnatTarget(Target): target_type: Literal["xnat"] = "xnat" @@ -95,6 +112,10 @@ class XnatTarget(Target): user: str password: str + @property + def short_description(self) -> str: + return self.host + class DicomWebTarget(Target): target_type: Literal["dicomweb"] = "dicomweb" @@ -106,6 +127,10 @@ class DicomWebTarget(Target): http_user: Optional[str] http_password: Optional[str] + @property + def short_description(self) -> str: + return self.url + class S3Target(Target): target_type: Literal["s3"] = "s3" @@ -115,12 +140,19 @@ class S3Target(Target): access_key_id: str secret_access_key: str + @property + def short_description(self) -> str: + return f"{self.bucket}/{self.prefix}" + class FolderTarget(Target): target_type: Literal["folder"] = "folder" folder: str file_filter: Optional[str] + @property + def short_description(self) -> str: + return self.folder class DummyTarget(Target): target_type: Literal["dummy"] = "dummy" diff --git a/dispatch/target_types/base.py b/dispatch/target_types/base.py index 4c670b25..51c2f070 100644 --- a/dispatch/target_types/base.py +++ b/dispatch/target_types/base.py @@ -18,6 +18,10 @@ class TargetHandler(Generic[TargetTypeVar]): def __init__(self): pass + @property + def info_short(self) -> str: + return "" + def send_to_target( self, task_id: str, diff --git a/webinterface/statics/css/custom.css b/webinterface/statics/css/custom.css index 18e092f6..d7b2f465 100755 --- a/webinterface/statics/css/custom.css +++ b/webinterface/statics/css/custom.css @@ -1,8 +1,8 @@ -.rulecard { +.entitycard { margin-bottom: 10px; } -.rulecard-content { +.entitycard-content { padding: 10px; } diff --git a/webinterface/templates/base.html b/webinterface/templates/base.html index f575e4bf..1f165da5 100755 --- a/webinterface/templates/base.html +++ b/webinterface/templates/base.html @@ -35,34 +35,31 @@ - {% block extra_nav %} {% endblock %} + {% block extra_nav %} + {% if page in ['rules','targets','modules', 'users'] %} +
+
+ +
+
+ {% endif %} + {% endblock %}
@@ -123,6 +135,72 @@