Skip to content

Commit

Permalink
Merge branch 'master' of github.com:codecentric/spring-boot-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasfritz committed Apr 1, 2022
2 parents 1c5b64e + c717803 commit d7f92c3
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 11 deletions.
Expand Up @@ -52,6 +52,10 @@
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-core</artifactId>
Expand Down
Expand Up @@ -15,10 +15,12 @@ management:
exposure:
include: "*"
endpoint:
env:
post:
enabled: true
health:
show-details: ALWAYS


spring:
application:
name: spring-boot-admin-sample-servlet
Expand Down
Expand Up @@ -112,6 +112,12 @@ class Application {
return {responses};
}

async setEnv(name, value) {
return this.axios.post(uri`actuator/env`, {name, value}, {
headers: {'Content-Type': 'application/json'}
});
}

async refreshContext() {
return this.axios.post(uri`actuator/refresh`);
}
Expand Down
Expand Up @@ -63,6 +63,9 @@
<span v-else v-text="$t('instances.env.context_reset')" />
</button>
</div>
<div class="control" v-if="application.instances.length > 1">
<sba-toggle-scope-button :instance-count="application.instances.length" v-model="scope" />
</div>
<div class="control">
<button class="button is-primary"
:class="{'is-loading' : updateStatus === 'executing', 'is-danger' : updateStatus === 'failed', 'is-success' : updateStatus === 'completed'}"
Expand All @@ -85,10 +88,16 @@ import Instance from '@/services/instance';
import {concatMap, filter, from, listen} from '@/utils/rxjs';
import debounce from 'lodash/debounce';
import uniq from 'lodash/uniq';
import Application from '@/services/application';
import SbaToggleScopeButton from '@/components/sba-toggle-scope-button';
export default {
components: {SbaToggleScopeButton},
props: {
application: {
type: Application,
required: true
},
instance: {
type: Instance,
required: true
Expand All @@ -100,6 +109,7 @@ export default {
},
data: () => ({
error: null,
scope: 'instance',
resetStatus: null,
updateStatus: null,
managedProperties: [{
Expand Down Expand Up @@ -148,8 +158,18 @@ export default {
filter(property => !!property.name && property.input !== property.value),
listen(status => vm.updateStatus = status),
concatMap(
property => from(vm.instance.setEnv(property.name, property.input))
.pipe(listen(status => property.status = status))
property => {
let target;
if (vm.scope === 'instance') {
target = vm.instance;
} else {
target = vm.application;
}
return from(target.setEnv(property.name, property.input))
.pipe(listen(status => property.status = status));
}
)
)
.subscribe({
Expand Down
Expand Up @@ -33,6 +33,7 @@
@reset="fetchEnv"
/>
<sba-env-manager v-if="env && hasEnvManagerSupport"
:application="application"
:instance="instance" :property-sources="env.propertySources"
@refresh="fetchEnv" @update="fetchEnv"
/>
Expand Down Expand Up @@ -73,8 +74,8 @@ import Instance from '@/services/instance';
import pickBy from 'lodash/pickBy';
import {VIEW_GROUP} from '../../index';
import sbaEnvManager from './env-manager';
import refresh from './refresh';
import Application from '@/services/application';
import refresh from './refresh';
import Application from '@/services/application';
const filterProperty = (needle) => (property, name) => {
return name.toString().toLowerCase().includes(needle) || (property.value && property.value.toString().toLowerCase().includes(needle));
Expand All @@ -95,13 +96,13 @@ export default {
instance: {
type: Instance,
required: true
},
application: {
type: Application,
required: true
},
application: {
type: Application,
required: true
}
},
components: {sbaEnvManager, refresh},
components: {sbaEnvManager, refresh},
data: () => ({
hasLoaded: false,
error: null,
Expand Down

0 comments on commit d7f92c3

Please sign in to comment.