Compare commits

...

7 Commits

Author SHA1 Message Date
Rainer Killinger
5a48342a8d docs: update changelogs for release
ci: publish release
2025-07-30 14:15:24 +02:00
Rainer Killinger
6b06de4019 refactor: update audit relevant nodemailer dependency 2025-07-30 13:58:25 +02:00
Rainer Killinger
c5c9bcf433 docs: update changelogs for release
ci: publish release
2025-07-30 12:44:30 +02:00
Rainer Killinger
b40ba7ad63 refactor: update elasticsearch and audit relevant dependencies 2025-07-30 12:40:59 +02:00
Jovan Krunić
362f6adf07 fix: use modal instead of menu inside of a split pane
Closes #234
2025-07-08 14:05:30 +02:00
Rainer Killinger
bbd6b0f874 fix: app missing chevron buttons in schedule module 2025-07-02 16:44:23 +02:00
Rainer Killinger
b1a9ba44d0 fix: app now requests backend version 4.0.0 2025-07-02 12:04:41 +02:00
55 changed files with 941 additions and 903 deletions

View File

@@ -1,5 +1,22 @@
# @openstapps/backend # @openstapps/backend
## 4.0.2
### Patch Changes
- 6b06de40: Updated nodemailer dependency
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/core@4.0.2
- @openstapps/core-tools@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/backend", "name": "@openstapps/backend",
"description": "A reference implementation for a StApps backend", "description": "A reference implementation for a StApps backend",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
@@ -43,11 +43,11 @@
"test:unit": "cross-env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true STAPPS_LOG_LEVEL=0 mocha --exit" "test:unit": "cross-env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true STAPPS_LOG_LEVEL=0 mocha --exit"
}, },
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "8.4.0", "@elastic/elasticsearch": "8.14.1",
"@openstapps/core": "workspace:*", "@openstapps/core": "workspace:*",
"@openstapps/core-tools": "workspace:*", "@openstapps/core-tools": "workspace:*",
"@openstapps/logger": "workspace:*", "@openstapps/logger": "workspace:*",
"@types/body-parser": "1.19.2", "@types/body-parser": "1.19.6",
"@types/cors": "2.8.13", "@types/cors": "2.8.13",
"@types/express": "4.17.17", "@types/express": "4.17.17",
"@types/geojson": "1.0.6", "@types/geojson": "1.0.6",
@@ -56,20 +56,20 @@
"@types/nodemailer": "6.4.7", "@types/nodemailer": "6.4.7",
"@types/promise-queue": "2.2.0", "@types/promise-queue": "2.2.0",
"@types/uuid": "8.3.4", "@types/uuid": "8.3.4",
"body-parser": "1.20.2", "body-parser": "1.20.3",
"cors": "2.8.5", "cors": "2.8.5",
"cosmiconfig": "8.1.3", "cosmiconfig": "8.1.3",
"deepmerge": "4.3.1", "deepmerge": "4.3.1",
"express": "4.18.2", "express": "4.21.2",
"express-prom-bundle": "6.6.0", "express-prom-bundle": "6.6.0",
"express-promise-router": "4.1.1", "express-promise-router": "4.1.1",
"got": "12.6.0", "got": "12.6.0",
"moment": "2.30.1", "moment": "2.30.1",
"morgan": "1.10.0", "morgan": "1.10.1",
"nock": "13.3.1", "nock": "13.3.1",
"node-cache": "5.1.2", "node-cache": "5.1.2",
"node-cron": "3.0.2", "node-cron": "3.0.2",
"nodemailer": "6.9.1", "nodemailer": "6.9.9",
"prom-client": "14.1.1", "prom-client": "14.1.1",
"promise-queue": "2.2.5", "promise-queue": "2.2.5",
"uuid": "8.3.2" "uuid": "8.3.2"
@@ -83,7 +83,7 @@
"@types/chai": "4.3.20", "@types/chai": "4.3.20",
"@types/chai-as-promised": "7.1.8", "@types/chai-as-promised": "7.1.8",
"@types/mocha": "10.0.10", "@types/mocha": "10.0.10",
"@types/morgan": "1.9.4", "@types/morgan": "1.9.10",
"@types/sinon": "10.0.14", "@types/sinon": "10.0.14",
"@types/sinon-express-mock": "1.3.9", "@types/sinon-express-mock": "1.3.9",
"@types/supertest": "2.0.12", "@types/supertest": "2.0.12",

View File

@@ -1,5 +1,11 @@
# @openstapps/database # @openstapps/database
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,4 +1,4 @@
FROM elasticsearch:8.4.2 FROM elasticsearch:8.14.3
EXPOSE 9200 EXPOSE 9200
EXPOSE 9300 EXPOSE 9300

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/database", "name": "@openstapps/database",
"version": "4.0.0", "version": "4.0.1",
"private": true, "private": true,
"files": [ "files": [
"config", "config",

View File

@@ -1,5 +1,12 @@
# @openstapps/proxy # @openstapps/proxy
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/proxy", "name": "@openstapps/proxy",
"description": "NGINX proxy that is dynamically configured by a Node.js script", "description": "NGINX proxy that is dynamically configured by a Node.js script",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",

View File

@@ -1,5 +1,19 @@
# @openstapps/projectmanagement # @openstapps/projectmanagement
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/gitlab-api@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/projectmanagement", "name": "@openstapps/projectmanagement",
"description": "Main documentation and scripts for maintenance.", "description": "Main documentation and scripts for maintenance.",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@@ -41,7 +41,6 @@
"@openstapps/collection-utils": "workspace:*", "@openstapps/collection-utils": "workspace:*",
"@openstapps/gitlab-api": "workspace:*", "@openstapps/gitlab-api": "workspace:*",
"@openstapps/logger": "workspace:*", "@openstapps/logger": "workspace:*",
"@slack/web-api": "6.8.1",
"commander": "10.0.0", "commander": "10.0.0",
"date-fns": "3.6.0", "date-fns": "3.6.0",
"glob": "10.3.10", "glob": "10.3.10",

View File

@@ -22,7 +22,6 @@ import {
User, User,
} from '@openstapps/gitlab-api'; } from '@openstapps/gitlab-api';
import {Logger} from '@openstapps/logger'; import {Logger} from '@openstapps/logger';
import {WebClient} from '@slack/web-api';
import {CONCURRENCY, GROUPS, MAX_DEPTH_FOR_REMINDER, NOTE_PREFIX, SLACK_CHANNEL} from '../configuration.js'; import {CONCURRENCY, GROUPS, MAX_DEPTH_FOR_REMINDER, NOTE_PREFIX, SLACK_CHANNEL} from '../configuration.js';
import {mapAsyncLimit} from '@openstapps/collection-utils'; import {mapAsyncLimit} from '@openstapps/collection-utils';
@@ -53,8 +52,7 @@ export async function remind(api: Api): Promise<void> {
Logger.info(`Found ${mergeRequests.length} open merge requests.`); Logger.info(`Found ${mergeRequests.length} open merge requests.`);
// instantiate slack client // instantiate slack client
const client = const client = undefined;
process.env.SLACK_API_TOKEN === undefined ? undefined : new WebClient(process.env.SLACK_API_TOKEN);
// get members of the main group // get members of the main group
const members = await api.getMembers(MembershipScope.GROUPS, GROUPS[0]); const members = await api.getMembers(MembershipScope.GROUPS, GROUPS[0]);

View File

@@ -1,5 +1,22 @@
# @openstapps/minimal-connector # @openstapps/minimal-connector
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/core@4.0.2
- @openstapps/api@4.0.2
## 4.0.1
### Patch Changes
- Updated dependencies [b40ba7ad]
- @openstapps/api@4.0.1
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/minimal-connector", "name": "@openstapps/minimal-connector",
"description": "This is a minimal connector which serves as an example", "description": "This is a minimal connector which serves as an example",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",

View File

@@ -1,5 +1,11 @@
# @openstapps/minimal-deployment # @openstapps/minimal-deployment
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,23 +1,21 @@
version: '3.7'
x-development-variables: &development-variables x-development-variables: &development-variables
NODE_ENV: "development" NODE_ENV: "development"
ALLOW_NO_TRANSPORT: "true" ALLOW_NO_TRANSPORT: "true"
services: services:
database: database:
image: registry.gitlab.com/openstapps/openstapps/database:3.0.0 image: registry.gitlab.com/openstapps/openstapps/database:4.0.1
# If you need persistence for debugging purposes uncomment the following lines # If you need persistence for debugging purposes uncomment the following lines
#volumes: # volumes:
# - ./database:/usr/share/elasticsearch/data # - ./database:/usr/share/elasticsearch/data
expose: expose:
- 9200 - 9200
ports: ports:
- 127.0.0.1:9200:9200 - 127.0.0.1:9200:9200
environment: environment:
- bootstrap.memory_lock=true # - bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms2g -Xmx2g" # - discovery.type=single-node
- discovery.type=single-node - "ES_JAVA_OPTS=-Xms4g -Xmx4g"
ulimits: ulimits:
memlock: memlock:
soft: -1 soft: -1
@@ -25,7 +23,7 @@ services:
restart: unless-stopped restart: unless-stopped
backend: backend:
image: registry.gitlab.com/openstapps/openstapps/backend:3.1.0 image: registry.gitlab.com/openstapps/openstapps/backend:4.0.1
environment: environment:
<<: *development-variables <<: *development-variables
ES_ADDR: "http://database:9200" ES_ADDR: "http://database:9200"
@@ -37,10 +35,11 @@ services:
ports: ports:
- 127.0.0.1:3000:3000 - 127.0.0.1:3000:3000
labels: labels:
- stapps.version=4.1.0 - stapps.version=4.0.0
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- database database:
condition: service_healthy
links: links:
- database - database

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/minimal-deployment", "name": "@openstapps/minimal-deployment",
"version": "4.0.0", "version": "4.0.1",
"private": true, "private": true,
"files": [ "files": [
"database", "database",

View File

@@ -1,5 +1,26 @@
# @openstapps/minimal-plugin # @openstapps/minimal-plugin
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/api-plugin@4.0.2
- @openstapps/core@4.0.2
- @openstapps/core-tools@4.0.2
- @openstapps/api@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
- Updated dependencies [b40ba7ad]
- @openstapps/api-plugin@4.0.1
- @openstapps/api@4.0.1
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/minimal-plugin", "name": "@openstapps/minimal-plugin",
"description": "Minimal Plugin", "description": "Minimal Plugin",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@@ -34,7 +34,7 @@
"@openstapps/core-tools": "workspace:*", "@openstapps/core-tools": "workspace:*",
"@openstapps/logger": "workspace:*", "@openstapps/logger": "workspace:*",
"commander": "10.0.0", "commander": "10.0.0",
"express": "4.18.2", "express": "4.21.2",
"ts-node": "10.9.2" "ts-node": "10.9.2"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -1,5 +1,21 @@
# @openstapps/app # @openstapps/app
## 4.0.2
### Patch Changes
- @openstapps/core@4.0.2
- @openstapps/api@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
- Updated dependencies [b40ba7ad]
- @openstapps/api@4.0.1
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -14,6 +14,8 @@
*/ */
describe('context menu', function () { describe('context menu', function () {
const contextMenuSelector = 'stapps-context-menu-modal';
beforeEach(function () { beforeEach(function () {
cy.interceptSearch({ cy.interceptSearch({
extends: {query: 'a'}, extends: {query: 'a'},
@@ -33,21 +35,21 @@ describe('context menu', function () {
}); });
it('should sort', function () { it('should sort', function () {
cy.get('stapps-context').within(() => { cy.get(contextMenuSelector).within(() => {
cy.contains('ion-item', 'Name').click(); cy.contains('ion-item', 'Name').click();
cy.wait('@search'); cy.wait('@search');
}); });
}); });
it('should filter', function () { it('should filter', function () {
cy.get('stapps-context').within(() => { cy.get(contextMenuSelector).within(() => {
cy.contains('ion-item', '(17) Akademische Veranstaltung').click(); cy.contains('ion-item', '(17) Akademische Veranstaltung').click();
cy.wait('@search'); cy.wait('@search');
}); });
}); });
it('should have a working delete button', function () { it('should have a working delete button', function () {
cy.get('stapps-context').within(() => { cy.get(contextMenuSelector).within(() => {
cy.contains('ion-item', '(17) Akademische Veranstaltung').click(); cy.contains('ion-item', '(17) Akademische Veranstaltung').click();
cy.get('.checkbox-checked').should('have.length', 1); cy.get('.checkbox-checked').should('have.length', 1);
@@ -60,7 +62,7 @@ describe('context menu', function () {
it('should truncate long category items', function () { it('should truncate long category items', function () {
cy.contains('ion-list', 'Akademische Veranstaltung / Kategorien').within(() => { cy.contains('ion-list', 'Akademische Veranstaltung / Kategorien').within(() => {
cy.contains('ion-item', '(1) Tutorium').should('not.exist'); cy.contains('ion-item', '(1) Tutorium').should('not.exist');
cy.get('div > ion-button').click(); cy.get('ion-button').click();
cy.contains('ion-item', '(1) Tutorium').should('exist'); cy.contains('ion-item', '(1) Tutorium').should('exist');
}); });
}); });

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/app", "name": "@openstapps/app",
"description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.", "description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.",
"version": "4.0.0", "version": "4.0.2",
"private": true, "private": true,
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>", "author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
@@ -91,7 +91,7 @@
"cordova-plugin-calendar": "5.1.6", "cordova-plugin-calendar": "5.1.6",
"date-fns": "3.6.0", "date-fns": "3.6.0",
"deepmerge": "4.3.1", "deepmerge": "4.3.1",
"form-data": "4.0.0", "form-data": "4.0.4",
"geojson": "0.5.0", "geojson": "0.5.0",
"ionic-appauth": "0.9.0", "ionic-appauth": "0.9.0",
"ionicons": "7.4.0", "ionicons": "7.4.0",

View File

@@ -15,7 +15,12 @@
import {Component, DestroyRef, inject, Input, OnInit} from '@angular/core'; import {Component, DestroyRef, inject, Input, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {Keyboard} from '@capacitor/keyboard'; import {Keyboard} from '@capacitor/keyboard';
import {AlertController, AnimationBuilder, AnimationController} from '@ionic/angular/standalone'; import {
AlertController,
AnimationBuilder,
AnimationController,
ModalController,
} from '@ionic/angular/standalone';
import {Capacitor} from '@capacitor/core'; import {Capacitor} from '@capacitor/core';
import { import {
SCFacet, SCFacet,
@@ -36,6 +41,8 @@ import {PositionService} from '../../map/position.service';
import {ConfigProvider} from '../../config/config.provider'; import {ConfigProvider} from '../../config/config.provider';
import {searchPageSwitchAnimation} from './search-page-switch-animation'; import {searchPageSwitchAnimation} from './search-page-switch-animation';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {ContextMenuModalComponent} from '../../menu/context/context-menu-modal.component';
import {enterAnimation, leaveAnimation} from '../../menu/context/context-menu-modal.animations';
/** /**
* SearchPageComponent queries things and shows list of things as search results and filter as context menu * SearchPageComponent queries things and shows list of things as search results and filter as context menu
@@ -173,7 +180,8 @@ export class SearchPageComponent implements OnInit {
private readonly route: ActivatedRoute, private readonly route: ActivatedRoute,
protected positionService: PositionService, protected positionService: PositionService,
private readonly configProvider: ConfigProvider, private readonly configProvider: ConfigProvider,
animationController: AnimationController, protected animationController: AnimationController,
protected modalController: ModalController,
) { ) {
this.routeAnimation = searchPageSwitchAnimation(animationController); this.routeAnimation = searchPageSwitchAnimation(animationController);
} }
@@ -368,4 +376,20 @@ export class SearchPageComponent implements OnInit {
this.searchStringChanged(term); this.searchStringChanged(term);
} }
} }
async openContextMenu(): Promise<void> {
const modal = await this.modalController.create({
component: ContextMenuModalComponent,
cssClass: 'context-menu-modal',
showBackdrop: true,
backdropDismiss: true,
enterAnimation: (baseElement: HTMLElement) => enterAnimation(baseElement, this.animationController),
leaveAnimation: (baseElement: HTMLElement) => leaveAnimation(baseElement, this.animationController),
componentProps: {
contextMenuService: this.contextMenuService,
},
});
await modal.present();
}
} }

View File

@@ -12,10 +12,6 @@
~ You should have received a copy of the GNU General Public License along with ~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>. ~ this program. If not, see <https://www.gnu.org/licenses/>.
--> -->
@if (showContextMenu) {
<stapps-context contentId="data-list"></stapps-context>
}
<ion-header> <ion-header>
@if (showDrawer && showTopToolbar) { @if (showDrawer && showTopToolbar) {
<ion-toolbar color="primary" mode="ios"> <ion-toolbar color="primary" mode="ios">
@@ -41,7 +37,7 @@
> >
</ion-searchbar> </ion-searchbar>
@if (showContextMenu) { @if (showContextMenu) {
<ion-menu-button menu="context" auto-hide="false" slot="end"> <ion-menu-button menu="context" auto-hide="false" slot="end" (click)="openContextMenu()">
<ion-icon name="tune"></ion-icon> <ion-icon name="tune"></ion-icon>
</ion-menu-button> </ion-menu-button>
} }

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {AlertController, AnimationController} from '@ionic/angular/standalone'; import {AlertController, AnimationController, ModalController} from '@ionic/angular/standalone';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {NGXLogger} from 'ngx-logger'; import {NGXLogger} from 'ngx-logger';
import {debounceTime, distinctUntilChanged, startWith, take} from 'rxjs/operators'; import {debounceTime, distinctUntilChanged, startWith, take} from 'rxjs/operators';
@@ -55,6 +55,7 @@ export class FavoritesPageComponent extends SearchPageComponent implements OnIni
private favoritesService: FavoritesService, private favoritesService: FavoritesService,
configProvider: ConfigProvider, configProvider: ConfigProvider,
animationController: AnimationController, animationController: AnimationController,
modalController: ModalController,
) { ) {
super( super(
alertController, alertController,
@@ -68,6 +69,7 @@ export class FavoritesPageComponent extends SearchPageComponent implements OnIni
positionService, positionService,
configProvider, configProvider,
animationController, animationController,
modalController,
); );
} }

View File

@@ -0,0 +1,68 @@
/*
* Copyright (C) 2025 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program 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 General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Animation, AnimationController} from '@ionic/angular';
/**
* Defines the animation for showing a modal as a right-hand sidebar.
* @param baseElement The root element of the modal (including Shadow DOM).
* @param animationCtrl The Ionic AnimationController.
* @returns The configured Ionic animation.
*/
export const enterAnimation = (baseElement: HTMLElement, animationCtrl: AnimationController): Animation => {
const root = baseElement.shadowRoot;
const backdrop = root?.querySelector('ion-backdrop');
const wrapper = root?.querySelector('.modal-wrapper');
// The wrapper needs to be positioned on the right side
if (wrapper instanceof HTMLElement) {
Object.assign(wrapper.style, {
position: 'absolute',
top: '0',
right: '0',
height: '100%',
width: '304px',
maxWidth: '75%',
opacity: '1',
});
}
const backdropAnimation = animationCtrl
.create()
.addElement(backdrop!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = animationCtrl
.create()
.addElement(wrapper!)
.fromTo('transform', 'translateX(100%)', 'translateX(0)');
return animationCtrl
.create()
.addElement(baseElement)
.duration(400)
.easing('ease-out')
.addAnimation([backdropAnimation, wrapperAnimation]);
};
/**
* Defines the animation for hiding a modal by sliding it out to the right.
* @param baseElement The root element of the modal.
* @param animationCtrl The Ionic AnimationController.
* @returns The configured Ionic animation (reverse of enterAnimation).
*/
export const leaveAnimation = (baseElement: HTMLElement, animationCtrl: AnimationController): Animation => {
return enterAnimation(baseElement, animationCtrl).direction('reverse');
};

View File

@@ -0,0 +1,179 @@
/*
* Copyright (C) 2025 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program 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 General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* eslint-disable @typescript-eslint/no-non-null-assertion,@typescript-eslint/no-explicit-any */
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {FormsModule} from '@angular/forms';
import {CommonModule} from '@angular/common';
import {TranslateModule} from '@ngx-translate/core';
import {IonicModule} from '@ionic/angular';
import {SCThingType} from '@openstapps/core';
import {ContextMenuModalComponent} from './context-menu-modal.component';
import {ContextMenuService} from './context-menu.service';
import {FilterContext, SortContext} from './context-type';
import {provideIonicAngular, ModalController} from '@ionic/angular/standalone';
import {BehaviorSubject, of} from 'rxjs';
import {addIcons} from 'ionicons';
import {swapVertical, trash} from 'ionicons/icons';
describe('ContextMenuModalComponent', () => {
let fixture: ComponentFixture<ContextMenuModalComponent>;
let component: ContextMenuModalComponent;
let modalControllerSpy: jasmine.SpyObj<ModalController>;
let contextMenuServiceMock: Partial<ContextMenuService>;
// Register used icons (suppress warnings)
addIcons({
delete: trash,
sort: swapVertical,
});
beforeEach(async () => {
modalControllerSpy = jasmine.createSpyObj<ModalController>('ModalController', ['dismiss']);
contextMenuServiceMock = {
filterOptions: new BehaviorSubject<FilterContext | undefined>(getFilterContextType()),
sortOptions: new BehaviorSubject<SortContext | undefined>(getSortContextType()),
filterContextChanged$: of(getFilterContextType()),
sortContextChanged$: of(getSortContextType()),
contextFilterChanged: jasmine.createSpy(),
contextSortChanged: jasmine.createSpy(),
};
await TestBed.configureTestingModule({
declarations: [ContextMenuModalComponent],
imports: [CommonModule, FormsModule, TranslateModule.forRoot(), IonicModule.forRoot()],
providers: [
provideIonicAngular(),
{
provide: ModalController,
useValue: modalControllerSpy,
},
{
provide: ContextMenuService,
useValue: contextMenuServiceMock,
},
],
}).compileComponents();
fixture = TestBed.createComponent(ContextMenuModalComponent);
component = fixture.componentInstance;
component.contextMenuService = contextMenuServiceMock as ContextMenuService;
component.translator = {
translatedPropertyValue: () => 'translated',
} as any;
fixture.detectChanges();
});
it('should create the component', () => {
expect(component).toBeTruthy();
});
it('should load initial sort and filter context', () => {
expect(component.sortOption?.value).toBe('relevance');
expect(component.filterOption?.options?.length).toBeGreaterThan(0);
});
it('should display sort items', () => {
const sortItems = fixture.nativeElement.querySelectorAll('.sort-item');
expect(sortItems.length).toBe(component.sortOption.values.length);
});
it('should update and reverse sort value on click', () => {
const value = component.sortOption.values[1]; // "name", reversible
component.sortChanged(component.sortOption, value);
expect(component.sortOption.value).toBe('name');
expect(component.sortOption.reversed).toBeFalse();
component.sortChanged(component.sortOption, value);
expect(component.sortOption.reversed).toBeTrue();
});
it('should call contextFilterChanged when filter is reset', () => {
component.filterOption.options[0].buckets[0].checked = true;
component.resetFilter(component.filterOption);
const allUnchecked = component.filterOption.options.every(opt =>
opt.buckets.every(bucket => !bucket.checked),
);
expect(allUnchecked).toBeTrue();
expect(contextMenuServiceMock.contextFilterChanged).toHaveBeenCalled();
});
it('should dismiss the modal', () => {
component.dismiss();
expect(modalControllerSpy.dismiss).toHaveBeenCalled();
});
});
/**
*
*/
function getSortContextType(): SortContext {
return {
name: 'sort',
reversed: false,
value: 'relevance',
values: [
{value: 'relevance', reversible: false},
{value: 'name', reversible: true},
{value: 'date', reversible: true},
{value: 'type', reversible: true},
],
};
}
/**
*
*/
function getFilterContextType(): FilterContext {
return {
name: 'filter',
compact: false,
options: facetsMock
.filter(facet => facet.buckets.length > 0)
.map((facet, i) => ({
buckets: facet.buckets.map(bucket => ({
count: bucket.count,
key: bucket.key,
checked: false,
})),
compact: false,
field: facet.field,
onlyOnType: facet.onlyOnType,
info: {
onlyOnType: facet.onlyOnType,
field: facet.field,
sortOrder: i,
},
})),
};
}
const facetsMock = [
{
buckets: [
{count: 10, key: 'lecture'},
{count: 5, key: 'seminar'},
],
field: 'type',
onlyOnType: SCThingType.AcademicEvent,
},
{
buckets: [{count: 7, key: 'research'}],
field: 'categories',
onlyOnType: SCThingType.AcademicEvent,
},
];

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2023 StApps * Copyright (C) 2025 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3. * Software Foundation, version 3.
@@ -12,76 +12,40 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {Component, Input} from '@angular/core';
import {LangChangeEvent, TranslateService} from '@ngx-translate/core'; import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
import {SCLanguage, SCThingTranslator, SCThingType, SCTranslations} from '@openstapps/core'; import {SCLanguage, SCThingTranslator, SCThingType, SCTranslations} from '@openstapps/core';
import {ContextMenuService} from './context-menu.service'; import {ContextMenuService} from './context-menu.service';
import {FilterContext, FilterFacet, SortContext, SortContextOption} from './context-type.js'; import {FilterContext, FilterFacet, SortContext, SortContextOption} from './context-type.js';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {ModalController} from '@ionic/angular/standalone';
import {Component, Input, OnInit, OnDestroy} from '@angular/core';
import {Subject, takeUntil} from 'rxjs';
/**
* The context menu
*
* It can be configured with sorting types and filtering on facets
*
* Example:<br>
* `<stapps-context (optionChange)="onOptionChange($event)" (settingChange)="onSettingChange($event)"
* [sortOption]="SortContext" [filterOption]="FilterContext"></stapps-context>`
*/
@Component({ @Component({
selector: 'stapps-context', selector: 'stapps-context-menu-modal',
templateUrl: 'context-menu.html', templateUrl: './context-menu-modal.html',
}) })
export class ContextMenuComponent { export class ContextMenuModalComponent implements OnInit, OnDestroy {
/** @Input() contextMenuService: ContextMenuService;
* Id of the content the menu is used for
*/
@Input()
contentId: string;
/**
* Amount of filter options shown on compact view
*/
compactFilterOptionCount = 5; compactFilterOptionCount = 5;
/**
* Container for the filter context
*/
filterOption: FilterContext; filterOption: FilterContext;
/**
* Picks facets based on the compact filter option and sorts
* them based on
*
* No specific type => Type name alphabetically => Bucket count
*/
get facets(): FilterFacet[] {
return this.filterOption.options.filter(it => it.buckets.length > 0);
}
/**
* Possible languages to be used for translation
*/
language: keyof SCTranslations<SCLanguage>;
/**
* Mapping of SCThingType
*/
scThingType = SCThingType;
/**
* Container for the sort context
*/
sortOption: SortContext; sortOption: SortContext;
/** language: keyof SCTranslations<SCLanguage>;
* Core translator
*/
translator: SCThingTranslator; translator: SCThingTranslator;
scThingType = SCThingType;
// Using a subject to manage subscriptions for clean-up
private readonly destroy$ = new Subject<void>();
constructor( constructor(
private translateService: TranslateService, private translateService: TranslateService,
private readonly contextMenuService: ContextMenuService, private readonly modalController: ModalController,
) { ) {
this.language = this.translateService.currentLang as keyof SCTranslations<SCLanguage>; this.language = this.translateService.currentLang as keyof SCTranslations<SCLanguage>;
this.translator = new SCThingTranslator(this.language); this.translator = new SCThingTranslator(this.language);
@@ -90,43 +54,56 @@ export class ContextMenuComponent {
this.language = event.lang as keyof SCTranslations<SCLanguage>; this.language = event.lang as keyof SCTranslations<SCLanguage>;
this.translator = new SCThingTranslator(this.language); this.translator = new SCThingTranslator(this.language);
}); });
this.contextMenuService.filterContextChanged$.pipe(takeUntilDestroyed()).subscribe(filterContext => { }
this.filterOption = filterContext;
ngOnInit(): void {
const initialFilter = this.contextMenuService.filterOptions.getValue();
if (initialFilter) {
this.filterOption = initialFilter;
}
const initialSort = this.contextMenuService.sortOptions.getValue();
if (initialSort) {
this.sortOption = initialSort;
}
// Move the subscription logic here. It's now safe to access this.contextMenuService.
this.contextMenuService.filterContextChanged$.pipe(takeUntil(this.destroy$)).subscribe(fc => {
if (fc) {
this.filterOption = fc;
}
}); });
this.contextMenuService.sortOptions.pipe(takeUntilDestroyed()).subscribe(sortContext => {
this.sortOption = sortContext; this.contextMenuService.sortContextChanged$.pipe(takeUntil(this.destroy$)).subscribe(sc => {
if (sc) {
this.sortOption = sc;
}
}); });
} }
/** ngOnDestroy(): void {
* Sets selected filter options and updates listener this.destroy$.next();
*/ this.destroy$.complete();
}
get facets(): FilterFacet[] {
return this.filterOption?.options?.filter(it => it.buckets.length > 0) || [];
}
resetFilter(option: FilterContext) {
for (const facet of option.options) {
for (const bucket of facet.buckets) {
bucket.checked = false;
}
}
this.contextMenuService.contextFilterChanged(this.filterOption);
}
filterChanged = () => { filterChanged = () => {
this.contextMenuService.contextFilterChanged(this.filterOption); this.contextMenuService.contextFilterChanged(this.filterOption);
}; };
/** sortChanged(option: SortContext, value: SortContextOption) {
* Returns translated property value
*/
getTranslatedPropertyValue(onlyForType: SCThingType, field: string, key?: string): string | undefined {
return this.translator.translatedPropertyValue(onlyForType, field, key);
}
/**
* Resets filter options
*/
resetFilter = (option: FilterContext) => {
for (const filterFacet of option.options)
for (const filterBucket of filterFacet.buckets) {
filterBucket.checked = false;
}
this.contextMenuService.contextFilterChanged(this.filterOption);
};
/**
* Updates selected sort option and updates listener
*/
sortChanged = (option: SortContext, value: SortContextOption) => {
if (option.value === value.value) { if (option.value === value.value) {
if (value.reversible) { if (value.reversible) {
option.reversed = !option.reversed; option.reversed = !option.reversed;
@@ -138,5 +115,13 @@ export class ContextMenuComponent {
} }
} }
this.contextMenuService.contextSortChanged(option); this.contextMenuService.contextSortChanged(option);
}; }
getTranslatedPropertyValue(onlyForType: SCThingType, field: string, key?: string): string | undefined {
return this.translator.translatedPropertyValue(onlyForType, field, key);
}
dismiss() {
this.modalController.dismiss();
}
} }

View File

@@ -0,0 +1,104 @@
<!--
~ Copyright (C) 2025 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program 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 General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-header>
<ion-toolbar color="primary" mode="ios">
<ion-label class="ion-padding-horizontal">
<h1 class="ion-padding-horizontal">{{ 'menu.context.title' | translate | titlecase }}</h1>
</ion-label>
</ion-toolbar>
</ion-header>
<ion-content>
<!-- Sort Context -->
<ion-list *ngIf="sortOption">
<ion-radio-group class="context-sort" [value]="0">
<ion-list-header>
<ion-icon name="sort"></ion-icon>
<ion-title>{{ 'menu.context.sort.title' | translate | titlecase }}</ion-title>
</ion-list-header>
<ion-item
class="sort-item"
*ngFor="let value of sortOption.values; let i = index"
(click)="sortChanged(sortOption, value)"
>
<ion-radio [value]="i">
{{ 'menu.context.sort.' + value.value | translate | titlecase }}
<span *ngIf="sortOption.value === value.value && value.reversible">
<ion-icon *ngIf="sortOption.reversed" name="arrow_downward"></ion-icon>
<ion-icon *ngIf="!sortOption.reversed" name="arrow_upward"></ion-icon>
</span>
</ion-radio>
</ion-item>
</ion-radio-group>
</ion-list>
<!-- Filter Context -->
<form class="context-filter" *ngIf="filterOption">
<ion-list-header>
<ion-icon name="filter_list"></ion-icon>
<ion-title>{{ 'menu.context.filter.title' | translate | titlecase }}</ion-title>
<ion-button class="resetFilterButton" fill="clear" color="dark" (click)="resetFilter(filterOption)">
<ion-icon name="delete"></ion-icon>
</ion-button>
</ion-list-header>
<ion-list class="filter-group" *ngFor="let facet of facets">
<ion-list-header class="h3">
<ion-label>
<span *ngIf="facet.info.onlyOnType"
><b>{{ facet.info.onlyOnType | titlecase }}</b> /
</span>
{{ facet.info.field | titlecase }}
</ion-label>
</ion-list-header>
<ng-container
*ngFor="
let bucket of !facet.compact ? facet.buckets.slice(0, compactFilterOptionCount) : facet.buckets
"
>
<ion-item>
<ion-checkbox
[(ngModel)]="bucket.checked"
(ngModelChange)="filterChanged()"
[name]="facet.onlyOnType + '-' + facet.field + '-' + bucket.key"
[value]="{
field: facet.field,
value: bucket.key,
onlyOnType: facet.onlyOnType
}"
class="filter-item-label"
>
({{ bucket.count }})
{{
facet.field === 'type'
? (getTranslatedPropertyValue($any(bucket.key), 'type') | titlecase)
: (facet.onlyOnType && getTranslatedPropertyValue(facet.onlyOnType, facet.field, bucket.key)
| titlecase)
}}
</ion-checkbox>
</ion-item>
</ng-container>
<ion-button
*ngIf="!facet.compact && facet.buckets.length > compactFilterOptionCount"
fill="clear"
(click)="facet.compact = true"
>
{{ 'menu.context.filter.showAll' | translate }}
</ion-button>
</ion-list>
</form>
</ion-content>

View File

@@ -1,303 +0,0 @@
/*
* Copyright (C) 2023 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program 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 General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* eslint-disable @typescript-eslint/no-non-null-assertion, @typescript-eslint/ban-ts-comment */
import {APP_BASE_HREF, CommonModule, Location, LocationStrategy, PathLocationStrategy} from '@angular/common';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {FormsModule} from '@angular/forms';
import {ChildrenOutletContexts, RouterModule, UrlSerializer} from '@angular/router';
import {TranslateModule} from '@ngx-translate/core';
import {SCFacet, SCThingType} from '@openstapps/core';
import {ContextMenuComponent} from './context-menu.component';
import {SettingsModule} from '../../settings/settings.module';
import {ContextMenuService} from './context-menu.service';
import {FilterContext, SortContext} from './context-type';
import {Component} from '@angular/core';
import {By} from '@angular/platform-browser';
import {provideIonicAngular} from '@ionic/angular/standalone';
@Component({
template: `<ion-content id="foo"></ion-content><stapps-context contentId="foo"></stapps-context> `,
})
class ContextMenuContainerComponent {}
describe('ContextMenuComponent', async () => {
let fixture: ComponentFixture<ContextMenuContainerComponent>;
let instance: ContextMenuComponent;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [ContextMenuComponent, ContextMenuContainerComponent],
providers: [
provideIonicAngular(),
ChildrenOutletContexts,
Location,
UrlSerializer,
ContextMenuService,
{provide: LocationStrategy, useClass: PathLocationStrategy},
{provide: APP_BASE_HREF, useValue: '/'},
],
imports: [
FormsModule,
TranslateModule.forRoot(),
CommonModule,
SettingsModule,
RouterModule.forRoot([]),
],
}).compileComponents();
fixture = TestBed.createComponent(ContextMenuContainerComponent);
instance = fixture.debugElement.query(By.directive(ContextMenuComponent)).componentInstance;
});
it('should show items in sort context', () => {
instance.sortOption = getSortContextType();
fixture.detectChanges();
const sort: HTMLElement = fixture.debugElement.nativeElement.querySelector('.context-sort');
expect(sort!.querySelector('ion-radio')?.textContent).toContain('relevance');
});
it('should show items in filter context', () => {
instance.filterOption = getFilterContextType();
fixture.detectChanges();
const filter: HTMLElement = fixture.debugElement.nativeElement.querySelector('.context-filter');
const filterItem = filter.querySelector('.filter-group');
expect(filterItem!.querySelector('ion-list-header')!.textContent).toContain('Type');
});
it('should set sort context value and reverse on click', () => {
instance.sortOption = getSortContextType();
fixture.detectChanges();
const sort: HTMLElement = fixture.debugElement.nativeElement.querySelector('.context-sort');
// @ts-expect-error not relevant for this case
const sortItem: HTMLElement = sort.querySelectorAll('.sort-item')[1];
sortItem!.click();
expect(instance.sortOption.value).toEqual('name');
expect(instance.sortOption.reversed).toBe(false);
// click again for reverse
sortItem!.click();
expect(instance.sortOption.reversed).toBe(true);
});
it('should show all filterable facets', () => {
// get set facets with non empty buckets
const facets: SCFacet[] = getFilterContextType().options;
instance.filterOption = getFilterContextType();
fixture.detectChanges();
// get filter context div
const filter: HTMLElement = fixture.debugElement.nativeElement.querySelector('.context-filter');
// get all filter groups that represent a facet
const filterGroups = filter.querySelectorAll('.filter-group');
expect(filterGroups.length).toEqual(facets.length);
for (const facet of facets) {
let filterGroup;
// get filter option for facets field
// eslint-disable-next-line unicorn/no-array-for-each
filterGroups.forEach(element => {
if (
element
.querySelector('ion-list-header')!
.textContent!.toString()
.toLowerCase()
.includes(facet.field)
) {
filterGroup = element;
return;
}
});
expect(filterGroup).toBeDefined();
const filterItems = filterGroup!.querySelectorAll('.filter-item-label');
if (filterItems.length !== facet.buckets.length) {
console.log(JSON.stringify(facet));
}
expect(filterItems.length).toEqual(facet.buckets.length);
// check all buckets are shown
for (const bucket of facet.buckets) {
let filterItem;
for (let i = 0; i < filterItems.length; i++) {
if (
filterItems.item(i).textContent!.toString().toLowerCase().indexOf(bucket.key.toLowerCase()) > 0
) {
filterItem = filterItems.item(i);
break;
}
}
expect(filterItem).toBeDefined();
}
}
});
it('should reset filter', () => {
instance.filterOption = getFilterContextType();
instance.filterOption.options = [
{
field: 'type',
buckets: [{count: 10, key: 'date series', checked: true}],
info: {
onlyOnType: SCThingType.AcademicEvent,
field: 'date series',
sortOrder: 0,
},
},
];
fixture.detectChanges();
// click reset button
const resetButton: HTMLElement = fixture.debugElement.nativeElement.querySelector('.resetFilterButton');
resetButton.click();
expect(instance.filterOption.options[0].buckets[0].checked).toEqual(false);
});
});
/**
*
*/
function getSortContextType(): SortContext {
return {
name: 'sort',
reversed: false,
value: 'relevance',
values: [
{
reversible: false,
value: 'relevance',
},
{
reversible: true,
value: 'name',
},
{
reversible: true,
value: 'date',
},
{
reversible: true,
value: 'type',
},
],
};
}
/**
*
*/
function getFilterContextType(): FilterContext {
return {
name: 'filter',
compact: false,
options: facetsMock
.filter(facet => facet.buckets.length > 0)
.map((facet, i) => {
return {
buckets: facet.buckets.map(bucket => {
return {
count: bucket.count,
key: bucket.key,
checked: false,
};
}),
compact: false,
field: facet.field,
onlyOnType: facet.onlyOnType,
info: {
onlyOnType: facet.onlyOnType,
field: facet.field,
sortOrder: i,
},
};
}),
};
}
const facetsMock: SCFacet[] = [
{
buckets: [
{
count: 60,
key: 'academic event',
},
{
count: 160,
key: 'message',
},
{
count: 151,
key: 'date series',
},
{
count: 106,
key: 'dish',
},
{
count: 20,
key: 'building',
},
],
field: 'type',
},
{
buckets: [
{
count: 12,
key: 'Max Mustermann',
},
{
count: 2,
key: 'Foo Bar',
},
],
field: 'performers',
onlyOnType: SCThingType.AcademicEvent,
},
{
buckets: [
{
count: 5,
key: 'colloquium',
},
{
count: 15,
key: 'course',
},
],
field: 'categories',
onlyOnType: SCThingType.AcademicEvent,
},
{
buckets: [
{
count: 5,
key: 'employees',
},
{
count: 15,
key: 'students',
},
],
field: 'audiences',
onlyOnType: SCThingType.Message,
},
];

View File

@@ -1,114 +0,0 @@
<!--
~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program 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 General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-menu type="overlay" menuId="context" contentId="{{ contentId }}" maxEdgeStart="0" side="end">
<ion-toolbar color="primary" mode="ios">
<ion-label class="ion-padding-horizontal">
<h1 class="ion-padding-horizontal">{{ 'menu.context.title' | translate | titlecase }}</h1>
</ion-label>
</ion-toolbar>
<ion-content>
<!-- Sort Context -->
<ion-list>
@if (sortOption) {
<ion-radio-group class="context-sort" [value]="0">
<ion-list-header>
<ion-icon name="sort"></ion-icon>
<ion-title>{{ 'menu.context.sort.title' | translate | titlecase }}</ion-title>
</ion-list-header>
@for (value of sortOption.values; track value; let i = $index) {
<ion-item class="sort-item" (click)="sortChanged(sortOption, sortOption.values[i])">
<ion-radio [value]="i">
{{ 'menu.context.sort.' + value.value | translate | titlecase }}
@if (sortOption.value === value.value && value.reversible) {
<span>
@if (sortOption.reversed) {
<ion-icon name="arrow_downward"></ion-icon>
}
@if (!sortOption.reversed) {
<ion-icon name="arrow_upward"></ion-icon>
}
</span>
}
</ion-radio>
</ion-item>
}
</ion-radio-group>
}
</ion-list>
<!-- Filter Context -->
@if (filterOption) {
<form class="context-filter">
<ion-list-header>
<ion-icon name="filter_list"></ion-icon>
<ion-title>{{ 'menu.context.filter.title' | translate | titlecase }}</ion-title>
<ion-button class="resetFilterButton" fill="clear" color="dark" (click)="resetFilter(filterOption)">
<ion-icon name="delete"></ion-icon>
</ion-button>
</ion-list-header>
@for (facet of facets; track facet) {
<ion-list class="filter-group">
<div>
<ion-list-header class="h3">
<ion-label>
@if (facet.info.onlyOnType) {
<span
><b>{{ facet.info.onlyOnType | titlecase }}</b> /
</span>
}
{{ facet.info.field | titlecase }}
</ion-label>
</ion-list-header>
<div>
@for (
bucket of !facet.compact ? facet.buckets.slice(0, compactFilterOptionCount) : facet.buckets;
track bucket
) {
<ion-item>
<ion-checkbox
[(ngModel)]="bucket.checked"
(ngModelChange)="filterChanged()"
[name]="facet.onlyOnType + '-' + facet.field + '-' + bucket.key"
[value]="{
field: facet.field,
value: bucket.key,
onlyOnType: facet.onlyOnType
}"
class="filter-item-label"
>
({{ bucket.count }})
{{
facet.field === 'type'
? (getTranslatedPropertyValue($any(bucket.key), 'type') | titlecase)
: (facet.onlyOnType &&
getTranslatedPropertyValue(facet.onlyOnType, facet.field, bucket.key)
| titlecase)
}}
</ion-checkbox>
</ion-item>
}
@if (!facet.compact && facet.buckets.length > compactFilterOptionCount) {
<ion-button fill="clear" (click)="facet.compact = true">
{{ 'menu.context.filter.showAll' | translate }}
</ion-button>
}
</div>
</div>
</ion-list>
}
</form>
}
</ion-content>
</ion-menu>

View File

@@ -12,14 +12,13 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {TestBed} from '@angular/core/testing'; import {TestBed} from '@angular/core/testing';
import {ContextMenuService} from './context-menu.service'; import {ContextMenuService} from './context-menu.service';
import {SCFacet} from '@openstapps/core'; import {SCFacet} from '@openstapps/core';
import {FilterContext, SortContext} from './context-type'; import {FilterContext, SortContext} from './context-type';
import {ThingTranslateModule} from '../../../translation/thing-translate.module'; import {ThingTranslateModule} from '../../../translation/thing-translate.module';
import {TranslateModule} from '@ngx-translate/core'; import {TranslateModule} from '@ngx-translate/core';
import {firstValueFrom, filter} from 'rxjs';
describe('ContextMenuService', () => { describe('ContextMenuService', () => {
let service: ContextMenuService; let service: ContextMenuService;
@@ -36,39 +35,39 @@ describe('ContextMenuService', () => {
expect(service).toBeTruthy(); expect(service).toBeTruthy();
}); });
it('should update filterOptions', done => { it('should update filterOptions', async () => {
service.filterContextChanged$.subscribe(result => {
expect(result).toBeDefined();
done();
});
service.updateContextFilter(facetsMock); service.updateContextFilter(facetsMock);
const result = await firstValueFrom(service.filterContextChanged$.pipe(filter(Boolean)));
expect(result).toBeDefined();
}); });
it('should update filterQuery', done => { it('should update filterQuery', async () => {
service.filterContextChanged$.subscribe(result => {
expect(result).toBeDefined();
expect(service.contextFilter.options[0].buckets.length).toEqual(
filterContext.options[0].buckets.length,
);
done();
});
service.updateContextFilter(facetsMock); service.updateContextFilter(facetsMock);
const result = await firstValueFrom(service.filterContextChanged$.pipe(filter(Boolean)));
expect(result).toBeDefined();
const current = service.contextFilter;
expect(current.options[0].buckets.length).toEqual(filterContext.options[0].buckets.length);
}); });
it('should update sortOptions', done => { it('should update sortOptions', async () => {
service.sortContextChanged$.subscribe(result => {
expect(result).toBeDefined();
done();
});
service.setContextSort(sortContext); service.setContextSort(sortContext);
const result = await firstValueFrom(service.sortContextChanged$.pipe(filter(Boolean)));
expect(result).toBeDefined();
}); });
it('should update sortQuery', done => { it('should update sortQuery', async () => {
service.sortContextChanged$.subscribe(result => {
expect(result).toBeDefined();
done();
});
service.setContextSort(sortContext); service.setContextSort(sortContext);
const result = await firstValueFrom(service.sortContextChanged$.pipe(filter(Boolean)));
expect(result).toBeDefined();
}); });
}); });

View File

@@ -21,7 +21,7 @@ import {
SCThingType, SCThingType,
SCTranslations, SCTranslations,
} from '@openstapps/core'; } from '@openstapps/core';
import {Subject} from 'rxjs'; import {BehaviorSubject} from 'rxjs';
import {FilterBucket, FilterContext, FilterFacet, SortContext, TransformedFacet} from './context-type'; import {FilterBucket, FilterContext, FilterFacet, SortContext, TransformedFacet} from './context-type';
import {TranslateService} from '@ngx-translate/core'; import {TranslateService} from '@ngx-translate/core';
import {ThingTranslateService} from '../../../translation/thing-translate.service'; import {ThingTranslateService} from '../../../translation/thing-translate.service';
@@ -40,7 +40,7 @@ export class ContextMenuService {
/** /**
* Container for the filter context * Container for the filter context
*/ */
filterOptions = new Subject<FilterContext>(); filterOptions = new BehaviorSubject<FilterContext | undefined>(undefined);
/** /**
* Observable filterContext streams * Observable filterContext streams
@@ -50,7 +50,7 @@ export class ContextMenuService {
/** /**
* Container for the filter query (SCSearchFilter) * Container for the filter query (SCSearchFilter)
*/ */
filterQuery = new Subject<SCSearchFilter | undefined>(); filterQuery = new BehaviorSubject<SCSearchFilter | undefined>(undefined);
/** /**
* Observable filterContext streams * Observable filterContext streams
@@ -65,7 +65,7 @@ export class ContextMenuService {
/** /**
* Container for the sort context * Container for the sort context
*/ */
sortOptions = new Subject<SortContext>(); sortOptions = new BehaviorSubject<SortContext | undefined>(undefined);
/** /**
* Observable SortContext streams * Observable SortContext streams
@@ -75,7 +75,7 @@ export class ContextMenuService {
/** /**
* Container for the sort query * Container for the sort query
*/ */
sortQuery = new Subject<SCSearchSort[] | undefined>(); sortQuery = new BehaviorSubject<SCSearchSort[] | undefined>(undefined);
/** /**
* Observable SortContext streams * Observable SortContext streams

View File

@@ -19,12 +19,13 @@ import {RouterModule} from '@angular/router';
import {LayoutModule} from '@angular/cdk/layout'; import {LayoutModule} from '@angular/cdk/layout';
import {TranslateModule} from '@ngx-translate/core'; import {TranslateModule} from '@ngx-translate/core';
import {SettingsModule} from '../settings/settings.module'; import {SettingsModule} from '../settings/settings.module';
import {ContextMenuComponent} from './context/context-menu.component';
import {ContextMenuService} from './context/context-menu.service'; import {ContextMenuService} from './context/context-menu.service';
import { import {
IonButton, IonButton,
IonButtons,
IonCheckbox, IonCheckbox,
IonContent, IonContent,
IonHeader,
IonItem, IonItem,
IonLabel, IonLabel,
IonList, IonList,
@@ -39,13 +40,14 @@ import {
IonToolbar, IonToolbar,
} from '@ionic/angular/standalone'; } from '@ionic/angular/standalone';
import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive'; import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive';
import {ContextMenuModalComponent} from './context/context-menu-modal.component';
/** /**
* Menu module * Menu module
*/ */
@NgModule({ @NgModule({
declarations: [ContextMenuComponent], declarations: [ContextMenuModalComponent],
exports: [ContextMenuComponent], exports: [ContextMenuModalComponent],
imports: [ imports: [
CommonModule, CommonModule,
IonIconDirective, IonIconDirective,
@@ -69,6 +71,8 @@ import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive';
IonRadioGroup, IonRadioGroup,
IonContent, IonContent,
IonToolbar, IonToolbar,
IonButtons,
IonHeader,
], ],
providers: [ContextMenuService], providers: [ContextMenuService],
}) })

View File

@@ -14,10 +14,10 @@
--> -->
<div class="header"> <div class="header">
<ion-button fill="clear" class="left-button" (click)="mainSwiper.pageBackwards()"> <ion-button fill="clear" class="left-button" (click)="mainSwiper.pageBackwards()">
<ion-icon slot="icon-only" name="navigate_before"></ion-icon> <ion-icon slot="icon-only" name="chevron_left"></ion-icon>
</ion-button> </ion-button>
<ion-button fill="clear" class="right-button" (click)="mainSwiper.pageForward()"> <ion-button fill="clear" class="right-button" (click)="mainSwiper.pageForward()">
<ion-icon slot="icon-only" name="navigate_next"></ion-icon> <ion-icon slot="icon-only" name="chevron_right"></ion-icon>
</ion-button> </ion-button>
<infinite-swiper <infinite-swiper
class="header-swiper" class="header-swiper"

View File

@@ -14,10 +14,10 @@
--> -->
<div class="header"> <div class="header">
<ion-button fill="clear" class="left-button" (click)="mainSwiper.swiperRef.slidePrev()"> <ion-button fill="clear" class="left-button" (click)="mainSwiper.swiperRef.slidePrev()">
<ion-icon slot="icon-only" name="navigate_before"></ion-icon> <ion-icon slot="icon-only" name="chevron_left"></ion-icon>
</ion-button> </ion-button>
<ion-button fill="clear" class="right-button" (click)="mainSwiper.swiperRef.slideNext()"> <ion-button fill="clear" class="right-button" (click)="mainSwiper.swiperRef.slideNext()">
<ion-icon slot="icon-only" name="navigate_next"></ion-icon> <ion-icon slot="icon-only" name="chevron_right"></ion-icon>
</ion-button> </ion-button>
<swiper <swiper
class="header-swiper" class="header-swiper"

File diff suppressed because one or more lines are too long

View File

@@ -21,7 +21,7 @@ export const environment = {
backend_url: 'https://mobile.server.uni-frankfurt.de', backend_url: 'https://mobile.server.uni-frankfurt.de',
app_host: 'mobile.app.uni-frankfurt.de', app_host: 'mobile.app.uni-frankfurt.de',
custom_url_scheme: 'de.anyschool.app', custom_url_scheme: 'de.anyschool.app',
backend_version: '3.3.0', backend_version: '4.0.0',
production: true, production: true,
}; };

View File

@@ -1,5 +1,23 @@
# @openstapps/api-cli # @openstapps/api-cli
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/core@4.0.2
- @openstapps/core-tools@4.0.2
- @openstapps/api@4.0.2
## 4.0.1
### Patch Changes
- Updated dependencies [b40ba7ad]
- @openstapps/api@4.0.1
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/api-cli", "name": "@openstapps/api-cli",
"description": "CLI client for @openstapps/api", "description": "CLI client for @openstapps/api",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/api.git", "repository": "git@gitlab.com:openstapps/api.git",

View File

@@ -1,5 +1,24 @@
# @openstapps/api-plugin # @openstapps/api-plugin
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/core@4.0.2
- @openstapps/core-tools@4.0.2
- @openstapps/api@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
- Updated dependencies [b40ba7ad]
- @openstapps/api@4.0.1
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/api-plugin", "name": "@openstapps/api-plugin",
"description": "Node.js library to interact with the StApps backend service", "description": "Node.js library to interact with the StApps backend service",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/api.git", "repository": "git@gitlab.com:openstapps/api.git",
@@ -36,14 +36,14 @@
"@openstapps/core": "workspace:*", "@openstapps/core": "workspace:*",
"@openstapps/core-tools": "workspace:*", "@openstapps/core-tools": "workspace:*",
"@openstapps/logger": "workspace:*", "@openstapps/logger": "workspace:*",
"@types/body-parser": "1.19.2", "@types/body-parser": "1.19.6",
"@types/express": "4.17.17", "@types/express": "4.17.17",
"@types/json-schema": "7.0.15", "@types/json-schema": "7.0.15",
"@types/morgan": "1.9.4", "@types/morgan": "1.9.10",
"body-parser": "1.20.2", "body-parser": "1.20.3",
"express": "4.18.2", "express": "4.21.2",
"json-schema": "0.4.0", "json-schema": "0.4.0",
"morgan": "1.10.0" "morgan": "1.10.1"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/eslint-config": "workspace:*", "@openstapps/eslint-config": "workspace:*",

View File

@@ -1,5 +1,18 @@
# @openstapps/api # @openstapps/api
## 4.0.2
### Patch Changes
- @openstapps/core@4.0.2
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
- @openstapps/core@4.0.0
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/api", "name": "@openstapps/api",
"description": "Node.js library to interact with the StApps backend service", "description": "Node.js library to interact with the StApps backend service",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/api.git", "repository": "git@gitlab.com:openstapps/api.git",
@@ -58,7 +58,7 @@
"tsup": "8.5.0", "tsup": "8.5.0",
"typedoc": "0.25.12", "typedoc": "0.25.12",
"typescript": "5.4.2", "typescript": "5.4.2",
"undici": "5.22.1" "undici": "6.21.3"
}, },
"peerDependencies": { "peerDependencies": {
"@openstapps/core": "workspace:*" "@openstapps/core": "workspace:*"

View File

@@ -1,5 +1,13 @@
# @openstapps/core-tools # @openstapps/core-tools
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
- @openstapps/easy-ast@4.0.2
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/core-tools", "name": "@openstapps/core-tools",
"description": "Tools to convert and validate StAppsCore", "description": "Tools to convert and validate StAppsCore",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/core-tools.git", "repository": "git@gitlab.com:openstapps/core-tools.git",

View File

@@ -1,5 +1,11 @@
# @openstapps/core # @openstapps/core
## 4.0.2
### Patch Changes
- @openstapps/core-tools@4.0.2
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/core", "name": "@openstapps/core",
"description": "StAppsCore - Generalized model of data", "description": "StAppsCore - Generalized model of data",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/core.git", "repository": "git@gitlab.com:openstapps/core.git",

View File

@@ -1,5 +1,12 @@
# @openstapps/easy-ast # @openstapps/easy-ast
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/easy-ast", "name": "@openstapps/easy-ast",
"description": "Tool to easily handle TypeScript AST", "description": "Tool to easily handle TypeScript AST",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/core-tools.git", "repository": "git@gitlab.com:openstapps/core-tools.git",

View File

@@ -1,5 +1,11 @@
# @openstapps/es-mapping-generator # @openstapps/es-mapping-generator
## 4.0.1
### Patch Changes
- b40ba7ad: Updated Elasticsearch dependency
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/es-mapping-generator", "name": "@openstapps/es-mapping-generator",
"description": "Tool to convert TypeScript Interfaces to Elasticsearch Mappings", "description": "Tool to convert TypeScript Interfaces to Elasticsearch Mappings",
"version": "4.0.0", "version": "4.0.1",
"type": "commonjs", "type": "commonjs",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"author": "Thea Schöbl <dev@theaninova.de>", "author": "Thea Schöbl <dev@theaninova.de>",
@@ -26,7 +26,7 @@
"test": "c8 mocha" "test": "c8 mocha"
}, },
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "8.4.0", "@elastic/elasticsearch": "8.14.1",
"commander": "10.0.0", "commander": "10.0.0",
"deepmerge": "4.3.1", "deepmerge": "4.3.1",
"flatted": "3.2.7", "flatted": "3.2.7",

View File

@@ -1,5 +1,12 @@
# @openstapps/gitlab-api # @openstapps/gitlab-api
## 4.0.2
### Patch Changes
- Updated dependencies [6b06de40]
- @openstapps/logger@4.0.2
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/gitlab-api", "name": "@openstapps/gitlab-api",
"description": "Wraps common GitLab API calls in a TypeScript class.", "description": "Wraps common GitLab API calls in a TypeScript class.",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/gitlab-api.git", "repository": "git@gitlab.com:openstapps/gitlab-api.git",

View File

@@ -1,5 +1,11 @@
# @openstapps/logger # @openstapps/logger
## 4.0.2
### Patch Changes
- 6b06de40: Updated nodemailer dependency
## 4.0.0 ## 4.0.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/logger", "name": "@openstapps/logger",
"description": "A cli logger with colors, log-levels and the possibility to use a transport system for errors", "description": "A cli logger with colors, log-levels and the possibility to use a transport system for errors",
"version": "4.0.0", "version": "4.0.2",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/logger.git", "repository": "git@gitlab.com:openstapps/logger.git",
@@ -31,7 +31,7 @@
"@types/nodemailer": "6.4.7", "@types/nodemailer": "6.4.7",
"chalk": "5.2.0", "chalk": "5.2.0",
"flatted": "3.2.7", "flatted": "3.2.7",
"nodemailer": "6.9.1" "nodemailer": "6.9.9"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/eslint-config": "workspace:*", "@openstapps/eslint-config": "workspace:*",

417
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff