Skip to content

Commit 5703aea

Browse files
committed
add delete and download button for team evidences
1 parent dc3b309 commit 5703aea

3 files changed

Lines changed: 46 additions & 10 deletions

File tree

src/app/pages/circular-heatmap/circular-heatmap.component.css

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@
5858
max-width: min(100vh - 60px, 100vw - 60px);
5959
}
6060

61-
.downloadButtonClass {
62-
margin: 10px 0;
63-
}
6461
.overlay-details {
6562
z-index: 2;
6663
background-color: rgba(0, 0, 0, 0.555);
@@ -191,9 +188,9 @@ button.filter-toggle {
191188
place-self: flex-end;
192189
margin: 0 1rem;
193190
padding-top: 1rem;
194-
display: flex;
195-
align-items: flex-end;
196-
flex-direction: column;
191+
display: grid;
192+
grid-template-columns: 1fr 1fr;
193+
gap: 10px;
197194
}
198195

199196
:host ::ng-deep .activity-card .mat-expansion-panel-body {

src/app/pages/circular-heatmap/circular-heatmap.component.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,27 @@ <h2>Nothing to show</h2>
135135
(click)="exportTeamProgress()">
136136
Download team progress
137137
</button>
138+
<button
139+
class="normal-button"
140+
mat-raised-button
141+
class="downloadButtonClass"
142+
(click)="exportTeamEvidences()">
143+
Download team evidences
144+
</button>
138145
<button
139146
class="normal-button"
140147
mat-raised-button
141148
class="resetButtonClass"
142149
(click)="deleteLocalTeamsProgress()">
143150
Delete team progress
144151
</button>
152+
<button
153+
class="normal-button"
154+
mat-raised-button
155+
class="resetButtonClass"
156+
(click)="deleteLocalTeamsEvidence()">
157+
Delete team evidences
158+
</button>
145159
</div>
146160
</div>
147161
</div>

src/app/pages/circular-heatmap/circular-heatmap.component.ts

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -717,21 +717,46 @@ export class CircularHeatmapComponent implements OnInit, OnDestroy {
717717
downloadYamlFile(yamlStr, this.dataStore?.meta?.teamProgressFile || 'team-progress.yaml');
718718
}
719719

720+
exportTeamEvidences() {
721+
console.log(`${perfNow()}: Exporting team evidence`);
722+
723+
let yamlStr: string | null = this.dataStore?.evidenceStore?.asYamlString() || null;
724+
if (!yamlStr) {
725+
this.displayMessage(new DialogInfo('No team evidence data available', 'Export Error'));
726+
return;
727+
}
728+
729+
downloadYamlFile(yamlStr, this.dataStore?.meta?.teamEvidenceFile || 'team-evidence.yaml');
730+
}
731+
720732
async deleteLocalTeamsProgress() {
721-
let buttonClicked: string = await this.displayDeleteLocalProgressDialog();
733+
let buttonClicked: string = await this.displayDeleteLocalFilesDialog('progress');
722734

723735
if (buttonClicked === 'Delete') {
724736
this.dataStore?.progressStore?.deleteBrowserStoredTeamProgress();
725737
location.reload(); // Make sure all load routines are initialized
726738
}
727739
}
728740

729-
displayDeleteLocalProgressDialog(): Promise<string> {
741+
async deleteLocalTeamsEvidence() {
742+
let buttonClicked: string = await this.displayDeleteLocalFilesDialog('evidence');
743+
744+
if (buttonClicked === 'Delete') {
745+
this.dataStore?.evidenceStore?.deleteBrowserStoredEvidence();
746+
location.reload(); // Make sure all load routines are initialized
747+
}
748+
}
749+
750+
displayDeleteLocalFilesDialog(type: 'progress' | 'evidence'): Promise<string> {
730751
return new Promise((resolve, reject) => {
731752
let title: string = 'Delete local browser data';
732753
let message: string =
733-
'Do you want to delete all progress for each team?' +
734-
'\n\nThis deletes all progress stored in your local browser, but does ' +
754+
'Do you want to delete all ' +
755+
type +
756+
' for each team?' +
757+
'\n\nThis deletes all ' +
758+
type +
759+
' stored in your local browser, but does ' +
735760
'not change any progress stored in the yaml file on the server.';
736761
let buttons: string[] = ['Cancel', 'Delete'];
737762
this.modal

0 commit comments

Comments
 (0)