Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using classes, show the resource tools in the console. #7110

Open
boyney123 opened this issue Sep 11, 2024 · 1 comment
Open

When using classes, show the resource tools in the console. #7110

boyney123 opened this issue Sep 11, 2024 · 1 comment
Labels
🛫 console Console ✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl

Comments

@boyney123
Copy link
Contributor

Use Case

I'm creating a class which is a simple table abstraction.

pub class SpaceTable {
  table: dynamodb.Table;
  new() {
    this.table = new dynamodb.Table(
      attributes: [
        { name: "PK", type: "S" },
        { name: "SK", type: "S" },
      ],
      name: "SpacesTable",
      hashKey: "PK",
      rangeKey: "SK",
      timeToLiveAttribute: "expiresAt",
    );
  }

  pub inflight createSpace(space: types.Space) {
      this.table.put(
        Item: {
          "PK": "SPACE#{space.id}",
          "SK": "META#SPACE",
          "id": space.id,
          "createdAt": space.createdAt,
          //unix timetamp 35 minutes in the future
          // "expiresAt": 35 * 60,
          "expiresAt": 1694700424,
        }
    );
  }

  pub inflight getSpaceById(id: str): types.Space? {
    let data = this.table.query(
      KeyConditionExpression: "PK = :spaceID AND begins_with(SK, :spaceMeta)",
      ExpressionAttributeValues: {
        ":spaceID": "SPACE#{id}",  // SpaceID to be queried
        ":spaceMeta": "META#SPACE"      // Filter for space metadata
      },
    );

    if (data.Count == 0) {
      return nil;
    }

    log(data.Items[0]);

    return {
      id: data.Items[0].get("id").asStr(),
      createdAt: data.Items[0].get("createdAt").asStr(),
      expiresAt: data.Items[0].get("expiresAt").asNum(),
    };

  }

}

When I use this table in my Wing application. I can see the custom resource on the wing console fine. But when I click on the new resource, I see no tools or elements on the right panel to interact with abstracted resources

image

Proposed Solution

It would be nice for Wing to know and understand that I'm using a table here and show that table (and any other resources) in the panel.

If I use the table directly in my main.w file then I see the table as expected.

In this case it would be great to see the table on the right?

Implementation Notes

No response

Component

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.
  • If this issue is labeled needs-discussion, it means the spec has not been finalized yet. Please reach out on the #dev channel in the Wing Discord.
@boyney123 boyney123 added ✨ enhancement New feature or request 🛫 console Console needs-discussion Further discussion is needed prior to impl labels Sep 11, 2024
@monadabot monadabot added this to Wing Sep 11, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New - not properly defined in Wing Sep 11, 2024
@Chriscbr
Copy link
Contributor

Chriscbr commented Sep 13, 2024

@boyney123 In this scenario, if you click on the right arrow next to "SpaceTable" to expand the resource, you'll find the table inside it, and then you can use the resource tools.

Screenshot 2024-09-13 at 1 54 17 PM

@skyrpex What if we decide on a convention where if a resource has a "default child", then clicking on the parent resource will inherit any UI components associated with the child?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛫 console Console ✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl
Projects
Status: 🆕 New - not properly defined
Development

Successfully merging a pull request may close this issue.

2 participants