Feature/improve read only mode (#2322)
* Improve read-only mode * Update changelog
This commit is contained in:
parent
921d38a706
commit
1fe1e2fe0c
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Harmonized the logger output: <symbol> (<dataSource>)
|
- Harmonized the logger output: <symbol> (<dataSource>)
|
||||||
- Improved the language localization for Italian (`it`)
|
- Improved the language localization for Italian (`it`)
|
||||||
- Improved the language localization for Dutch (`nl`)
|
- Improved the language localization for Dutch (`nl`)
|
||||||
|
- Improved the read-only mode
|
||||||
|
|
||||||
### Fixed
|
### 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
|
- Supported the management of additional currencies in the admin control panel
|
||||||
- Introduced the system message
|
- Introduced the system message
|
||||||
- Introduced the read only mode
|
- Introduced the read-only mode
|
||||||
|
|
||||||
### Changed
|
### 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 { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';
|
||||||
import {
|
import {
|
||||||
DEFAULT_CURRENCY,
|
DEFAULT_CURRENCY,
|
||||||
PROPERTY_CURRENCIES
|
PROPERTY_CURRENCIES,
|
||||||
|
PROPERTY_IS_READ_ONLY_MODE,
|
||||||
|
PROPERTY_IS_USER_SIGNUP_ENABLED
|
||||||
} from '@ghostfolio/common/config';
|
} from '@ghostfolio/common/config';
|
||||||
import {
|
import {
|
||||||
AdminData,
|
AdminData,
|
||||||
@ -305,7 +307,9 @@ export class AdminService {
|
|||||||
response = await this.propertyService.delete({ key });
|
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();
|
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 { DataService } from '@ghostfolio/client/services/data.service';
|
||||||
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
||||||
import { User } from '@ghostfolio/common/interfaces';
|
import { User } from '@ghostfolio/common/interfaces';
|
||||||
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
||||||
import { translate } from '@ghostfolio/ui/i18n';
|
import { translate } from '@ghostfolio/ui/i18n';
|
||||||
import { StripeService } from 'ngx-stripe';
|
import { StripeService } from 'ngx-stripe';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
@ -17,6 +18,7 @@ export class PricingPageComponent implements OnDestroy, OnInit {
|
|||||||
public baseCurrency: string;
|
public baseCurrency: string;
|
||||||
public coupon: number;
|
public coupon: number;
|
||||||
public couponId: string;
|
public couponId: string;
|
||||||
|
public hasPermissionToUpdateUserSettings: boolean;
|
||||||
public importAndExportTooltipBasic = translate(
|
public importAndExportTooltipBasic = translate(
|
||||||
'DATA_IMPORT_AND_EXPORT_TOOLTIP_BASIC'
|
'DATA_IMPORT_AND_EXPORT_TOOLTIP_BASIC'
|
||||||
);
|
);
|
||||||
@ -55,6 +57,11 @@ export class PricingPageComponent implements OnDestroy, OnInit {
|
|||||||
if (state?.user) {
|
if (state?.user) {
|
||||||
this.user = state.user;
|
this.user = state.user;
|
||||||
|
|
||||||
|
this.hasPermissionToUpdateUserSettings = hasPermission(
|
||||||
|
this.user.permissions,
|
||||||
|
permissions.updateUserSettings
|
||||||
|
);
|
||||||
|
|
||||||
this.coupon = subscriptions?.[this.user?.subscription?.offer]?.coupon;
|
this.coupon = subscriptions?.[this.user?.subscription?.offer]?.coupon;
|
||||||
this.couponId =
|
this.couponId =
|
||||||
subscriptions?.[this.user.subscription.offer]?.couponId;
|
subscriptions?.[this.user.subscription.offer]?.couponId;
|
||||||
|
@ -333,7 +333,7 @@
|
|||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
*ngIf="user?.subscription?.type === 'Basic'"
|
*ngIf="hasPermissionToUpdateUserSettings && user?.subscription?.type === 'Basic'"
|
||||||
class="mt-3 text-center"
|
class="mt-3 text-center"
|
||||||
>
|
>
|
||||||
<button color="primary" mat-flat-button (click)="onCheckout()">
|
<button color="primary" mat-flat-button (click)="onCheckout()">
|
||||||
|
@ -8,10 +8,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<mat-card appearance="outlined" class="mb-3">
|
<mat-card appearance="outlined" class="mb-3">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<div
|
<div *ngIf="user?.subscription" class="d-flex py-1">
|
||||||
*ngIf="hasPermissionToUpdateUserSettings && user?.subscription"
|
|
||||||
class="d-flex py-1"
|
|
||||||
>
|
|
||||||
<div class="pr-1 w-50" i18n>Membership</div>
|
<div class="pr-1 w-50" i18n>Membership</div>
|
||||||
<div class="pl-1 w-50">
|
<div class="pl-1 w-50">
|
||||||
<div class="align-items-center d-flex mb-1">
|
<div class="align-items-center d-flex mb-1">
|
||||||
@ -28,7 +25,9 @@
|
|||||||
user?.subscription?.expiresAt | date: defaultDateFormat }}
|
user?.subscription?.expiresAt | date: defaultDateFormat }}
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="user?.subscription?.type === 'Basic'">
|
<div *ngIf="user?.subscription?.type === 'Basic'">
|
||||||
<ng-container *ngIf="hasPermissionForSubscription">
|
<ng-container
|
||||||
|
*ngIf="hasPermissionForSubscription && hasPermissionToUpdateUserSettings"
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
color="primary"
|
color="primary"
|
||||||
mat-flat-button
|
mat-flat-button
|
||||||
@ -69,6 +68,7 @@
|
|||||||
></gf-premium-indicator
|
></gf-premium-indicator
|
||||||
></a>
|
></a>
|
||||||
<a
|
<a
|
||||||
|
*ngIf="hasPermissionToUpdateUserSettings"
|
||||||
class="mr-2 my-2"
|
class="mr-2 my-2"
|
||||||
i18n
|
i18n
|
||||||
mat-stroked-button
|
mat-stroked-button
|
||||||
|
Loading…
x
Reference in New Issue
Block a user