Skip to content

Commit a2f9886

Browse files
authored
fix: improve UI style consistency across button components and templates (#4844)
1 parent 415e32a commit a2f9886

File tree

7 files changed

+52
-73
lines changed

7 files changed

+52
-73
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ describe('SbaActionButtonScoped', function () {
2828
render(SbaActionButtonScoped, {
2929
props: {
3030
instanceCount: 10,
31-
label: 'Execute',
3231
actionFn,
3332
},
33+
slots: {
34+
default: 'Execute',
35+
},
3436
});
3537
});
3638

spring-boot-admin-server-ui/src/main/frontend/components/sba-action-button-scoped.vue

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -27,39 +27,40 @@
2727
<sba-confirm-button
2828
class="inline-flex focus:z-10"
2929
:class="{ '!rounded-l-none': instanceCount > 1 }"
30-
:disabled="disabled"
30+
:disabled="
31+
disabled ||
32+
refreshStatus === 'executing' ||
33+
refreshStatus === 'completed'
34+
"
3135
@click="click"
3236
>
33-
<slot v-if="label">
34-
<span v-if="refreshStatus === 'completed'" v-text="labelCompleted" />
35-
<span v-else-if="refreshStatus === 'failed'" v-text="labelFailed" />
36-
<div v-else-if="refreshStatus === 'executing'">
37-
<svg
38-
class="inline w-4 h-4 text-gray-900 animate-spin"
39-
viewBox="0 0 100 101"
40-
fill="none"
41-
xmlns="http://www.w3.org/2000/svg"
42-
>
43-
<path
44-
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
45-
fill="#E5E7EB"
46-
/>
47-
<path
48-
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
49-
fill="currentColor"
50-
/>
51-
</svg>
52-
</div>
53-
<span v-else v-text="label" />
37+
<slot v-if="!refreshStatus" name="default" />
38+
39+
<slot v-if="refreshStatus === 'completed'" name="completed" />
40+
<slot v-if="refreshStatus === 'failed'" name="failed" />
41+
<slot v-if="refreshStatus === 'executing'" name="executing">
42+
<svg
43+
class="inline w-5 h-5 text-gray-900 animate-spin"
44+
viewBox="0 0 100 101"
45+
fill="none"
46+
xmlns="http://www.w3.org/2000/svg"
47+
>
48+
<path
49+
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
50+
fill="#E5E7EB"
51+
/>
52+
<path
53+
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
54+
fill="currentColor"
55+
/>
56+
</svg>
5457
</slot>
55-
<slot v-else :refresh-status="refreshStatus" />
5658
</sba-confirm-button>
5759
</div>
5860
</template>
5961

6062
<script>
6163
import { finalize } from 'rxjs';
62-
import { useI18n } from 'vue-i18n';
6364
6465
import { ActionScope } from '@/components/ActionScope';
6566
@@ -76,24 +77,6 @@ export default {
7677
required: true,
7778
},
7879
disabled: { type: Boolean, default: false },
79-
label: {
80-
type: String,
81-
default: undefined,
82-
},
83-
labelFailed: {
84-
type: String,
85-
default() {
86-
const { tm } = useI18n();
87-
return tm('term.execution_failed');
88-
},
89-
},
90-
labelCompleted: {
91-
type: String,
92-
default() {
93-
const { tm } = useI18n();
94-
return tm('term.execution_successful');
95-
},
96-
},
9780
showInfo: {
9881
type: Boolean,
9982
default: true,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</div>
55
</template>
66

7-
<style type="text/css">
7+
<style scoped>
88
.btn-group {
99
@apply inline-flex z-0 relative -space-x-px;
1010
}
@@ -14,15 +14,15 @@
1414
@apply items-center relative inline-flex rounded-none border focus:z-10;
1515
}
1616
17-
.btn-group button:first-child:not(:last-child) {
17+
.btn-group:deep(:first-child:not(:last-child)) {
1818
@apply rounded-r-none !important;
1919
}
2020
21-
.btn-group button:not(:first-child):not(:last-child) {
21+
.btn-group:deep(:not(:first-child):not(:last-child)) {
2222
@apply rounded-none !important;
2323
}
2424
25-
.btn-group button:last-child:not(:first-child) {
25+
.btn-group:deep(:last-child:not(:first-child)) {
2626
@apply rounded-l-none !important;
2727
}
2828
</style>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<component
33
:is="as"
4-
class="btn relative"
4+
class="btn relative items-center"
55
v-bind="componentAttrs"
66
@click="handleClick"
77
>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
:value="modelValue"
5656
:aria-label="label || placeholder"
5757
:autofocus="autofocus"
58-
class="focus:z-10 p-2 relative flex-1 block w-full rounded-none bg-opacity-40 backdrop-blur-sm"
58+
class="focus:z-10 px-2 py-1.5 relative flex-1 block w-full rounded-none bg-opacity-40 backdrop-blur-sm"
5959
@input="handleInput"
6060
/>
6161
<!-- APPEND -->

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

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,15 @@
2525
:show-info="false"
2626
@scope-changed="changeScope"
2727
>
28-
<template #default="slotProps">
29-
<span
30-
v-if="slotProps.refreshStatus === 'completed'"
31-
v-text="$t('term.execution_successful')"
32-
/>
33-
<span
34-
v-else-if="slotProps.refreshStatus === 'failed'"
35-
v-text="$t('term.execution_failed')"
36-
/>
37-
<span v-else>
38-
<font-awesome-icon icon="trash" />&nbsp;
39-
<span v-text="$t('term.clear')" />
40-
</span>
28+
<template #completed>
29+
<span v-text="$t('term.execution_successful')" />
30+
</template>
31+
<template #failed>
32+
<span v-text="$t('term.execution_failed')" />
33+
</template>
34+
<template #default>
35+
<font-awesome-icon icon="trash" />&nbsp;
36+
<span v-text="$t('term.clear')" />
4137
</template>
4238
</sba-action-button-scoped>
4339

spring-boot-admin-server-ui/src/main/frontend/views/instances/env/refresh.vue

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33
:instance-count="instanceCount"
44
:action-fn="refreshContext"
55
:show-info="false"
6+
:label="$t('instances.env.context_refresh')"
67
>
7-
<template #default="slotProps">
8-
<span
9-
v-if="slotProps.refreshStatus === 'completed'"
10-
class="is-success"
11-
v-text="$t('instances.env.context_refreshed')"
12-
/>
13-
<span
14-
v-else-if="slotProps.refreshStatus === 'failed'"
15-
v-text="$t('instances.env.context_refresh_failed')"
16-
/>
17-
<span v-else v-text="$t('instances.env.context_refresh')" />
8+
<template #default>
9+
{{ $t('instances.env.context_refresh') }}
10+
</template>
11+
<template #completed>
12+
<span v-text="$t('instances.env.context_refreshed')" />
13+
</template>
14+
<template #failed>
15+
<span v-text="$t('instances.env.context_refresh_failed')" />
1816
</template>
1917
</sba-action-button-scoped>
2018

0 commit comments

Comments
 (0)