client/web: copy existing UI to basic react components
This copies the existing go template frontend into very crude react components that will be driven by a simple JSON api for fetching and updating data. For now, this returns a static set of test data. This just implements the simple existing UI, so I've put these all in a "legacy" component, with the expectation that we will rebuild this with more properly defined components, some pulled from corp. Updates tailscale/corp#13775 Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
48
client/web/src/hooks/node-data.ts
Normal file
48
client/web/src/hooks/node-data.ts
Normal file
@ -0,0 +1,48 @@
|
||||
export type UserProfile = {
|
||||
LoginName: string
|
||||
DisplayName: string
|
||||
ProfilePicURL: string
|
||||
}
|
||||
|
||||
export type NodeData = {
|
||||
Profile: UserProfile
|
||||
Status: string
|
||||
DeviceName: string
|
||||
IP: string
|
||||
AdvertiseExitNode: boolean
|
||||
AdvertiseRoutes: string
|
||||
LicensesURL: string
|
||||
TUNMode: boolean
|
||||
IsSynology: boolean
|
||||
DSMVersion: number
|
||||
IsUnraid: boolean
|
||||
UnraidToken: string
|
||||
IPNVersion: string
|
||||
}
|
||||
|
||||
// testData is static set of nodedata used during development.
|
||||
// This can be removed once we have a real node data API.
|
||||
const testData: NodeData = {
|
||||
Profile: {
|
||||
LoginName: "amelie",
|
||||
DisplayName: "Amelie Pangolin",
|
||||
ProfilePicURL: "https://login.tailscale.com/logo192.png",
|
||||
},
|
||||
Status: "Running",
|
||||
DeviceName: "amelies-laptop",
|
||||
IP: "100.1.2.3",
|
||||
AdvertiseExitNode: false,
|
||||
AdvertiseRoutes: "",
|
||||
LicensesURL: "https://tailscale.com/licenses/tailscale",
|
||||
TUNMode: false,
|
||||
IsSynology: true,
|
||||
DSMVersion: 7,
|
||||
IsUnraid: false,
|
||||
UnraidToken: "",
|
||||
IPNVersion: "0.1.0",
|
||||
}
|
||||
|
||||
// useNodeData returns basic data about the current node.
|
||||
export default function useNodeData() {
|
||||
return testData
|
||||
}
|
Reference in New Issue
Block a user