Skip to content

Commit 5704373

Browse files
committed
fix: application list version jumping
1 parent 9e3c738 commit 5704373

File tree

7 files changed

+115
-25
lines changed

7 files changed

+115
-25
lines changed

spring-boot-admin-server-ui/src/main/frontend/components/sba-tag.vue

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
11
<template>
2-
<span class="inline-flex bg-white leading-none rounded p-1 shadow-sm text-sm border border-gray-300">
2+
<span class="inline-flex leading-none rounded shadow-sm text-sm overflow-hidden"
3+
:class="{
4+
'p-1 border border-gray-300 bg-white': !small,
5+
'p-0 border text-xs': small,
6+
}"
7+
>
38
<span
49
v-if="label"
5-
class="inline-flex bg-sba-200 rounded text-sba-900 py-1 px-3 justify-center items-center transition-all"
10+
class="inline-flex bg-sba-200 rounded text-sba-900 justify-center items-center transition-all"
11+
:class="{
12+
'py-1.5 px-3': !small,
13+
'py-1.5 px-2 rounded-r-none': small
14+
}"
615
v-text="label"
716
/>
817
<span
9-
class="inline-flex px-2 justify-center items-center"
10-
:class="{'pl-2': !!label}"
18+
class="inline-flex px-2 justify-center items-center whitespace-nowrap"
19+
:class="{
20+
'pl-2': !!label,
21+
'bg-white': small
22+
}"
1123
v-text="value"
1224
/>
1325
</span>
1426
</template>
27+
1528
<script>
1629
export default {
1730
name: 'SbaTag',
@@ -20,6 +33,10 @@ export default {
2033
type: [String, Number],
2134
default: null
2235
},
36+
small: {
37+
type: Boolean,
38+
default: false
39+
},
2340
value: {
2441
type: [String, Number],
2542
required: true

spring-boot-admin-server-ui/src/main/frontend/components/sba-tags.stories.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ SingleTag.args = {
1818
}
1919
};
2020

21+
export const SingleTagSmall = Template.bind({});
22+
SingleTagSmall.args = {
23+
small: true,
24+
tags: {
25+
'This is a key': 'This a value',
26+
}
27+
};
28+
2129
export const MultipleTags = Template.bind({});
2230
MultipleTags.args = {
2331
tags: {

spring-boot-admin-server-ui/src/main/frontend/components/sba-tags.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
:key="key"
2222
>
2323
<sba-tag
24+
:small="small"
2425
:label="key"
2526
:value="value"
2627
/>
@@ -35,7 +36,11 @@ export default {
3536
tags: {
3637
type: Object,
3738
required: true
38-
}
39+
},
40+
small: {
41+
type: Boolean,
42+
default: false
43+
},
3944
}
4045
}
4146
</script>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<sba-button-group
3-
class="application-list-item__header__actions"
3+
class="application-list-item__header__actions text-right"
44
>
55
<router-link
66
v-slot="{ navigate }"
@@ -71,7 +71,7 @@ export default {
7171
<style scoped>
7272
.application-list-item__header__actions {
7373
@apply hidden md:flex;
74-
justify-self: end;
74+
justify-content: flex-end;
7575
opacity: 0;
7676
transition: all ease-out 86ms;
7777
will-change: opacity;

spring-boot-admin-server-ui/src/main/frontend/views/applications/applications-list-item.stories.js

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ const routes = [
2525
{path: "/journal", name: "journal"}
2626
];
2727

28+
const firstInstance = {...application.instances[0]};
29+
const secondInstance = {...application.instances[0]};
30+
secondInstance.statusTimestamp = Date.now();
31+
32+
const instanceWithoutRestart = {...firstInstance}
33+
instanceWithoutRestart.endpoints = instanceWithoutRestart.endpoints.filter(e => e.id === "restart")
34+
const instanceWithABunchOfTags = {...firstInstance}
35+
instanceWithABunchOfTags.tags = {
36+
"tag0": "Tag value",
37+
"tag1": "Tag value",
38+
"tag2": "Tag value",
39+
"tag3": "Tag value",
40+
"tag4": "Tag value",
41+
"tag5": "Tag value"
42+
}
43+
2844
export default {
2945
component: ApplicationsListItem,
3046
title: 'Views/Applications/ApplicationListItem',
@@ -39,7 +55,7 @@ const Template = (args) => ({
3955
},
4056
template: `
4157
<sba-panel :seamless="true">
42-
<applications-list-item v-bind="args"/>
58+
<applications-list-item v-bind="args"/>
4359
</sba-panel>`,
4460
});
4561

@@ -64,17 +80,14 @@ OneInstanceExpanded.args = {
6480
export const MultipleInstances = Template.bind({});
6581
MultipleInstances.decorators = [
6682
withVueRouter(routes)
67-
6883
];
69-
const firstInstance = {...application.instances[0]};
70-
const secondInstance = {...application.instances[0]};
71-
secondInstance.statusTimestamp = Date.now();
84+
7285
MultipleInstances.args = {
7386
application: new Application({
7487
...application,
7588
instances: [
7689
firstInstance,
77-
secondInstance
90+
secondInstance,
7891
]
7992
})
8093
}
@@ -85,5 +98,49 @@ MultipleInstancesExpanded.decorators = [
8598
];
8699
MultipleInstancesExpanded.args = {
87100
...MultipleInstances.args,
101+
application: new Application({
102+
...application,
103+
instances: [
104+
firstInstance,
105+
secondInstance,
106+
instanceWithoutRestart,
107+
instanceWithABunchOfTags
108+
]
109+
}),
88110
isExpanded: true,
89111
}
112+
113+
const TemplateWithMultipleApplications = (args) => ({
114+
components: {ApplicationsListItem, SbaPanel},
115+
setup() {
116+
return {
117+
args
118+
};
119+
},
120+
template: `
121+
<sba-panel :seamless="true">
122+
<applications-list-item
123+
v-for="application in args.applications"
124+
:application="application"
125+
/>
126+
</sba-panel>`,
127+
});
128+
129+
export const MultipleApplications = TemplateWithMultipleApplications.bind({});
130+
MultipleApplications.decorators = [
131+
withVueRouter(routes)
132+
];
133+
134+
MultipleApplications.args = {
135+
applications: [
136+
new Application({
137+
...application,
138+
}),
139+
new Application({
140+
...application,
141+
instances: [
142+
instanceWithoutRestart
143+
]
144+
})
145+
]
146+
}

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,17 @@
102102
class="font-bold text-lg"
103103
v-text="application.name"
104104
/>
105-
<ApplicationListItemActions
106-
:application="application"
107-
:has-active-notification-filter="hasActiveNotificationFilter(application)"
108-
:has-notification-filters-support="hasNotificationFiltersSupport"
109-
@restart="confirmRestartApplication"
110-
@shutdown="confirmShutdownApplication"
111-
@filter-settings="$emit('toggle-notification-filter-settings', application)"
112-
@unregister="isModalUnregisterApplicationOpen = true"
113-
/>
105+
<div class="w-1/6">
106+
<ApplicationListItemActions
107+
:application="application"
108+
:has-active-notification-filter="hasActiveNotificationFilter(application)"
109+
:has-notification-filters-support="hasNotificationFiltersSupport"
110+
@restart="confirmRestartApplication"
111+
@shutdown="confirmShutdownApplication"
112+
@filter-settings="$emit('toggle-notification-filter-settings', application)"
113+
@unregister="isModalUnregisterApplicationOpen = true"
114+
/>
115+
</div>
114116
</header>
115117
<!-- EXPANDED -->
116118
<ul

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
v-text="instance.id"
3939
/>
4040
</div>
41-
<div class="hidden lg:block">
42-
<sba-tags :tags="instance.tags" />
41+
<div class="hidden lg:block w-1/4 overflow-x-scroll">
42+
<sba-tags :tags="instance.tags" :small="true" />
4343
</div>
4444
<div
4545
class="hidden md:block w-1/4 text-center"
4646
v-text="instance.buildVersion"
4747
/>
48-
<div class="instance-list-item__actions items-right">
48+
<div class="instance-list-item__actions text-right">
4949
<slot
5050
name="actions"
5151
:instance="instance"
@@ -83,6 +83,7 @@ export default {
8383
}
8484
8585
.instance-list-item__actions {
86+
@apply w-1/6;
8687
transition: all ease-out 86ms;
8788
will-change: opacity;
8889
opacity: 0;

0 commit comments

Comments
 (0)