Main Page Component - TJohn2017/Laputa GitHub Wiki
The main page, detailed in MainPageView.swift
is where the user can view all of their hosts and canvases, from which they can start new sessions. They can also add and edit hosts and canvases from this page.
When hosts and canvases are created or edited, they get saved to CoreData. Canvases saved to a new Canvas
entity, and hosts gets saved to a new Host
entity. Details on the attributes contained in these entities are below.
Host
entity
General Attributes
Attribute | Type | Functionality |
---|---|---|
host | String | host to connect to (eg 'myth.stanford.edu') |
name | String | a user-inputted name to identify this host with |
password | String | if authenticating by password, the user's SSH password |
port | String | port to connect to; default is 22 |
privateKey | String | if authenticating by pubKey, the private key |
privateKeyPassword | String | if authenticating by pubKey, the private key password |
publicKey | String | if authenticating by pubKey, the public key that is used |
username | String | the user's SSH username |
authenticationTypeRawValue | String | authentictation type; could be password or publicPrivateKey |
Canvas
entity
See the Canvas
section of the Canvas & Code Card Components page.
Sheets for adding, editing, and selecting hosts and canvases
Whenever the user wants to create or edit canvases or hosts, or add one to a session, the app will bring up a sheet for this. There are several sheets for various flows in the app, described below.
For starting up multiple hosts or canvases in one session:
AddCanvasView
AddHostView
For creating or editing hosts and canvases:
EntityInputView
(a general wrapper for the next two sheets)InputCanvasView
InputHostView
For selecting a host or canvas that will newly split the screen during a session:
SelectCanvasView
SelectHostView
SelectCanvasView
and SelectHostView
have an extra binding, navToSessionActive
which is used to automatically navigate to the session page when a host or canvas has been selected from the main page in particular.
These sheets can be categorized into different types under the ActiveSheet
enum:
enum ActiveSheet: Identifiable {
// inputSheet: sheet to be used when creating or editing host or canvas info.
case inputSheet
// selectCanvas: sheet to be used when selecting a single canvas from a list of
// canvases in tandem with a single selected host.
case selectCanvas
// selectHost: sheet to be used when selecting a single host from a list of hosts
// in tandem with a single selected canvas.
case selectHost
// addCanvas: sheet to be used when selecting a canvas to append to a list of
// of canvases.
case addCanvas
// addHost: sheet to be used when selecting a hos to append to a list of hosts.
case addHost
var id: Int {
hashValue
}
}