Skip to content

Commit

Permalink
XWIKI-18998: Replace the Livetable of the System Filters of the Notif…
Browse files Browse the repository at this point in the history
…ications Administration with a Live Data macro (#2827)
  • Loading branch information
manuelleduc authored Feb 6, 2024
1 parent 0c92506 commit 3a375b0
Show file tree
Hide file tree
Showing 32 changed files with 4,785 additions and 499 deletions.
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,19 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>vue</artifactId>
<version>2.7.16</version>
<exclusions>
<!-- Excluded because this dependency is 1) not used at runtime since all out components are pre-compiled 2)
not currently deployable on webjars.org (see https://github.com/webjars/webjars/issues/1976) -->
<exclusion>
<groupId>org.webjars.npm</groupId>
<artifactId>vue__compiler-sfc</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<build>
Expand Down Expand Up @@ -1510,6 +1523,11 @@
<options>esversion:11,maxparams:5,maxdepth:3,maxstatements:20,maxcomplexity:10,camelcase,maxlen:120</options>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.15.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ public class TableLayoutElement extends BaseElement

private final LiveDataElement liveData;

/**
* @return the list of rows {@link WebElement}s
* @since 16.1.0RC1
*/
public List<WebElement> getRows()
{
return getRoot().findElements(By.cssSelector("tbody > tr"));
}

/**
* A matcher for the cell containing links. The matcher assert of a given {@link WebElement} contains a {@code a}
* tag with the expected text and link.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,7 @@
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>vue</artifactId>
<version>2.7.16</version>
<exclusions>
<!-- Excluded because this dependency is 1) not used at runtime since all out components are pre-compiled 2)
not currently deployable on webjars.org (see https://github.com/webjars/webjars/issues/1976) -->
<exclusion>
<groupId>org.webjars.npm</groupId>
<artifactId>vue__compiler-sfc</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>
<!-- Used by the date filter. -->
<dependency>
Expand Down Expand Up @@ -159,7 +151,6 @@
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.15.0</version>
<executions>
<execution>
<id>install-node-and-npm</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"scripts": {
"build": "vue-cli-service build --target lib --formats umd-min XWikiLivedata.vue",
"build": "vue-cli-service build --target lib --formats umd-min main.mjs",
"inspect": "vue-cli-service inspect > inspection.js",
"lint": "vue-cli-service lint . --no-fix",
"test": "vue-cli-service test:unit"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
import displayerMixin from "./displayers/displayerMixin.js";
import BaseDisplayer from "./displayers/BaseDisplayer.vue";
import XWikiIcon from "./utilities/XWikiIcon.vue";
import XWikiLivedata from "./XWikiLivedata.vue"

// Export the elements that are expected to be imported from other modules.
export {
displayerMixin,
BaseDisplayer,
XWikiIcon,
XWikiLivedata
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ export default {
}
// Set the icon to the resolved value of the promise.
this.remoteIconDescriptor = await iconCache[iconName];
// Send a ready even once initialize so that parent containers can know when this component is in a stable
// state.
this.$emit('ready');
},
immediate: true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ define('xwiki-livedata', [
], function(
Vue,
VueI18n,
XWikiLivedata,
xwikiLivedataVue,
liveDataSourceModule,
jsonMerge,
editBus
) {
const XWikiLivedata = xwikiLivedataVue.XWikiLivedata;
/**
* Make vue use the i18n plugin
*/
Expand Down
1 change: 1 addition & 0 deletions xwiki-platform-core/xwiki-platform-notifications/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<module>xwiki-platform-notifications-sources</module>
<module>xwiki-platform-notifications-ui</module>
<module>xwiki-platform-notifications-macro</module>
<module>xwiki-platform-notifications-webjar</module>
</modules>
<profiles>
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
<artifactId>xwiki-platform-oldcore</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-livedata-api</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>org.xwiki.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.notifications.filters.internal.livedata;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import org.xwiki.component.annotation.Component;
import org.xwiki.livedata.LiveDataConfiguration;
import org.xwiki.livedata.LiveDataConfigurationResolver;
import org.xwiki.livedata.LiveDataEntryDescriptor;
import org.xwiki.livedata.LiveDataException;
import org.xwiki.livedata.LiveDataPropertyDescriptorStore;
import org.xwiki.livedata.internal.JSONMerge;

import static org.xwiki.notifications.filters.internal.livedata.NotificationFilterPreferenceLiveDataSource.NOTIFICATION_FILTER_PREFERENCE;
import static org.xwiki.notifications.filters.internal.livedata.NotificationFilterPreferencePropertyDescriptorStore.FILTER_PREFERENCE_ID;

/**
* @version $Id$
* @since 16.1.0RC1
*/
@Component
@Named(NOTIFICATION_FILTER_PREFERENCE)
@Singleton
public class NotificationFilterPreferenceConfigurationResolver
implements LiveDataConfigurationResolver<LiveDataConfiguration>
{
@Inject
@Named(NOTIFICATION_FILTER_PREFERENCE)
private LiveDataPropertyDescriptorStore liveDataPropertyDescriptorStore;

@Override
public LiveDataConfiguration resolve(LiveDataConfiguration input) throws LiveDataException
{
LiveDataConfiguration liveDataConfiguration = new LiveDataConfiguration();
liveDataConfiguration.getMeta().setPropertyDescriptors(this.liveDataPropertyDescriptorStore.get());
LiveDataEntryDescriptor entryDescriptor = new LiveDataEntryDescriptor();
entryDescriptor.setIdProperty(FILTER_PREFERENCE_ID);
liveDataConfiguration.getMeta().setEntryDescriptor(entryDescriptor);
return new JSONMerge().merge(input, liveDataConfiguration);
}
}
Loading

0 comments on commit 3a375b0

Please sign in to comment.