Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration Vue3: step 2 vue3 + bootstrap-vue-next + bootstrap 5 #560

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1d2aa33
migration: remove @vue/compat + update to vue 3.4.21
Axolotle Mar 12, 2024
bba1aa8
migration(vue3): COMPILER_V_ON_NATIVE
Axolotle Mar 12, 2024
ccc7298
migration(vue-i18n): legacy mode off
Axolotle Mar 12, 2024
1f45899
migration: bootstrap-vue to bootstrap-vue-next
Axolotle Mar 13, 2024
ad2f792
refactor: rm previous light/dark theme hacks
Axolotle Mar 13, 2024
4f047d9
migration(vue3): COMPONENT_V_MODEL
Axolotle Mar 14, 2024
5892842
migration: rework dark theme enabling
Axolotle Mar 14, 2024
c7bd9af
migration(bvn): add BSkeleton & BSkeletonWrapper component missing in…
Axolotle Mar 14, 2024
6241ba4
migration(bs5): media-breakpoint-down(): use breakpoint itself instea…
Axolotle Mar 14, 2024
9eb4b29
migration(bs5): update to new color functions
Axolotle Mar 14, 2024
6d26ef5
migration(bs5): rename left/right classes to start/end
Axolotle Mar 14, 2024
915023d
migration(bs5): update scss variables (colors, etc.)
Axolotle Mar 14, 2024
622e5be
migration(bvn): update modals and modal system
Axolotle Mar 17, 2024
6229e40
fix: validation on blur
Axolotle Mar 18, 2024
2156196
fix: DomainAdd event bubbling
Axolotle Mar 18, 2024
6be1609
migration(vuex): currentRoute is now a ref
Axolotle Mar 18, 2024
9ec1fbd
fix: ConfigPanels event bubbling
Axolotle Mar 18, 2024
cb7b13f
fix: temp fix for RoutableTabs link active class
Axolotle Mar 19, 2024
cc02444
fix: ExplainWhat popover
Axolotle Mar 19, 2024
620694c
fix: CardDeckFeed slots slicing + keyboard navigation
Axolotle Mar 19, 2024
c730de8
fix: FileItem display
Axolotle Mar 19, 2024
4b33e67
fix: misc component issues
Axolotle Mar 19, 2024
94956c5
fix: adapt `choices` data structure
Axolotle Mar 19, 2024
e87d76e
fix: Diagnosis ignored count and display
Axolotle Mar 19, 2024
183e281
fix: css misc fixes
Axolotle Mar 19, 2024
e53c2c1
migration(bs5): font-weight-* to fw-*
Axolotle Mar 19, 2024
357405d
migration(bvn): remove no longer necessary BInputGroupAppend|Prepend
Axolotle Mar 19, 2024
26b691d
migration(bs5): r/sr-only/visually-hidden
Axolotle Mar 19, 2024
dc530e3
migration(bvn): BAlert needs explicit show value
Axolotle Mar 19, 2024
e4ab46b
chore: update yarn.lock
Axolotle Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,28 @@
"dependencies": {
"@fontsource/fira-code": "^5.0.17",
"@fontsource/firago": "^5.0.7",
"@vue/compat": "3.3.4",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"bootstrap-vue": "^2.23.1",
"bootstrap": "^5.3.3",
"bootstrap-vue-next": "^0.16.6",
"date-fns": "^3.3.1",
"fork-awesome": "^1.2.0",
"simple-evaluate": "^1.4.6",
"vue": "3.3.4",
"vue": "^3.4.21",
"vue-i18n": "^9.10.1",
"vue-router": "^4.3.0",
"vue-showdown": "^4.2.0",
"vuex": "^4.1.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"bootstrap": "^4.6.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-vue": "^9.22.0",
"popper.js": "^1.16.0",
"portal-vue": "^2.1.7",
"prettier": "^3.2.5",
"sass": "^1.71.1",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.1.4"
},
"browserslist": [
Expand Down
25 changes: 12 additions & 13 deletions app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
:disabled="waiting"
exact-active-class="active"
>
<span v-if="theme">
<span v-if="dark">
<img alt="YunoHost logo" src="./assets/logo_light.png" width="40" />
</span>
<span v-else>
<img alt="YunoHost logo" src="./assets/logo_dark.png" width="40" />
</span>
</BNavbarBrand>

<BNavbarNav class="ml-auto">
<BNavbarNav class="ms-auto">
<li class="nav-item">
<BButton :href="ssoLink" variant="primary" size="sm" block>
{{ $t('user_interface_link') }} <YIcon iname="user" />
Expand Down Expand Up @@ -53,6 +53,8 @@
</main>
</ViewLockOverlay>

<BModalOrchestrator />

<!-- HISTORY CONSOLE -->
<HistoryConsole />

Expand Down Expand Up @@ -85,7 +87,7 @@
<BNavText
v-if="yunohost"
id="yunohost-version"
class="ml-md-auto text-center"
class="ms-md-auto text-center"
>
<span v-html="$t('footer_version', yunohost)" />
</BNavText>
Expand All @@ -101,7 +103,6 @@ import { mapGetters } from 'vuex'
import { HistoryConsole, ViewLockOverlay } from '@/views/_partials'

export default {
compatConfig: { MODE: 3 },
name: 'App',

components: {
Expand All @@ -117,7 +118,7 @@ export default {
'transitions',
'transitionName',
'waiting',
'theme',
'dark',
'ssoLink',
]),
},
Expand All @@ -141,7 +142,7 @@ export default {
if (key === copypastaCode[copypastastep++]) {
if (copypastastep === copypastaCode.length) {
document
.getElementsByClassName('unselectable')
.querySelectorAll('.unselectable')
.forEach((element) => element.classList.remove('unselectable'))
copypastastep = 0
}
Expand Down Expand Up @@ -185,17 +186,15 @@ export default {
if (today.getDate() === 31 && today.getMonth() + 1 === 10) {
this.$store.commit('SET_SPINNER', 'spookycat')
}

document.documentElement.setAttribute('dark-theme', this.theme) // updates the data-theme attribute
// updates the data-bs-theme attribute
document.documentElement.setAttribute(
'data-bs-theme',
this.dark ? 'dark' : 'light',
)
},
}
</script>

<style lang="scss">
// Global import of Bootstrap and custom styles
@import '@/scss/main.scss';
</style>

<style lang="scss" scoped>
// generic style for <html>, <body> and <#app> is in `scss/main.scss`
header {
Expand Down
35 changes: 9 additions & 26 deletions app/src/components/AdressInputSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,24 @@
:state="state"
:aria-describedby="id + 'local-part-desc'"
@update:modelValue="onInput('localPart', $event)"
@blur="$parent.$emit('touch')"
/>

<BInputGroupAppend>
<BInputGroupText>{{ modelValue.separator }}</BInputGroupText>
</BInputGroupAppend>
<BInputGroupText>{{ modelValue.separator }}</BInputGroupText>

<BInputGroupAppend>
<SelectItem
:modelValue="modelValue.domain"
:choices="choices"
:aria-describedby="id + 'domain-desc'"
@update:modelValue="onInput('domain', $event)"
@blur="$parent.$emit('touch')"
/>
</BInputGroupAppend>
<SelectItem
:modelValue="modelValue.domain"
:choices="choices"
:aria-describedby="id + 'domain-desc'"
@update:modelValue="onInput('domain', $event)"
/>

<span
class="sr-only"
class="visually-hidden"
:id="id + 'local-part-desc'"
v-t="'address.local_part_description.' + type"
/>
<span
class="sr-only"
class="visually-hidden"
:id="id + 'domain-desc'"
v-t="'address.domain_description.' + type"
/>
Expand All @@ -39,7 +33,6 @@

<script>
export default {
compatConfig: { MODE: 3 },
name: 'AdressInputSelect',

inheritAttrs: false,
Expand All @@ -63,13 +56,3 @@ export default {
},
}
</script>

<style lang="scss" scoped>
.input-group-append ~ .input-group-append {
flex-basis: 40%;
}
select {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
</style>
5 changes: 2 additions & 3 deletions app/src/components/CardCollapse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class="card-collapse-button"
>
{{ title }}
<YIcon class="ml-auto" iname="chevron-right" />
<YIcon class="ms-auto" iname="chevron-right" />
</BButton>
</h2>
</slot>
Expand All @@ -23,7 +23,6 @@

<script>
export default {
compatConfig: { MODE: 3 },
name: 'CardCollapse',

props: {
Expand Down Expand Up @@ -79,7 +78,7 @@ export default {
@each $color, $value in $theme-colors {
&-#{$color} {
background-color: $value;
color: color-yiq($value);
color: color-contrast($value);
}
}
}
Expand Down
19 changes: 10 additions & 9 deletions app/src/components/CardDeckFeed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
// Implementation of the feed pattern
// https://www.w3.org/WAI/ARIA/apg/patterns/feed/
import { h } from 'vue'
import { BCardGroup } from 'bootstrap-vue'
import { BCardGroup } from 'bootstrap-vue-next'

export default {
compatConfig: { MODE: 3 },
name: 'CardDeckFeed',

props: {
Expand All @@ -16,19 +15,19 @@ export default {
return {
busy: false,
range: this.stacks,
childrenCount: this.$slots.default().length,
childrenCount: this.$slots.default()[0].children,
}
},

methods: {
getTopParent(prev) {
return prev.parentElement === this.$refs.feed
return prev.parentElement === this.$refs.feed.$el
? prev
: this.getTopParent(prev.parentElement)
},

onScroll() {
const elem = this.$refs.feed
const elem = this.$refs.feed.$el
if (
window.innerHeight >
elem.clientHeight + elem.getBoundingClientRect().top - 200
Expand Down Expand Up @@ -57,12 +56,12 @@ export default {

mounted() {
window.addEventListener('scroll', this.onScroll)
this.$refs.feed.addEventListener('keydown', this.onKeydown)
this.$refs.feed.$el.addEventListener('keydown', this.onKeydown)
this.onScroll()
},

beforeUpdate() {
const slots = this.$slots.default()
const slots = this.$slots.default()[0].children
if (this.childrenCount !== slots.length) {
this.range = this.stacks
this.childrenCount = slots.length
Expand All @@ -78,13 +77,15 @@ export default {
'aria-busy': this.busy.toString(),
ref: 'feed',
},
this.$slots.default().slice(0, this.range),
{
default: () => this.$slots.default()[0].children.slice(0, this.range),
},
)
},

beforeUnmount() {
window.removeEventListener('scroll', this.onScroll)
this.$refs.feed.removeEventListener('keydown', this.onKeydown)
this.$refs.feed.$el.removeEventListener('keydown', this.onKeydown)
},
}
</script>
3 changes: 1 addition & 2 deletions app/src/components/ConfigPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
validation,
serverError: panel.serverError,
}"
@apply="onApply"
@submit="onApply"
:no-footer="!panel.hasApplyButton"
>
<slot name="tab-top" />
Expand Down Expand Up @@ -54,7 +54,6 @@
import { filterObject } from '@/helpers/commons'

export default {
compatConfig: { MODE: 3 },
name: 'ConfigPanel',

props: {
Expand Down
4 changes: 1 addition & 3 deletions app/src/components/ConfigPanels.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
v-if="routes_.length > 1"
v-bind="{ panels, forms, v: v$, ...$attrs }"
:routes="routes_"
@apply="$emit('apply', $event)"
>
<template #tab-top>
<slot name="tab-top" />
Expand All @@ -32,7 +31,6 @@ import { defineAsyncComponent } from 'vue'
import { useVuelidate } from '@vuelidate/core'

export default {
compatConfig: { MODE: 3 },
name: 'ConfigPanels',

inheritAttrs: false,
Expand All @@ -56,7 +54,7 @@ export default {
setup(props) {
const externalResults = toRef(props, 'externalResults')
return {
v$: useVuelidate({ $externalResults: externalResults, $autoDirty: true }),
v$: useVuelidate({ $externalResults: externalResults }),
}
},

Expand Down
1 change: 0 additions & 1 deletion app/src/components/LazyRenderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

<script>
export default {
compatConfig: { MODE: 3 },
name: 'LazyRenderer',

props: {
Expand Down
1 change: 0 additions & 1 deletion app/src/components/MessageListGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

<script>
export default {
compatConfig: { MODE: 3 },
name: 'MessageListGroup',

props: {
Expand Down
11 changes: 5 additions & 6 deletions app/src/components/QueryHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<div v-if="request.errors || request.warnings">
<!-- WEBSOCKET ERRORS COUNT -->
<span class="count" v-if="request.errors">
{{ request.errors }}<YIcon iname="bug" class="text-danger ml-1" />
{{ request.errors }}<YIcon iname="bug" class="text-danger ms-1" />
</span>
<!-- WEBSOCKET WARNINGS COUNT -->
<span class="count" v-if="request.warnings">
{{ request.warnings
}}<YIcon iname="warning" class="text-warning ml-1" />
}}<YIcon iname="warning" class="text-warning ms-1" />
</span>
</div>

Expand All @@ -29,7 +29,7 @@
v-if="showError && request.error"
size="sm"
pill
class="error-btn ml-auto py-0"
class="error-btn ms-auto py-0"
variant="danger"
@click="reviewError"
>
Expand All @@ -40,7 +40,7 @@
<time
v-if="showTime"
:datetime="hour(request.date)"
:class="request.error ? 'ml-2' : 'ml-auto'"
:class="request.error ? 'ms-2' : 'ms-auto'"
>
{{ hour(request.date) }}
</time>
Expand All @@ -49,7 +49,6 @@

<script>
export default {
compatConfig: { MODE: 3 },
name: 'QueryHeader',

props: {
Expand Down Expand Up @@ -134,7 +133,7 @@ time {
margin-left: 0.5rem;
}

@include media-breakpoint-down(xs) {
@include media-breakpoint-down(sm) {
.xs-hide .request-desc {
display: none;
}
Expand Down
Loading
Loading