Skip to content

Commit

Permalink
Cyclos 4.14.3
Browse files Browse the repository at this point in the history
  • Loading branch information
acaurrinhos committed Jan 6, 2021
1 parent 0181376 commit 1c09acd
Show file tree
Hide file tree
Showing 14 changed files with 96 additions and 14 deletions.
2 changes: 1 addition & 1 deletion 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 @@ -3,7 +3,7 @@
"displayName": "Cyclos 4 UI",
"description": "The new Cyclos 4 frontend",
"icon": "cyclos.png",
"version": "4.14.2",
"version": "4.14.3",
"license": "MIT",
"author": {
"name": "Cyclos development team",
Expand Down
6 changes: 4 additions & 2 deletions src/app/shared/user-field.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,13 @@ export class UserFieldComponent
}

setAsPrincipal(value: string) {
if (value != null && this.allowPrincipal) {
let locator = ApiHelper.escapeNumeric(value);
if (!empty(value) && this.allowPrincipal) {
let locator = value;
if (!/^[\w\*]+\:/.test(locator)) {
// When not already using a specific principal (such as id: when searching), use a wildcard
locator = '*:' + locator;
} else {
locator = ApiHelper.escapeNumeric(locator);
}
this.value = locator;
this.inputField.nativeElement.value = value;
Expand Down
19 changes: 15 additions & 4 deletions src/app/ui/marketplace/view/view-ad.component.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { HttpErrorResponse } from '@angular/common/http';
import { ChangeDetectionStrategy, Component, Injector, OnInit } from '@angular/core';
import {
AdCategoryWithParent, AdKind, AdQuestionView, AdView,
Expand All @@ -6,6 +7,7 @@ import {
import { AdQuestionsService } from 'app/api/services/ad-questions.service';
import { MarketplaceService } from 'app/api/services/marketplace.service';
import { ShoppingCartsService } from 'app/api/services/shopping-carts.service';
import { ErrorStatus } from 'app/core/error-status';
import { SvgIcon } from 'app/core/svg-icon';
import { HeadingAction } from 'app/shared/action';
import { empty, words } from 'app/shared/helper';
Expand Down Expand Up @@ -54,10 +56,19 @@ export class ViewAdComponent extends BaseViewPageComponent<AdView> implements On
super.ngOnInit();
this.guest = this.loginService.user == null;
this.id = this.route.snapshot.paramMap.get('id');
this.addSub(this.marketplaceService.viewAd({ ad: this.id })
.subscribe(ad => {
this.data = ad;
}));
this.errorHandler.requestWithCustomErrorHandler(handle => {
this.addSub(this.marketplaceService.viewAd({ ad: this.id })
.subscribe(ad => {
this.data = ad;
}, (err: HttpErrorResponse) => {
// When not logged in and got a not found, redirect to login
if (err.status === ErrorStatus.NOT_FOUND && this.dataForFrontendHolder.user == null) {
this.login.goToLoginPage(this.router.url);
} else {
handle(err);
}
}));
});
}

/**
Expand Down
23 changes: 23 additions & 0 deletions src/app/ui/users/profile/view-profile.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,29 @@ <h2 class="border-0 mb-2">{{ i18n.user.profile.management }}</h2>
</label-value>
<custom-field-value *ngFor="let value of user.customValues"
[fieldValue]="value"></custom-field-value>
<h3 *ngIf="
data.references ||
data.paymentFeedbacks ||
data.accounts.length > 0 ||
data.lastLogin ||
data.firstLogin ||
data.online != null" class="mb-1">
{{ i18n.user.activities }}</h3>
<label-value *ngIf="data.online" [label]="i18n.user.connectionStatus"
[value]="i18n.user.connected">
</label-value>
<label-value *ngIf="data.lastLogin && !data.online"
[label]="i18n.user.connectionStatus"
[value]="i18n.user.disconnectedStatus(format.formatAsDateTime(data.lastLogin))">
</label-value>
<label-value *ngIf="data.lastLogin == null && data.online != null"
[label]="i18n.user.connectionStatus"
[value]="i18n.user.neverLogged"></label-value>
<ng-container *ngFor="let acc of data.accounts">
<label-value [label]="i18n.user.accountBalance(acc.type.name)">
{{ acc.status.balance | currency: acc.currency }}
</label-value>
</ng-container>
<label-value *ngIf="data.references"
[label]="i18n.user.profile.references">
<a [routerLink]="referencesPath()">
Expand Down
5 changes: 4 additions & 1 deletion src/app/ui/users/profile/view-profile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ export class ViewProfileComponent extends BaseViewPageComponent<UserView> implem
.subscribe(user => {
this.data = user;
}, (resp: HttpErrorResponse) => {
if ([ErrorStatus.FORBIDDEN, ErrorStatus.UNAUTHORIZED].includes(resp.status)) {
if (resp.status === ErrorStatus.NOT_FOUND && this.dataForFrontendHolder.user == null) {
// When not logged in and got a not found, redirect to login
this.login.goToLoginPage(this.router.url);
} else if ([ErrorStatus.FORBIDDEN, ErrorStatus.UNAUTHORIZED].includes(resp.status)) {
this.notification.error(this.i18n.user.profile.noPermission);
this.breadcrumb.back();
this.data = {};
Expand Down
12 changes: 11 additions & 1 deletion src/i18n/i18n.el.json
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
{}
{
"general": {
"printed": "Τυπωμένο",
"showFilters": "Εμφάνιση φίλτρων",
"lessFilters": "Λιγότερα φίλτρα",
"disabled": "Απενεργοποιημένο",
"close": "Κλείσιμο",
"finish": "Ολοκλήρωση",
"remoteAddress": "Διεύθυνση IP"
}
}
6 changes: 6 additions & 0 deletions src/i18n/i18n.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,12 @@
"myBrokerings": "Miembros asignados",
"userBrokerings": "Brokers"
},
"accountBalance": "Saldo de {name}",
"connected": "Conectado",
"connectionStatus": "Estado de conexión",
"disconnectedStatus": "Desconectado (último acceso: {0})",
"neverLogged": "Nunca ha accedido",
"activities": "Actividades",
"group": "Grupo",
"broker": "Broker",
"brokers": "Brokers",
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,12 @@
"myBrokerings": "Assigned members",
"userBrokerings": "Broker members"
},
"accountBalance": "{name} balance",
"connected": "Online",
"connectionStatus": "Connection status",
"disconnectedStatus": "Off-line (last login: {date})",
"neverLogged": "Never logged",
"activities": "Activities",
"group": "Group",
"broker": "Broker",
"brokers": "Brokers",
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/i18n.pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,12 @@
"myBrokerings": "Membros atribuídos",
"userBrokerings": "Membros do corretor"
},
"accountBalance": "{name} saldo",
"connected": "Online",
"connectionStatus": "Estado da conexão",
"disconnectedStatus": "Desconectado (último login: {date})",
"neverLogged": "Nunca acessou",
"activities": "Atividades",
"group": "Grupo",
"broker": "Corretor",
"brokers": "Corretores",
Expand Down
6 changes: 6 additions & 0 deletions src/openapi/cyclos-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70138,6 +70138,12 @@ components:
$ref: '#/components/schemas/UserRecords'
documents:
$ref: '#/components/schemas/UserDocuments'
accounts:
description: >-
The list of accounts with status
type: array
items:
$ref: '#/components/schemas/AccountWithStatus'


UserVouchersDataForSearch:
Expand Down
12 changes: 10 additions & 2 deletions src/styles/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,20 @@ $spaced-label-values: (
@each $lv2 in $spaced-label-values {
body.xxs {
#{$lv1} + #{$lv2} {
margin-top: 0.3rem;
@if $lv2 == 'h1' or $lv2 == 'h2' or $lv2 == 'h3' {
margin-top: 0.6rem;
} @else {
margin-top: 0.3rem;
}
}
}
body.gt-xxs {
#{$lv1} + #{$lv2} {
margin-top: 0.6rem;
@if $lv2 == 'h1' or $lv2 == 'h2' or $lv2 == 'h3' {
margin-top: 1rem;
} @else {
margin-top: 0.6rem;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/styles/_headers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ h2 {
}
h3 {
font-size: 1.1em;
font-weight: $font-weight-bold;
color: $h3-color;
margin-top: 0.5rem;
margin-top: 0.75rem;
margin-bottom: 0.6rem;
}
h4, h5, h6 {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</style>
<meta charset="utf-8">
<script>
var href = window.location.href;
var href = window.location.pathname;
if (!href.endsWith('/')) {
href = href + '/';
}
Expand Down

0 comments on commit 1c09acd

Please sign in to comment.