Feature/export single draft (#835)
* Export single draft * Update changelog
This commit is contained in:
parent
ec2ecab751
commit
6e7cf0380b
@ -5,11 +5,17 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added support to export a single future activity (draft) as an `.ics` file
|
||||||
|
|
||||||
## 1.137.0 - 15.04.2022
|
## 1.137.0 - 15.04.2022
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added support to export future activities (drafts) as `.ics` files
|
- Added support to export future activities (drafts) as an `.ics` file
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -194,16 +194,17 @@
|
|||||||
<ion-icon name="ellipsis-vertical"></ion-icon>
|
<ion-icon name="ellipsis-vertical"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-menu #accountMenu="matMenu" xPosition="before">
|
<mat-menu #accountMenu="matMenu" xPosition="before">
|
||||||
<button i18n mat-menu-item (click)="onUpdateAccount(element)">
|
<button mat-menu-item (click)="onUpdateAccount(element)">
|
||||||
Edit
|
<ion-icon class="mr-2" name="create-outline"></ion-icon>
|
||||||
|
<span i18n>Edit</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
i18n
|
|
||||||
mat-menu-item
|
mat-menu-item
|
||||||
[disabled]="element.isDefault || element.Order?.length > 0"
|
[disabled]="element.isDefault || element.Order?.length > 0"
|
||||||
(click)="onDeleteAccount(element.id)"
|
(click)="onDeleteAccount(element.id)"
|
||||||
>
|
>
|
||||||
Delete
|
<ion-icon class="mr-2" name="trash-outline"></ion-icon>
|
||||||
|
<span i18n>Delete</span>
|
||||||
</button>
|
</button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
</td>
|
</td>
|
||||||
|
@ -68,12 +68,12 @@
|
|||||||
</button>
|
</button>
|
||||||
<mat-menu #accountMenu="matMenu" xPosition="before">
|
<mat-menu #accountMenu="matMenu" xPosition="before">
|
||||||
<button
|
<button
|
||||||
i18n
|
|
||||||
mat-menu-item
|
mat-menu-item
|
||||||
[disabled]="userItem.id === user?.id"
|
[disabled]="userItem.id === user?.id"
|
||||||
(click)="onDeleteUser(userItem.id)"
|
(click)="onDeleteUser(userItem.id)"
|
||||||
>
|
>
|
||||||
Delete
|
<ion-icon class="mr-2" name="trash-outline"></ion-icon>
|
||||||
|
<span i18n>Delete</span>
|
||||||
</button>
|
</button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
</td>
|
</td>
|
||||||
|
@ -178,10 +178,10 @@ export class TransactionsPageComponent implements OnDestroy, OnInit {
|
|||||||
content: this.icsService.transformActivitiesToIcsContent(
|
content: this.icsService.transformActivitiesToIcsContent(
|
||||||
data.activities
|
data.activities
|
||||||
),
|
),
|
||||||
fileName: `ghostfolio-drafts-${format(
|
contentType: 'text/calendar',
|
||||||
parseISO(data.meta.date),
|
fileName: `ghostfolio-draft${
|
||||||
'yyyyMMddHHmm'
|
data.activities.length > 1 ? 's' : ''
|
||||||
)}.ics`,
|
}-${format(parseISO(data.meta.date), 'yyyyMMddHHmm')}.ics`,
|
||||||
format: 'string'
|
format: 'string'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -9,6 +9,7 @@ import { format, parseISO } from 'date-fns';
|
|||||||
})
|
})
|
||||||
export class IcsService {
|
export class IcsService {
|
||||||
private readonly ICS_DATE_FORMAT = 'yyyyMMdd';
|
private readonly ICS_DATE_FORMAT = 'yyyyMMdd';
|
||||||
|
private readonly ICS_LINE_BREAK = '\r\n';
|
||||||
|
|
||||||
public constructor() {}
|
public constructor() {}
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ export class IcsService {
|
|||||||
});
|
});
|
||||||
const footer = ['END:VCALENDAR'];
|
const footer = ['END:VCALENDAR'];
|
||||||
|
|
||||||
return [...header, ...events, ...footer].join('\n');
|
return [...header, ...events, ...footer].join(this.ICS_LINE_BREAK);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getEvent({
|
private getEvent({
|
||||||
@ -54,6 +55,6 @@ export class IcsService {
|
|||||||
`DTEND;VALUE=DATE:${format(date, this.ICS_DATE_FORMAT)}`,
|
`DTEND;VALUE=DATE:${format(date, this.ICS_DATE_FORMAT)}`,
|
||||||
`SUMMARY:${capitalize(type)} ${symbol}`,
|
`SUMMARY:${capitalize(type)} ${symbol}`,
|
||||||
'END:VEVENT'
|
'END:VEVENT'
|
||||||
].join('\n');
|
].join(this.ICS_LINE_BREAK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,14 +387,25 @@
|
|||||||
<ion-icon name="ellipsis-vertical"></ion-icon>
|
<ion-icon name="ellipsis-vertical"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-menu #activityMenu="matMenu" xPosition="before">
|
<mat-menu #activityMenu="matMenu" xPosition="before">
|
||||||
<button i18n mat-menu-item (click)="onUpdateActivity(element)">
|
<button mat-menu-item (click)="onUpdateActivity(element)">
|
||||||
Edit
|
<ion-icon class="mr-2" name="create-outline"></ion-icon>
|
||||||
|
<span i18n>Edit</span>
|
||||||
</button>
|
</button>
|
||||||
<button i18n mat-menu-item (click)="onCloneActivity(element)">
|
<button mat-menu-item (click)="onCloneActivity(element)">
|
||||||
Clone
|
<ion-icon class="mr-2" name="copy-outline"></ion-icon>
|
||||||
|
<span i18n>Clone</span>
|
||||||
</button>
|
</button>
|
||||||
<button i18n mat-menu-item (click)="onDeleteActivity(element.id)">
|
<button
|
||||||
Delete
|
mat-menu-item
|
||||||
|
[disabled]="!element.isDraft"
|
||||||
|
(click)="onExportDraft(element.id)"
|
||||||
|
>
|
||||||
|
<ion-icon class="mr-2" name="calendar-clear-outline"></ion-icon>
|
||||||
|
<span i18n>Export Draft as ICS</span>
|
||||||
|
</button>
|
||||||
|
<button mat-menu-item (click)="onDeleteActivity(element.id)">
|
||||||
|
<ion-icon class="mr-2" name="trash-outline"></ion-icon>
|
||||||
|
<span i18n>Delete</span>
|
||||||
</button>
|
</button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
</td>
|
</td>
|
||||||
|
@ -200,6 +200,10 @@ export class ActivitiesTableComponent implements OnChanges, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onExportDraft(aActivityId: string) {
|
||||||
|
this.exportDrafts.emit([aActivityId]);
|
||||||
|
}
|
||||||
|
|
||||||
public onExportDrafts() {
|
public onExportDrafts() {
|
||||||
this.exportDrafts.emit(
|
this.exportDrafts.emit(
|
||||||
this.dataSource.filteredData
|
this.dataSource.filteredData
|
||||||
|
Loading…
x
Reference in New Issue
Block a user