Skip to content

Commit 5902fb8

Browse files
committed
Allow TimelineEvent objects to have no name
1 parent ea9b41f commit 5902fb8

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

yamcs-client/src/yamcs/client/timeline/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ def save_item(self, item: Union[TimelineItem, Item]):
209209
req.type = proto.type
210210

211211
req.autoStart = item.auto_start
212-
req.name = item.name
212+
213+
if item.name:
214+
req.name = item.name
213215

214216
if proto.tags:
215217
req.tags.MergeFrom(proto.tags)

yamcs-client/src/yamcs/client/timeline/model.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class TimelineItem(abc.ABC):
200200
def __init__(
201201
self,
202202
*,
203-
name: str,
203+
name: Optional[str],
204204
start: Union[datetime.datetime, StartTrigger, List[StartTrigger]],
205205
duration: Optional[datetime.timedelta],
206206
id: Optional[str],
@@ -325,7 +325,8 @@ def _as_subclass(proto: timeline_pb2.TimelineItem):
325325
def _to_proto(self) -> timeline_pb2.TimelineItem:
326326
proto = timeline_pb2.TimelineItem()
327327
proto.id = self.id
328-
proto.name = self.name
328+
if self.name:
329+
proto.name = self.name
329330
proto.autoStart = self.auto_start
330331
proto.duration.FromTimedelta(self.duration)
331332
proto.tags[:] = self.tags
@@ -351,7 +352,7 @@ class TimelineEvent(TimelineItem):
351352

352353
def __init__(
353354
self,
354-
name: str,
355+
name: Optional[str] = None,
355356
*,
356357
start: datetime.datetime,
357358
id: Optional[str] = None,
@@ -372,7 +373,7 @@ def __init__(
372373
:param start:
373374
Event start
374375
:param duration:
375-
Event duration. If emtpy, the event is considered to be a *milestone*.
376+
Event duration. If empty, the event is considered to be a *milestone*.
376377
:param id:
377378
Item identifier. If empty, the client will automatically determine a random
378379
identifier.

0 commit comments

Comments
 (0)