Skip to content

Commit

Permalink
Merge main into stable/4.0.x. Update 20231113
Browse files Browse the repository at this point in the history
* commit 'bf78a207a4b47dc0cefef536e403aed436654633':
  Fix analog default election mode (#3009)
  Add sorting to workflow next states (comma-list, menu) (#2983)
  Account import improvements (#2919)
  Motion block update place of recommender (#2989)
  Update material tabs and slider to mdc (#2998)
  change string (#2993)
  • Loading branch information
m-schieder committed Nov 13, 2023
2 parents 0ef541f + bf78a20 commit d9449f3
Show file tree
Hide file tree
Showing 26 changed files with 128 additions and 38 deletions.
4 changes: 3 additions & 1 deletion client/src/app/domain/models/organizations/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class OrganizationSetting {
public saml_metadata_idp!: string;
public saml_metadata_sp!: string;
public saml_private_key!: string;
public genders!: string[];
}

export class Organization extends BaseModel<Organization> {
Expand Down Expand Up @@ -87,7 +88,8 @@ export class Organization extends BaseModel<Organization> {
`users_email_replyto`,
`users_email_subject`,
`users_email_body`,
`url`
`url`,
`genders`
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export class OrganizationRepositoryService extends BaseRepository<ViewOrganizati
`default_language`,
`saml_metadata_idp`,
`saml_metadata_sp`,
`saml_private_key`
`saml_private_key`,
`genders`
);
return {
...super.getFieldsets(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class TopicPollService extends PollService {
const poll: Partial<Poll> = {
title: this.translate.instant(`Vote`),
onehundred_percent_base: this.defaultPercentBase,
entitled_group_ids: Object.values(this.defaultGroupIds),
entitled_group_ids: Object.values(this.defaultGroupIds ?? []),
pollmethod: this.defaultPollMethod,
type: this.defaultPollType,
backend: PollBackendDurationType.FAST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class AssignmentPollService extends PollService {
const poll: Partial<Poll> = {
title: this.translate.instant(`Ballot`),
onehundred_percent_base: this.defaultPercentBase,
entitled_group_ids: Object.values(this.defaultGroupIds),
entitled_group_ids: Object.values(this.defaultGroupIds ?? []),
pollmethod: this.defaultPollMethod,
type: this.isElectronicVotingEnabled ? this.defaultPollType : PollType.Analog
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';
import { MatLegacyCardModule as MatCardModule } from '@angular/material/legacy-card';
import { MatLegacyMenuModule as MatMenuModule } from '@angular/material/legacy-menu';
import { MatLegacyTabsModule as MatTabsModule } from '@angular/material/legacy-tabs';
import { MatTabsModule } from '@angular/material/tabs';
import { RouterModule } from '@angular/router';
import { OpenSlidesTranslationModule } from 'src/app/site/modules/translations';
import { MeetingsComponentCollectorModule } from 'src/app/site/pages/meetings/modules/meetings-component-collector';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class MotionPollService extends PollService {
const poll: Partial<Poll> = {
title: this.translate.instant(`Vote`),
onehundred_percent_base: this.defaultPercentBase,
entitled_group_ids: Object.values(this.defaultGroupIds),
entitled_group_ids: Object.values(this.defaultGroupIds ?? []),
type: this.isElectronicVotingEnabled ? this.defaultPollType : PollType.Analog,
pollmethod: PollMethod.YNA
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@
{{ getStateLabel(motion) }}
</mat-basic-chip>
</div>
</div>
</div>

<!-- Recommendation column -->
<div *osScrollingTableCell="'recommendation'; row as motion; config: { width: 120 }" class="cell-slot fill">
<mat-basic-chip *ngIf="!!motion.recommendation" disableRipple class="bluegrey">
{{ getRecommendationLabel(motion) }}
</mat-basic-chip>
<!-- Recommendation column -->
<div class="ellipsis-overflow white spacer-top-3">
<mat-basic-chip *ngIf="!!motion.recommendation" class="bluegrey" [disabled]="true">
{{ getRecommendationLabel(motion) }}
</mat-basic-chip>
</div>
</div>
</div>

<!-- Remove from block column -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';
import { MatLegacyCardModule as MatCardModule } from '@angular/material/legacy-card';
import { MatLegacyMenuModule as MatMenuModule } from '@angular/material/legacy-menu';
import { MatLegacyTabsModule as MatTabsModule } from '@angular/material/legacy-tabs';
import { MatTabsModule } from '@angular/material/tabs';
import { RouterModule } from '@angular/router';
import { OpenSlidesTranslationModule } from 'src/app/site/modules/translations';
import { MeetingsComponentCollectorModule } from 'src/app/site/pages/meetings/modules/meetings-component-collector';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h2 *ngIf="workflow">
<div class="inner-table">
<div *ngIf="!state.next_states.length">-</div>
<div *ngIf="state.next_states.length">
<os-comma-separated-listing [list]="state.next_states">
<os-comma-separated-listing [list]="sortedNextStates(state)">
<ng-template let-next>{{ next.name }}</ng-template>
</os-comma-separated-listing>
</div>
Expand Down Expand Up @@ -217,7 +217,7 @@ <h1 mat-dialog-title>
<!-- select next states menu -->
<mat-menu matMenuContent #nextStatesMenu="matMenu">
<ng-template let-state="state" matMenuContent>
<div *ngFor="let nextState of workflow.states">
<div *ngFor="let nextState of getWorkflowStates()">
<button mat-menu-item *ngIf="nextState.name !== state.name" (click)="onSetNextState(nextState, state)">
<mat-icon *ngIf="state.next_state_ids?.includes(nextState.id)">check</mat-icon>
<span>{{ nextState.name }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@ Note: Does not affect the visibility of change recommendations.`
return (<any>state)[perm.selector];
}

public sortedNextStates(state: ViewMotionState): ViewMotionState[] {
return state.next_states.sort((a, b) => a.weight - b.weight);
}

private async deleteWorkflowState(state: ViewMotionState): Promise<void> {
const title = this.translate.instant(`Are you sure you want to delete this state?`);
const content = `${state.name}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ <h3>{{ 'Resolution and size' | translate }}</h3>
<div class="spacer-top-20 grid-form">
<mat-slider
class="grid-start"
formControlName="width"
[thumbLabel]="true"
[discrete]="true"
[min]="minWidth"
[max]="maxResolution"
[step]="resolutionChangeStep"
[value]="updateForm.value.width"
></mat-slider>
>
<input matSliderThumb formControlName="width" [value]="updateForm.value.width" />
</mat-slider>
<div class="grid-end">
<mat-form-field>
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { MatLegacyFormFieldModule as MatFormFieldModule } from '@angular/materia
import { MatLegacyInputModule as MatInputModule } from '@angular/material/legacy-input';
import { MatLegacyRadioModule as MatRadioModule } from '@angular/material/legacy-radio';
import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
import { MatLegacySliderModule as MatSliderModule } from '@angular/material/legacy-slider';
import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip';
import { MatSliderModule } from '@angular/material/slider';
import { OpenSlidesTranslationModule } from 'src/app/site/modules/translations';

import { ProjectorModule } from '../../../../modules/projector/projector.module';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ export const meetingSettings: SettingsGroup[] = fillInSettingsDefaults([
},
{
key: `motions_recommendation_text_mode`,
label: _(`Default text version for change recommendations`),
label: _(`Default text version for change recommendations and projection of motions`),
type: `choice`,
choices: {
// matches ChangeRecoMode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { map, Observable } from 'rxjs';
import { BaseViaBackendImportListComponent } from 'src/app/site/base/base-via-backend-import-list.component';
import { OrganizationSettingsService } from 'src/app/site/pages/organization/services/organization-settings.service';
import { ComponentServiceCollectorService } from 'src/app/site/services/component-service-collector.service';
import { ImportListHeaderDefinition } from 'src/app/ui/modules/import-list';

Expand All @@ -18,14 +20,22 @@ export class AccountImportListComponent extends BaseViaBackendImportListComponen
public columns: ImportListHeaderDefinition[] = Object.keys(accountHeadersAndVerboseNames).map(header => ({
property: header,
label: (<any>accountHeadersAndVerboseNames)[header],
isTableColumn: true
isTableColumn: true,
customInfo: header === `gender` ? this.getTranslatedGenderInfoObservable() : undefined
}));

public constructor(
componentServiceCollector: ComponentServiceCollectorService,
protected override translate: TranslateService,
public override importer: AccountImportService
public override importer: AccountImportService,
public orgaSettings: OrganizationSettingsService
) {
super(componentServiceCollector, translate, importer);
}

private getTranslatedGenderInfoObservable(): Observable<string> {
return this.translate
.get(`Possible options`)
.pipe(map(framework => framework + `: ` + this.orgaSettings.instant(`genders`).join(`, `)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class AccountImportService extends BaseBackendImportService {
created: _(`Accounts created`),
updated: _(`Accounts updated`),
error: _(`Accounts with errors`),
warning: _(`Accounts with warnings (will be skipped)`)
warning: _(`Accounts with warnings: affected cells will be skipped`)
};

public constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@angular/core';
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog';
import { MatLegacySelectChange as MatSelectChange } from '@angular/material/legacy-select';
import { MatLegacyTab as MatTab, MatLegacyTabChangeEvent as MatTabChangeEvent } from '@angular/material/legacy-tabs';
import { MatTab, MatTabChangeEvent } from '@angular/material/tabs';
import { marker as _ } from '@colsen1991/ngx-translate-extract-marker';
import { auditTime, distinctUntilChanged, firstValueFrom, map, Observable, of } from 'rxjs';
import { Identifiable } from 'src/app/domain/interfaces';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ <h2>{{ finishedWithWarning ? ('Rows with warnings' | translate) : ('Preview' | t
<ng-template #nonObjectEntryTemplate let-entry="entry" let-type="type">
<ng-container *ngIf="type === 'string'">{{ entry | translate }}</ng-container>
<ng-container *ngIf="type === 'number' || type === 'integer'">{{ entry }}</ng-container>
<ng-container *ngIf="type === 'decimal'">{{ getShortenedDecimal(entry) }}</ng-container>
<ng-container *ngIf="type === 'date'">{{ entry }}</ng-container>
<mat-checkbox *ngIf="type === 'boolean'" [checked]="entry" disabled></mat-checkbox>
&nbsp;
Expand All @@ -216,16 +217,34 @@ <h2>{{ finishedWithWarning ? ('Rows with warnings' | translate) : ('Preview' | t
rowClass="import-list-preview-row"
>
<div
*osScrollingTableCell="'status'; row as row; config: { width: 25, position: START_POSITION }"
*osScrollingTableCell="'errors'; row as row; config: { width: 25, position: START_POSITION }"
class="flex-vertical-center"
>
<mat-icon
[ngClass]="{ 'red-warning-text': row.state === 'error', warn: row.state === 'warning' }"
*ngIf="row.state === 'error'"
class="red-warning-text"
matTooltip="{{ getRowTooltip(row) }}"
matTooltipPosition="right"
>
{{ getActionIcon(row) }}
</mat-icon>
<mat-icon
*ngIf="row.state !== 'error' && row.messages.length"
class="warn"
matTooltip="{{ getWarningRowTooltip(row) }}"
matTooltipPosition="right"
>
warning
</mat-icon>
</div>

<div
*osScrollingTableCell="'status'; row as row; config: { width: 25, position: START_POSITION }"
class="flex-vertical-center"
>
<mat-icon *ngIf="row.state !== 'error'" matTooltip="{{ getRowTooltip(row) }}" matTooltipPosition="right">
{{ getActionIcon(row) }}
</mat-icon>
</div>
<div *osScrollingTableCell="'id'; value as value; config: { width: 25, position: START_POSITION }">
<div *osScrollingTableCellLabel>#</div>
Expand Down Expand Up @@ -273,8 +292,19 @@ <h1 class="dialog-title" translate>The fields are defined as follows</h1>
<div mat-dialog-content>
<table>
<tr *ngFor="let column of defaultColumns">
<td>{{ column.property }}:</td>
<td>&nbsp;{{ column.label | translate }}</td>
<td class="table-title-column">{{ column.property }}:</td>
<td>
&nbsp;{{ column.label | translate }}
<ng-container *ngIf="column.customInfo">
<br />
<ng-container *ngIf="isString(column.customInfo)">
{{ column.customInfo | translate }}
</ng-container>
<ng-container *ngIf="!isString(column.customInfo)">
{{ column.customInfo | async }}
</ng-container>
</ng-container>
</td>
</tr>
</table>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ pbl-ngrid-cell {
.bottom-offset {
margin: 0 0 5px 0;
}

.table-title-column {
vertical-align: top;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@angular/core';
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog';
import { MatLegacySelectChange as MatSelectChange } from '@angular/material/legacy-select';
import { MatLegacyTab as MatTab, MatLegacyTabChangeEvent as MatTabChangeEvent } from '@angular/material/legacy-tabs';
import { MatTab, MatTabChangeEvent } from '@angular/material/tabs';
import { marker as _ } from '@colsen1991/ngx-translate-extract-marker';
import { TranslateService } from '@ngx-translate/core';
import { delay, firstValueFrom, map, Observable, of } from 'rxjs';
Expand Down Expand Up @@ -381,7 +381,7 @@ export class BackendImportListComponent implements OnInit, OnDestroy {
_(`There is an unspecified error in this line, which prevents the import.`)
);
case BackendImportState.Warning:
return this.getErrorDescription(row) ?? _(`This row will not be imported, due to an unknown reason.`);
return this.getErrorDescription(row) ?? _(`The affected columns will not be imported.`);
case BackendImportState.New:
return this.translate.instant(this.modelName) + ` ` + this.translate.instant(`will be imported`);
case BackendImportState.Done: // item will be updated / has been imported
Expand All @@ -397,6 +397,18 @@ export class BackendImportListComponent implements OnInit, OnDestroy {
}
}

public getWarningRowTooltip(row: BackendImportIdentifiedRow): string {
switch (row.state) {
case BackendImportState.Error: // no import possible
return (
this.getErrorDescription(row) ??
_(`There is an unspecified error in this line, which prevents the import.`)
);
default:
return this.getErrorDescription(row) ?? _(`The affected columns will not be imported.`);
}
}

/**
* A function to trigger the csv example download.
*/
Expand Down Expand Up @@ -453,6 +465,17 @@ export class BackendImportListComponent implements OnInit, OnDestroy {
return this._importer.getVerboseSummaryPointTitle(title);
}

public getShortenedDecimal(decimalString: string): string {
while (decimalString.length && [`0`, `.`].includes(decimalString.charAt(decimalString.length - 1))) {
decimalString = decimalString.substring(0, decimalString.length - 1);
}
return decimalString;
}

public isString(value: any): value is string {
return typeof value === `string`;
}

private setHeaders(data: { default?: ImportListHeaderDefinition[]; preview?: BackendImportHeader[] }): void {
for (const key of Object.keys(data)) {
for (const header of data[key] ?? []) {
Expand All @@ -466,7 +489,7 @@ export class BackendImportListComponent implements OnInit, OnDestroy {
}

private getErrorDescription(entry: BackendImportIdentifiedRow): string {
return entry.messages?.map(error => this.translate.instant(this._importer.verbose(error))).join(`,\n `);
return entry.messages?.map(error => this.translate.instant(this._importer.verbose(error))).join(`\n `);
}

private fillPreviewData(previews: BackendImportPreview[]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Observable } from 'rxjs';

export type ImportListHeaderDefinition = HeaderDefinition;

interface HeaderDefinition {
Expand All @@ -8,4 +10,5 @@ interface HeaderDefinition {
isTableColumn?: boolean;
width?: number;
flexible?: boolean;
customInfo?: string | Observable<string>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { MatLegacyCardModule as MatCardModule } from '@angular/material/legacy-c
import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
import { MatLegacyDialogModule as MatDialogModule } from '@angular/material/legacy-dialog';
import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
import { MatLegacyTabsModule as MatTabsModule } from '@angular/material/legacy-tabs';
import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip';
import { MatTabsModule } from '@angular/material/tabs';
import { ScrollingTableModule } from 'src/app/ui/modules/scrolling-table';

import { OpenSlidesTranslationModule } from '../../../site/modules/translations';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
QueryList,
TemplateRef
} from '@angular/core';
import { MatLegacyTab as MatTab } from '@angular/material/legacy-tabs';
import { MatTab } from '@angular/material/tabs';
import { BehaviorSubject, Observable } from 'rxjs';
import { ViewPortService } from 'src/app/site/services/view-port.service';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';
import { MatLegacyTabsModule as MatTabsModule } from '@angular/material/legacy-tabs';
import { MatTabsModule } from '@angular/material/tabs';

import { VerticalTabGroupComponent } from './components/vertical-tab-group/vertical-tab-group.component';
import { VerticalTabGroupLabelHeaderDirective } from './directives/vertical-tab-group-label-header.directive';
Expand Down
Loading

0 comments on commit d9449f3

Please sign in to comment.