Skip to content

Commit 95cbf83

Browse files
author
Flurb
committed
Add basic plugin
Signed-off-by: Flurb <[email protected]>
1 parent 57c184c commit 95cbf83

File tree

5 files changed

+61
-1
lines changed

5 files changed

+61
-1
lines changed

public/js/plugins.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ export const officialPlugins = [
8282
requireDoc: false,
8383
position: 'top'
8484
},
85+
{
86+
name: 'Import from API',
87+
src: '/src/menu/CompasImportFromLiander.js',
88+
icon: 'create_new_folder',
89+
default: false,
90+
kind: 'menu',
91+
requireDoc: false,
92+
position: 'top'
93+
},
8594
{
8695
name: 'Save project',
8796
src: '/src/menu/CompasSave.js',
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { html, LitElement } from 'lit-element';
2+
import { get } from 'lit-translate';
3+
4+
import '../filtered-list.js';
5+
import '../wizard-textfield.js';
6+
import {
7+
newWizardEvent,
8+
Wizard,
9+
} from '../foundation.js';
10+
11+
export default class ImportFromApiPlugin extends LitElement {
12+
private importFromApiWizard(): Wizard {
13+
return [
14+
{
15+
title: get('compas.import.title'),
16+
content: [
17+
html`<filtered-list>
18+
19+
</filtered-list>`,
20+
],
21+
},
22+
];
23+
}
24+
25+
async run(): Promise<void> {
26+
document
27+
.querySelector('open-scd')
28+
?.dispatchEvent(newWizardEvent(this.importFromApiWizard()));
29+
}
30+
}

src/translations/de.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,9 @@ export const de: Translations = {
567567
minor: '???',
568568
patch: '???',
569569
},
570+
import: {
571+
title: '???'
572+
},
570573
open: {
571574
title: '???',
572575
localTitle: '???',

src/translations/en.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,9 @@ export const en = {
563563
minor: 'Minor change',
564564
patch: 'Patch change',
565565
},
566+
import: {
567+
title: 'Import from API'
568+
},
566569
open: {
567570
title: 'Open project',
568571
localTitle: 'Local',

test/integration/__snapshots__/open-scd.test.snap.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* @web/test-runner snapshot v1 */
22
export const snapshots = {};
33

4-
snapshots["open-scd looks like its snapshot"] =
4+
snapshots["open-scd looks like its snapshot"] =
55
`<mwc-drawer
66
class="mdc-theme--surface"
77
hasheader=""
@@ -850,6 +850,21 @@ snapshots["open-scd looks like its snapshot"] =
850850
</mwc-icon>
851851
Project from CIM
852852
</mwc-check-list-item>
853+
<mwc-check-list-item
854+
aria-disabled="false"
855+
class="official"
856+
graphic="control"
857+
hasmeta=""
858+
left=""
859+
mwc-list-item=""
860+
tabindex="-1"
861+
value="/src/menu/CompasImportFromLiander.js"
862+
>
863+
<mwc-icon slot="meta">
864+
create_new_folder
865+
</mwc-icon>
866+
Import from API
867+
</mwc-check-list-item>
853868
<mwc-check-list-item
854869
aria-disabled="false"
855870
class="official"

0 commit comments

Comments
 (0)