Skip to content

Commit

Permalink
on netapp onboarding hide the docker image url. When purchasing a net…
Browse files Browse the repository at this point in the history
… app, the Marketplace should download the docker image internally and then send it to the user
  • Loading branch information
AlexJoom committed Mar 2, 2023
1 parent 64877a8 commit 103f43b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 41 deletions.
56 changes: 18 additions & 38 deletions app/Http/Controllers/PurchasedNetAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,6 @@ public function __construct(
$this->purchasedNetAppManager = $purchasedNetAppManager;
$this->purchasedNetAppRepository = $purchasedNetAppRepository;
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
}

/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
Expand Down Expand Up @@ -77,26 +58,25 @@ public function myPurchasedNetApps() {
return view('purchased-netapps', compact('purchasedNetApps'));
}

/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request, $id)
public function download(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse
{
//
}
$url = $request->query->get("url");
$headers = [
'Content-Type' => 'application/vnd.docker.distribution.manifest.v2+json',
'Content-Disposition' => 'attachment; filename="docker-image"',
];
return response()->streamDownload(function() use ($url) {

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
$file = fopen($url, 'rb');

while(!feof($file)) {
echo fread($file, 1024*8);
flush();
}

fclose($file);
}, "docker-image", $headers);
}


}
7 changes: 4 additions & 3 deletions resources/views/purchased-netapps.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<th scope="col">Digital signature</th>
<th scope="col">NetApp</th>
<th scope="col">GitHub URL</th>
<th scope="col">Docker image URL</th>
<th scope="col">Download Docker image </th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -56,8 +56,9 @@
</a>
@endif
</td>
<td><a href="{{ $purchasedNetApp->netapp->docker_image_url }}" target="_blank">
URL
<td>
<a href="/netapps/purchased/download/?url={{ $purchasedNetApp->netapp->docker_image_url }}" >
Download
</a>
</td>
</tr>
Expand Down
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
Route::get('/saved-netapp', [SaveNetappController::class, 'index'])->name('saved-netapp');
Route::get('/revenue-page/{id}', [PurchasedNetAppController::class, 'showRevenue'])->name('revenue-page');
Route::get('/netapps/purchased', [PurchasedNetAppController::class, 'myPurchasedNetApps'])->name('my-purchased-netapps');
Route::get('/netapps/purchased/download', [PurchasedNetAppController::class, 'download'])->name('my-purchased-netapps-download');
Route::view('/support', 'support')->name('support');
Route::get('/create-netapp', [NetappController::class, 'index'])->name('create-netapp');
Route::get('/edit-netapp/{id}', [NetappController::class, 'edit'])->name('edit-netapp');
Expand Down

0 comments on commit 103f43b

Please sign in to comment.