Skip to content

Commit ce430e2

Browse files
committed
reflect selected application in router url
1 parent 6ba113e commit ce430e2

File tree

2 files changed

+107
-99
lines changed

2 files changed

+107
-99
lines changed

spring-boot-admin-server-ui/src/main/frontend/views/applications/applications-list.vue

Lines changed: 99 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,25 @@
8989
applications: {
9090
type: Array,
9191
default: () => []
92+
},
93+
selected: {
94+
type: String,
95+
default: null
9296
}
9397
},
9498
directives: {onClickaway},
9599
data: () => ({
96-
selected: null,
97100
errors: []
98101
}),
99102
methods: {
100103
select(name) {
101-
this.selected = name;
104+
this.$router.push(`/applications/${name}`);
102105
},
103106
deselect() {
104-
this.selected = null;
107+
this.$router.push('/applications');
105108
},
106109
showDetails(instance) {
107-
this.$router.push(`/instances/${instance.id}`)
110+
this.$router.push(`/instances/${instance.id}`);
108111
},
109112
async unregister(item) {
110113
try {
@@ -118,106 +121,106 @@
118121
</script>
119122

120123
<style lang="scss">
121-
@import "~@/assets/css/utilities";
122-
123-
$list-background-color: $white !default;
124-
$list-shadow: 0 2px 3px rgba($black, 0.1), 0 0 0 1px rgba($black, 0.1) !default;
125-
$list-color: $text !default;
126-
127-
.applications-list-item {
128-
background-color: $list-background-color;
129-
box-shadow: $list-shadow;
130-
color: $list-color;
131-
max-width: 100%;
132-
133-
&--collapsed {
134-
display: flex;
135-
align-items: center;
136-
overflow: hidden;
137-
cursor: pointer;
138-
&:hover {
139-
background-color: $white-bis;
140-
}
141-
}
124+
@import "~@/assets/css/utilities";
125+
126+
$list-background-color: $white !default;
127+
$list-shadow: 0 2px 3px rgba($black, 0.1), 0 0 0 1px rgba($black, 0.1) !default;
128+
$list-color: $text !default;
129+
130+
.applications-list-item {
131+
background-color: $list-background-color;
132+
box-shadow: $list-shadow;
133+
color: $list-color;
134+
max-width: 100%;
135+
136+
&--collapsed {
137+
display: flex;
138+
align-items: center;
139+
overflow: hidden;
140+
cursor: pointer;
141+
&:hover {
142+
background-color: $white-bis;
143+
}
144+
}
142145
143-
&--detailed {
144-
display: flex;
145-
flex-direction: column;
146-
margin: ($gap / 2) 0;
147-
}
146+
&--detailed {
147+
display: flex;
148+
flex-direction: column;
149+
margin: ($gap / 2) 0;
150+
}
148151
149-
&__status {
150-
width: 40px;
151-
padding-left: ($gap / 2);
152-
}
152+
&__status {
153+
width: 40px;
154+
padding-left: ($gap / 2);
155+
}
153156
154-
&__text {
155-
padding-left: ($gap / 2);
156-
display: inline-flex;
157-
align-items: flex-start;
158-
flex-direction: column;
159-
flex-grow: 1;
160-
flex-basis: 0;
161-
}
157+
&__text {
158+
padding-left: ($gap / 2);
159+
display: inline-flex;
160+
align-items: flex-start;
161+
flex-direction: column;
162+
flex-grow: 1;
163+
flex-basis: 0;
164+
}
162165
163-
&__secondary {
164-
color: $grey-light;
165-
font-size: $size-6;
166-
}
166+
&__secondary {
167+
color: $grey-light;
168+
font-size: $size-6;
169+
}
167170
168-
&__actions {
169-
justify-self: end;
170-
padding-right: ($gap / 2);
171-
opacity: 0;
172-
transition: all $easing $speed;
173-
will-change: opacity;
174-
}
171+
&__actions {
172+
justify-self: end;
173+
padding-right: ($gap / 2);
174+
opacity: 0;
175+
transition: all $easing $speed;
176+
will-change: opacity;
177+
}
175178
176-
*:hover > &__actions {
177-
opacity: 1;
178-
}
179+
*:hover > &__actions {
180+
opacity: 1;
181+
}
179182
180-
&__header {
181-
display: flex;
182-
height: 48px;
183-
align-items: center;
184-
overflow: hidden;
185-
cursor: pointer;
186-
187-
&-text {
188-
color: $grey-darker;
189-
font-weight: $weight-semibold;
190-
padding-left: $gap;
191-
flex-grow: 1;
192-
}
193-
194-
&-actions {
195-
justify-self: end;
196-
padding-right: $gap;
197-
}
198-
}
183+
&__header {
184+
display: flex;
185+
height: 48px;
186+
align-items: center;
187+
overflow: hidden;
188+
cursor: pointer;
189+
190+
&-text {
191+
color: $grey-darker;
192+
font-weight: $weight-semibold;
193+
padding-left: $gap;
194+
flex-grow: 1;
195+
}
199196
200-
&__instance-list {
201-
list-style: none;
202-
margin: 0 ($gap / 2) ($gap / 2) ($gap / 2);
203-
padding: 0;
204-
}
197+
&-actions {
198+
justify-self: end;
199+
padding-right: $gap;
200+
}
201+
}
205202
206-
&__instance {
207-
display: flex;
208-
height: 48px;
209-
overflow: hidden;
210-
background-color: #fff;
211-
align-items: center;
212-
cursor: pointer;
213-
&:hover {
214-
background-color: $white-bis;
215-
}
216-
217-
& + & {
218-
border-top: 1px solid rgba(0, 0, 0, .12);
219-
margin-top: 0;
220-
}
221-
}
203+
&__instance-list {
204+
list-style: none;
205+
margin: 0 ($gap / 2) ($gap / 2) ($gap / 2);
206+
padding: 0;
222207
}
208+
209+
&__instance {
210+
display: flex;
211+
height: 48px;
212+
overflow: hidden;
213+
background-color: #fff;
214+
align-items: center;
215+
cursor: pointer;
216+
&:hover {
217+
background-color: $white-bis;
218+
}
219+
220+
& + & {
221+
border-top: 1px solid rgba(0, 0, 0, .12);
222+
margin-top: 0;
223+
}
224+
}
225+
}
223226
</style>

spring-boot-admin-server-ui/src/main/frontend/views/applications/index.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</div>
5353
<div v-for="group in statusGroups" :key="group.status">
5454
<p class="heading" v-text="group.status"/>
55-
<applications-list :applications="group.applications"/>
55+
<applications-list :applications="group.applications" :selected="selected"/>
5656
</div>
5757
<div v-if="statusGroups.length === 0">
5858
<p class="is-muted">No applications registered.</p>
@@ -73,7 +73,11 @@
7373
default: () => [],
7474
},
7575
error: {
76-
type: Object,
76+
type: null,
77+
default: null
78+
},
79+
selected: {
80+
type: String,
7781
default: null
7882
}
7983
},
@@ -105,7 +109,8 @@
105109
106110
export default component;
107111
export const view = {
108-
path: '/applications',
112+
path: '/applications/:selected?',
113+
props: true,
109114
name: 'applications',
110115
handle: handle,
111116
order: 0,

0 commit comments

Comments
 (0)