Skip to content

Commit

Permalink
Merge branch 'main' into dep/update-meta-repo
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel committed Sep 10, 2024
2 parents 7e31e7a + 8a0c5ce commit 38bd6bc
Show file tree
Hide file tree
Showing 92 changed files with 1,300 additions and 665 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ run-tests: | build-dev
docker run -t openslides-client-dev npm run test-silently
docker run -t openslides-client-dev npm run build-debug

run-karma-tests:
run-karma-tests: | build-dev
docker run -t openslides-client-dev /bin/sh -c "apk add chromium && npm run test-silently -- --browsers=ChromiumHeadlessNoSandbox"

run-check-linting:
Expand Down
394 changes: 185 additions & 209 deletions client/package-lock.json

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@
"get-available-languages": "npm run ts -- cli/get-available-languages.ts"
},
"dependencies": {
"@angular/animations": "^18.2.1",
"@angular/cdk": "^18.2.1",
"@angular/common": "^18.2.1",
"@angular/compiler": "^18.2.1",
"@angular/core": "^18.2.1",
"@angular/forms": "^18.2.1",
"@angular/material": "^18.2.1",
"@angular/material-date-fns-adapter": "^18.2.1",
"@angular/platform-browser": "^18.2.1",
"@angular/platform-browser-dynamic": "^18.2.1",
"@angular/router": "^18.2.1",
"@angular/service-worker": "^18.2.1",
"@angular/animations": "^18.2.3",
"@angular/cdk": "^18.2.3",
"@angular/common": "^18.2.3",
"@angular/compiler": "^18.2.3",
"@angular/core": "^18.2.3",
"@angular/forms": "^18.2.3",
"@angular/material": "^18.2.3",
"@angular/material-date-fns-adapter": "^18.2.3",
"@angular/platform-browser": "^18.2.3",
"@angular/platform-browser-dynamic": "^18.2.3",
"@angular/router": "^18.2.3",
"@angular/service-worker": "^18.2.3",
"@material/typography": "^14.0.0",
"@ngx-pwa/local-storage": "^18.0.0",
"@ngx-translate/core": "^15.0.0",
Expand Down Expand Up @@ -83,7 +83,7 @@
"jszip": "^3.10.1",
"material-design-icons-iconfont": "^6.7.0",
"ng2-charts": "^6.0.1",
"ng2-pdf-viewer": "^10.2.2",
"ng2-pdf-viewer": "^10.3.0",
"ngx-date-fns": "^11.0.0",
"ngx-device-detector": "^8.0.0",
"ngx-file-drop": "^16.0.0",
Expand All @@ -98,19 +98,19 @@
"zone.js": "^0.14.10"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.2.1",
"@angular-devkit/build-angular": "^18.2.3",
"@angular-eslint/builder": "^18.3.0",
"@angular-eslint/eslint-plugin": "^18.3.0",
"@angular-eslint/eslint-plugin-template": "^18.3.0",
"@angular-eslint/schematics": "^18.3.0",
"@angular-eslint/template-parser": "^18.3.0",
"@angular/cli": "^18.2.1",
"@angular/compiler-cli": "^18.2.1",
"@angular/cli": "^18.2.3",
"@angular/compiler-cli": "^18.2.3",
"@colsen1991/ngx-translate-extract-marker": "^2.0.8",
"@types/file-saver": "^2.0.7",
"@types/jasmine": "~5.1.4",
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.16.1",
"@types/node": "^20.16.5",
"@types/pdfmake": "^0.2.9",
"@types/qrcode": "^1.5.5",
"@types/tinycolor2": "^1.4.6",
Expand All @@ -122,9 +122,9 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^3.2.0",
"fetch-mock": "^11.1.1",
"jasmine-core": "~5.2.0",
"eslint-plugin-unused-imports": "^4.1.3",
"fetch-mock": "^11.1.3",
"jasmine-core": "~5.3.0",
"js-yaml": "^4.1.0",
"karma": "~6.4.4",
"karma-chrome-launcher": "~3.2.0",
Expand Down
4 changes: 2 additions & 2 deletions client/src/app/domain/interfaces/has-attachment-ids.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Id } from '../definitions/key-types';

export interface HasAttachmentIds {
attachment_ids: Id[]; // (mediafile/attachment_ids)[];
export interface HasAttachmentMeetingMediafileIds {
attachment_meeting_mediafile_ids: Id[]; // (meeting_mediafile/attachment_meeting_mediafile_ids)[];
}
6 changes: 3 additions & 3 deletions client/src/app/domain/models/assignments/assignment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Id } from '../../definitions/key-types';
import { HasSequentialNumber } from '../../interfaces';
import { HasAgendaItemId } from '../../interfaces/has-agenda-item-id';
import { HasAttachmentIds } from '../../interfaces/has-attachment-ids';
import { HasAttachmentMeetingMediafileIds } from '../../interfaces/has-attachment-ids';
import { HasListOfSpeakersId } from '../../interfaces/has-list-of-speakers-id';
import { HasMeetingId } from '../../interfaces/has-meeting-id';
import { HasPollIds } from '../../interfaces/has-poll-ids';
Expand Down Expand Up @@ -44,15 +44,15 @@ export class Assignment extends BaseModel<Assignment> {
`agenda_item_id`,
`list_of_speakers_id`,
`tag_ids`,
`attachment_ids`,
`attachment_meeting_mediafile_ids`,
`projection_ids`,
`meeting_id`
];
}
export interface Assignment
extends HasMeetingId,
HasProjectionIds,
HasAttachmentIds,
HasAttachmentMeetingMediafileIds,
HasTagIds,
HasAgendaItemId,
HasListOfSpeakersId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export const FontDefaults: { [place in FontPlace]: string } = {
};
export const FONT_PLACES = Object.keys(FontDisplayNames) as FontPlace[];

export type MediafileUsageType = `logo` | `font`;

export type ViewMediafileMeetingUsageKey =
| `used_as_logo_${LogoPlace}_in_meeting`
| `used_as_font_${FontPlace}_in_meeting`;
Expand Down
101 changes: 10 additions & 91 deletions client/src/app/domain/models/mediafiles/mediafile.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Fqid, Id } from '../../definitions/key-types';
import { HasListOfSpeakersId } from '../../interfaces/has-list-of-speakers-id';
import { ORGANIZATION_ID } from 'src/app/site/pages/organization/services/organization.service';

import { Id } from '../../definitions/key-types';
import { HasOwnerId } from '../../interfaces/has-owner-id';
import { HasProjectionIds } from '../../interfaces/has-projectable-ids';
import { HasProperties } from '../../interfaces/has-properties';
import { BaseModel } from '../base/base-model';
import { FONT_PLACES, FontPlace, LOGO_PLACES, LogoPlace, MediafileMeetingUsageIdKey } from './mediafile.constants';

interface PdfInformation {
pages?: number;
Expand All @@ -21,80 +19,24 @@ export class Mediafile extends BaseModel<Mediafile> {

public title!: string;
public is_directory!: boolean;
public published_to_meetings_in_organization_id!: Id;
public meeting_mediafile_ids!: Id[];
public filesize!: string;
public filename!: string;
public mimetype!: string;
public pdf_information!: PdfInformation;
public create_timestamp!: string;
public has_inherited_access_groups!: boolean;
public token: string;

public access_group_ids!: Id[]; // (group/mediafile_access_group_ids)[];
public inherited_access_group_ids!: Id[]; // (group/mediafile_inherited_access_group_ids)[]; // Note: calculated
public parent_id!: Id; // mediafile/child_ids;
public child_ids!: Id[]; // (mediafile/parent_id)[];
public attachment_ids!: Fqid[]; // (*/attachment_ids)[];

public constructor(input?: any) {
super(Mediafile.COLLECTION, input);
}

/**
* Check if the image is used at the given place. If place is empty, checks
* if the image is used in any place and returns the first meeting id found.
*
* @param place The places the image can be used
* @returns the meeting id or `null` if the image is not used.
*/
public used_as_logo_in_meeting_id(place?: LogoPlace): Id | null {
return this.used_in_meeting(`logo`, place);
}

/**
* Check if the font is used at the given place. If place is empty, checks
* if the font is used in any place and returns the first meeting id found.
*
* @param place The text parts the font can be used
* @returns the meeting id or `null` if the font is not used.
*/
public used_as_font_in_meeting_id(place?: FontPlace): Id | null {
return this.used_in_meeting(`font`, place);
}

private used_in_meeting(type: string, place?: LogoPlace | FontPlace): Id | null {
if (!place) {
const list = this.getPlaces();
for (let i = 0; i < list?.length; i++) {
const meetingId = this.getSpecificUsedInMeetingId(type, list[i]);
if (meetingId) {
return meetingId;
}
}
return null;
}

if (this.getPlaces().indexOf(place) === -1) {
return null;
}

return this.getSpecificUsedInMeetingId(type, place) || null;
}

public getFontPlaces(): FontPlace[] {
return FONT_PLACES.filter(place => !!this.getSpecificUsedInMeetingId(`font`, place));
}

public getLogoPlaces(): LogoPlace[] {
return LOGO_PLACES.filter(place => !!this.getSpecificUsedInMeetingId(`logo`, place));
}

public getPlaces(): (LogoPlace | FontPlace)[] {
return [...this.getFontPlaces(), ...this.getLogoPlaces()];
}

private getSpecificUsedInMeetingId(type: string, place: LogoPlace | FontPlace): Id {
const path = `used_as_${type}_${place}_in_meeting_id` as keyof Mediafile;
return this[path] as Id;
public get isPublishedOrganizationWide(): boolean {
return this.published_to_meetings_in_organization_id === ORGANIZATION_ID;
}

/**
Expand All @@ -116,34 +58,11 @@ export class Mediafile extends BaseModel<Mediafile> {
`pdf_information`,
`create_timestamp`,
`token`,
`inherited_access_group_ids`,
`access_group_ids`,
`published_to_meetings_in_organization_id`,
`parent_id`,
`child_ids`,
`list_of_speakers_id`,
`projection_ids`,
`attachment_ids`,
`owner_id`,
`used_as_logo_projector_main_in_meeting_id`,
`used_as_logo_projector_header_in_meeting_id`,
`used_as_logo_web_header_in_meeting_id`,
`used_as_logo_pdf_header_l_in_meeting_id`,
`used_as_logo_pdf_header_r_in_meeting_id`,
`used_as_logo_pdf_footer_l_in_meeting_id`,
`used_as_logo_pdf_footer_r_in_meeting_id`,
`used_as_logo_pdf_ballot_paper_in_meeting_id`,
`used_as_font_regular_in_meeting_id`,
`used_as_font_italic_in_meeting_id`,
`used_as_font_bold_in_meeting_id`,
`used_as_font_bold_italic_in_meeting_id`,
`used_as_font_monospace_in_meeting_id`,
`used_as_font_chyron_speaker_name_in_meeting_id`,
`used_as_font_projector_h1_in_meeting_id`,
`used_as_font_projector_h2_in_meeting_id`
`meeting_mediafile_ids`
];
}
export interface Mediafile
extends HasOwnerId,
HasProjectionIds,
HasListOfSpeakersId,
HasProperties<MediafileMeetingUsageIdKey, number> {}
export interface Mediafile extends HasOwnerId {}
123 changes: 123 additions & 0 deletions client/src/app/domain/models/meeting-mediafile/meeting-mediafile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import { Fqid, Id } from '../../definitions/key-types';
import { HasMeetingId } from '../../interfaces';
import { HasListOfSpeakersId } from '../../interfaces/has-list-of-speakers-id';
import { HasProjectionIds } from '../../interfaces/has-projectable-ids';
import { HasProperties } from '../../interfaces/has-properties';
import { BaseModel } from '../base/base-model';
import {
FONT_PLACES,
FontPlace,
LOGO_PLACES,
LogoPlace,
MediafileMeetingUsageIdKey,
MediafileUsageType
} from '../mediafiles/mediafile.constants';

/**
* Representation of MeetingMediaFile
* @ignore
*/
export class MeetingMediafile extends BaseModel<MeetingMediafile> {
public static COLLECTION = `meeting_mediafile`;

public mediafile_id: Id;
public is_public: boolean;
public inherited_access_group_ids!: Id[]; // (group/meeting_mediafile_inherited_access_group_ids)[]; // Note: calculated
public access_group_ids!: Id[]; // (group/meeting_mediafile_access_group_ids)[];
public attachment_ids!: Fqid[]; // (*/attachment_meeting_mediafile_ids)[];

public constructor(input?: any) {
super(MeetingMediafile.COLLECTION, input);
}

/**
* Check if the image is used at the given place. If place is empty, checks
* if the image is used in any place and returns the first meeting id found.
*
* @param place The places the image can be used
* @returns the meeting id or `null` if the image is not used.
*/
public used_as_logo_in_meeting_id(place?: LogoPlace): Id | null {
return this.used_in_meeting(`logo`, place);
}

/**
* Check if the font is used at the given place. If place is empty, checks
* if the font is used in any place and returns the first meeting id found.
*
* @param place The text parts the font can be used
* @returns the meeting id or `null` if the font is not used.
*/
public used_as_font_in_meeting_id(place?: FontPlace): Id | null {
return this.used_in_meeting(`font`, place);
}

private used_in_meeting(type: MediafileUsageType, place?: LogoPlace | FontPlace): Id | null {
if (!place) {
const list = this.getPlaces();
for (let i = 0; i < list?.length; i++) {
const meetingId = this.getSpecificUsedInMeetingId(type, list[i]);
if (meetingId) {
return meetingId;
}
}
return null;
}

if (this.getPlaces().indexOf(place) === -1) {
return null;
}

return this.getSpecificUsedInMeetingId(type, place) || null;
}

public getFontPlaces(): FontPlace[] {
return FONT_PLACES.filter(place => !!this.getSpecificUsedInMeetingId(`font`, place));
}

public getLogoPlaces(): LogoPlace[] {
return LOGO_PLACES.filter(place => !!this.getSpecificUsedInMeetingId(`logo`, place));
}

public getPlaces(): (LogoPlace | FontPlace)[] {
return [...this.getFontPlaces(), ...this.getLogoPlaces()];
}

private getSpecificUsedInMeetingId(type: MediafileUsageType, place: LogoPlace | FontPlace): Id {
const path = `used_as_${type}_${place}_in_meeting_id` as keyof MeetingMediafile;
return this[path] as Id;
}

public static readonly REQUESTABLE_FIELDS: (keyof MeetingMediafile)[] = [
`id`,
`mediafile_id`,
`meeting_id`,
`is_public`,
`inherited_access_group_ids`,
`access_group_ids`,
`list_of_speakers_id`,
`projection_ids`,
`attachment_ids`,
`used_as_logo_projector_main_in_meeting_id`,
`used_as_logo_projector_header_in_meeting_id`,
`used_as_logo_web_header_in_meeting_id`,
`used_as_logo_pdf_header_l_in_meeting_id`,
`used_as_logo_pdf_header_r_in_meeting_id`,
`used_as_logo_pdf_footer_l_in_meeting_id`,
`used_as_logo_pdf_footer_r_in_meeting_id`,
`used_as_logo_pdf_ballot_paper_in_meeting_id`,
`used_as_font_regular_in_meeting_id`,
`used_as_font_italic_in_meeting_id`,
`used_as_font_bold_in_meeting_id`,
`used_as_font_bold_italic_in_meeting_id`,
`used_as_font_monospace_in_meeting_id`,
`used_as_font_chyron_speaker_name_in_meeting_id`,
`used_as_font_projector_h1_in_meeting_id`,
`used_as_font_projector_h2_in_meeting_id`
];
}
export interface MeetingMediafile
extends HasProjectionIds,
HasListOfSpeakersId,
HasMeetingId,
HasProperties<MediafileMeetingUsageIdKey, number> {}
Loading

0 comments on commit 38bd6bc

Please sign in to comment.