From 2e873aefb7784063a4378e693f4ae36927be7a9e Mon Sep 17 00:00:00 2001 From: matheus Date: Fri, 22 Jul 2022 10:50:38 -0300 Subject: [PATCH 1/2] Add section to README about audit events --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index eb274b20f..e6e1aec75 100644 --- a/README.md +++ b/README.md @@ -182,3 +182,14 @@ the root of this repository. Keep in mind that there should only be a single `yarn.lock` in this repository, here at the top level. If you add packages via `yarn workspace add `, it will create a `packages//yarn.lock` file, which should not be checked in. + +### Adding an Audit Event + +When a new event is added to Teleport, the web UI has to be updated to display it correctly: + +1. Add a new entry to [`eventCodes`](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/services/audit/types.ts). +2. Add a new entry to [`RawEvents`](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/services/audit/types.ts) using the event you just created as the key. The fields should match the fields of the metadata fields on `events.proto` on Teleport repository. +3. Add a new entry in [Formatters](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/services/audit/makeEvent.ts) to format the event on the events table. The `format` function will receive the event you added to `RawEvents` as parameter. +4. Define an icon to the event on [`EventIconMap`](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/Audit/EventList/EventTypeCell.tsx). +5. Add an entry to the [`events`](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/Audit/fixtures/index.ts) array so it will show up on the [`AllEvents` story](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/Audit/Audit.story.ts) +6. Check fixture is rendered in storybook, then update snapshot for `Audit.story.test.tsx` From 9fddc765727e22648a6e9732d521da5b83191394 Mon Sep 17 00:00:00 2001 From: matheus Date: Fri, 22 Jul 2022 12:30:08 -0300 Subject: [PATCH 2/2] Point files to specific commit instead of master; add example PR --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e6e1aec75..e90efafe7 100644 --- a/README.md +++ b/README.md @@ -187,9 +187,11 @@ via `yarn workspace add `, it will create a `pack When a new event is added to Teleport, the web UI has to be updated to display it correctly: -1. Add a new entry to [`eventCodes`](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/services/audit/types.ts). -2. Add a new entry to [`RawEvents`](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/services/audit/types.ts) using the event you just created as the key. The fields should match the fields of the metadata fields on `events.proto` on Teleport repository. -3. Add a new entry in [Formatters](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/services/audit/makeEvent.ts) to format the event on the events table. The `format` function will receive the event you added to `RawEvents` as parameter. -4. Define an icon to the event on [`EventIconMap`](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/Audit/EventList/EventTypeCell.tsx). -5. Add an entry to the [`events`](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/Audit/fixtures/index.ts) array so it will show up on the [`AllEvents` story](https://github.com/gravitational/webapps/blob/master/packages/teleport/src/Audit/Audit.story.ts) +1. Add a new entry to [`eventCodes`](https://github.com/gravitational/webapps/blob/8a0201667f045be7a46606189a6deccdaee2fe1f/packages/teleport/src/services/audit/types.ts). +2. Add a new entry to [`RawEvents`](https://github.com/gravitational/webapps/blob/8a0201667f045be7a46606189a6deccdaee2fe1f/packages/teleport/src/services/audit/types.ts) using the event you just created as the key. The fields should match the fields of the metadata fields on `events.proto` on Teleport repository. +3. Add a new entry in [Formatters](https://github.com/gravitational/webapps/blob/8a0201667f045be7a46606189a6deccdaee2fe1f/packages/teleport/src/services/audit/makeEvent.ts) to format the event on the events table. The `format` function will receive the event you added to `RawEvents` as parameter. +4. Define an icon to the event on [`EventIconMap`](https://github.com/gravitational/webapps/blob/8a0201667f045be7a46606189a6deccdaee2fe1f/packages/teleport/src/Audit/EventList/EventTypeCell.tsx). +5. Add an entry to the [`events`](https://github.com/gravitational/webapps/blob/8a0201667f045be7a46606189a6deccdaee2fe1f/packages/teleport/src/Audit/fixtures/index.ts) array so it will show up on the [`AllEvents` story](https://github.com/gravitational/webapps/blob/8a0201667f045be7a46606189a6deccdaee2fe1f/packages/teleport/src/Audit/Audit.story.tsx) 6. Check fixture is rendered in storybook, then update snapshot for `Audit.story.test.tsx` + +You can see an example in [this pr](https://github.com/gravitational/webapps/pull/561).