Archived
1
0

Simplify frontend

Just a login form and a list of applications. No modals or anything like
that.
This commit is contained in:
Asher
2020-02-13 16:38:05 -06:00
parent bf1be16d11
commit b8fa7da972
49 changed files with 984 additions and 1846 deletions

View File

@ -1,13 +1,15 @@
export interface Application {
readonly categories?: string[]
readonly comment?: string
readonly directory?: string
readonly embedPath?: string
readonly exec?: string
readonly genericName?: string
readonly icon?: string
readonly loaded?: boolean
readonly installed?: boolean
readonly name: string
readonly path: string
readonly path?: string
readonly sessionId?: string
readonly version?: string
}
export interface ApplicationsResponse {
@ -22,52 +24,17 @@ export enum SessionError {
Unknown,
}
export interface LoginRequest {
basePath: string
password: string
}
export interface LoginResponse {
export interface SessionResponse {
/**
* An application to load immediately after logging in.
* Whether the session was created or an existing one was returned.
*/
app?: Application
success: boolean
}
export interface CreateSessionResponse {
created: boolean
sessionId: string
}
export interface ExecutableApplication extends Application {
exec: string
}
export const isExecutableApplication = (app: Application): app is ExecutableApplication => {
return !!(app as ExecutableApplication).exec
}
export interface RunningApplication extends ExecutableApplication {
sessionId: string
}
export const isRunningApplication = (app: Application): app is RunningApplication => {
return !!(app as RunningApplication).sessionId
}
export interface RecentResponse {
readonly recent: ReadonlyArray<Application>
readonly running: ReadonlyArray<RunningApplication>
}
export interface FileEntry {
readonly type: "file" | "directory"
readonly name: string
readonly size: number
}
export interface FilesResponse {
files: FileEntry[]
readonly running: ReadonlyArray<Application>
}
export interface HealthRequest {

View File

@ -17,8 +17,8 @@ export class HttpError extends Error {
export enum ApiEndpoint {
applications = "/applications",
files = "/files",
login = "/login",
recent = "/recent",
run = "/run",
session = "/session",
status = "/status",
}

View File

@ -1,11 +1,9 @@
import { logger } from "@coder/logger"
import { Application } from "../common/api"
export interface Options {
app?: Application
authed: boolean
basePath: string
base: string
logLevel: number
sessionId: string
}
/**