Add version information
parent
f853605898
commit
d1239a3ec0
25
src/app.tsx
25
src/app.tsx
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { TailscaleBackendState, TailscalePeer, TailscaleStatus, TailscaleUp } from './types';
|
import { TailscaleBackendState, TailscalePeer, TailscaleStatus, TailscaleUp, TailscaleVersion } from './types';
|
||||||
import { Icon } from '@patternfly/react-core';
|
import { Icon } from '@patternfly/react-core';
|
||||||
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
||||||
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
|
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
|
||||||
|
@ -16,18 +16,28 @@ type ApplicationProps = {
|
||||||
|
|
||||||
type ApplicationState = {
|
type ApplicationState = {
|
||||||
Status: TailscaleStatus
|
Status: TailscaleStatus
|
||||||
|
Version: TailscaleVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class Application extends React.Component<ApplicationProps, ApplicationState> {
|
export class Application extends React.Component<ApplicationProps, ApplicationState> {
|
||||||
state: ApplicationState = {
|
state: ApplicationState = {
|
||||||
Status: null
|
Status: null,
|
||||||
|
Version: null
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props: ApplicationProps) {
|
constructor(props: ApplicationProps) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
cockpit.spawn(['tailscale', 'status', '--json']).done(content => {
|
cockpit
|
||||||
|
.spawn(['tailscale', 'version', '--json'])
|
||||||
|
.done(content => {
|
||||||
|
const version: TailscaleVersion = JSON.parse(content)
|
||||||
|
this.setState(state => ({ Version: version }));
|
||||||
|
});
|
||||||
|
|
||||||
|
cockpit
|
||||||
|
.spawn(['tailscale', 'status', '--json'])
|
||||||
|
.done(content => {
|
||||||
const status: TailscaleStatus = JSON.parse(content)
|
const status: TailscaleStatus = JSON.parse(content)
|
||||||
this.setState(state => ({ Status: status }));
|
this.setState(state => ({ Status: status }));
|
||||||
});
|
});
|
||||||
|
@ -43,7 +53,8 @@ export class Application extends React.Component<ApplicationProps, ApplicationSt
|
||||||
<>
|
<>
|
||||||
{
|
{
|
||||||
this.state.Status != null
|
this.state.Status != null
|
||||||
? <Table
|
? <div>
|
||||||
|
<Table
|
||||||
aria-label="Tailscale peers"
|
aria-label="Tailscale peers"
|
||||||
variant='compact' borders={false}>
|
variant='compact' borders={false}>
|
||||||
<Caption>Tailscale peers</Caption>
|
<Caption>Tailscale peers</Caption>
|
||||||
|
@ -73,6 +84,10 @@ export class Application extends React.Component<ApplicationProps, ApplicationSt
|
||||||
}
|
}
|
||||||
</Tbody>
|
</Tbody>
|
||||||
</Table>
|
</Table>
|
||||||
|
|
||||||
|
<div>Tailscale {this.state.Version.majorMinorPatch}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
: <p>Loading...</p>
|
: <p>Loading...</p>
|
||||||
}
|
}
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -9,6 +9,15 @@ export type TailscaleBackendState =
|
||||||
| 'Starting'
|
| 'Starting'
|
||||||
| 'Running';
|
| 'Running';
|
||||||
|
|
||||||
|
export type TailscaleVersion = {
|
||||||
|
majorMinorPatch: string;
|
||||||
|
short: string;
|
||||||
|
long: string;
|
||||||
|
gitCommit: string;
|
||||||
|
extraGitCommit: string;
|
||||||
|
cap: number;
|
||||||
|
}
|
||||||
|
|
||||||
export enum OS {
|
export enum OS {
|
||||||
Android = "android",
|
Android = "android",
|
||||||
IOS = "iOS",
|
IOS = "iOS",
|
||||||
|
|
Loading…
Reference in New Issue