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 to Vue3 and Vuetify3 #411

Draft
wants to merge 113 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
f274ec8
Changed engines to minimal versions needed for Vuetify3
sronveaux May 14, 2024
f058bde
Regenerated package-lock.json with updated engines
sronveaux May 14, 2024
e503450
Updated Vue and Vuetify to V3.x and all their dependencies to require…
sronveaux May 14, 2024
94444a4
Added needed configuration for new vuetify webpack plugin
sronveaux May 14, 2024
0dd85dc
Changed .browserlistrc to match vuetify skeleton template
sronveaux May 14, 2024
a75a617
Alias vue to @vue/compat during migration
sronveaux May 14, 2024
c9ac2f7
Updated .eslintrc.js to use vue3 rules
sronveaux May 14, 2024
acffd41
Updated Vuetify locales directory
sronveaux May 14, 2024
2617a32
Changed v-for key binding
sronveaux May 15, 2024
87a913a
Temporary guess on how to upgrade Vuetify to V3
sronveaux May 15, 2024
26a09b9
Changed v-bind position to ensure same behaviour as in Vue2
sronveaux May 16, 2024
d7f5a41
First version of color theme generator updated to Vuetify3
sronveaux May 16, 2024
0fa001a
Migrated event bus using mitt
sronveaux May 16, 2024
fc5d7e3
First version of Vue instance creation and removal of global variable…
sronveaux May 16, 2024
66bbebd
Updated Vuetify theme configuration in documentation
sronveaux May 16, 2024
4fd25c2
Updated OverviewMap to Vue3 / Vuetify3
sronveaux May 16, 2024
6febf44
Updated BgLayerSwitcher to Vue3 / Vuetify3
sronveaux May 17, 2024
f8e2273
Fixed position and color on OverviewMap and BgLayerSwitcher buttons
sronveaux May 17, 2024
76ff1a5
Using v-img instead of v-avatar in AppLogo as Vuetify3 avatars have e…
sronveaux May 17, 2024
c472425
Changed DraggableWin directive hook name
sronveaux May 21, 2024
9b99d6c
Migrated inherited class binding in Vue3
sronveaux May 21, 2024
53ce081
First version of AppHeader and AppFooter converted to Vuetify3
sronveaux May 21, 2024
1f0b6fb
First version of LocaleSwitcher converted to Vuetify3
sronveaux May 21, 2024
36fbfd1
Updated Vuetify locale import
sronveaux May 21, 2024
de59110
Changed LocaleSwitcher v-icon definition to recommended way
sronveaux May 21, 2024
8866a28
Converted ModuleCard and ToggleButton to Vuetify3
sronveaux May 21, 2024
03be16d
Added first version of ColorTheme composable
sronveaux May 22, 2024
870ce21
Added first buggy version of converted AttributeTable to Vuetify 3
sronveaux May 22, 2024
94ac193
Updated ThemeSwitcher to Vuetify3
sronveaux May 22, 2024
ab31a32
Removed useless ColorTheme mixin from map component
sronveaux May 22, 2024
6b4f514
Added first buggy version of converted Geocoder to Vuetify 3
sronveaux May 22, 2024
ebb9a8c
Removed the now useless ColorTheme mixin
sronveaux May 22, 2024
d8bc2a9
Corrected toolbar title overflow
sronveaux May 22, 2024
083dab2
Converted ViewAnimationUtil to a class
sronveaux May 22, 2024
9c7ebf6
Converted Geolocator to Vue3
sronveaux May 22, 2024
47e4d60
Converted ZoomToMaxExtent to Vue3
sronveaux May 22, 2024
35fe769
Updated ModuleCard title the recommended way for Vuetify 3
sronveaux May 22, 2024
6cfd225
Updated Map component to use new ViewAnimationUtil class
sronveaux May 22, 2024
53827f8
Updated AttributeTable component to use new ViewAnimationUtil class
sronveaux May 23, 2024
6b85751
Updated Geocoder component to use new ViewAnimationUtil class
sronveaux May 23, 2024
f462118
Changed Geocoder list styling to look more like in Vuetify 2
sronveaux May 23, 2024
55eb8e3
Updated dev server configuration to get around ResizeObserver errors …
sronveaux May 23, 2024
c65306f
Updated zoomToLayerExtent LayerUtil to take the appConfig as parameter
sronveaux May 23, 2024
da289bb
Converted MapRecorder to Vuetify 3
sronveaux May 23, 2024
9bf6592
Converted Helpwin component to Vuetify 3
sronveaux May 23, 2024
dbd805c
Converted useless InfoWindow component to Vuetify 3
sronveaux May 23, 2024
9967577
Converted SampleModule to Vuetify 3
sronveaux May 29, 2024
ff922b6
Corrected toolbar title overflow in a more stable way
sronveaux May 30, 2024
e18266a
Converted LayerList component to Vuetify 3
sronveaux May 30, 2024
f8f6500
Changed way text is wrapped inside Infoclick component
sronveaux May 30, 2024
118bd43
Converted MeasureTool component to Vuetify 3
sronveaux May 30, 2024
a711ffb
Changed ModuleCard toolbar classes to be globally more like it was wi…
sronveaux May 30, 2024
f3f662b
Corrected DraggableWin directive upgrade to Vuetify 3
sronveaux May 31, 2024
938d517
Merged upstream master branch - breaks wgu-i18n.js
sronveaux Jun 3, 2024
f6cef1a
Upgraded InfoClick module when multiple features are visible to Vuetify3
sronveaux Jun 3, 2024
5fd95d7
Converted VueI18n own module to Vue 3
sronveaux Jun 3, 2024
a5e5ca3
Corrected geocoder button size - Vuetify 3 bug ?
sronveaux Jun 3, 2024
e931fd0
Replaced mitt with tiny-emitter to support multi-args events needed b…
sronveaux Jun 5, 2024
20b50d7
Changed WguEventBus code to use tiny-emitter and added function
sronveaux Jun 5, 2024
001ec1e
Updated HoverController to Vue 3
sronveaux Jun 5, 2024
1176578
Converted AppSidebar component to Vue 3 and Vuetify 3
sronveaux Jun 6, 2024
bf9356c
Corrected a bug where the menu was not keeping its state between opens
sronveaux Jun 6, 2024
bd46d21
Updated all config files to get correct icons
sronveaux Jun 6, 2024
5f8eaa1
Upgraded Vuetify to V3.6.8
sronveaux Jun 6, 2024
beea29d
Corrected width of InfoClick to behave better in AppSidebar
sronveaux Jun 6, 2024
dd26131
Corrected width of InfoClick to behave better in AppSidebar
sronveaux Jun 6, 2024
62a1053
Added temporary configure compat rules to better experiment while mig…
sronveaux Jun 10, 2024
da06ca6
Fixed conflicts between local and origin
sronveaux Jun 10, 2024
db29125
Converted AppLoadingMask component to Vuetify 3
sronveaux Jun 11, 2024
10e2d0a
Updated wgu-solo-field CSS selectors to better match Vuetify 2 behaviour
sronveaux Jun 12, 2024
bce7798
Merged upstream master branch - sync with V2.0.1
sronveaux Jun 14, 2024
5e8e11c
Merged upstream master branch - Update AttributeTable before upgrade …
sronveaux Jun 21, 2024
3f99394
Upgraded the allow custom theme properties functionality to Vuetify3
sronveaux Jun 21, 2024
c691d85
Converted AttributeTable component to Vuetify 3
sronveaux Jun 21, 2024
fdf52f0
Updated Vue to V3.4.29
sronveaux Jun 21, 2024
2aa6efd
Updated vue config for unit tests with Vue 3.4+
sronveaux Jun 25, 2024
8eab10a
Updated unit tests index file to Vue3
sronveaux Jun 25, 2024
6e06635
Converted DraggableWin directive unit tests to Vue3
sronveaux Jun 25, 2024
9e65672
Converted ViewAnimation utility class unit tests to Vue3
sronveaux Jun 25, 2024
e121315
Changed VueI18N parameter to hide some warnings as with previous version
sronveaux Jul 15, 2024
c9972e7
Changed Map component to make layers list reactive again
sronveaux Jul 15, 2024
95c855d
Changed BgLayerList component following results of unit tests
sronveaux Jul 15, 2024
32316d9
Removed useless property in Geocoder component
sronveaux Jul 17, 2024
2b26004
Changed default icon of InfoClick component
sronveaux Jul 17, 2024
950af46
Changed default icon of LayerList component
sronveaux Jul 17, 2024
376d91c
Changed default icon of MeasureTool component
sronveaux Jul 17, 2024
d825e3f
Changed default icon of AttributeTable component
sronveaux Jul 17, 2024
e760f82
Updated Vue to V3.4.32
sronveaux Jul 18, 2024
9a5000c
Updated Vuetify to V3.6.13
sronveaux Jul 18, 2024
4e05a6a
Removed global DraggableWin registration
sronveaux Jul 25, 2024
c7ae644
Switched Vue-i18n to Composition API with global injection
sronveaux Jul 25, 2024
40f9a7f
Updated ToggleButton to be more logical
sronveaux Jul 26, 2024
46ee05e
Reverted reactive layers injection as it breaks OpenLayers internals
sronveaux Jul 26, 2024
d15354b
Added first version of unit test suite migrated to Vue 3
sronveaux Jul 26, 2024
132db54
Temporary fix of non-reactive layers list for draft PR
sronveaux Jul 30, 2024
8cf46e3
Temporary fix to avoid manual patch of Vue-test-utils
sronveaux Aug 26, 2024
8227799
Update of Vue-test-utils following accepted PR
sronveaux Aug 26, 2024
87145fc
Refactored i18n plugin management to avoid warnings
sronveaux Sep 9, 2024
e30911b
Merge upstream master branch - sync with V2.1.0
sronveaux Oct 8, 2024
b7747b3
Sanitized package-lock.json with NPM
sronveaux Oct 8, 2024
bda0c43
Corrected linting errors
sronveaux Oct 8, 2024
7b61139
Converted custom icons functionality to Vuetify3
sronveaux Oct 8, 2024
918b683
Converted new Geocoder implementation to Vue3
sronveaux Oct 8, 2024
1b7b5a2
Updated Vue, Vuetify and Babel to latest versions
sronveaux Oct 8, 2024
8b8260b
Updated Karma and test libraries to latest compatible versions
sronveaux Oct 8, 2024
7f9921d
Updated ESLint and plugins to latest V8.x
sronveaux Oct 8, 2024
785d10e
Updated vue-i18n to latest V9.x
sronveaux Oct 8, 2024
cdeebaf
Updated core-js to V3.38.1
sronveaux Oct 8, 2024
57c6fda
Corrected AttributeTableWin slowdown bug
sronveaux Oct 14, 2024
6bf79b2
Updated Vue-i18n to V10
sronveaux Oct 14, 2024
1cd5e1e
First version of map composable to replace mapable mixin
sronveaux Oct 18, 2024
656eef6
Corrected a map unbounding bug in MapOverlay
sronveaux Oct 28, 2024
17774c7
Refactored unit tests to use the map composable
sronveaux Oct 28, 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
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = {
node: true
},
extends: [
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
// consider switching to `plugin:vue/vue3-strongly-recommended` or `plugin:vue/vue3-recommended` for stricter rules.
'plugin:vue/vue3-essential',
'plugin:vuetify/recommended',
'@vue/standard'
],
Expand Down
28 changes: 16 additions & 12 deletions app-starter/WguAppTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
<slot name="wgu-after-header" />

<wgu-app-sidebar v-if="sidebarWins.length" v-bind="sidebarConfig">
<template v-for="(moduleWin, index) in sidebarWins">
<template v-for="(moduleWin, index) in sidebarWins" :key="index">
<component
:is="moduleWin.type" :key="index"
v-bind="moduleWin"
:is="moduleWin.type"
/>
</template>
</wgu-app-sidebar>

<slot name="wgu-before-content" />
<v-main app>
<v-container id="ol-map-container" fluid class="fill-height pa-0">
<v-container id="ol-map-container" fluid class="fill-height pa-0 position-relative">
<wgu-map />
<!-- layer loading indicator -->
<wgu-maploading-status />
Expand All @@ -50,10 +50,10 @@
</v-container>
</v-main>

<template v-for="(moduleWin, index) in floatingWins">
<template v-for="(moduleWin, index) in floatingWins" :key="index">
<component
:is="moduleWin.type" :key="index"
v-bind="moduleWin"
:is="moduleWin.type"
/>
</template>

Expand All @@ -77,7 +77,7 @@
</template>

<script>
import Vue from 'vue'
import { getCurrentInstance } from 'vue'
import { WguEventBus } from '../src/WguEventBus'
import OlMap from '../src/components/ol/Map'
import HoverTooltip from '../src/components/ol/HoverTooltip'
Expand Down Expand Up @@ -118,14 +118,18 @@ export default {
'wgu-maprecorder-win': MapRecorderWin,
'sample-module-win': SampleModuleWin
},
setup () {
const vueInstance = getCurrentInstance();
return { vueInstance };
},
data () {
return {
isEmbedded: false,
sidebarConfig: this.getSidebarConfig(),
overviewMapConfig: this.getOverviewMapConfig(),
floatingWins: this.getModuleWinData('floating'),
sidebarWins: this.getModuleWinData('sidebar'),
showCopyrightYear: Vue.prototype.$appConfig.showCopyrightYear
showCopyrightYear: this.$appConfig.showCopyrightYear
}
},
created () {
Expand All @@ -143,7 +147,7 @@ export default {
for (const key of Object.keys(refs)) {
cmpLookup[key] = refs[key][0];
}
Vue.prototype.cmpLookup = cmpLookup;
this.vueInstance.appContext.config.globalProperties.cmpLookup = cmpLookup;
// inform registered cmps that the app is mounted and the dynamic
// components are available
WguEventBus.$emit('app-mounted');
Expand All @@ -154,15 +158,15 @@ export default {
* @return {Object} Sidebar configuration object.
*/
getSidebarConfig () {
const appConfig = Vue.prototype.$appConfig || {};
const appConfig = this.$appConfig || {};
return appConfig.sidebar;
},
/**
* Returns the configuration object for the overview map from app-config.
* @return {Object} Overview map configuration object.
*/
getOverviewMapConfig () {
const appConfig = Vue.prototype.$appConfig || {};
const appConfig = this.$appConfig || {};
return appConfig.overviewMap;
},
/**
Expand All @@ -175,7 +179,7 @@ export default {
* @return {Array} module window configuration objects
*/
getModuleWinData (target) {
const appConfig = Vue.prototype.$appConfig || {};
const appConfig = this.$appConfig || {};
const modulesConfs = appConfig.modules || {};
const moduleWins = [];
for (const key of Object.keys(modulesConfs)) {
Expand All @@ -199,7 +203,7 @@ export default {
* Sets the current i18n language to the global app language lookup.
*/
setGlobalAppLang () {
Vue.prototype.$appLanguage = this.$i18n.locale;
this.vueInstance.appContext.config.globalProperties.$appLanguage = this.$i18n.locale;
}
},
watch: {
Expand Down
2 changes: 1 addition & 1 deletion app-starter/components/AppFooter.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<v-footer color="primary" class="onprimary--text" app>
<v-footer color="primary" app>
<span class="wgu-footer-left" v-html="footerTextLeft"></span>
<v-spacer></v-spacer>
<div class="wgu-footer-right">
Expand Down
33 changes: 13 additions & 20 deletions app-starter/components/AppHeader.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<template>
<v-app-bar
class="wgu-app-toolbar onprimary--text"
class="wgu-app-toolbar"
color="primary"
fixed
app
clipped-left
clipped-right
>

<!-- slot to inject components at the beginning (before title) -->
Expand All @@ -21,32 +17,31 @@
<!-- slot to inject components before the auto-generated buttons (by config) -->
<slot name="wgu-tb-before-auto-buttons"></slot>

<template v-for="(tbButton, index) in tbButtons">
<template v-for="(tbButton, index) in tbButtons" :key="index">
<component
:is="tbButton.type" :key="index"
v-bind="tbButton"
:is="tbButton.type"
/>
</template>

<!-- slot to inject components after the auto-generated buttons (by config) -->
<slot name="wgu-tb-after-auto-buttons"></slot>

<v-menu v-if="menuButtons.length" offset-y nudge-bottom="15">
<template v-slot:activator="{on}">
<v-menu v-if="menuButtons.length" eager offset="15">
<template v-slot:activator="{props}">

<v-btn icon v-on="on"
<v-btn v-bind="props"
class="wgu-menu-button"
color="onprimary"
:title="$t('wgu-toolbar-menu.title')">
<v-icon medium>menu</v-icon>
:title="$t('wgu-toolbar-menu.title')"
icon="md:menu">
</v-btn>
</template>
<v-list color="primary">
<template v-for="(tbButton, index) in menuButtons">
<v-list-item :key="index">
<v-list bg-color="primary">
<template v-for="(tbButton, index) in menuButtons" :key="index">
<v-list-item class="py-0">
<component
:is="tbButton.type" :key="index"
v-bind="tbButton"
:is="tbButton.type" :key="index"
/>
</v-list-item>
</template>
Expand All @@ -60,8 +55,6 @@
</template>

<script>

import Vue from 'vue'
import ToggleButton from '../../src/components/modulecore/ToggleButton'
import ZoomToMaxExtentButton from '../../src/components/maxextentbutton/ZoomToMaxExtentButton'
import Geocoder from '../../src/components/geocoder/Geocoder'
Expand Down Expand Up @@ -101,7 +94,7 @@ export default {
* @return {Array} module button configuration objects
*/
getModuleButtons (target) {
const appConfig = Vue.prototype.$appConfig || {};
const appConfig = this.$appConfig || {};
const modulesConfs = appConfig.modules || {};
const buttons = [];
for (const key of Object.keys(modulesConfs)) {
Expand Down
23 changes: 12 additions & 11 deletions app-starter/components/AppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@
<v-navigation-drawer
class="wgu-app-sidebar"
ref="sidebar"
app
clipped
:width=sidebarWidth
v-model="sidebarOpen"
>
<!-- Forward the default slot for sidebar content. -->
<slot></slot>
<!-- Sidebar toggle button -->
<template v-slot:prepend>
<v-btn small
class="wgu-app-sidebar-toggle-btn px0"
absolute
top
<v-btn size="small"
class="wgu-app-sidebar-toggle-btn position-absolute px0"
location="top right"
color="secondary"
@click="sidebarOpen = !sidebarOpen">
<v-icon color="onsecondary" v-if="sidebarOpen">chevron_left</v-icon>
<v-icon color="onsecondary" v-else>chevron_right</v-icon>
<v-icon color="onsecondary" v-if="sidebarOpen">md:chevron_left</v-icon>
<v-icon color="onsecondary" v-else>md:chevron_right</v-icon>
</v-btn>
</template>
<!-- Invisible sidebar resizer -->
Expand All @@ -30,8 +27,8 @@
</template>

<script>

import { WguEventBus } from '../../src/WguEventBus';
import { useGoTo } from 'vuetify'

export default {
name: 'wgu-app-sidebar',
Expand All @@ -44,6 +41,10 @@ export default {
scrollDuration: { type: Number, required: false, default: 500 },
resizable: { type: Boolean, required: false, default: false }
},
setup () {
const goTo = useGoTo();
return { goTo };
},
data () {
return {
sidebarOpen: this.visible,
Expand Down Expand Up @@ -73,7 +74,7 @@ export default {
*/
scrollTo (comp) {
if (this.autoScroll) {
this.$vuetify.goTo(comp, {
this.goTo(comp, {
container: '.wgu-app-sidebar > .v-navigation-drawer__content',
duration: this.scrollDuration
});
Expand All @@ -83,7 +84,7 @@ export default {
* Resize the sidebar, if the 'resizable' option is enabled.
*/
onResize () {
const sidebarEl = this.$refs.sidebar.$el;
const sidebarEl = this.$refs.sidebar.$el.nextSibling;
sidebarEl.style.transition = 'initial';

// Resize on mouse move
Expand Down
21 changes: 18 additions & 3 deletions app-starter/components/SampleModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
// the module card is a the template for a typical Wegue module
import ModuleCard from '../../src/components/modulecore/ModuleCard';
// we import a so called "mixin" that helps us to interact with the map
import { Mapable } from '../../src/mixins/Mapable';
// import { Mapable } from '../../src/mixins/Mapable';
import { useMap } from '../../src/composables/Map';
// an OpenLayers helper function to display coordinates
import { toStringXY } from 'ol/coordinate';
// an OpenLayer helper function to transform coordinate reference systems
Expand All @@ -39,21 +40,35 @@ import { transform } from 'ol/proj.js';
export default {
name: 'sample-module',
// make sure to register the 'Mapable' mixin
mixins: [Mapable],
// mixins: [Mapable],
inheritAttrs: false,
components: {
'wgu-module-card': ModuleCard
},
props: {
icon: { type: String, required: false, default: 'star' }
icon: { type: String, required: false, default: 'md:star' }
},
// here we define variables that are used in the HTML above
setup () {
const { map, layers } = useMap();
return { map, layers };
},
data () {
return {
zoom: '',
center: ''
};
},
watch: {
map: {
handler (newMap) {
if (newMap) {
this.onMapBound();
}
},
immediate: true
}
},
methods: {
/**
* This function is called once the map is bound to the application
Expand Down
3 changes: 1 addition & 2 deletions app-starter/static/app-conf-minimal.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
"wgu-helpwin": {
"target": "toolbar",
"win": "floating",
"icon": "help"
"icon": "md:help"
}
}

}
15 changes: 7 additions & 8 deletions app-starter/static/app-conf-projected.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"themes": {
"light": {
"primary": "#EF6C00",
"onprimary": "#FFFFFF",
"onsecondary": "#FFFFFF"
"on-primary": "#FFFFFF",
"on-secondary": "#FFFFFF"
},
"dark": {
"secondary": "#FFCC80"
Expand Down Expand Up @@ -146,13 +146,13 @@
"wgu-layerlist": {
"target": "menu",
"win": "floating",
"icon": "layers",
"icon": "md:layers",
"draggable": false
},
"wgu-measuretool": {
"target": "menu",
"win": "floating",
"icon": "photo_size_select_small",
"icon": "md:photo_size_select_small",
"draggable": false,
"strokeColor": "#c62828",
"fillColor": "rgba(198,40,40,0.2)",
Expand All @@ -163,8 +163,8 @@
},
"wgu-infoclick": {
"target": "menu",
"win":"floating",
"icon": "info",
"win": "floating",
"icon": "md:info",
"draggable": false,
"initPos": {
"left": 8,
Expand Down Expand Up @@ -200,11 +200,10 @@
"wgu-helpwin": {
"target": "toolbar",
"win": "floating",
"icon": "help"
"icon": "md:help"
},
"wgu-localeswitcher": {
"target": "toolbar"
}
}

}
Loading
Loading