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

feat: allowing extension to provide routeId to progress task #8902

Merged
merged 3 commits into from
Sep 17, 2024

Conversation

axel7083
Copy link
Contributor

@axel7083 axel7083 commented Sep 16, 2024

What does this PR do?

Allow extensions to provide a navigation object when using window.withProgress.

Screenshot / video of UI

extension-custom-rout.mp4

What issues does this PR fix or reference?

Fixes #7709

How to test this PR?

  • Tests are covering the bug fix or the new feature

Testing manually

Inside the activate of an extension add the following

  extensionApi.commands.registerCommand('podman.dummy-command-id', (...args) => {
    console.log('[podman] command triggered ', args);
    return extensionApi.navigation.navigateToContainers();
  });

  extensionApi.navigation.register('dummy-route-id', 'podman.dummy-command-id');

  extensionApi.window.withProgress<string>({
    location: ProgressLocation.TASK_WIDGET,
    details: {
      routeId: 'dummy-route-id',
      routeArfs: ['tracking-id'],
    },
    title: 'Task example'
  }, async (): Promise<string> => {
    return new Promise<string>((resolve, reject) => {
      setTimeout(() => {
        resolve('patate');
      }, 10 * 1000);
    });
  }).catch((err: unknown) => {
    console.error(err);
  });

and add the following to the extension package.json

{
....
  "contributes": {
    "commands": [
      {
        "command": "podman.dummy-command-id",
        "title": "Podman: Dummy command (navigation related)"
      },
....
  1. Then activate / deactivate the given extension
  2. See the TaskManager

@axel7083 axel7083 requested review from benoitf and a team as code owners September 16, 2024 16:13
@axel7083 axel7083 requested review from feloy, gastoner and SoniaSandler and removed request for a team September 16, 2024 16:13
Copy link
Contributor

@gastoner gastoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Works nicely!

}

return {
name: 'View',
Copy link
Collaborator

@benoitf benoitf Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still believe View details or Inspect is more accurate but as it's not part of the spec (.d.ts file), it can be easily changed over time (or not) later.

can merge and discuss it during UX discussions

Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
@axel7083 axel7083 force-pushed the feature/extension-navigation-route branch from 28a3efd to a49317e Compare September 17, 2024 15:24
@axel7083 axel7083 enabled auto-merge (squash) September 17, 2024 15:24
@axel7083 axel7083 merged commit 208b2a0 into containers:main Sep 17, 2024
13 checks passed
@podman-desktop-bot podman-desktop-bot added this to the 1.13.0 milestone Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(Task): extensions should be able to define an action
5 participants