Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rsj 80 #19

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</td>
<td>{{ getMachineTypeName(job.idMachineType) }}</td>
<td class="actions-cell">
<button class="action-button" title="Export">
<button class="action-button" title="Export" (click)="exportJob(job)">
<i class="fas fa-file-export"></i>
</button>
<button class="action-button edit" title="Edit" (click)="openEditDialog(job)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,20 @@ export class ViewExportDeleteJobsComponent implements OnInit {
return 'status-unknown';
}
}

exportJob(job: JobDTO): void {
const enrichedJob = {
...job,
machineTypeName: this.getMachineTypeName(job.idMachineType)
};
const jsonContent = JSON.stringify(enrichedJob, null, 2);
const blob = new Blob([jsonContent], { type: 'application/json' });
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `job_${job.id}_export.json`;
link.click();
window.URL.revokeObjectURL(url);
this.showMessage(`Job ${job.id} exported successfully`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<td>{{ type.name }}</td>
<td>{{ type.description }}</td>
<td class="actions-cell">
<button class="action-button" title="Export">
<button class="action-button" title="Export" (click)="exportMachineType(type)">
<i class="fas fa-file-export"></i>
</button>
<button class="action-button edit" title="Edit" (click)="openEditDialog(type)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,16 @@ export class ViewExportDeleteMachineTypesComponent implements OnInit {
}
});
}

exportMachineType(machineType: MachineType): void {
const jsonContent = JSON.stringify(machineType, null, 2);
const blob = new Blob([jsonContent], { type: 'application/json' });
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `machine_type_${machineType.id}_export.json`;
link.click();
window.URL.revokeObjectURL(url);
this.showMessage(`Machine Type ${machineType.id} exported successfully`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</td>
<td>{{ getMachineTypeName(machine.typeId) }}</td>
<td class="actions-cell">
<button class="action-button" title="Export">
<button class="action-button" title="Export" (click)="exportMachine(machine)">
<i class="fas fa-file-export"></i>
</button>
<button class="action-button edit" title="Edit" (click)="openEditDialog(machine)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,20 @@ export class ViewExportDeleteMachinesComponent implements OnInit {
verticalPosition: 'top'
});
}

exportMachine(machine: Machine): void {
const enrichedMachine = {
...machine,
machineTypeName: this.getMachineTypeName(machine.typeId)
};
const jsonContent = JSON.stringify(enrichedMachine, null, 2);
const blob = new Blob([jsonContent], { type: 'application/json' });
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `machine_${machine.id}_export.json`;
link.click();
window.URL.revokeObjectURL(url);
this.showMessage(`Machine ${machine.id} exported successfully`);
}
}
Loading