Skip to content

Commit

Permalink
ImagesTable/Instance: open cockpit's file browser for local imgs
Browse files Browse the repository at this point in the history
Uses `cockpit.jump` to prevent the page actually loading, which makes it
very easy to navigate back to image builder.
  • Loading branch information
croissanne committed Jan 30, 2025
1 parent 40d1d4c commit 375c4e3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Components/ImagesTable/Instance.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Suspense, useState } from 'react';
import path from 'path';

import {
Alert,
Expand Down Expand Up @@ -429,5 +430,18 @@ export const LocalInstance = ({ compose }: LocalInstancePropTypes) => {
return <></>;
}

return <div>Filepath to disk: {options.filename}</div>;
const href = "/files#/?path=" + encodeURIComponent(path.parse(options?.filename).dir);
return (<Button
component="a"
target="_blank"
variant="link"
onClick={ev => {
ev.preventDefault();
cockpit.jump(href, cockpit.transport.host)
}}
href={href}
isInline
>
Open in File browser
</Button>);
};

0 comments on commit 375c4e3

Please sign in to comment.