Skip to content

Commit a910d9e

Browse files
committed
plugins/examples: Add platformeng example
This shows how people might customize their Headlamp and gives examples of a variety of plugin API uses, where the other examples focus on specific things. Signed-off-by: René Dudfield <[email protected]>
1 parent d24fc9f commit a910d9e

18 files changed

+33266
-0
lines changed

Diff for: plugins/examples/platformeng/.gitignore

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
# The output for npm run storybook-book, static html built storybook for the plugin
26+
storybook-static
27+
28+
.eslintcache
29+

Diff for: plugins/examples/platformeng/.vscode/extensions.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
5+
}

Diff for: plugins/examples/platformeng/.vscode/settings.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "esbenp.prettier-vscode",
5+
"[javascript]": {
6+
"editor.defaultFormatter": "esbenp.prettier-vscode"
7+
},
8+
"[javascriptreact]": {
9+
"editor.defaultFormatter": "esbenp.prettier-vscode"
10+
},
11+
"[typescript]": {
12+
"editor.defaultFormatter": "esbenp.prettier-vscode"
13+
},
14+
"[typescriptreact]": {
15+
"editor.defaultFormatter": "esbenp.prettier-vscode"
16+
}
17+
}

Diff for: plugins/examples/platformeng/.vscode/tasks.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "start",
9+
"problemMatcher": ["$tsc-watch", "$eslint-compact"],
10+
"isBackground": true,
11+
"presentation": {
12+
"reveal": "never"
13+
},
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
},
19+
{
20+
"type": "npm",
21+
"script": "test",
22+
"problemMatcher": ["$tsc-watch", "$eslint-compact"],
23+
"isBackground": true,
24+
"presentation": {
25+
"reveal": "always"
26+
},
27+
"group": {
28+
"kind": "test",
29+
"isDefault": true
30+
}
31+
}
32+
]
33+
}

Diff for: plugins/examples/platformeng/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Example Plugin: Pod Counter
2+
3+
This example plugin shows how to put something in the appbar at the top of Headlamp. Also how to
4+
use the K8s API to count the number of pods in the cluster.
5+
6+
![screenshot of the logo being changed](../../../docs/development/plugins/images/podcounter_screenshot.png)
7+
8+
To run the plugin:
9+
10+
```bash
11+
cd plugins/examples/pod-counter
12+
npm install
13+
npm start
14+
# See the app bar at the top of Headlamp has changed to show the number of Pods.
15+
```
16+
17+
The main code for the plugin is in [src/index.tsx](src/index.tsx).
18+
19+
See these API documentation for:
20+
21+
- [registerAppBarAction](https://headlamp.dev/docs/latest/development/api/modules/plugin_registry/#registerappbaraction)

0 commit comments

Comments
 (0)