Skip to content

Commit fdc4d21

Browse files
authored
XWIKI-23024: Upgrade to Vue 3.x (#4079)
1 parent a39e5c4 commit fdc4d21

File tree

176 files changed

+14654
-26727
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+14654
-26727
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@ xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/res
7272
.clover
7373
*~
7474
**/overlays/*.info
75+
76+
## Node specific
77+
node_modules/
78+
dist/

pom.xml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@
123123
<oracle.groupId>com.oracle.database.jdbc</oracle.groupId>
124124
<oracle.artifactId>ojdbc11</oracle.artifactId>
125125
<oracle.version>21.17.0.0</oracle.version>
126-
126+
127127
<!-- Versions of Node related tools -->
128-
<node.version>v22.13.1</node.version>
129-
<npm.version>11.1.0</npm.version>
128+
<node.version>v22.14.0</node.version>
129+
<npm.version>11.2.0</npm.version>
130130
</properties>
131131
<scm>
132132
<tag>HEAD</tag>
@@ -1187,15 +1187,7 @@
11871187
<dependency>
11881188
<groupId>org.webjars.npm</groupId>
11891189
<artifactId>vue</artifactId>
1190-
<version>2.7.16</version>
1191-
<exclusions>
1192-
<!-- Excluded because this dependency is 1) not used at runtime since all out components are pre-compiled 2)
1193-
not currently deployable on webjars.org (see https://github.com/webjars/webjars/issues/1976) -->
1194-
<exclusion>
1195-
<groupId>org.webjars.npm</groupId>
1196-
<artifactId>vue__compiler-sfc</artifactId>
1197-
</exclusion>
1198-
</exclusions>
1190+
<version>3.5.13</version>
11991191
</dependency>
12001192
</dependencies>
12011193
</dependencyManagement>

xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-test/xwiki-platform-flamingo-skin-test-docker/src/test/it/org/xwiki/flamingo/test/docker/AttachmentIT.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ class AttachmentIT
8080
@BeforeAll
8181
public void setup(TestUtils setup)
8282
{
83+
setup.loginAsSuperAdmin();
84+
// Make sure the timezone configuration the default value until XWIKI-21924 is fixed.
85+
setup.setPropertyInXWikiPreferences("timezone", "String", "");
8386
setup.createUser("User2", "pass", "");
8487
setup.createUserAndLogin("User1", "pass");
8588
}
@@ -104,7 +107,7 @@ void uploadAttachments(TestUtils setup, TestReference testReference, TestConfigu
104107
setup.rest().savePage(testReference, "", "");
105108
Page page = setup.rest().get(testReference);
106109
// We make the page hidden as we identified some issues specific to hidden pages (see XWIKI-20093).
107-
// If it happens that some issues are specific to non-hidden pages, the test will need to be improved to
110+
// If it happens that some issues are specific to non-hidden pages, the test will need to be improved to
108111
// cover both cases (which will make the execution time of the test suite larger).
109112
page.setHidden(true);
110113
setup.rest().save(page);

xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-macro/pom.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<name>XWiki Platform - Live Data - Macro</name>
3333
<description>Display dynamic lists of data.</description>
3434
<properties>
35-
<xwiki.jacoco.instructionRatio>0.91</xwiki.jacoco.instructionRatio>
35+
<xwiki.jacoco.instructionRatio>0.78</xwiki.jacoco.instructionRatio>
3636
<!-- Name to display by the Extension Manager -->
3737
<xwiki.extension.name>Live Data Macro</xwiki.extension.name>
3838
</properties>
@@ -58,6 +58,22 @@
5858
<artifactId>xwiki-platform-bridge</artifactId>
5959
<version>${project.version}</version>
6060
</dependency>
61+
<dependency>
62+
<groupId>org.xwiki.platform</groupId>
63+
<artifactId>xwiki-platform-template-api</artifactId>
64+
<version>${project.version}</version>
65+
</dependency>
66+
<dependency>
67+
<groupId>org.xwiki.platform</groupId>
68+
<artifactId>xwiki-platform-uiextension-api</artifactId>
69+
<version>${project.version}</version>
70+
</dependency>
71+
<dependency>
72+
<groupId>org.xwiki.platform</groupId>
73+
<artifactId>xwiki-platform-webjars-api</artifactId>
74+
<version>${project.version}</version>
75+
<scope>runtime</scope>
76+
</dependency>
6177
<!-- Test dependencies -->
6278
<dependency>
6379
<groupId>org.xwiki.rendering</groupId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* See the NOTICE file distributed with this work for additional
3+
* information regarding copyright ownership.
4+
*
5+
* This is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU Lesser General Public License as
7+
* published by the Free Software Foundation; either version 2.1 of
8+
* the License, or (at your option) any later version.
9+
*
10+
* This software is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this software; if not, write to the Free
17+
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18+
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19+
*/
20+
package org.xwiki.livedata.internal;
21+
22+
import java.util.Map;
23+
24+
import javax.inject.Inject;
25+
import javax.inject.Named;
26+
import javax.inject.Singleton;
27+
28+
import org.xwiki.component.annotation.Component;
29+
import org.xwiki.rendering.block.Block;
30+
import org.xwiki.template.TemplateManager;
31+
import org.xwiki.uiextension.UIExtension;
32+
33+
/**
34+
* Produces the import map for Live Data, allowing other modules to import the utility provided by Live Data using
35+
* JavaScript modules import syntax.
36+
*
37+
* @version $Id$
38+
* @since 17.4.0RC1
39+
*/
40+
@Component
41+
@Singleton
42+
@Named("LiveDataImportmap")
43+
public class LiveDataImportmapUIExtension implements UIExtension
44+
{
45+
@Inject
46+
private TemplateManager templateManager;
47+
48+
@Override
49+
public String getId()
50+
{
51+
return "org.xwiki.platform.livedata.html.head";
52+
}
53+
54+
@Override
55+
public String getExtensionPointId()
56+
{
57+
return "org.xwiki.platform.html.head";
58+
}
59+
60+
@Override
61+
public Map<String, String> getParameters()
62+
{
63+
return Map.of(
64+
"order", "1000"
65+
);
66+
}
67+
68+
@Override
69+
public Block execute()
70+
{
71+
return this.templateManager.executeNoException("liveData/importmap.vm");
72+
}
73+
}
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
org.xwiki.livedata.internal.macro.LiveDataMacro
2+
org.xwiki.livedata.internal.LiveDataImportmapUIExtension
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## ---------------------------------------------------------------------------
2+
## See the NOTICE file distributed with this work for additional
3+
## information regarding copyright ownership.
4+
##
5+
## This is free software; you can redistribute it and/or modify it
6+
## under the terms of the GNU Lesser General Public License as
7+
## published by the Free Software Foundation; either version 2.1 of
8+
## the License, or (at your option) any later version.
9+
##
10+
## This software is distributed in the hope that it will be useful,
11+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
## Lesser General Public License for more details.
14+
##
15+
## You should have received a copy of the GNU Lesser General Public
16+
## License along with this software; if not, write to the Free
17+
## Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18+
## 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19+
## ---------------------------------------------------------------------------
20+
<script type="importmap">
21+
$jsontool.serialize({
22+
'imports': {
23+
'xwiki-livedata': $services.webjars.url('org.xwiki.platform:xwiki-platform-livedata-webjar', 'main.es.js'),
24+
'vue': $services.webjars.url('org.webjars.npm:vue', 'dist/vue.runtime.esm-browser.prod.js'),
25+
'vue-i18n': $services.webjars.url('org.webjars.npm:vue-i18n', 'dist/vue-i18n.esm-browser.prod.js')
26+
}
27+
})
28+
</script>

xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-war/src/main/webapp/resources/uicomponents/widgets/liveData.js

Lines changed: 50 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,19 @@
1818
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
1919
*/
2020
/*!
21-
#set ($liveDataEntry = 'xwiki-livedata.min')
22-
#set ($liveDataPath = $services.webjars.url('org.xwiki.platform:xwiki-platform-livedata-webjar', $liveDataEntry))
2321
#set ($paths = {
2422
'js': {
25-
'xwiki-livedata': $liveDataPath,
26-
'xwiki-livedata-vue': $services.webjars.url('org.xwiki.platform:xwiki-platform-livedata-webjar',
27-
'xwiki-livedata-vue.umd.min'),
28-
'vue': $services.webjars.url('org.webjars.npm:vue', 'dist/vue.min'),
29-
'vue-i18n': $services.webjars.url('org.webjars.npm:vue-i18n', 'dist/vue-i18n.min'),
23+
'vue': $services.webjars.url('org.webjars.npm:vue', 'dist/vue.runtime.esm-browser.prod'),
3024
'daterangepicker': $services.webjars.url('bootstrap-daterangepicker', 'js/bootstrap-daterangepicker.js')
3125
},
26+
'module': {
27+
'xwiki-livedata': $services.webjars.url('org.xwiki.platform:xwiki-platform-livedata-webjar', 'main.es.js')
28+
},
3229
'css': {
3330
'liveData': $services.webjars.url('org.xwiki.platform:xwiki-platform-livedata-webjar',
34-
'xwiki-livedata-vue.umd.min.less', {'evaluate': true}),
31+
'xwiki-platform-livedata.css'),
32+
'liveDataLess': $services.webjars.url('org.xwiki.platform:xwiki-platform-livedata-webjar',
33+
'variables.less', {'evaluate': true}),
3534
'dateRangePicker': $services.webjars.url('bootstrap-daterangepicker', 'css/bootstrap-daterangepicker.css'),
3635
'selectize': [
3736
$services.webjars.url('selectize.js', 'css/selectize.bootstrap3.css'),
@@ -49,81 +48,67 @@
4948
require.config({
5049
paths: paths.js,
5150
map: {
52-
'*': {
53-
'xwiki-livedata-vue': 'xwiki-livedata-vue-with-css',
54-
daterangepicker: 'daterangepicker-with-css',
55-
'xwiki-selectize': 'xwiki-selectize-with-css'
51+
"*": {
52+
"xwiki-livedata": "xwiki-livedata-with-css",
53+
daterangepicker: "daterangepicker-with-css",
54+
"xwiki-selectize": "xwiki-selectize-with-css",
55+
},
56+
"xwiki-livedata-with-css": {
57+
"xwiki-livedata": "xwiki-livedata",
5658
},
57-
'xwiki-livedata-vue-with-css': {
58-
'xwiki-livedata-vue': 'xwiki-livedata-vue'
59+
"daterangepicker-with-css": {
60+
daterangepicker: "daterangepicker",
5961
},
60-
'daterangepicker-with-css': {
61-
daterangepicker: 'daterangepicker'
62+
"xwiki-selectize-with-css": {
63+
"xwiki-selectize": "xwiki-selectize",
6264
},
63-
'xwiki-selectize-with-css': {
64-
'xwiki-selectize': 'xwiki-selectize'
65-
}
6665
},
6766
config: {
68-
'xwiki-livedata-source': {
69-
contextPath: paths.contextPath
70-
}
71-
}
67+
"xwiki-livedata-source": {
68+
contextPath: paths.contextPath,
69+
},
70+
},
7271
});
7372

74-
define('loadCSS', function() {
75-
var loadCSS = function(url) {
76-
var link = document.createElement("link");
77-
link.type = "text/css";
78-
link.rel = "stylesheet";
79-
link.href = url;
80-
document.getElementsByTagName("head")[0].appendChild(link);
81-
};
82-
73+
function loadCSS(url) {
74+
const link = document.createElement("link");
75+
link.type = "text/css";
76+
link.rel = "stylesheet";
77+
link.href = url;
78+
document.getElementsByTagName("head")[0].appendChild(link);
79+
}
80+
81+
function loadModule(url) {
82+
const script = document.createElement("script");
83+
script.type = "module";
84+
script.src = url;
85+
document.getElementsByTagName("head")[0].appendChild(script);
86+
}
87+
88+
define("loadCSS", function() {
8389
return (url) => {
84-
var urls = Array.isArray(url) ? url : [url];
90+
const urls = Array.isArray(url) ? url : [url];
8591
urls.forEach(loadCSS);
8692
};
8793
});
88-
89-
define('xwiki-livedata-vue-with-css', ['loadCSS', 'xwiki-livedata-vue'], function(loadCSS) {
90-
// Load the CSS for the live data.
91-
loadCSS(paths.css.liveData);
92-
return arguments[1];
93-
});
94-
95-
define('daterangepicker-with-css', ['loadCSS', 'daterangepicker'], function(loadCSS) {
94+
95+
define("daterangepicker-with-css", ["loadCSS", "daterangepicker"], function(loadCSS) {
9696
// Load the CSS for the date range picker.
9797
loadCSS(paths.css.dateRangePicker);
9898
return arguments[1];
9999
});
100-
101-
define('xwiki-selectize-with-css', ['loadCSS', 'xwiki-selectize'], function(loadCSS) {
100+
101+
define("xwiki-selectize-with-css", ["loadCSS", "xwiki-selectize"], function(loadCSS) {
102102
// Load the CSS for the suggest picker.
103103
loadCSS(paths.css.selectize);
104104
return arguments[1];
105105
});
106-
107-
window.liveDataBaseURL = paths.liveDataBasePath;
108-
109-
require(['jquery', 'xwiki-livedata'], function($, LiveData) {
110-
$.fn.liveData = function(config) {
111-
return this.each(function() {
112-
if (!$(this).data('liveData')) {
113-
var instanceConfig = $.extend($(this).data('config'), config);
114-
$(this).attr('data-config', JSON.stringify(instanceConfig)).data('liveData', LiveData(this));
115-
}
116-
});
117-
};
118-
119-
var init = function(event, data) {
120-
var container = $((data && data.elements) || document);
121-
container.find('.liveData').liveData();
122-
};
123-
124-
$(document).on('xwiki:dom:updated', init);
125-
$(init);
126-
});
106+
107+
loadModule(paths.module["xwiki-livedata"]);
108+
loadCSS(paths.css.liveData);
109+
// Load a small less file with the declarations of a few LESS values that are not exported
110+
// elsewhere
111+
loadCSS(paths.css.liveDataLess);
127112

128113
// End JavaScript-only code.
129-
}).apply(']]#', $jsontool.serialize([$paths]));
114+
}).apply("]]#", $jsontool.serialize([$paths]));

0 commit comments

Comments
 (0)