2022-08-12 01:27:30 +00:00
|
|
|
import { useState } from 'react';
|
2024-01-25 05:41:33 +00:00
|
|
|
import {
|
|
|
|
Database,
|
|
|
|
GitCommit,
|
|
|
|
Hash,
|
2024-12-02 19:45:44 +00:00
|
|
|
Link as LinkIcon,
|
2024-01-25 05:41:33 +00:00
|
|
|
Server,
|
|
|
|
Tag,
|
|
|
|
Variable,
|
|
|
|
Wrench,
|
|
|
|
} from 'lucide-react';
|
|
|
|
import clsx from 'clsx';
|
2022-08-12 01:27:30 +00:00
|
|
|
|
2022-12-11 06:58:22 +00:00
|
|
|
import { useSystemStatus } from '@/react/portainer/system/useSystemStatus';
|
|
|
|
import { useSystemVersion } from '@/react/portainer/system/useSystemVersion';
|
2024-02-14 22:50:20 +00:00
|
|
|
import { useIsEdgeAdmin } from '@/react/hooks/useUser';
|
2022-08-12 01:27:30 +00:00
|
|
|
|
2023-02-14 08:19:41 +00:00
|
|
|
import { Modal } from '@@/modals';
|
2022-08-12 01:27:30 +00:00
|
|
|
import { Button } from '@@/buttons';
|
|
|
|
|
|
|
|
import styles from './Footer.module.css';
|
|
|
|
|
|
|
|
export function BuildInfoModalButton() {
|
|
|
|
const [isBuildInfoVisible, setIsBuildInfoVisible] = useState(false);
|
2022-12-11 06:58:22 +00:00
|
|
|
const statusQuery = useSystemStatus();
|
2024-12-06 05:41:32 +00:00
|
|
|
const versionQuery = useSystemVersion();
|
2022-08-12 01:27:30 +00:00
|
|
|
|
2024-12-06 05:41:32 +00:00
|
|
|
if (!statusQuery.data || !versionQuery.data) {
|
2022-08-12 01:27:30 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { Version } = statusQuery.data;
|
2024-12-06 05:41:32 +00:00
|
|
|
const { VersionSupport } = versionQuery.data;
|
2022-08-12 01:27:30 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
data-cy="portainerSidebar-versionNumber"
|
2024-12-06 05:41:32 +00:00
|
|
|
className="btn-none hover:underline"
|
2022-08-12 01:27:30 +00:00
|
|
|
onClick={() => setIsBuildInfoVisible(true)}
|
2024-12-06 05:41:32 +00:00
|
|
|
title="About Portainer"
|
2022-08-12 01:27:30 +00:00
|
|
|
>
|
2024-12-06 09:52:47 +00:00
|
|
|
{`${Version} ${VersionSupport}`}
|
2022-08-12 01:27:30 +00:00
|
|
|
</button>
|
|
|
|
{isBuildInfoVisible && (
|
|
|
|
<BuildInfoModal closeModal={() => setIsBuildInfoVisible(false)} />
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function BuildInfoModal({ closeModal }: { closeModal: () => void }) {
|
2024-02-14 22:50:20 +00:00
|
|
|
const { isAdmin } = useIsEdgeAdmin({ noEnvScope: true });
|
2022-12-11 06:58:22 +00:00
|
|
|
const versionQuery = useSystemVersion();
|
|
|
|
const statusQuery = useSystemStatus();
|
2022-08-12 01:27:30 +00:00
|
|
|
|
|
|
|
if (!statusQuery.data || !versionQuery.data) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { Edition } = statusQuery.data;
|
2024-12-06 05:41:32 +00:00
|
|
|
const {
|
|
|
|
ServerVersion,
|
|
|
|
DatabaseVersion,
|
|
|
|
Build,
|
|
|
|
Dependencies,
|
|
|
|
Runtime,
|
|
|
|
VersionSupport,
|
|
|
|
} = versionQuery.data;
|
2022-08-12 01:27:30 +00:00
|
|
|
|
|
|
|
return (
|
2023-02-14 08:19:41 +00:00
|
|
|
<Modal onDismiss={closeModal} aria-label="build-info-modal">
|
|
|
|
<Modal.Header title={`Portainer ${Edition}`} />
|
|
|
|
<Modal.Body>
|
|
|
|
<div className={styles.versionInfo}>
|
|
|
|
<table>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>
|
2024-12-06 05:41:32 +00:00
|
|
|
<span className="inline-flex items-center flex-wrap">
|
2023-02-14 08:19:41 +00:00
|
|
|
<Server size="13" className="space-right" />
|
2024-12-06 09:52:47 +00:00
|
|
|
Server Version: {ServerVersion} {VersionSupport}
|
2023-02-14 08:19:41 +00:00
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
<td>
|
2024-12-06 05:41:32 +00:00
|
|
|
<span className="inline-flex items-center flex-wrap">
|
2023-02-14 08:19:41 +00:00
|
|
|
<Database size="13" className="space-right" />
|
|
|
|
Database Version: {DatabaseVersion}
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
2024-12-06 05:41:32 +00:00
|
|
|
<span className="inline-flex items-center flex-wrap">
|
2023-02-14 08:19:41 +00:00
|
|
|
<Hash size="13" className="space-right" />
|
|
|
|
CI Build Number: {Build.BuildNumber}
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
<td>
|
2024-12-06 05:41:32 +00:00
|
|
|
<span className="inline-flex items-center flex-wrap">
|
2023-02-14 08:19:41 +00:00
|
|
|
<Tag size="13" className="space-right" />
|
|
|
|
Image Tag: {Build.ImageTag}
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2024-01-25 05:41:33 +00:00
|
|
|
<tr>
|
|
|
|
<td>
|
2024-12-06 05:41:32 +00:00
|
|
|
<span className="inline-flex items-center flex-wrap">
|
|
|
|
<GitCommit size="13" className="space-right" />
|
|
|
|
Git Commit: {Build.GitCommit}
|
|
|
|
</span>
|
2024-01-25 05:41:33 +00:00
|
|
|
</td>
|
|
|
|
<td />
|
|
|
|
</tr>
|
2023-02-14 08:19:41 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div className={styles.toolsList}>
|
|
|
|
<span className="inline-flex items-center">
|
|
|
|
<Wrench size="13" className="space-right" />
|
|
|
|
Compilation tools:
|
|
|
|
</span>
|
2022-08-12 01:27:30 +00:00
|
|
|
|
2023-02-14 08:19:41 +00:00
|
|
|
<div className={styles.tools}>
|
|
|
|
<span className="text-muted small">
|
2024-12-02 19:45:44 +00:00
|
|
|
Nodejs {Build.NodejsVersion}
|
2023-02-14 08:19:41 +00:00
|
|
|
</span>
|
|
|
|
<span className="text-muted small">Yarn v{Build.YarnVersion}</span>
|
|
|
|
<span className="text-muted small">
|
|
|
|
Webpack v{Build.WebpackVersion}
|
|
|
|
</span>
|
2024-12-02 19:45:44 +00:00
|
|
|
<span className="text-muted small">Go {Build.GoVersion}</span>
|
2022-08-12 01:27:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-01-25 05:41:33 +00:00
|
|
|
|
2024-12-02 19:45:44 +00:00
|
|
|
<div className={clsx(styles.toolsList, 'mt-3')}>
|
|
|
|
<span className="inline-flex items-center">
|
|
|
|
<LinkIcon size="13" className="space-right" />
|
|
|
|
Dependencies:
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<div className={styles.tools}>
|
|
|
|
<span className="text-muted small">
|
|
|
|
Docker {Dependencies.DockerVersion}
|
|
|
|
</span>
|
|
|
|
<span className="text-muted small">
|
|
|
|
Helm {Dependencies.HelmVersion}
|
|
|
|
</span>
|
|
|
|
<span className="text-muted small">
|
|
|
|
Kubectl {Dependencies.KubectlVersion}
|
|
|
|
</span>
|
|
|
|
<span className="text-muted small">
|
|
|
|
Compose {Dependencies.ComposeVersion}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{isAdmin && Runtime.Env && (
|
2024-01-25 05:41:33 +00:00
|
|
|
<div className={clsx(styles.toolsList, 'mt-3')}>
|
|
|
|
<span className="inline-flex items-center ">
|
|
|
|
<Variable size="13" className="space-right" />
|
|
|
|
Environment Variables
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<div
|
2024-04-11 00:11:38 +00:00
|
|
|
className={clsx(styles.tools, 'max-h-32 space-y-2 overflow-auto')}
|
2024-01-25 05:41:33 +00:00
|
|
|
>
|
2024-12-02 19:45:44 +00:00
|
|
|
{Runtime.Env.map((envVar) => (
|
2024-01-25 05:41:33 +00:00
|
|
|
<div key={envVar}>
|
|
|
|
<code>{envVar}</code>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
2023-02-14 08:19:41 +00:00
|
|
|
</Modal.Body>
|
|
|
|
<Modal.Footer>
|
2024-04-11 00:11:38 +00:00
|
|
|
<Button
|
|
|
|
className="w-full"
|
|
|
|
onClick={closeModal}
|
|
|
|
data-cy="portainerBuildInfoModal-CloseButton"
|
|
|
|
>
|
2023-02-14 08:19:41 +00:00
|
|
|
Ok
|
|
|
|
</Button>
|
|
|
|
</Modal.Footer>
|
|
|
|
</Modal>
|
2022-08-12 01:27:30 +00:00
|
|
|
);
|
|
|
|
}
|