4 Commits
1.7 ... 1.9.2

Author SHA1 Message Date
2f4cb1ee7a fix file download 2026-01-07 12:52:52 +01:00
162688ceb4 fix file download 2026-01-07 12:33:08 +01:00
95be4fc5a9 fix file download 2026-01-07 12:25:18 +01:00
dec195e619 export custom metrics 2025-12-17 11:17:46 +01:00
2 changed files with 33 additions and 8 deletions

View File

@@ -14,6 +14,12 @@ abstract class Action extends Entity
?string $url = null, ?string $url = null,
array $files = [], array $files = [],
) { ) {
foreach ($files as $i => $file) {
if (isset($file['content'])) {
$files[$i]['content'] = base64_encode($file['content']);
}
}
return [ return [
'json' => [ 'json' => [
'type' => 'action', 'type' => 'action',
@@ -23,12 +29,13 @@ abstract class Action extends Entity
} }
public function file( public function file(
string $contents, string $path,
string $name = '', string $name = '',
string $type = '' string $type = '',
bool $deleteAfterDownload = false,
) { ) {
return [ return [
'file' => compact('contents', 'name', 'type'), 'file' => compact('path', 'name', 'type', 'deleteAfterDownload'),
]; ];
} }
@@ -66,6 +73,24 @@ abstract class Action extends Entity
]; ];
} }
public function exportMetrics(
?string $entry = null,
?array $entries = null,
?string $filter = null,
?array $metrics = null
)
{
return [
'json' => [
'type' => 'export-metrics',
'entry' => $entry,
'entries' => $entries,
'filter' => $filter,
'metrics' => $metrics,
],
];
}
public function error(string $message) public function error(string $message)
{ {
return [ return [

View File

@@ -96,12 +96,12 @@ class PilotServiceProvider extends ServiceProvider
if (isset($output['file'])) { if (isset($output['file'])) {
return response()->download( return response()->download(
$output['file']['content'], $output['file']['path'],
$output['file']['name'], $output['file']['name'] ?? null,
[ ! empty($output['file']['type']) ? [
'Content-Type' => $output['file']['type'], 'Content-Type' => $output['file']['type'],
] ] : []
); )->deleteFileAfterSend(isset($output['file']['deleteAfterDownload']) ? $output['file']['deleteAfterDownload'] : false);
} }
return response(); return response();