From 3a310d894f1febd1ae64d66cf3c04e30d91bfb86 Mon Sep 17 00:00:00 2001 From: Christian Nicolai Date: Sat, 21 Dec 2019 22:22:51 +0100 Subject: [PATCH] Improves the text panel initializer similar to graph panel (#6) Since text panel has no datasource property the initializer is currently broken. Also the dashboard parameter can be optional in graph panel so I copied the same logic here. --- src/crafana/models/panels/text.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crafana/models/panels/text.cr b/src/crafana/models/panels/text.cr index 28f8d7c..cea67df 100644 --- a/src/crafana/models/panels/text.cr +++ b/src/crafana/models/panels/text.cr @@ -13,9 +13,9 @@ module Crafana property mode : String = Crafana::Vars::TEXT_MODE_MARKDOWN property span : String? - def initialize(@dashboard : Crafana::Dashboard, @datasource) + def initialize(@dashboard : Crafana::Dashboard? = nil) @panel_type = Crafana::Vars::TEXT_TYPE - @id = @dashboard.next_panel_id + @id = @dashboard.as(Crafana::Dashboard).next_panel_id unless @dashboard.nil? end end end