mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
cleanup example-extension
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
0219c62b8a
commit
21ab580144
@ -1,3 +1,7 @@
|
|||||||
# Lens Example Extension
|
# Lens Example Extension
|
||||||
|
|
||||||
*TODO*: add more info
|
*TODO*: add more info
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
`npm run build`
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
import { Button, DynamicPageType, Icon, IconProps, LensExtension, React } from "@lens/extensions";
|
import { Button, DynamicPageType, Icon, IconProps, LensExtension, React } from "@lens/extensions";
|
||||||
|
import { CoffeeDoodle } from "react-open-doodles";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import _ from "lodash"
|
import _ from "lodash"
|
||||||
import stripAnsi from "strip-ansi"
|
|
||||||
|
|
||||||
export default class ExampleExtension extends LensExtension {
|
export default class ExampleExtension extends LensExtension {
|
||||||
onActivate() {
|
onActivate() {
|
||||||
_.has({a: 1}, "a")
|
|
||||||
stripAnsi("asdasdasd")
|
|
||||||
console.log('EXAMPLE EXTENSION: ACTIVATED', this.getMeta());
|
console.log('EXAMPLE EXTENSION: ACTIVATED', this.getMeta());
|
||||||
this.registerPage({
|
this.registerPage({
|
||||||
type: DynamicPageType.CLUSTER,
|
type: DynamicPageType.CLUSTER,
|
||||||
@ -25,7 +23,7 @@ export default class ExampleExtension extends LensExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function ExtensionIcon(props: IconProps) {
|
export function ExtensionIcon(props: IconProps) {
|
||||||
return <Icon {...props} material="camera" tooltip={path.basename(__filename)}/>
|
return <Icon {...props} material="pages" tooltip={path.basename(__filename)}/>
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ExtensionPage extends React.Component<{ extension: ExampleExtension }> {
|
export class ExtensionPage extends React.Component<{ extension: ExampleExtension }> {
|
||||||
@ -37,10 +35,14 @@ export class ExtensionPage extends React.Component<{ extension: ExampleExtension
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { TabLayout } = this.props.extension.runtime.components;
|
const { TabLayout } = this.props.extension.runtime.components;
|
||||||
|
const doodleStyle = {
|
||||||
|
width: "200px"
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<TabLayout className="ExampleExtension">
|
<TabLayout className="ExampleExtension">
|
||||||
<div className="flex column gaps align-flex-start">
|
<div className="flex column gaps align-flex-start">
|
||||||
<p>{stripAnsi("Hello from extensions-api!!!!!!!")}</p>
|
<div style={doodleStyle}><CoffeeDoodle accent="#3d90ce" /></div>
|
||||||
|
<p>Hello from Example extension!</p>
|
||||||
<p>File: <i>{__filename}</i></p>
|
<p>File: <i>{__filename}</i></p>
|
||||||
<Button accent label="Deactivate" onClick={this.deactivate}/>
|
<Button accent label="Deactivate" onClick={this.deactivate}/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
21
extensions/example-extension/package-lock.json
generated
21
extensions/example-extension/package-lock.json
generated
@ -4,23 +4,10 @@
|
|||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-regex": {
|
"react-open-doodles": {
|
||||||
"version": "5.0.0",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-open-doodles/-/react-open-doodles-1.0.5.tgz",
|
||||||
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
|
"integrity": "sha512-TGYuRDL2XX2PG/9ZH2MXfYi/vbQLRnvqPxfzNRc4X3Nxmsiz93kIRmT5OWbItadvqEwZTD4IncwHMSLOTUvSZQ=="
|
||||||
},
|
|
||||||
"lodash": {
|
|
||||||
"version": "4.17.20",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
|
||||||
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
|
|
||||||
},
|
|
||||||
"strip-ansi": {
|
|
||||||
"version": "6.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
|
|
||||||
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
|
|
||||||
"requires": {
|
|
||||||
"ansi-regex": "^5.0.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "4.0.3",
|
"version": "4.0.3",
|
||||||
|
|||||||
@ -8,10 +8,12 @@
|
|||||||
"styles": []
|
"styles": []
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc"
|
"build": "tsc",
|
||||||
|
"dev": "tsc --watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.20",
|
||||||
|
"react-open-doodles": "^1.0.5",
|
||||||
"strip-ansi": "^6.0.0"
|
"strip-ansi": "^6.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user