Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@ngneat/input-mask": "^6.1.0",
"@sentry/angular": "^10.68.0",
"@tailwindcss/postcss": "^4.3.1",
"@vality/domain-proto": "^2.0.2-6e28041.0",
"@vality/domain-proto": "^2.0.2-8d6174b.0",
"@vality/fistful-proto": "^2.0.1-360c737.0",
"@vality/machinegun-proto": "^1.0.1-273f2f3.0",
"@vality/magista-proto": "^2.0.2-bd58cea.0",
Expand Down
200 changes: 102 additions & 98 deletions projects/matez/src/lib/components/value/value.component.html
Original file line number Diff line number Diff line change
@@ -1,110 +1,114 @@
@if (!value() && lazyValue() && !lazyVisible()) {
<button class="button" mat-icon-button (click)="lazyVisible.set(true)">
<mat-icon>sync</mat-icon>
</button>
} @else {
@if (value$ | async; as v) {
<div class="flex gap-1 items-center">
@if (v.prefix) {
<button
class="action ml-[-16px]"
mat-icon-button
(click)="v.prefix.click ? v.prefix.click($event) : undefined"
>
<mat-icon>{{ v.prefix.icon }}</mat-icon>
</button>
}
<div
[ngClass]="{ wrapper__action: v.click || v.link }"
class="wrapper"
(click)="click($event)"
@if (value$ | async; as v) {
<div class="flex gap-1 items-center">
@if (lazyValue() && !lazyVisible()) {
<button
class="button ml-[-8px] mr-[-8px]"
mat-icon-button
(click)="lazyVisible.set(true)"
>
<mat-icon>sync</mat-icon>
</button>
}
@if (v.error) {
<mat-icon
[matTooltip]="
v.error?.['error']?.['message'] || v.error?.['message'] || (v.error | json)
"
>error</mat-icon
>
}
@if (v.prefix) {
<button
class="action ml-[-16px]"
mat-icon-button
(click)="v.prefix.click ? v.prefix.click($event) : undefined"
>
@if (v.template) {
<ng-container *ngTemplateOutlet="v.template; context: {}"></ng-container>
<mat-icon>{{ v.prefix.icon }}</mat-icon>
</button>
}
<div
[ngClass]="{ wrapper__action: v.click || v.link }"
class="wrapper"
(click)="click($event)"
>
@if (v.template) {
<ng-container *ngTemplateOutlet="v.template; context: {}"></ng-container>
} @else {
@if (v.color) {
<v-tag [color]="v.color">
<ng-container *ngTemplateOutlet="tooltipTemplate"></ng-container>
</v-tag>
} @else {
@if (v.color) {
<v-tag [color]="v.color">
<ng-container *ngTemplateOutlet="tooltipTemplate"></ng-container>
</v-tag>
<ng-container *ngTemplateOutlet="tooltipTemplate"></ng-container>
}

<ng-template #tooltipTemplate>
@if (v.tooltip) {
<span
[matTooltip]="v.tooltip"
class="tooltip"
matTooltipClass="tooltip-content"
>
<ng-container *ngTemplateOutlet="valueTemplate"></ng-container>
</span>
} @else {
<ng-container *ngTemplateOutlet="tooltipTemplate"></ng-container>
<span [title]="v.value">
<ng-container *ngTemplateOutlet="valueTemplate"></ng-container>
</span>
}
</ng-template>

<ng-template #tooltipTemplate>
@if (v.tooltip) {
<span
[matTooltip]="v.tooltip"
class="tooltip"
matTooltipClass="tooltip-content"
>
<ng-container *ngTemplateOutlet="valueTemplate"></ng-container>
</span>
} @else {
<span [title]="v.value">
<ng-container *ngTemplateOutlet="valueTemplate"></ng-container>
</span>
<ng-template #valueTemplate>
@switch (v.type) {
@case ('menu') {
<v-menu-value [value]="v"></v-menu-value>
}
</ng-template>

<ng-template #valueTemplate>
@switch (v.type) {
@case ('menu') {
<v-menu-value [value]="v"></v-menu-value>
}
@case ('toggle') {
<v-toggle-value [value]="v"></v-toggle-value>
}
@default {
@let valueText = valueText$ | async;
@if (inProgress$ | async) {
<v-content-loading [hiddenText]="valueText"></v-content-loading>
} @else if (valueText) {
<span
[ngClass]="{ value__click: v.click, value__link: v.link }"
[vHighlightSearch]="highlight"
[vHighlightText]="valueText"
vHighlight
></span>
} @else if (v.error) {
<mat-icon
[matTooltip]="
v.error?.['error']?.['message'] ||
v.error?.['message'] ||
(v.error | json)
"
>error</mat-icon
>
} @else if (emptySymbol) {
<span class="text-[var(--mat-sys-outline)]">{{
emptySymbol
}}</span>
}
@case ('toggle') {
<v-toggle-value [value]="v"></v-toggle-value>
}
@default {
@let valueText = valueText$ | async;
@if (inProgress$ | async) {
<v-content-loading [hiddenText]="valueText"></v-content-loading>
} @else if (valueText) {
<span
[ngClass]="{ value__click: v.click, value__link: v.link }"
[vHighlightSearch]="highlight"
[vHighlightText]="valueText"
vHighlight
></span>
} @else if (emptySymbol) {
<span class="text-[var(--mat-sys-outline)]">{{ emptySymbol }}</span>
}
}
</ng-template>
}
}
</ng-template>
}

@if (v.description) {
<div
[title]="v.description"
[vHighlightSearch]="highlight"
[vHighlightText]="v.description"
class="description text-[var(--mat-sys-outline)] text-xs"
vHighlight
></div>
}
</div>
@if (v.postfix) {
<button
class="action ml-auto mr-[-16px]"
mat-icon-button
(click)="v.postfix.click ? v.postfix.click($event) : undefined"
>
<mat-icon>{{ v.postfix.icon }}</mat-icon>
</button>
@if (v.description) {
<div
[title]="v.description"
[vHighlightSearch]="highlight"
[vHighlightText]="v.description"
class="description text-[var(--mat-sys-outline)] text-xs"
vHighlight
></div>
}
</div>
} @else {
<v-content-loading></v-content-loading>
}
@if (v.postfix) {
<button
class="action ml-auto mr-[-16px]"
mat-icon-button
(click)="v.postfix.click ? v.postfix.click($event) : undefined"
>
<mat-icon>{{ v.postfix.icon }}</mat-icon>
</button>
}
</div>
} @else if (lazyValue() && !lazyVisible()) {
<button class="button ml-[-8px]" mat-icon-button (click)="lazyVisible.set(true)">
<mat-icon>sync</mat-icon>
</button>
} @else {
<v-content-loading></v-content-loading>
}
13 changes: 11 additions & 2 deletions projects/matez/src/lib/components/value/value.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,17 @@ export class ValueComponent {

@Input() highlight?: string | null;

value$ = combineLatest([toObservable(this.value), toObservable(this.lazyValue)]).pipe(
switchMap(([value, lazyValue]) => (isObservable(lazyValue) ? lazyValue : of(value))),
value$ = combineLatest([
toObservable(this.value),
toObservable(this.lazyValue),
toObservable(this.lazyVisible),
]).pipe(
switchMap(([value, lazyValue, lazyVisible]) => {
if (lazyVisible && isObservable(lazyValue)) {
return lazyValue;
}
return of(value);
}),
shareReplay({ refCount: true, bufferSize: 1 }),
);
valueText$ = this.value$.pipe(
Expand Down
5 changes: 5 additions & 0 deletions src/api/org-management/utils/member-roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import uniq from 'lodash-es/uniq';
import { domain } from '@vality/org-management-proto/admin_management';

import { ROLE_PRIORITY, sortRoleIds } from '../constants';
import { SCOPES, ScopeId } from '../types';

export { ROLE_PRIORITY, sortRoleIds };

Expand All @@ -11,6 +12,10 @@ export interface RoleLike {
scope?: domain.RoleScope;
}

export function getRoleScopes(roleId?: string): readonly ScopeId[] {
return roleId === 'WalletManager' ? ['Wallet'] : SCOPES;
}

export function isWalletRole(role: RoleLike): boolean {
return role.scope?.scope_id === 'Wallet' || role.role_id === 'WalletManager';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@if (!partyId) {
<cc-merchant-field [formField]="control.party_id" label="Party" required />
}
<v-input-field [formField]="control.owner_id" label="Owner ID" />
<cc-user-field [formField]="control.owner_id" label="Owner ID" />
</div>

<v-dialog-actions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { domain } from '@vality/org-management-proto/admin_management';

import { ThriftOrganizationManagementService } from '~/api/services';
import { MerchantFieldModule } from '~/components/merchant-field';
import { UserFieldComponent } from '~/components/user-field';

export interface CreateOrganizationDialogData {
partyId?: domain.PartyID;
Expand All @@ -36,6 +37,7 @@ interface CreateOrganizationModel {
MerchantFieldModule,
InputFieldModule,
FormField,
UserFieldComponent,
],
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './create-organization-dialog.component.html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
</cc-page-layout-actions>
<v-filters #filtersComponent [active]="active()" merge (clear)="resetFilters()">
<ng-template>
<v-input-field
[formField]="filtersControl.owner_id"
cleanButton
label="Owner ID"
></v-input-field>
<cc-user-field [formField]="filtersControl.owner_id" label="Owner ID"></cc-user-field>
<v-select-field
[formField]="filtersControl.status"
[options]="statusOptions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { Router } from '@angular/router';
import {
Column,
FiltersModule,
InputFieldModule,
NotifyLogService,
Option,
QueryParamsService,
Expand All @@ -27,6 +26,7 @@ import { domain } from '@vality/org-management-proto/admin_management';

import { ThriftOrganizationManagementService } from '~/api/services';
import { PageLayoutModule } from '~/components/page-layout';
import { UserFieldComponent } from '~/components/user-field';
import { createPartyColumn } from '~/utils';

import { OrganizationActionsService } from '../../services';
Expand All @@ -50,9 +50,9 @@ const DEFAULT_FILTERS: OrganizationsFilters = {
PageLayoutModule,
TableResourceComponent,
FiltersModule,
InputFieldModule,
SelectFieldModule,
FormField,
UserFieldComponent,
],
})
export class OrganizationsListComponent {
Expand Down Expand Up @@ -119,7 +119,18 @@ export class OrganizationsListComponent {
{
field: 'owner_id',
header: 'Owner',
cell: (org) => ({ value: org.owner_id }),
cell: (org) => ({ value: '', description: org.owner_id }),
lazyCell: (org) =>
this.organizationsService.GetUser(org.owner_id).pipe(
map((res) => ({
value: res.email,
description: org.owner_id,
})),
catchError((err) => {
this.log.error(err);
return of({ value: '', description: org.owner_id, error: err });
}),
),
},
{
field: 'status',
Expand Down
Loading
Loading