Browse Source

feat: Add base currency dropdown to filter menu

pull/5361/head
google-labs-jules[bot] 2 weeks ago
parent
commit
eca6bb0a34
  1. 1
      apps/client/src/app/components/header/header.component.html
  2. 2
      apps/client/src/app/components/header/header.component.ts
  3. 14
      client.log
  4. 24
      libs/ui/src/lib/assistant/assistant.component.ts
  5. 13
      libs/ui/src/lib/assistant/assistant.html
  6. 14
      server.log

1
apps/client/src/app/components/header/header.component.html

@ -153,6 +153,7 @@
"
[hasPermissionToChangeDateRange]="hasPermissionToChangeDateRange"
[hasPermissionToChangeFilters]="hasPermissionToChangeFilters"
[info]="info"
[user]="user"
(closed)="closeAssistant()"
(dateRangeChanged)="onDateRangeChange($event)"

2
apps/client/src/app/components/header/header.component.ts

@ -208,6 +208,8 @@ export class HeaderComponent implements OnChanges {
userSetting['filters.accounts'] = filter.id ? [filter.id] : null;
} else if (filter.type === 'ASSET_CLASS') {
userSetting['filters.assetClasses'] = filter.id ? [filter.id] : null;
} else if (filter.type === 'BASE_CURRENCY') {
userSetting['baseCurrency'] = filter.id ? filter.id : null;
} else if (filter.type === 'DATA_SOURCE') {
userSetting['filters.dataSource'] = filter.id ? filter.id : null;
} else if (filter.type === 'SYMBOL') {

14
client.log

@ -0,0 +1,14 @@
> ghostfolio@2.190.0 start:client
> nx run client:copy-assets && nx run client:serve --configuration=development-en --hmr -o
> nx run client:copy-assets
> shx rm -rf dist/apps/client
> shx mkdir -p dist/apps/client/.well-known
> shx mkdir -p dist/apps/client/assets
> shx cp -r apps/client/src/assets/* dist/apps/client/assets

24
libs/ui/src/lib/assistant/assistant.component.ts

@ -2,7 +2,12 @@ import { GfSymbolModule } from '@ghostfolio/client/pipes/symbol/symbol.module';
import { AdminService } from '@ghostfolio/client/services/admin.service';
import { DataService } from '@ghostfolio/client/services/data.service';
import { getAssetProfileIdentifier } from '@ghostfolio/common/helper';
import { Filter, PortfolioPosition, User } from '@ghostfolio/common/interfaces';
import {
Filter,
InfoItem,
PortfolioPosition,
User
} from '@ghostfolio/common/interfaces';
import { InternalRoute } from '@ghostfolio/common/routes/interfaces/internal-route.interface';
import { internalRoutes } from '@ghostfolio/common/routes/routes';
import { DateRange } from '@ghostfolio/common/types';
@ -127,6 +132,7 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
@Input() hasPermissionToAccessAdminControl: boolean;
@Input() hasPermissionToChangeDateRange: boolean;
@Input() hasPermissionToChangeFilters: boolean;
@Input() info: InfoItem;
@Input() user: User;
@Output() closed = new EventEmitter<void>();
@ -143,11 +149,13 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
public accounts: Account[] = [];
public assetClasses: Filter[] = [];
public currencies: Filter[] = [];
public dateRangeFormControl = new FormControl<string>(undefined);
public dateRangeOptions: IDateRangeOption[] = [];
public filterForm = this.formBuilder.group({
account: new FormControl<string>(undefined),
assetClass: new FormControl<string>(undefined),
baseCurrency: new FormControl<string>(undefined),
holding: new FormControl<PortfolioPosition>(undefined),
tag: new FormControl<string>(undefined)
});
@ -170,6 +178,7 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
private filterTypes: Filter['type'][] = [
'ACCOUNT',
'ASSET_CLASS',
'BASE_CURRENCY',
'DATA_SOURCE',
'SYMBOL',
'TAG'
@ -343,6 +352,14 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
public ngOnChanges() {
this.accounts = this.user?.accounts ?? [];
this.currencies = this.info.currencies.map((currency) => {
return {
id: currency.id,
label: currency.id,
type: 'BASE_CURRENCY'
};
});
this.dateRangeOptions = [
{
label: $localize`Today`,
@ -509,6 +526,10 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
id: this.filterForm.get('assetClass').value,
type: 'ASSET_CLASS'
},
{
id: this.filterForm.get('baseCurrency').value,
type: 'BASE_CURRENCY'
},
{
id: this.filterForm.get('holding').value?.dataSource,
type: 'DATA_SOURCE'
@ -682,6 +703,7 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
{
account: this.user?.settings?.['filters.accounts']?.[0] ?? null,
assetClass: this.user?.settings?.['filters.assetClasses']?.[0] ?? null,
baseCurrency: this.user?.settings?.baseCurrency ?? null,
holding: selectedHolding ?? null,
tag: this.user?.settings?.['filters.tags']?.[0] ?? null
},

13
libs/ui/src/lib/assistant/assistant.html

@ -226,6 +226,19 @@
</mat-select>
</mat-form-field>
</div>
<div class="mb-3">
<mat-form-field appearance="outline" class="w-100 without-hint">
<mat-label i18n>Base Currency</mat-label>
<mat-select formControlName="baseCurrency">
<mat-option [value]="null" />
@for (currency of currencies; track currency.id) {
<mat-option [value]="currency.id">{{
currency.label
}}</mat-option>
}
</mat-select>
</mat-form-field>
</div>
<div class="d-flex w-100">
<button
i18n

14
server.log

@ -0,0 +1,14 @@
> ghostfolio@2.190.0 start:server
> nx run api:copy-assets && nx run api:serve --watch
> nx run api:copy-assets
> shx rm -rf dist/apps/api
> shx mkdir -p dist/apps/api/assets/locales
> shx cp -r apps/api/src/assets/* dist/apps/api/assets
> shx cp -r apps/client/src/locales/* dist/apps/api/assets/locales
Loading…
Cancel
Save