Kubernetes Access Screen Master Ticket #5086
Labels
c-ab
Internal Customer Reference
good-starter-issue
Good starter issue to start contributing to Teleport
kubernetes-access
ui
ux
Milestone
Goal
webapps
andwebapps.e
and know how to update enterprise submodules e-refHow to get started
view doc
btn and for each table row, add connect btn and popup dialogue: [Kb Access 5] Add Buttons and Popup Dialogue webapps#286Design Images
Most images I posted on issues are just examples. The design should be the same, but the data displayed will be different. Normally we get design mocks from our designer, but it wasn't required b/c it will look the same as other other similar views like our Servers (aka Nodes) and Apps.
Open-source vs Enterprise
We have two webapps repo: Open-source (webapps) and Enterprise (webapps.e). Enterprise is included as a submodule in our OS repo (as show in image below). The
![image](https://user-images.githubusercontent.com/43280172/115443481-2d459c80-a1c8-11eb-9dd6-b1c78a008566.png)
webapps.e @ 5240310
says the enterprise webapps is currently pointing to commit5240310
(which is the latest commit in webapps.e master). Whenever we make commits to the Enterprise repo, we have to update the reference this submodule is pointing to.Directory Structure
This is how our directory is usually structured for most features (and what will look like for you). Note that capitalization's matter.
Uppercase
for components directory and components itself andlowercase
for everything else.References
Because the design's are the same, the code will be very similar to existing components, which can be used as reference to help you create your components. When you look up these directories/components, note the directory path, b/c some components can be from the
gravity
directory that have the same names.gravity
is obsolete and outdated and is just there to be used as extra examples.References for Table, Add Button, and Popup Dialogue
Nodes (aka Servers) is probably the closest in similarity in what you will create for table and dialogue:
Nodes
: https://github.com/gravitational/webapps/tree/master/packages/teleport/src/NodesNodesList
: https://github.com/gravitational/webapps/tree/master/packages/teleport/src/components/NodeList (Thecomponents
directory contains components that can be shared between different components,NodeList
is used withinDocumentNodes
andNode
components, otherwise child components will be contained within their parent directory).Apps is mostly as a second example to help you with creating the dialogue and button component:
Apps
: https://github.com/gravitational/webapps/tree/master/packages/teleport/src/AppsReferences for defining api endpoints and app routes
Routings and endpoints are defined in our
config.ts
file: https://github.com/gravitational/webapps/blob/master/packages/teleport/src/config.tsSince kube listing is cluster specific, routing/ api endpoint will be very similar to how we define
nodes
andapps
. The naming convention should also be similar:App route: https://github.com/gravitational/webapps/blob/master/packages/teleport/src/config.ts#L42
App route getter: https://github.com/gravitational/webapps/blob/master/packages/teleport/src/config.ts#L171
App api endpoint: https://github.com/gravitational/webapps/blob/master/packages/teleport/src/config.ts#L79
App api endpoint getter: https://github.com/gravitational/webapps/blob/master/packages/teleport/src/config.ts#L255
References for creating a service file
Files inside
services
directory mostly contain files that are named after features and contains its related api calls, sanitizing/processing of response values, and typing the response value object. Serviceworkflow
follows the most up to date conventions (ie: defining service as a class and testing): https://github.com/gravitational/webapps.e/tree/master/teleport/src/services/workflowThe service is then instantiated in
teleportContext.tsx
file like so: https://github.com/gravitational/webapps/blob/master/packages/teleport/src/teleportContext.tsx#L41Reference for registering a feature to sidenav
Any Open-source feature will also be in Enterprise and will be similar to how we register Nodes feature.
First need to set access perms:
https://github.com/gravitational/webapps/blob/master/packages/teleport/src/services/user/makeAcl.ts#L32
Features first needs to be defined in our OS
features.ts
file: https://github.com/gravitational/webapps/blob/master/packages/teleport/src/features.ts#L174Then we need to register this feature to both OS and Enterprise in
features.ts
:OSS: https://github.com/gravitational/webapps/blob/master/packages/teleport/src/features.ts#L381
Enterprise: https://github.com/gravitational/webapps.e/blob/master/teleport/src/features.ts#L96
References for updating Main.story.tsx
We have a story that renders a dashboard called
Main.story
(doesn't have all the features). We can use this component to test our component that uses custom hooks. Hooks contain dependencies that we can mock (contexts and api endpoints) insideMain.story
.Workflow
features has good examples:Mocking services: https://github.com/gravitational/webapps.e/blob/master/teleport/src/Workflow/fixtures/index.ts#L99
Instantiating the mocked service: https://github.com/gravitational/webapps.e/blob/master/teleport/src/Main/Main.story.tsx#L59
The text was updated successfully, but these errors were encountered: