mirror of
https://github.com/fosrl/pangolin.git
synced 2026-10-29 15:09:07 +01:00
Add olm agentVersion to separate the library from the agent
This commit is contained in:
@@ -89,6 +89,7 @@ export default async function ClientsPage(props: ClientsPageProps) {
|
||||
orgId: params.orgId,
|
||||
online: client.online,
|
||||
olmVersion: client.olmVersion || undefined,
|
||||
agentVersion: client.agentVersion || undefined,
|
||||
olmUpdateAvailable: client.olmUpdateAvailable || false,
|
||||
userId: client.userId,
|
||||
username: client.username,
|
||||
|
||||
@@ -92,6 +92,7 @@ export default async function ClientsPage(props: ClientsPageProps) {
|
||||
orgId: params.orgId,
|
||||
online: client.online,
|
||||
olmVersion: client.olmVersion || undefined,
|
||||
agentVersion: client.agentVersion || undefined,
|
||||
olmUpdateAvailable: Boolean(client.olmUpdateAvailable),
|
||||
userId: client.userId,
|
||||
username: client.username,
|
||||
|
||||
@@ -44,26 +44,29 @@ export default function SiteInfoCard({}: ClientInfoCardProps) {
|
||||
const data = useQuery(productUpdatesQueries.latestVersion(true));
|
||||
const latestPlatformVersions = data.data?.data;
|
||||
|
||||
// agentVersion was added after olmVersion, and older olm clients report
|
||||
// the app version in olmVersion, so fall back to it for clients that have
|
||||
// not re-registered yet.
|
||||
const agentVersion = client.agentVersion ?? client.olmVersion;
|
||||
|
||||
let updateAvailable = false;
|
||||
if (client.agent && client.olmVersion && latestPlatformVersions) {
|
||||
if (client.agent && agentVersion && latestPlatformVersions) {
|
||||
const agent = agentVersionMap[
|
||||
client.agent
|
||||
] as keyof LatestVersionResponse;
|
||||
|
||||
if (agent in latestPlatformVersions) {
|
||||
const agentVersion = latestPlatformVersions[agent];
|
||||
const latestAgentVersion = latestPlatformVersions[agent];
|
||||
|
||||
updateAvailable = Boolean(
|
||||
semver.valid(client.olmVersion) &&
|
||||
semver.lt(client.olmVersion, agentVersion.latestVersion)
|
||||
semver.valid(agentVersion) &&
|
||||
semver.lt(agentVersion, latestAgentVersion.latestVersion)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const cols =
|
||||
2 +
|
||||
(userDisplayName ? 1 : 0) +
|
||||
(client.agent && client.olmVersion ? 1 : 0);
|
||||
2 + (userDisplayName ? 1 : 0) + (client.agent && agentVersion ? 1 : 0);
|
||||
|
||||
return (
|
||||
<Alert>
|
||||
@@ -73,15 +76,13 @@ export default function SiteInfoCard({}: ClientInfoCardProps) {
|
||||
<InfoSectionTitle>{t("name")}</InfoSectionTitle>
|
||||
<InfoSectionContent>{client.name}</InfoSectionContent>
|
||||
</InfoSection>
|
||||
{client.agent && client.olmVersion ? (
|
||||
{client.agent && agentVersion ? (
|
||||
<InfoSection>
|
||||
<InfoSectionTitle>{t("agent")}</InfoSectionTitle>
|
||||
<InfoSectionContent>
|
||||
<div className="flex items-center gap-2">
|
||||
<span>
|
||||
{client.agent +
|
||||
" v" +
|
||||
client.olmVersion}
|
||||
{client.agent + " v" + agentVersion}
|
||||
</span>
|
||||
{updateAvailable && (
|
||||
<InfoPopup
|
||||
|
||||
@@ -56,6 +56,7 @@ export type ClientRow = {
|
||||
orgId: string;
|
||||
online: boolean;
|
||||
olmVersion?: string;
|
||||
agentVersion?: string;
|
||||
olmUpdateAvailable: boolean;
|
||||
userId: string | null;
|
||||
username: string | null;
|
||||
@@ -397,10 +398,16 @@ export default function MachineClientsTable({
|
||||
"Olm CLI": "olm"
|
||||
};
|
||||
|
||||
// agentVersion was added after olmVersion, and older olm
|
||||
// clients report the app version in olmVersion, so fall
|
||||
// back to it for rows that have not re-registered yet.
|
||||
const displayedVersion =
|
||||
originalRow.agentVersion ?? originalRow.olmVersion;
|
||||
|
||||
let updateAvailable = false;
|
||||
|
||||
if (
|
||||
originalRow.olmVersion &&
|
||||
displayedVersion &&
|
||||
originalRow.agent &&
|
||||
latestPlatformVersions
|
||||
) {
|
||||
@@ -409,13 +416,14 @@ export default function MachineClientsTable({
|
||||
] as keyof LatestVersionResponse;
|
||||
|
||||
if (agent in latestPlatformVersions) {
|
||||
const agentVersion = latestPlatformVersions[agent];
|
||||
const latestAgentVersion =
|
||||
latestPlatformVersions[agent];
|
||||
|
||||
updateAvailable = Boolean(
|
||||
semver.valid(originalRow.olmVersion) &&
|
||||
semver.valid(displayedVersion) &&
|
||||
semver.lt(
|
||||
originalRow.olmVersion,
|
||||
agentVersion.latestVersion
|
||||
displayedVersion,
|
||||
latestAgentVersion.latestVersion
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -423,11 +431,11 @@ export default function MachineClientsTable({
|
||||
|
||||
return (
|
||||
<div className="flex items-center space-x-1">
|
||||
{originalRow.agent && originalRow.olmVersion ? (
|
||||
{originalRow.agent && displayedVersion ? (
|
||||
<Badge variant="secondary">
|
||||
{originalRow.agent +
|
||||
" v" +
|
||||
originalRow.olmVersion}
|
||||
displayedVersion}
|
||||
</Badge>
|
||||
) : (
|
||||
"-"
|
||||
|
||||
@@ -55,6 +55,7 @@ export type ClientRow = {
|
||||
orgId: string;
|
||||
online: boolean;
|
||||
olmVersion?: string;
|
||||
agentVersion?: string;
|
||||
olmUpdateAvailable: boolean;
|
||||
userId: string | null;
|
||||
username: string | null;
|
||||
@@ -578,10 +579,16 @@ export default function UserDevicesTable({
|
||||
"Olm CLI": "olm"
|
||||
};
|
||||
|
||||
// agentVersion was added after olmVersion, and older olm
|
||||
// clients report the app version in olmVersion, so fall
|
||||
// back to it for rows that have not re-registered yet.
|
||||
const displayedVersion =
|
||||
originalRow.agentVersion ?? originalRow.olmVersion;
|
||||
|
||||
let updateAvailable = false;
|
||||
|
||||
if (
|
||||
originalRow.olmVersion &&
|
||||
displayedVersion &&
|
||||
originalRow.agent &&
|
||||
latestPlatformVersions
|
||||
) {
|
||||
@@ -590,13 +597,14 @@ export default function UserDevicesTable({
|
||||
] as keyof LatestVersionResponse;
|
||||
|
||||
if (agent in latestPlatformVersions) {
|
||||
const agentVersion = latestPlatformVersions[agent];
|
||||
const latestAgentVersion =
|
||||
latestPlatformVersions[agent];
|
||||
|
||||
updateAvailable = Boolean(
|
||||
semver.valid(originalRow.olmVersion) &&
|
||||
semver.valid(displayedVersion) &&
|
||||
semver.lt(
|
||||
originalRow.olmVersion,
|
||||
agentVersion.latestVersion
|
||||
displayedVersion,
|
||||
latestAgentVersion.latestVersion
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -604,11 +612,11 @@ export default function UserDevicesTable({
|
||||
|
||||
return (
|
||||
<div className="flex items-center space-x-1">
|
||||
{originalRow.agent && originalRow.olmVersion ? (
|
||||
{originalRow.agent && displayedVersion ? (
|
||||
<Badge variant="secondary">
|
||||
{originalRow.agent +
|
||||
" v" +
|
||||
originalRow.olmVersion}
|
||||
displayedVersion}
|
||||
</Badge>
|
||||
) : (
|
||||
"-"
|
||||
|
||||
Reference in New Issue
Block a user