winglang / winglang/wing

Custom resource icons are not used in log panel

Open
#6,972 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 bug 🛫 console
Dominant language
TypeScript
Stars
5.4k
Forks
215
Avg merge
2h 9m
Merged PRs (30d)
27

Description

I tried this:

I have a resource with a custom UI applied to its icons:

bring cloud;
bring sim;

inflight class CounterBackend impl sim.IResource {
  var counter: num;

  new(ctx: sim.IResourceContext) {
    // startup code
    this.counter = 0;
  }

  pub onStop() {
    // shutdown code
  }

  pub inc(n: num?): num {
    let p = this.counter;
    this.counter += (n ?? 1);
    return p;
  }

  pub peek(): num {
    return this.counter;
  }
}

class Counter {
  backend: sim.Resource;

  new() {
    let factory = inflight (ctx): sim.IResource => {
      return new CounterBackend(ctx);
    };
    this.backend = new sim.Resource(factory);

    nodeof(this).color = "lime";
    nodeof(this).icon = "calculator";
    nodeof(this.backend).color = "lime";
    nodeof(this.backend).icon = "calculator";
  }

  pub inflight inc(n: num?): num {
    let response = this.backend.call("inc", [Json (n ?? 1)]);
    return num.fromJson(response);
  }

  pub inflight peek(): num {
    let response = this.backend.call("peek");
    return num.fromJson(response);
  }
}

let c = new Counter();
new cloud.Function(inflight () => {
  c.inc();
});
This happened:

In the visual map, the Counter resource appears with a green calculator icon. But in the logs, it still shows as a gray box (the generic "Resource" icon).

Screenshot 2024-07-30 at 6 18 43 PM
I expected this:

No response

Is there a workaround?

No response

Anything else?

No response

Wing Version

0.79.20

Node.js Version

No response

Platform(s)

No response

Community Notes
  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the supplied Counter example and compare its custom calculator icon and lime color in the visual map and log panel. Trace how the log panel renders resource entries; done means it displays the resource's custom icon instead of the generic gray Resource icon.

Written by the indexing model from the issue text.

Assessment

Domain
frontend, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.