-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add api to contribute custom views and a sample for custom views
- Loading branch information
Showing
48 changed files
with
13,668 additions
and
484 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
spring-boot-admin-samples/spring-boot-admin-sample-custom-ui/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw* |
5 changes: 5 additions & 0 deletions
5
spring-boot-admin-samples/spring-boot-admin-sample-custom-ui/babel.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
presets: [ | ||
'@vue/app' | ||
] | ||
} |
12,191 changes: 12,191 additions & 0 deletions
12,191
spring-boot-admin-samples/spring-boot-admin-sample-custom-ui/package-lock.json
Large diffs are not rendered by default.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
spring-boot-admin-samples/spring-boot-admin-sample-custom-ui/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "spring-boot-admin-sample-custom-ui", | ||
"private": true, | ||
"scripts": { | ||
"build": "vue-cli-service build", | ||
"watch": "vue-cli-service build --watch", | ||
"lint": "vue-cli-service lint" | ||
}, | ||
"peerDependencies": { | ||
"vue": "^2.5.16" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@vue/cli-plugin-babel": "^3.0.0-rc.5", | ||
"@vue/cli-plugin-eslint": "^3.0.0-rc.5", | ||
"@vue/cli-service": "^3.0.0-rc.5", | ||
"@vue/eslint-config-standard": "^3.0.0-rc.5", | ||
"vue-template-compiler": "^2.5.16" | ||
}, | ||
"eslintConfig": { | ||
"root": true, | ||
"env": { | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:vue/strongly-recommended" | ||
], | ||
"rules": {}, | ||
"parserOptions": { | ||
"parser": "babel-eslint" | ||
} | ||
}, | ||
"postcss": { | ||
"plugins": { | ||
"autoprefixer": {} | ||
} | ||
}, | ||
"browserslist": [ | ||
"> 1%", | ||
"last 2 versions", | ||
"not ie <= 8" | ||
] | ||
} |
83 changes: 83 additions & 0 deletions
83
spring-boot-admin-samples/spring-boot-admin-sample-custom-ui/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 2014-2018 the original author or authors. | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>spring-boot-admin-sample-custom-ui</artifactId> | ||
<name>Spring Boot Admin Server custom UI</name> | ||
<description>Spring Boot Admin Server custom UI</description> | ||
<parent> | ||
<groupId>de.codecentric</groupId> | ||
<artifactId>spring-boot-admin-samples</artifactId> | ||
<version>${revision}</version> | ||
<relativePath>..</relativePath> | ||
</parent> | ||
<dependencies> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>npm-install</id> | ||
<phase>validate</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>npm</executable> | ||
<arguments> | ||
<argument>install</argument> | ||
</arguments> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>npm-build</id> | ||
<phase>generate-resources</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>npm</executable> | ||
<arguments> | ||
<argument>run</argument> | ||
<argument>build</argument> | ||
</arguments> | ||
<environmentVariables> | ||
<PROJECT_VERSION>${project.version}</PROJECT_VERSION> | ||
</environmentVariables> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
<resources> | ||
<resource> | ||
<directory>target/dist</directory> | ||
<targetPath>META-INF/spring-boot-admin-server-ui/extensions/custom</targetPath> | ||
<filtering>false</filtering> | ||
</resource> | ||
</resources> | ||
</build> | ||
</project> |
47 changes: 47 additions & 0 deletions
47
spring-boot-admin-samples/spring-boot-admin-sample-custom-ui/src/custom-endpoint.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!-- | ||
- Copyright 2014-2018 the original author or authors. | ||
- | ||
- Licensed under the Apache License, Version 2.0 (the "License"); | ||
- you may not use this file except in compliance with the License. | ||
- You may obtain a copy of the License at | ||
- | ||
- http://www.apache.org/licenses/LICENSE-2.0 | ||
- | ||
- Unless required by applicable law or agreed to in writing, software | ||
- distributed under the License is distributed on an "AS IS" BASIS, | ||
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
- See the License for the specific language governing permissions and | ||
- limitations under the License. | ||
--> | ||
|
||
<template> | ||
<div class="custom"> | ||
Instance: <span v-text="instance.id"/> | ||
Output: <span v-text="text"/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
instance: { | ||
type: Object, | ||
required: true | ||
} | ||
}, | ||
data: () => ({ | ||
text: '' | ||
}), | ||
async created() { | ||
const response = await this.instance.axios.get('actuator/custom'); | ||
this.text = response.data; | ||
} | ||
}; | ||
</script> | ||
|
||
<style> | ||
.custom { | ||
font-size: 20px; | ||
width: 80%; | ||
} | ||
</style> |
36 changes: 36 additions & 0 deletions
36
spring-boot-admin-samples/spring-boot-admin-sample-custom-ui/src/custom.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!-- | ||
- Copyright 2014-2018 the original author or authors. | ||
- | ||
- Licensed under the Apache License, Version 2.0 (the "License"); | ||
- you may not use this file except in compliance with the License. | ||
- You may obtain a copy of the License at | ||
- | ||
- http://www.apache.org/licenses/LICENSE-2.0 | ||
- | ||
- Unless required by applicable law or agreed to in writing, software | ||
- distributed under the License is distributed on an "AS IS" BASIS, | ||
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
- See the License for the specific language governing permissions and | ||
- limitations under the License. | ||
--> | ||
|
||
<template> | ||
<pre v-text="stringify(applications, null, 4)"/> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
applications: { | ||
type: Array, | ||
required: true | ||
} | ||
}, | ||
methods: { | ||
stringify: JSON.stringify | ||
} | ||
}; | ||
</script> | ||
|
||
<style> | ||
</style> |
43 changes: 43 additions & 0 deletions
43
spring-boot-admin-samples/spring-boot-admin-sample-custom-ui/src/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2014-2018 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import custom from './custom'; | ||
import customEndpoint from './custom-endpoint'; | ||
|
||
/* global SBA */ | ||
SBA.extensions.push({ | ||
install({viewRegistry}) { | ||
viewRegistry.addView({ | ||
name: 'custom', | ||
path: '/custom', | ||
component: custom, | ||
props: true, | ||
label: 'Custom', | ||
order: 1000, | ||
}); | ||
|
||
viewRegistry.addView({ | ||
name: 'instances/custom', | ||
parent: 'instances', | ||
path: 'custom', | ||
component: customEndpoint, | ||
props: true, | ||
label: 'Custom', | ||
order: 1000, | ||
isEnabled: ({instance}) => instance.hasEndpoint('custom') | ||
}); | ||
} | ||
}); |
43 changes: 43 additions & 0 deletions
43
spring-boot-admin-samples/spring-boot-admin-sample-custom-ui/vue.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2014-2018 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
module.exports = { | ||
outputDir: 'target/dist', | ||
chainWebpack: config => { | ||
config.entryPoints.delete('app'); | ||
config.entry('custom').add('./src/index.js'); | ||
config.externals({ | ||
vue: { | ||
commonjs: 'vue', | ||
commonjs2: 'vue', | ||
root: 'Vue' | ||
} | ||
}); | ||
config.output.libraryTarget('var'); | ||
config.optimization.splitChunks(false); | ||
config.module | ||
.rule('vue') | ||
.use('vue-loader') | ||
.loader('vue-loader') | ||
.tap(options => ({ | ||
...options, | ||
hotReload: false | ||
})); | ||
config.plugins.delete('html'); | ||
config.plugins.delete('preload'); | ||
config.plugins.delete('prefetch'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ing-boot-admin-sample-servlet/src/main/java/de/codecentric/boot/admin/CustomEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2014-2018 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package de.codecentric.boot.admin; | ||
|
||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; | ||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; | ||
|
||
@Endpoint(id = "custom") | ||
public class CustomEndpoint { | ||
|
||
@ReadOperation | ||
public String invoke() { | ||
return "Hello World!"; | ||
} | ||
} |
Oops, something went wrong.