From 3f3ad054b92b2cbe37580e19fb252c20174acb1c Mon Sep 17 00:00:00 2001 From: DanPeled <98838880+DanPeled@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:59:45 +0200 Subject: [PATCH 1/8] Added support for elasticlib in python --- elasticlib/elasticlib.py | 94 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 elasticlib/elasticlib.py diff --git a/elasticlib/elasticlib.py b/elasticlib/elasticlib.py new file mode 100644 index 00000000..c50b1157 --- /dev/null +++ b/elasticlib/elasticlib.py @@ -0,0 +1,94 @@ +import json +from ntcore import NetworkTableInstance, PubSubOptions + + +class ElasticNotification: + class NotificationLevel: + INFO = "INFO" + WARNING = "WARNING" + ERROR = "ERROR" + + def __init__( + self, + level=NotificationLevel.INFO, + title="", + description="", + display_time=3000, + width=350, + height=-1, + ): + self.level = level + self.title = title + self.description = description + self.display_time = display_time + self.width = width + self.height = height + + def to_dict(self): + """ + Converts the notification to a dictionary for JSON serialization. + """ + return { + "level": self.level, + "title": self.title, + "description": self.description, + "displayTime": self.display_time, + "width": self.width, + "height": self.height, + } + + def with_level(self, level: str): + self.level = level + return self + + def with_title(self, title: str): + self.title = title + return self + + def with_description(self, description: str): + self.description = description + return self + + def with_display_seconds(self, seconds: float): + self.display_time = int(round(seconds * 1000)) + return self + + def with_display_milliseconds(self, display_time: int): + self.display_time = display_time + return self + + def with_width(self, width: float): + self.width = width + return self + + def with_height(self, height: float): + self.height = height + return self + + def with_automatic_height(self): + self.height = -1 + return self + + def with_no_auto_dismiss(self): + self.display_time = 0 + return self + + +class Elastic: + _topic = NetworkTableInstance.getDefault().getStringTopic( + "/Elastic/RobotNotifications" + ) + _publisher = _topic.publish(PubSubOptions(sendAll=True, keepDuplicates=True)) + + @staticmethod + def send_alert(alert: ElasticNotification): + """ + Sends an alert notification to the Elastic dashboard. + The alert is serialized as a JSON string before being published. + + :param alert: ElasticNotification object containing alert details + """ + try: + Elastic._publisher.set(json.dumps(alert.to_dict())) + except Exception as e: + print(f"Error serializing alert: {e}") From cac641d3ab46b7296620d047b6161a5798c004a5 Mon Sep 17 00:00:00 2001 From: DanPeled <98838880+DanPeled@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:15:26 +0200 Subject: [PATCH 2/8] Added setters & getters --- elasticlib/elasticlib.py | 96 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 89 insertions(+), 7 deletions(-) diff --git a/elasticlib/elasticlib.py b/elasticlib/elasticlib.py index c50b1157..6ddcab53 100644 --- a/elasticlib/elasticlib.py +++ b/elasticlib/elasticlib.py @@ -1,4 +1,5 @@ import json +from typing import Dict from ntcore import NetworkTableInstance, PubSubOptions @@ -11,11 +12,11 @@ class NotificationLevel: def __init__( self, level=NotificationLevel.INFO, - title="", - description="", - display_time=3000, - width=350, - height=-1, + title: str = "", + description: str = "", + display_time: int = 3000, + width: float = 350, + height: float = -1, ): self.level = level self.title = title @@ -24,7 +25,7 @@ def __init__( self.width = width self.height = height - def to_dict(self): + def to_dict(self) -> Dict[str, str | float | int | NotificationLevel]: """ Converts the notification to a dictionary for JSON serialization. """ @@ -71,7 +72,88 @@ def with_automatic_height(self): def with_no_auto_dismiss(self): self.display_time = 0 - return self + + def get_level(self) -> str: + """Returns the level of this notification.""" + return self.level + + def set_level(self, level: str): + """ + Updates the level of this notification. + + :param level: The level to set the notification to. + """ + self.level = level + + def get_title(self) -> str: + """Returns the title of this notification.""" + return self.title + + def set_title(self, title: str): + """ + Updates the title of this notification. + + :param title: The title to set the notification to. + """ + self.title = title + + def get_description(self) -> str: + """Returns the description of this notification.""" + return self.description + + def set_description(self, description: str): + """ + Updates the description of this notification. + + :param description: The description to set the notification to. + """ + self.description = description + + def get_display_time_millis(self) -> int: + """Returns the number of milliseconds the notification is displayed for.""" + return self.display_time_millis + + def set_display_time_seconds(self, seconds: float): + """ + Updates the display time of the notification in seconds. + + :param seconds: The number of seconds to display the notification for. + """ + self.display_time_millis = int(round(seconds * 1000)) + + def set_display_time_millis(self, display_time_millis: int): + """ + Updates the display time of the notification in milliseconds. + + :param display_time_millis: The number of milliseconds to display the notification for. + """ + self.display_time_millis = display_time_millis + + def get_width(self) -> float: + """Returns the width of the notification.""" + return self.width + + def set_width(self, width: float): + """ + Updates the width of the notification. + + :param width: The width to set the notification to. + """ + self.width = width + + def get_height(self) -> float: + """Returns the height of the notification.""" + return self.height + + def set_height(self, height: float): + """ + Updates the height of the notification. + + If the height is set to -1, the height will be determined automatically by the dashboard. + + :param height: The height to set the notification to. + """ + self.height = height class Elastic: From 338b000c893285c679c91af4e0b4bc9849f1e357 Mon Sep 17 00:00:00 2001 From: DanPeled <98838880+DanPeled@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:10:18 +0200 Subject: [PATCH 3/8] Added wpiformat files and ran wpiformat --- .clang-format | 271 ++++++++++++++++++++++++++++++++++++++++ .styleguide | 22 ++++ .styleguide-license | 23 ++++ elasticlib/Elastic.java | 24 ++++ elasticlib/elasticlib.h | 24 ++++ 5 files changed, 364 insertions(+) create mode 100644 .clang-format create mode 100644 .styleguide create mode 100644 .styleguide-license diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..d424ff94 --- /dev/null +++ b/.clang-format @@ -0,0 +1,271 @@ +--- +Language: Cpp +BasedOnStyle: Google +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseColons: false +AlignEscapedNewlines: Left +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: + - __capability +BinPackArguments: true +BinPackParameters: true +BitFieldColonSpacing: Both +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterExternBlock: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakAfterAttributes: Always +BreakAfterJavaFieldAnnotations: false +BreakArrays: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always +BreakBeforeBraces: Attach +BreakBeforeInlineASMColon: OnlyMultiline +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^<.*\.h>' + Priority: 1 + SortPriority: 0 + CaseSensitive: false + - Regex: '^<.*' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' + Priority: 3 + SortPriority: 0 + CaseSensitive: false +IncludeIsMainRegex: '([-_](test|unittest))?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseBlocks: false +IndentCaseLabels: true +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true +IndentPPDirectives: None +IndentRequiresClause: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false +InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +KeepEmptyLinesAtEOF: false +LambdaBodyIndentation: Signature +LineEnding: DeriveLF +MacroBlockBegin: '' +MacroBlockEnd: '' +Macros: + - 'HAL_ENUM(name)=enum name' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Never +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: NextLine +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +PPIndentWidth: -1 +QualifierAlignment: Leave +RawStringFormats: + - Language: Cpp + Delimiters: + - cc + - CC + - cpp + - Cpp + - CPP + - 'c++' + - 'C++' + CanonicalDelimiter: '' + BasedOnStyle: google + - Language: TextProto + Delimiters: + - pb + - PB + - proto + - PROTO + EnclosingFunctions: + - EqualsProto + - EquivToProto + - PARSE_PARTIAL_TEXT_PROTO + - PARSE_TEST_PROTO + - PARSE_TEXT_PROTO + - ParseTextOrDie + - ParseTextProtoOrDie + - ParseTestProto + - ParsePartialTestProto + CanonicalDelimiter: pb + BasedOnStyle: google +ReferenceAlignment: Pointer +ReflowComments: true +RemoveBracesLLVM: false +RemoveParentheses: Leave +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SortIncludes: false +SortJavaStaticImport: Before +SortUsingDeclarations: LexicographicNumeric +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false +SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: Never +SpacesInContainerLiterals: true +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParens: Never +SpacesInParensOptions: + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false +SpacesInSquareBrackets: false +Standard: c++20 +StatementAttributeLikeMacros: + - Q_EMIT +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 8 +UseTab: Never +VerilogBreakBetweenInstancePorts: true +WhitespaceSensitiveMacros: + - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE +... diff --git a/.styleguide b/.styleguide new file mode 100644 index 00000000..425b8074 --- /dev/null +++ b/.styleguide @@ -0,0 +1,22 @@ +cppHeaderFileInclude { + \.h$ + \.hpp$ + \.inc$ + \.inl$ +} + +cppSrcFileInclude { + \.cpp$ +} + +modifiableFileExclude { + gradle/ + assets/ + macos/ + windows/ + linux/ + test_resources/ + screenshots/ + installer_setup_script.iss + README.md +} diff --git a/.styleguide-license b/.styleguide-license new file mode 100644 index 00000000..e39086e4 --- /dev/null +++ b/.styleguide-license @@ -0,0 +1,23 @@ +/* +MIT License + +Copyright (c) 2023-2024 Gold87 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ diff --git a/elasticlib/Elastic.java b/elasticlib/Elastic.java index 09b2ef2b..d99f3614 100644 --- a/elasticlib/Elastic.java +++ b/elasticlib/Elastic.java @@ -1,3 +1,27 @@ +/* +MIT License + +Copyright (c) 2023-2024 Gold87 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + package frc.robot.util; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/elasticlib/elasticlib.h b/elasticlib/elasticlib.h index 62664d0b..c96ee7eb 100644 --- a/elasticlib/elasticlib.h +++ b/elasticlib/elasticlib.h @@ -1,3 +1,27 @@ +/* +MIT License + +Copyright (c) 2023-2024 Gold87 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + #pragma once #include From b055d895899bed5668c93dd4c7d6a0c207b2b582 Mon Sep 17 00:00:00 2001 From: DanPeled <98838880+DanPeled@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:13:34 +0200 Subject: [PATCH 4/8] Doc comments --- elasticlib/elasticlib.py | 204 +++++++++++++++++++++++++++++++++++---- 1 file changed, 184 insertions(+), 20 deletions(-) diff --git a/elasticlib/elasticlib.py b/elasticlib/elasticlib.py index 6ddcab53..b9c160a8 100644 --- a/elasticlib/elasticlib.py +++ b/elasticlib/elasticlib.py @@ -4,6 +4,12 @@ class ElasticNotification: + """ + Represents a notification object to be sent to the Elastic dashboard. + This object holds properties such as level, title, description, display time, + and dimensions to control how the alert is displayed on the dashboard. + """ + class NotificationLevel: INFO = "INFO" WARNING = "WARNING" @@ -18,6 +24,17 @@ def __init__( width: float = 350, height: float = -1, ): + """ + Initializes an ElasticNotification object. + + Args: + level (str): The severity level of the notification. Default is 'INFO'. + title (str): The title of the notification. Default is an empty string. + description (str): The description of the notification. Default is an empty string. + display_time (int): Time in milliseconds for which the notification should be displayed. Default is 3000 ms. + width (float): Width of the notification display area. Default is 350. + height (float): Height of the notification display area. Default is -1 (automatic height). + """ self.level = level self.title = title self.description = description @@ -28,6 +45,9 @@ def __init__( def to_dict(self) -> Dict[str, str | float | int | NotificationLevel]: """ Converts the notification to a dictionary for JSON serialization. + + Returns: + dict: A dictionary representation of the notification object. """ return { "level": self.level, @@ -39,124 +59,264 @@ def to_dict(self) -> Dict[str, str | float | int | NotificationLevel]: } def with_level(self, level: str): + """ + Sets the notification level and returns the object for chaining. + + Args: + level (str): The level to set the notification to. + + Returns: + ElasticNotification: The current notification object with the updated level. + """ self.level = level return self def with_title(self, title: str): + """ + Sets the title and returns the object for chaining. + + Args: + title (str): The title to set for the notification. + + Returns: + ElasticNotification: The current notification object with the updated title. + """ self.title = title return self def with_description(self, description: str): + """ + Sets the description and returns the object for chaining. + + Args: + description (str): The description to set for the notification. + + Returns: + ElasticNotification: The current notification object with the updated description. + """ self.description = description return self def with_display_seconds(self, seconds: float): + """ + Sets the display time in seconds and returns the object for chaining. + + Args: + seconds (float): The number of seconds the notification should be displayed for. + + Returns: + ElasticNotification: The current notification object with the updated display time. + """ self.display_time = int(round(seconds * 1000)) return self def with_display_milliseconds(self, display_time: int): + """ + Sets the display time in milliseconds and returns the object for chaining. + + Args: + display_time (int): The display time in milliseconds. + + Returns: + ElasticNotification: The current notification object with the updated display time. + """ self.display_time = display_time return self def with_width(self, width: float): + """ + Sets the display width and returns the object for chaining. + + Args: + width (float): The width to set for the notification. + + Returns: + ElasticNotification: The current notification object with the updated width. + """ self.width = width return self def with_height(self, height: float): + """ + Sets the display height and returns the object for chaining. + + Args: + height (float): The height to set for the notification. + + Returns: + ElasticNotification: The current notification object with the updated height. + """ self.height = height return self def with_automatic_height(self): + """ + Sets the height to automatic and returns the object for chaining. + + Returns: + ElasticNotification: The current notification object with automatic height. + """ self.height = -1 return self def with_no_auto_dismiss(self): + """ + Sets the display time to 0 to prevent automatic dismissal. + + This method prevents the notification from disappearing automatically. + + Returns: + None + """ self.display_time = 0 def get_level(self) -> str: - """Returns the level of this notification.""" + """ + Returns the level of this notification. + + Returns: + str: The current level of the notification. + """ return self.level def set_level(self, level: str): """ Updates the level of this notification. - :param level: The level to set the notification to. + Args: + level (str): The level to set the notification to. + + Returns: + None """ self.level = level def get_title(self) -> str: - """Returns the title of this notification.""" + """ + Returns the title of this notification. + + Returns: + str: The current title of the notification. + """ return self.title def set_title(self, title: str): """ Updates the title of this notification. - :param title: The title to set the notification to. + Args: + title (str): The title to set the notification to. + + Returns: + None """ self.title = title def get_description(self) -> str: - """Returns the description of this notification.""" + """ + Returns the description of this notification. + + Returns: + str: The current description of the notification. + """ return self.description def set_description(self, description: str): """ Updates the description of this notification. - :param description: The description to set the notification to. + Args: + description (str): The description to set the notification to. + + Returns: + None """ self.description = description def get_display_time_millis(self) -> int: - """Returns the number of milliseconds the notification is displayed for.""" - return self.display_time_millis + """ + Returns the number of milliseconds the notification is displayed for. + + Returns: + int: The display time in milliseconds. + """ + return self.display_time def set_display_time_seconds(self, seconds: float): """ Updates the display time of the notification in seconds. - :param seconds: The number of seconds to display the notification for. + Args: + seconds (float): The number of seconds to display the notification for. + + Returns: + None """ - self.display_time_millis = int(round(seconds * 1000)) + self.display_time = int(round(seconds * 1000)) def set_display_time_millis(self, display_time_millis: int): """ Updates the display time of the notification in milliseconds. - :param display_time_millis: The number of milliseconds to display the notification for. + Args: + display_time_millis (int): The number of milliseconds to display the notification for. + + Returns: + None """ - self.display_time_millis = display_time_millis + self.display_time = display_time_millis def get_width(self) -> float: - """Returns the width of the notification.""" + """ + Returns the width of this notification. + + Returns: + float: The current width of the notification. + """ return self.width def set_width(self, width: float): """ - Updates the width of the notification. + Updates the width of this notification. + + Args: + width (float): The width to set for the notification. - :param width: The width to set the notification to. + Returns: + None """ self.width = width def get_height(self) -> float: - """Returns the height of the notification.""" + """ + Returns the height of this notification. + + Returns: + float: The current height of the notification. + """ return self.height def set_height(self, height: float): """ - Updates the height of the notification. + Updates the height of this notification. - If the height is set to -1, the height will be determined automatically by the dashboard. + Args: + height (float): The height to set for the notification. If height is -1, it indicates automatic height. - :param height: The height to set the notification to. + Returns: + None """ self.height = height class Elastic: + """ + A class responsible for sending alert notifications to the Elastic dashboard. + + This class uses NetworkTables to publish notifications to the dashboard. + The alerts are serialized as JSON strings before being sent. + """ + _topic = NetworkTableInstance.getDefault().getStringTopic( "/Elastic/RobotNotifications" ) @@ -168,7 +328,11 @@ def send_alert(alert: ElasticNotification): Sends an alert notification to the Elastic dashboard. The alert is serialized as a JSON string before being published. - :param alert: ElasticNotification object containing alert details + Args: + alert (ElasticNotification): The notification object containing the alert details. + + Raises: + Exception: If there is an error during serialization or publishing the alert. """ try: Elastic._publisher.set(json.dumps(alert.to_dict())) From 5a8158aa0b1b4fd101a30a8c04590beb5a7d5a5e Mon Sep 17 00:00:00 2001 From: DanPeled <98838880+DanPeled@users.noreply.github.com> Date: Sat, 23 Nov 2024 09:00:39 +0200 Subject: [PATCH 5/8] Changed license --- .styleguide-license | 27 ++------ elasticlib/Elastic.java | 138 +++++++++++++++++++++------------------- elasticlib/elasticlib.h | 27 ++------ 3 files changed, 82 insertions(+), 110 deletions(-) diff --git a/.styleguide-license b/.styleguide-license index e39086e4..89a67365 100644 --- a/.styleguide-license +++ b/.styleguide-license @@ -1,23 +1,4 @@ -/* -MIT License - -Copyright (c) 2023-2024 Gold87 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ +// Copyright (c) 2023-2024 Gold87 and other Elastic contributors +// This Software can be modified and/or shared under the terms +// defined by the Elastic license: +// https://github.com/Gold872/elastic-dashboard/blob/main/LICENSE diff --git a/elasticlib/Elastic.java b/elasticlib/Elastic.java index d99f3614..6f10b3be 100644 --- a/elasticlib/Elastic.java +++ b/elasticlib/Elastic.java @@ -1,26 +1,7 @@ -/* -MIT License - -Copyright (c) 2023-2024 Gold87 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ +// Copyright (c) 2023-2024 Gold87 and other Elastic contributors +// This Software can be modified and/or shared under the terms +// defined by the Elastic license: +// https://github.com/Gold872/elastic-dashboard/blob/main/LICENSE package frc.robot.util; @@ -33,14 +14,15 @@ of this software and associated documentation files (the "Software"), to deal import edu.wpi.first.networktables.StringTopic; public final class Elastic { - private static final StringTopic topic = - NetworkTableInstance.getDefault().getStringTopic("/Elastic/RobotNotifications"); - private static final StringPublisher publisher = - topic.publish(PubSubOption.sendAll(true), PubSubOption.keepDuplicates(true)); + private static final StringTopic topic = NetworkTableInstance.getDefault() + .getStringTopic("/Elastic/RobotNotifications"); + private static final StringPublisher publisher = topic.publish(PubSubOption.sendAll(true), + PubSubOption.keepDuplicates(true)); private static final ObjectMapper objectMapper = new ObjectMapper(); /** - * Sends an alert notification to the Elastic dashboard. The alert is serialized as a JSON string + * Sends an alert notification to the Elastic dashboard. The alert is serialized + * as a JSON string * before being published. * * @param alert the {@link ElasticNotification} object containing alert details @@ -54,8 +36,10 @@ public static void sendAlert(ElasticNotification alert) { } /** - * Represents a notification object to be sent to the Elastic dashboard. This object holds - * properties such as level, title, description, display time, and dimensions to control how the + * Represents a notification object to be sent to the Elastic dashboard. This + * object holds + * properties such as level, title, description, display time, and dimensions to + * control how the * alert is displayed on the dashboard. */ public static class ElasticNotification { @@ -78,10 +62,12 @@ public static class ElasticNotification { private double height; /** - * Creates a new ElasticNotification with all default parameters. This constructor is intended + * Creates a new ElasticNotification with all default parameters. This + * constructor is intended * to be used with the chainable decorator methods * - *

Title and description fields are empty. + *

+ * Title and description fields are empty. */ public ElasticNotification() { this(NotificationLevel.INFO, "", ""); @@ -90,12 +76,15 @@ public ElasticNotification() { /** * Creates a new ElasticNotification with all properties specified. * - * @param level the level of the notification (e.g., INFO, WARNING, ERROR) - * @param title the title text of the notification - * @param description the descriptive text of the notification - * @param displayTimeMillis the time in milliseconds for which the notification is displayed - * @param width the width of the notification display area - * @param height the height of the notification display area, inferred if below zero + * @param level the level of the notification (e.g., INFO, WARNING, + * ERROR) + * @param title the title text of the notification + * @param description the descriptive text of the notification + * @param displayTimeMillis the time in milliseconds for which the notification + * is displayed + * @param width the width of the notification display area + * @param height the height of the notification display area, + * inferred if below zero */ public ElasticNotification( NotificationLevel level, @@ -115,8 +104,8 @@ public ElasticNotification( /** * Creates a new ElasticNotification with default display time and dimensions. * - * @param level the level of the notification - * @param title the title text of the notification + * @param level the level of the notification + * @param title the title text of the notification * @param description the descriptive text of the notification */ public ElasticNotification(NotificationLevel level, String title, String description) { @@ -124,11 +113,12 @@ public ElasticNotification(NotificationLevel level, String title, String descrip } /** - * Creates a new ElasticNotification with a specified display time and default dimensions. + * Creates a new ElasticNotification with a specified display time and default + * dimensions. * - * @param level the level of the notification - * @param title the title text of the notification - * @param description the descriptive text of the notification + * @param level the level of the notification + * @param title the title text of the notification + * @param description the descriptive text of the notification * @param displayTimeMillis the display time in milliseconds */ public ElasticNotification( @@ -137,14 +127,16 @@ public ElasticNotification( } /** - * Creates a new ElasticNotification with specified dimensions and default display time. If the + * Creates a new ElasticNotification with specified dimensions and default + * display time. If the * height is below zero, it is automatically inferred based on screen size. * - * @param level the level of the notification - * @param title the title text of the notification + * @param level the level of the notification + * @param title the title text of the notification * @param description the descriptive text of the notification - * @param width the width of the notification display area - * @param height the height of the notification display area, inferred if below zero + * @param width the width of the notification display area + * @param height the height of the notification display area, inferred if + * below zero */ public ElasticNotification( NotificationLevel level, String title, String description, double width, double height) { @@ -210,7 +202,8 @@ public void setDisplayTimeSeconds(double seconds) { /** * Updates the display time of the notification in milliseconds * - * @param displayTimeMillis the number of milliseconds to display the notification for + * @param displayTimeMillis the number of milliseconds to display the + * notification for */ public void setDisplayTimeMillis(int displayTimeMillis) { this.displayTimeMillis = displayTimeMillis; @@ -246,7 +239,9 @@ public double getWidth() { /** * Updates the height of the notification * - *

If the height is set to -1, the height will be determined automatically by the dashboard + *

+ * If the height is set to -1, the height will be determined automatically by + * the dashboard * * @param height the height to set the notification to */ @@ -264,7 +259,8 @@ public double getHeight() { } /** - * Modifies the notification's level and returns itself to allow for method chaining + * Modifies the notification's level and returns itself to allow for method + * chaining * * @param level the level to set the notification to * @return the current notification @@ -275,7 +271,8 @@ public ElasticNotification withLevel(NotificationLevel level) { } /** - * Modifies the notification's title and returns itself to allow for method chaining + * Modifies the notification's title and returns itself to allow for method + * chaining * * @param title the title to set the notification to * @return the current notification @@ -286,7 +283,8 @@ public ElasticNotification withTitle(String title) { } /** - * Modifies the notification's description and returns itself to allow for method chaining + * Modifies the notification's description and returns itself to allow for + * method chaining * * @param description the description to set the notification to * @return the current notification @@ -297,7 +295,8 @@ public ElasticNotification withDescription(String description) { } /** - * Modifies the notification's display time and returns itself to allow for method chaining + * Modifies the notification's display time and returns itself to allow for + * method chaining * * @param seconds the number of seconds to display the notification for * @return the current notification @@ -307,9 +306,11 @@ public ElasticNotification withDisplaySeconds(double seconds) { } /** - * Modifies the notification's display time and returns itself to allow for method chaining + * Modifies the notification's display time and returns itself to allow for + * method chaining * - * @param displayTimeMillis the number of milliseconds to display the notification for + * @param displayTimeMillis the number of milliseconds to display the + * notification for * @return the current notification */ public ElasticNotification withDisplayMilliseconds(int displayTimeMillis) { @@ -318,7 +319,8 @@ public ElasticNotification withDisplayMilliseconds(int displayTimeMillis) { } /** - * Modifies the notification's width and returns itself to allow for method chaining + * Modifies the notification's width and returns itself to allow for method + * chaining * * @param width the width to set the notification to * @return the current notification @@ -329,7 +331,8 @@ public ElasticNotification withWidth(double width) { } /** - * Modifies the notification's height and returns itself to allow for method chaining + * Modifies the notification's height and returns itself to allow for method + * chaining * * @param height the height to set the notification to * @return the current notification @@ -340,9 +343,12 @@ public ElasticNotification withHeight(double height) { } /** - * Modifies the notification's height and returns itself to allow for method chaining + * Modifies the notification's height and returns itself to allow for method + * chaining * - *

This will set the height to -1 to have it automatically determined by the dashboard + *

+ * This will set the height to -1 to have it automatically determined by the + * dashboard * * @return the current notification */ @@ -354,9 +360,12 @@ public ElasticNotification withAutomaticHeight() { /** * Modifies the notification to disable the auto dismiss behavior * - *

This sets the display time to 0 milliseconds + *

+ * This sets the display time to 0 milliseconds * - *

The auto dismiss behavior can be re-enabled by setting the display time to a number + *

+ * The auto dismiss behavior can be re-enabled by setting the display time to a + * number * greater than 0 * * @return the current notification @@ -367,7 +376,8 @@ public ElasticNotification withNoAutoDismiss() { } /** - * Represents the possible levels of notifications for the Elastic dashboard. These levels are + * Represents the possible levels of notifications for the Elastic dashboard. + * These levels are * used to indicate the severity or type of notification. */ public enum NotificationLevel { diff --git a/elasticlib/elasticlib.h b/elasticlib/elasticlib.h index c96ee7eb..a94f4622 100644 --- a/elasticlib/elasticlib.h +++ b/elasticlib/elasticlib.h @@ -1,26 +1,7 @@ -/* -MIT License - -Copyright (c) 2023-2024 Gold87 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ +// Copyright (c) 2023-2024 Gold87 and other Elastic contributors +// This Software can be modified and/or shared under the terms +// defined by the Elastic license: +// https://github.com/Gold872/elastic-dashboard/blob/main/LICENSE #pragma once From 3233dee3508dcd36b43b2e3e8c487be065439aaf Mon Sep 17 00:00:00 2001 From: DanPeled <98838880+DanPeled@users.noreply.github.com> Date: Sat, 23 Nov 2024 20:52:59 +0200 Subject: [PATCH 6/8] Moved wpiformat files --- .clang-format => elasticlib/.clang-format | 0 .styleguide => elasticlib/.styleguide | 0 .styleguide-license => elasticlib/.styleguide-license | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename .clang-format => elasticlib/.clang-format (100%) rename .styleguide => elasticlib/.styleguide (100%) rename .styleguide-license => elasticlib/.styleguide-license (100%) diff --git a/.clang-format b/elasticlib/.clang-format similarity index 100% rename from .clang-format rename to elasticlib/.clang-format diff --git a/.styleguide b/elasticlib/.styleguide similarity index 100% rename from .styleguide rename to elasticlib/.styleguide diff --git a/.styleguide-license b/elasticlib/.styleguide-license similarity index 100% rename from .styleguide-license rename to elasticlib/.styleguide-license From 7eb148e51bb828c46a266ee1365eb013ad6ee8c1 Mon Sep 17 00:00:00 2001 From: Gold87 <91761103+Gold872@users.noreply.github.com> Date: Sat, 23 Nov 2024 15:01:59 -0500 Subject: [PATCH 7/8] Fix spotless on java --- elasticlib/Elastic.java | 111 +++++++++++++++------------------------- 1 file changed, 41 insertions(+), 70 deletions(-) diff --git a/elasticlib/Elastic.java b/elasticlib/Elastic.java index 6f10b3be..6ae0d87c 100644 --- a/elasticlib/Elastic.java +++ b/elasticlib/Elastic.java @@ -14,15 +14,14 @@ import edu.wpi.first.networktables.StringTopic; public final class Elastic { - private static final StringTopic topic = NetworkTableInstance.getDefault() - .getStringTopic("/Elastic/RobotNotifications"); - private static final StringPublisher publisher = topic.publish(PubSubOption.sendAll(true), - PubSubOption.keepDuplicates(true)); + private static final StringTopic topic = + NetworkTableInstance.getDefault().getStringTopic("/Elastic/RobotNotifications"); + private static final StringPublisher publisher = + topic.publish(PubSubOption.sendAll(true), PubSubOption.keepDuplicates(true)); private static final ObjectMapper objectMapper = new ObjectMapper(); /** - * Sends an alert notification to the Elastic dashboard. The alert is serialized - * as a JSON string + * Sends an alert notification to the Elastic dashboard. The alert is serialized as a JSON string * before being published. * * @param alert the {@link ElasticNotification} object containing alert details @@ -36,10 +35,8 @@ public static void sendAlert(ElasticNotification alert) { } /** - * Represents a notification object to be sent to the Elastic dashboard. This - * object holds - * properties such as level, title, description, display time, and dimensions to - * control how the + * Represents a notification object to be sent to the Elastic dashboard. This object holds + * properties such as level, title, description, display time, and dimensions to control how the * alert is displayed on the dashboard. */ public static class ElasticNotification { @@ -62,12 +59,10 @@ public static class ElasticNotification { private double height; /** - * Creates a new ElasticNotification with all default parameters. This - * constructor is intended + * Creates a new ElasticNotification with all default parameters. This constructor is intended * to be used with the chainable decorator methods * - *

- * Title and description fields are empty. + *

Title and description fields are empty. */ public ElasticNotification() { this(NotificationLevel.INFO, "", ""); @@ -76,15 +71,12 @@ public ElasticNotification() { /** * Creates a new ElasticNotification with all properties specified. * - * @param level the level of the notification (e.g., INFO, WARNING, - * ERROR) - * @param title the title text of the notification - * @param description the descriptive text of the notification - * @param displayTimeMillis the time in milliseconds for which the notification - * is displayed - * @param width the width of the notification display area - * @param height the height of the notification display area, - * inferred if below zero + * @param level the level of the notification (e.g., INFO, WARNING, ERROR) + * @param title the title text of the notification + * @param description the descriptive text of the notification + * @param displayTimeMillis the time in milliseconds for which the notification is displayed + * @param width the width of the notification display area + * @param height the height of the notification display area, inferred if below zero */ public ElasticNotification( NotificationLevel level, @@ -104,8 +96,8 @@ public ElasticNotification( /** * Creates a new ElasticNotification with default display time and dimensions. * - * @param level the level of the notification - * @param title the title text of the notification + * @param level the level of the notification + * @param title the title text of the notification * @param description the descriptive text of the notification */ public ElasticNotification(NotificationLevel level, String title, String description) { @@ -113,12 +105,11 @@ public ElasticNotification(NotificationLevel level, String title, String descrip } /** - * Creates a new ElasticNotification with a specified display time and default - * dimensions. + * Creates a new ElasticNotification with a specified display time and default dimensions. * - * @param level the level of the notification - * @param title the title text of the notification - * @param description the descriptive text of the notification + * @param level the level of the notification + * @param title the title text of the notification + * @param description the descriptive text of the notification * @param displayTimeMillis the display time in milliseconds */ public ElasticNotification( @@ -127,16 +118,14 @@ public ElasticNotification( } /** - * Creates a new ElasticNotification with specified dimensions and default - * display time. If the + * Creates a new ElasticNotification with specified dimensions and default display time. If the * height is below zero, it is automatically inferred based on screen size. * - * @param level the level of the notification - * @param title the title text of the notification + * @param level the level of the notification + * @param title the title text of the notification * @param description the descriptive text of the notification - * @param width the width of the notification display area - * @param height the height of the notification display area, inferred if - * below zero + * @param width the width of the notification display area + * @param height the height of the notification display area, inferred if below zero */ public ElasticNotification( NotificationLevel level, String title, String description, double width, double height) { @@ -202,8 +191,7 @@ public void setDisplayTimeSeconds(double seconds) { /** * Updates the display time of the notification in milliseconds * - * @param displayTimeMillis the number of milliseconds to display the - * notification for + * @param displayTimeMillis the number of milliseconds to display the notification for */ public void setDisplayTimeMillis(int displayTimeMillis) { this.displayTimeMillis = displayTimeMillis; @@ -239,9 +227,7 @@ public double getWidth() { /** * Updates the height of the notification * - *

- * If the height is set to -1, the height will be determined automatically by - * the dashboard + *

If the height is set to -1, the height will be determined automatically by the dashboard * * @param height the height to set the notification to */ @@ -259,8 +245,7 @@ public double getHeight() { } /** - * Modifies the notification's level and returns itself to allow for method - * chaining + * Modifies the notification's level and returns itself to allow for method chaining * * @param level the level to set the notification to * @return the current notification @@ -271,8 +256,7 @@ public ElasticNotification withLevel(NotificationLevel level) { } /** - * Modifies the notification's title and returns itself to allow for method - * chaining + * Modifies the notification's title and returns itself to allow for method chaining * * @param title the title to set the notification to * @return the current notification @@ -283,8 +267,7 @@ public ElasticNotification withTitle(String title) { } /** - * Modifies the notification's description and returns itself to allow for - * method chaining + * Modifies the notification's description and returns itself to allow for method chaining * * @param description the description to set the notification to * @return the current notification @@ -295,8 +278,7 @@ public ElasticNotification withDescription(String description) { } /** - * Modifies the notification's display time and returns itself to allow for - * method chaining + * Modifies the notification's display time and returns itself to allow for method chaining * * @param seconds the number of seconds to display the notification for * @return the current notification @@ -306,11 +288,9 @@ public ElasticNotification withDisplaySeconds(double seconds) { } /** - * Modifies the notification's display time and returns itself to allow for - * method chaining + * Modifies the notification's display time and returns itself to allow for method chaining * - * @param displayTimeMillis the number of milliseconds to display the - * notification for + * @param displayTimeMillis the number of milliseconds to display the notification for * @return the current notification */ public ElasticNotification withDisplayMilliseconds(int displayTimeMillis) { @@ -319,8 +299,7 @@ public ElasticNotification withDisplayMilliseconds(int displayTimeMillis) { } /** - * Modifies the notification's width and returns itself to allow for method - * chaining + * Modifies the notification's width and returns itself to allow for method chaining * * @param width the width to set the notification to * @return the current notification @@ -331,8 +310,7 @@ public ElasticNotification withWidth(double width) { } /** - * Modifies the notification's height and returns itself to allow for method - * chaining + * Modifies the notification's height and returns itself to allow for method chaining * * @param height the height to set the notification to * @return the current notification @@ -343,12 +321,9 @@ public ElasticNotification withHeight(double height) { } /** - * Modifies the notification's height and returns itself to allow for method - * chaining + * Modifies the notification's height and returns itself to allow for method chaining * - *

- * This will set the height to -1 to have it automatically determined by the - * dashboard + *

This will set the height to -1 to have it automatically determined by the dashboard * * @return the current notification */ @@ -360,12 +335,9 @@ public ElasticNotification withAutomaticHeight() { /** * Modifies the notification to disable the auto dismiss behavior * - *

- * This sets the display time to 0 milliseconds + *

This sets the display time to 0 milliseconds * - *

- * The auto dismiss behavior can be re-enabled by setting the display time to a - * number + *

The auto dismiss behavior can be re-enabled by setting the display time to a number * greater than 0 * * @return the current notification @@ -376,8 +348,7 @@ public ElasticNotification withNoAutoDismiss() { } /** - * Represents the possible levels of notifications for the Elastic dashboard. - * These levels are + * Represents the possible levels of notifications for the Elastic dashboard. These levels are * used to indicate the severity or type of notification. */ public enum NotificationLevel { From 7b542996426b8b8d48ca00d52c34402cf76c7874 Mon Sep 17 00:00:00 2001 From: Gold87 <91761103+Gold872@users.noreply.github.com> Date: Sat, 23 Nov 2024 15:13:29 -0500 Subject: [PATCH 8/8] Fixed typo in styleguide license --- elasticlib/.styleguide-license | 2 +- elasticlib/Elastic.java | 2 +- elasticlib/elasticlib.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/elasticlib/.styleguide-license b/elasticlib/.styleguide-license index 89a67365..9575e60c 100644 --- a/elasticlib/.styleguide-license +++ b/elasticlib/.styleguide-license @@ -1,4 +1,4 @@ // Copyright (c) 2023-2024 Gold87 and other Elastic contributors -// This Software can be modified and/or shared under the terms +// This software can be modified and/or shared under the terms // defined by the Elastic license: // https://github.com/Gold872/elastic-dashboard/blob/main/LICENSE diff --git a/elasticlib/Elastic.java b/elasticlib/Elastic.java index 6ae0d87c..d8ab4df0 100644 --- a/elasticlib/Elastic.java +++ b/elasticlib/Elastic.java @@ -1,5 +1,5 @@ // Copyright (c) 2023-2024 Gold87 and other Elastic contributors -// This Software can be modified and/or shared under the terms +// This software can be modified and/or shared under the terms // defined by the Elastic license: // https://github.com/Gold872/elastic-dashboard/blob/main/LICENSE diff --git a/elasticlib/elasticlib.h b/elasticlib/elasticlib.h index a94f4622..76854e88 100644 --- a/elasticlib/elasticlib.h +++ b/elasticlib/elasticlib.h @@ -1,5 +1,5 @@ // Copyright (c) 2023-2024 Gold87 and other Elastic contributors -// This Software can be modified and/or shared under the terms +// This software can be modified and/or shared under the terms // defined by the Elastic license: // https://github.com/Gold872/elastic-dashboard/blob/main/LICENSE