// Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause import React from "react" import { ReactComponent as CheckCircleIcon } from "src/assets/icons/check-circle.svg" import { ReactComponent as XCircleIcon } from "src/assets/icons/x-circle.svg" import { ChangelogText } from "src/components/update-available" import { UpdateState, useInstallUpdate, VersionInfo, } from "src/hooks/self-update" import Spinner from "src/ui/spinner" import { Link } from "wouter" /** * UpdatingView is rendered when the user initiates a Tailscale update, and * the update is in-progress, failed, or completed. */ export function UpdatingView({ versionInfo, currentVersion, }: { versionInfo?: VersionInfo currentVersion: string }) { const { updateState, updateLog } = useInstallUpdate( currentVersion, versionInfo ) return ( <>
{updateState === UpdateState.InProgress ? ( <>

Update in progress

The update shouldn't take more than a couple of minutes. Once it's completed, you will be asked to log in again.

) : updateState === UpdateState.Complete ? ( <>

Update complete!

You updated Tailscale {versionInfo && versionInfo.LatestVersion ? ` to ${versionInfo.LatestVersion}` : null} .

Log in to access ) : updateState === UpdateState.UpToDate ? ( <>

Up to date!

You are already running Tailscale {currentVersion}, which is the newest version available.

Return ) : ( /* TODO(naman,sonia): Figure out the body copy and design for this view. */ <>

Update failed

Update {versionInfo && versionInfo.LatestVersion ? ` to ${versionInfo.LatestVersion}` : null}{" "} failed.

Return )}
          {updateLog}
        
) }