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: build plugin pages and update electron ver. #2226

Merged
merged 10 commits into from
Mar 4, 2024

Conversation

agatha197
Copy link
Contributor

@agatha197 agatha197 commented Feb 22, 2024

Plugin pages are not accessible from the electron app. This PR builds both the components and plugins folder.

How to test

  1. add any plugin page
  2. set plugins - page of the config.toml file
    e.g) page = "link-test-plugin,admin-plugin"
  3. make clean
  4. make dep
  5. npm run electron:d

Checklist for reviewer

  • Can you access plugin pages from the electron app?

Just in case, this is my plugin test page.
set page = "link-test-plugin" of the config.toml file

/**
 @license
 Copyright (c) 2015-2024 Lablup Inc. All rights reserved.
 */
import { BackendAIPage } from '../components/backend-ai-page';
import { html } from 'lit';
import { customElement, property } from 'lit/decorators.js';

/**
 Test plugin for Backend.AI Console

 */
@customElement('link-test-plugin')
export default class LinkTestPlugin extends BackendAIPage {
  @property({ type: String }) menuitem = 'LinkTestPage'; // Menu name on sidebar.
  @property({ type: String }) is = 'link-test-plugin'; // Should be exist.
  @property({ type: String }) permission = 'user'; // Can be 'user', 'admin' or 'superadmin'.
  @property({ type: String }) url = 'https://www.google.com'; // URL to redirect.

  constructor() {
    super();
  }

  static get styles() {
    return [];
  }

  updated() {
    this.openExternalLink();
  }

  openExternalLink() {
    window.open(this.url, '_blank');
    window.history.back();
  }

  render() {
    // language=HTML
    return html``;
  }
}

declare global {
  interface HTMLElementTagNameMap {
    'link-test-plugin': LinkTestPlugin;
  }
}

Checklist: (if applicable)

  • Mention to the original issue
  • Documentation
  • Minium required manager version: 23.09
  • Specific setting for review (eg., KB link, endpoint or how to setup)
  • Minimum requirements to check during review
  • Test case(s) to demonstrate the difference of before/after

@agatha197 agatha197 added type:fix Fix features that are not working effort:normal Need to understand a few modules / some extent of contextual or historical information. platform:app App-specific issue mnt:build-chain Maintenance: build-chain related issues urgency:3 Must be finished within a certain time frame. impact:invisible This change is invisible to users (internal changes). labels Feb 22, 2024
@agatha197 agatha197 added this to the 23.09 milestone Feb 22, 2024
@agatha197 agatha197 self-assigned this Feb 22, 2024
@github-actions github-actions bot added the size:XL 500~ LoC label Feb 22, 2024
Copy link

github-actions bot commented Feb 22, 2024

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
2.96% (+0.05% 🔼)
102/3448
🔴 Branches
3.14% (+0.05% 🔼)
69/2195
🔴 Functions
1.47% (+0.02% 🔼)
17/1160
🔴 Lines
3.01% (+0.05% 🔼)
102/3385

Test suite run success

20 tests passing in 4 suites.

Report generated by 🧪jest coverage report action from b6821d5

@yomybaby
Copy link
Member

In sample plugin, window.open('https://www.google.com', '_blank'); => window.open(this.url, '_blank'); 😉

@agatha197 agatha197 marked this pull request as draft February 23, 2024 04:33
@yomybaby yomybaby self-assigned this Mar 4, 2024
@agatha197 agatha197 marked this pull request as ready for review March 4, 2024 10:24
package.json Outdated Show resolved Hide resolved
@agatha197 agatha197 requested a review from yomybaby March 4, 2024 10:35
Copy link
Member

@yomybaby yomybaby left a comment

Choose a reason for hiding this comment

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

LGTM!

@yomybaby yomybaby merged commit 0bdde9c into main Mar 4, 2024
8 of 9 checks passed
@yomybaby yomybaby deleted the fix/load-plugin-pages-in-electron-app branch March 4, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort:normal Need to understand a few modules / some extent of contextual or historical information. impact:invisible This change is invisible to users (internal changes). mnt:build-chain Maintenance: build-chain related issues platform:app App-specific issue size:XL 500~ LoC type:fix Fix features that are not working urgency:3 Must be finished within a certain time frame.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants