Skip to content

Commit fdaa082

Browse files
committed
Fixed dash import case
1 parent 936d927 commit fdaa082

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

internal/iot/client.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -348,18 +348,17 @@ func (cl *Client) ThingDelete(ctx context.Context, id string) error {
348348
return nil
349349
}
350350

351-
// ThingShow allows to retrieve a specific thing, given its id,
352-
// from Arduino IoT Cloud.
351+
// ThingShow allows to retrieve a specific thing, given its id from Arduino IoT Cloud.
353352
func (cl *Client) ThingShow(ctx context.Context, id string) (*iotclient.ArduinoThing, error) {
354353
ctx, err := ctxWithToken(ctx, cl.token)
355354
if err != nil {
356355
return nil, err
357356
}
358357

359-
thing, _, err := cl.api.ThingsV2Api.ThingsV2ShowExecute(cl.api.ThingsV2Api.ThingsV2Show(ctx, id))
358+
req := cl.api.ThingsV2Api.ThingsV2Show(ctx, id)
359+
thing, _, err := cl.api.ThingsV2Api.ThingsV2ShowExecute(req)
360360
if err != nil {
361-
err = fmt.Errorf("retrieving thing, %w", errorDetail(err))
362-
return nil, err
361+
return nil, fmt.Errorf("retrieving thing, %w", errorDetail(err))
363362
}
364363
return thing, nil
365364
}

internal/template/load.go

+4
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,13 @@ func LoadDashboard(ctx context.Context, file string, override map[string]string,
111111
// Set the correct variable id, given the thing id and the variable name
112112
for j, variable := range widget.Variables {
113113
// Check if thing name should be overridden
114+
precheck := variable.ThingID
114115
if id, ok := override[variable.ThingID]; ok {
115116
variable.ThingID = id
116117
}
118+
if variable.ThingID == "" || variable.ThingID == precheck {
119+
return nil, fmt.Errorf("no override provided for thing %s", precheck)
120+
}
117121
variable.VariableID, err = getVariableID(ctx, variable.ThingID, variable.VariableName, thinger)
118122
if err != nil {
119123
return nil, err

0 commit comments

Comments
 (0)