diff --git a/web/packages/teleport/src/Integrations/IntegrationList.tsx b/web/packages/teleport/src/Integrations/IntegrationList.tsx index a7a41ccbbafa..369909cab9b7 100644 --- a/web/packages/teleport/src/Integrations/IntegrationList.tsx +++ b/web/packages/teleport/src/Integrations/IntegrationList.tsx @@ -18,6 +18,7 @@ import React from 'react'; import styled from 'styled-components'; +import { useHistory } from 'react-router'; import { Link as InternalRouteLink } from 'react-router-dom'; import { Box, Flex, Image } from 'design'; @@ -65,11 +66,27 @@ type Props = { type IntegrationLike = Integration | Plugin | ExternalAuditStorageIntegration; export function IntegrationList(props: Props) { + const history = useHistory(); + + function handleRowClick(row: IntegrationLike) { + if (row.kind !== 'okta') return; + history.push(cfg.getIntegrationStatusRoute(row.kind, row.name)); + } + + function getRowStyle(row: IntegrationLike): React.CSSProperties { + if (row.kind !== 'okta') return; + return { cursor: 'pointer' }; + } + return ( ) { return ( + {/* Currently, only okta supports status pages */} + {item.kind === 'okta' && ( + + View Status + + )} props.onDeletePlugin(item)}> Delete... diff --git a/web/packages/teleport/src/services/integrations/oktaStatusTypes.ts b/web/packages/teleport/src/services/integrations/oktaStatusTypes.ts index 1761c6e7d18e..eaec026f3b2a 100644 --- a/web/packages/teleport/src/services/integrations/oktaStatusTypes.ts +++ b/web/packages/teleport/src/services/integrations/oktaStatusTypes.ts @@ -36,13 +36,11 @@ export enum PluginOktaSyncStatusCode { Error = 2, } +/** + * Contains statistics about the various sub-services in the Okta + * integration + */ export type PluginStatusOkta = { - orgUrl: string; - accessListSyncEnabled: boolean; - details?: PluginOktaDetails; -}; - -export type PluginOktaDetails = { ssoDetails?: OktaSsoDetails; appGroupSyncDetails?: OktaAppGroupSyncDetails; usersSyncDetails?: OktaUserSyncDetails; @@ -92,7 +90,6 @@ export type OktaAccessListSyncDetails = { numGroups: number; appFilters: string[]; groupFilters: string[]; - defaultOwners: string[]; /** * Error contains a textual description of the reason the last synchronization * failed. Only valid when StatusCode is OKTA_PLUGIN_SYNC_STATUS_CODE_ERROR. diff --git a/web/packages/teleport/src/services/integrations/types.ts b/web/packages/teleport/src/services/integrations/types.ts index 80dd390f5ec9..d6c273cd4da3 100644 --- a/web/packages/teleport/src/services/integrations/types.ts +++ b/web/packages/teleport/src/services/integrations/types.ts @@ -33,18 +33,27 @@ import { Node } from '../nodes'; * while "plugin" resource is only supported in enterprise. Plugin * type exists in OS for easier typing when combining the resources * into one list. + * + * Generics: + * T is resource type "integration" or "plugin" + * K is the kind of integration (eg: aws-oidc) or plugin (eg: okta) + * SP is the provider-specific spec of integration or plugin + * SD is the provider-specific status containing status details + * - currently only defined for plugin resource */ export type Integration< T extends string = 'integration', K extends string = IntegrationKind, - S extends Record = IntegrationSpecAwsOidc, + SP extends Record = IntegrationSpecAwsOidc, + SD extends Record = null, > = { resourceType: T; kind: K; - spec?: S; + spec?: SP; name: string; details?: string; statusCode: IntegrationStatusCode; + status?: SD; }; // IntegrationKind string values should be in sync // with the backend value for defining the integration @@ -118,7 +127,32 @@ export type ExternalAuditStorageIntegration = Integration< ExternalAuditStorage >; -export type Plugin = Integration<'plugin', PluginKind, T>; +export type Plugin = Integration< + 'plugin', + PluginKind, + SP, + PluginStatus +>; + +export type PluginStatus = { + /** + * the status code of the plugin + */ + code: IntegrationStatusCode; + /** + * the time the plugin was last run + */ + lastRun: Date; + /** + * the last error message from the plugin + */ + errorMessage: string; + /** + * contains provider-specific status information + */ + details?: D; +}; + export type PluginSpec = | PluginOktaSpec | PluginSlackSpec @@ -143,13 +177,6 @@ export type PluginKind = | 'jamf' | 'entra-id'; -export type PluginStatus = { - name: string; - type: PluginKind; - statusCode: IntegrationStatusCode; - stats?: S; -}; - export type PluginOktaSpec = { // scimBearerToken is the plain text of the bearer token that Okta will use // to authenticate SCIM requests @@ -167,6 +194,15 @@ export type PluginOktaSpec = { // that were deemed not serious enough to fail the plugin installation, but // may effect the operation of advanced features like User Sync or SCIM. error: string; + /** + * is the set of usernames that the integration assigns as + * owners to any Access Lists that it creates + */ + defaultOwners: string[]; + /** + * the Okta org's base URL + */ + orgUrl: string; }; export type PluginSlackSpec = {