Browse Source
Feature/improve read only mode (#2322)
* Improve read-only mode
* Update changelog
pull/2335/head^2
Thomas Kaul
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
21 additions and
9 deletions
-
CHANGELOG.md
-
apps/api/src/app/admin/admin.service.ts
-
apps/client/src/app/pages/pricing/pricing-page.component.ts
-
apps/client/src/app/pages/pricing/pricing-page.html
-
apps/client/src/app/pages/user-account/user-account-page.html
|
|
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
- Harmonized the logger output: <symbol> (<dataSource>) |
|
|
|
- Improved the language localization for Italian (`it`) |
|
|
|
- Improved the language localization for Dutch (`nl`) |
|
|
|
- Improved the read-only mode |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
@ -2950,7 +2951,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
- Supported the management of additional currencies in the admin control panel |
|
|
|
- Introduced the system message |
|
|
|
- Introduced the read only mode |
|
|
|
- Introduced the read-only mode |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
|
|
@ -8,7 +8,9 @@ import { PropertyService } from '@ghostfolio/api/services/property/property.serv |
|
|
|
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; |
|
|
|
import { |
|
|
|
DEFAULT_CURRENCY, |
|
|
|
PROPERTY_CURRENCIES |
|
|
|
PROPERTY_CURRENCIES, |
|
|
|
PROPERTY_IS_READ_ONLY_MODE, |
|
|
|
PROPERTY_IS_USER_SIGNUP_ENABLED |
|
|
|
} from '@ghostfolio/common/config'; |
|
|
|
import { |
|
|
|
AdminData, |
|
|
@ -305,7 +307,9 @@ export class AdminService { |
|
|
|
response = await this.propertyService.delete({ key }); |
|
|
|
} |
|
|
|
|
|
|
|
if (key === PROPERTY_CURRENCIES) { |
|
|
|
if (key === PROPERTY_IS_READ_ONLY_MODE && value === 'true') { |
|
|
|
await this.putSetting(PROPERTY_IS_USER_SIGNUP_ENABLED, 'false'); |
|
|
|
} else if (key === PROPERTY_CURRENCIES) { |
|
|
|
await this.exchangeRateDataService.initialize(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; |
|
|
|
import { DataService } from '@ghostfolio/client/services/data.service'; |
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
|
import { User } from '@ghostfolio/common/interfaces'; |
|
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; |
|
|
|
import { translate } from '@ghostfolio/ui/i18n'; |
|
|
|
import { StripeService } from 'ngx-stripe'; |
|
|
|
import { Subject } from 'rxjs'; |
|
|
@ -17,6 +18,7 @@ export class PricingPageComponent implements OnDestroy, OnInit { |
|
|
|
public baseCurrency: string; |
|
|
|
public coupon: number; |
|
|
|
public couponId: string; |
|
|
|
public hasPermissionToUpdateUserSettings: boolean; |
|
|
|
public importAndExportTooltipBasic = translate( |
|
|
|
'DATA_IMPORT_AND_EXPORT_TOOLTIP_BASIC' |
|
|
|
); |
|
|
@ -55,6 +57,11 @@ export class PricingPageComponent implements OnDestroy, OnInit { |
|
|
|
if (state?.user) { |
|
|
|
this.user = state.user; |
|
|
|
|
|
|
|
this.hasPermissionToUpdateUserSettings = hasPermission( |
|
|
|
this.user.permissions, |
|
|
|
permissions.updateUserSettings |
|
|
|
); |
|
|
|
|
|
|
|
this.coupon = subscriptions?.[this.user?.subscription?.offer]?.coupon; |
|
|
|
this.couponId = |
|
|
|
subscriptions?.[this.user.subscription.offer]?.couponId; |
|
|
|
|
|
@ -333,7 +333,7 @@ |
|
|
|
> |
|
|
|
</p> |
|
|
|
<div |
|
|
|
*ngIf="user?.subscription?.type === 'Basic'" |
|
|
|
*ngIf="hasPermissionToUpdateUserSettings && user?.subscription?.type === 'Basic'" |
|
|
|
class="mt-3 text-center" |
|
|
|
> |
|
|
|
<button color="primary" mat-flat-button (click)="onCheckout()"> |
|
|
|
|
|
@ -8,10 +8,7 @@ |
|
|
|
<div class="col"> |
|
|
|
<mat-card appearance="outlined" class="mb-3"> |
|
|
|
<mat-card-content> |
|
|
|
<div |
|
|
|
*ngIf="hasPermissionToUpdateUserSettings && user?.subscription" |
|
|
|
class="d-flex py-1" |
|
|
|
> |
|
|
|
<div *ngIf="user?.subscription" class="d-flex py-1"> |
|
|
|
<div class="pr-1 w-50" i18n>Membership</div> |
|
|
|
<div class="pl-1 w-50"> |
|
|
|
<div class="align-items-center d-flex mb-1"> |
|
|
@ -28,7 +25,9 @@ |
|
|
|
user?.subscription?.expiresAt | date: defaultDateFormat }} |
|
|
|
</div> |
|
|
|
<div *ngIf="user?.subscription?.type === 'Basic'"> |
|
|
|
<ng-container *ngIf="hasPermissionForSubscription"> |
|
|
|
<ng-container |
|
|
|
*ngIf="hasPermissionForSubscription && hasPermissionToUpdateUserSettings" |
|
|
|
> |
|
|
|
<button |
|
|
|
color="primary" |
|
|
|
mat-flat-button |
|
|
@ -69,6 +68,7 @@ |
|
|
|
></gf-premium-indicator |
|
|
|
></a> |
|
|
|
<a |
|
|
|
*ngIf="hasPermissionToUpdateUserSettings" |
|
|
|
class="mr-2 my-2" |
|
|
|
i18n |
|
|
|
mat-stroked-button |
|
|
|