import * as Icons from 'design/Icon' ; import Ctx from 'teleport/teleportContext' ; import cfg from 'teleport/config' ; import Audit from './Audit' ; import Nodes from './Nodes' ; import Sessions from './Sessions' ; import Account from './Account' ; import Applications from './Apps' ; import Kubes from './Kubes' ; import Support from './Support' ; import Clusters from './Clusters' ; import Trust from './TrustedClusters' ; import Users from './Users' ; import Roles from './Roles' ; import Recordings from './Recordings' ; import AuthConnectors from './AuthConnectors' ; import Databases from './Databases' ; import Desktops from './Desktops' ; export class FeatureClusters { getTopNavTitle ( ) { return 'Clusters' ; } route = { title : 'Clusters' , path : cfg . routes . clusters , exact : false , component : Clusters , } ; register ( ctx ) { ctx . storeNav . addSideItem ( { title : 'Manage Clusters' , group : 'clusters' , Icon : Icons . EqualizerVertical , exact : false , getLink ( ) { return cfg . routes . clusters ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureAuthConnectors { getTopNavTitle ( ) { return 'Team' ; } route = { title : 'Auth Connectors' , path : cfg . routes . sso , exact : false , component : AuthConnectors , } ; register ( ctx ) { if ( ! ctx . getFeatureFlags ( ) . authConnector ) { return ; } ctx . storeNav . addSideItem ( { group : 'team' , title : 'Auth Connectors' , Icon : Icons . Lock , exact : false , getLink ( ) { return cfg . routes . sso ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureHelpAndSupport { getTopNavTitle ( ) { return 'Help & Support' ; } route = { title : 'Help & Support' , path : cfg . routes . support , exact : true , component : Support , } ; register ( ctx ) { ctx . storeNav . addTopMenuItem ( { title : 'Help & Support' , Icon : Icons . Question , exact : true , getLink ( ) { return cfg . routes . support ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureAudit { getTopNavTitle ( ) { return 'Account Settings' ; } route = { title : 'Audit Log' , path : cfg . routes . audit , component : Audit , } ; register ( ctx ) { if ( ! ctx . getFeatureFlags ( ) . audit ) { return ; } ctx . storeNav . addSideItem ( { group : 'activity' , title : 'Audit Log' , Icon : Icons . ListThin , getLink ( clusterId ) { return cfg . getAuditRoute ( clusterId ) ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureAccount { getTopNavTitle ( ) { return 'Account Settings' ; } route = { title : 'Account Settings' , path : cfg . routes . account , component : Account , } ; register ( ctx ) { ctx . storeNav . addTopMenuItem ( { title : 'Account Settings' , Icon : Icons . User , getLink ( ) { return cfg . routes . account ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureNodes { getTopNavTitle ( ) { return '' ; } route = { title : 'Servers' , path : cfg . routes . nodes , exact : true , component : Nodes , } ; register ( ctx ) { ctx . storeNav . addSideItem ( { title : 'Servers' , Icon : Icons . Server , exact : true , getLink ( clusterId ) { return cfg . getNodesRoute ( clusterId ) ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureRecordings { getTopNavTitle ( ) { return '' ; } route = { title : 'Session Recordings' , path : cfg . routes . recordings , exact : true , component : Recordings , } ; register ( ctx ) { if ( ! ctx . getFeatureFlags ( ) . recordings ) { return ; } ctx . storeNav . addSideItem ( { group : 'activity' , title : 'Session Recordings' , Icon : Icons . CirclePlay , exact : true , getLink ( clusterId ) { return cfg . getRecordingsRoute ( clusterId ) ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureSessions { getTopNavTitle ( ) { return 'Sessions' ; } route = { title : 'Sessions' , path : cfg . routes . sessions , exact : true , component : Sessions , } ; register ( ctx ) { ctx . storeNav . addSideItem ( { group : 'activity' , title : 'Active Sessions' , Icon : Icons . Terminal , exact : true , getLink ( clusterId ) { return cfg . getSessionsRoute ( clusterId ) ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureRoles { getTopNavTitle ( ) { return 'Team' ; } route = { title : 'Roles' , path : cfg . routes . roles , exact : true , component : Roles , } ; register ( ctx ) { if ( ! ctx . getFeatureFlags ( ) . roles ) { return ; } ctx . storeNav . addSideItem ( { title : 'Roles' , group : 'team' , Icon : Icons . ClipboardUser , exact : true , getLink ( ) { return cfg . routes . roles ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureUsers { getTopNavTitle ( ) { return 'Team' ; } route = { title : 'Users' , path : cfg . routes . users , exact : true , component : Users , } ; register ( ctx ) { if ( ! ctx . getFeatureFlags ( ) . users ) { return ; } ctx . storeNav . addSideItem ( { title : 'Users' , group : 'team' , Icon : Icons . Users , exact : true , getLink ( ) { return cfg . routes . users ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureApps { getTopNavTitle ( ) { return 'Applications' ; } route = { title : 'Applications' , path : cfg . routes . apps , exact : true , component : Applications , } ; register ( ctx ) { if ( ! ctx . getFeatureFlags ( ) . applications ) { return ; } ctx . storeNav . addSideItem ( { title : 'Applications' , Icon : Icons . NewTab , exact : true , getLink ( clusterId ) { return cfg . getAppsRoute ( clusterId ) ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureKubes { getTopNavTitle ( ) { return '' ; } route = { title : 'Kubernetes' , path : cfg . routes . kubernetes , exact : true , component : Kubes , } ; register ( ctx ) { if ( ! ctx . getFeatureFlags ( ) . kubernetes ) { return ; } ctx . storeNav . addSideItem ( { title : 'Kubernetes' , Icon : Icons . Kubernetes , exact : true , getLink ( clusterId ) { return cfg . getKubernetesRoute ( clusterId ) ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureTrust { getTopNavTitle ( ) { return 'Clusters' ; } route = { title : 'Trust' , path : cfg . routes . trustedClusters , component : Trust , } ; register ( ctx ) { if ( ! ctx . getFeatureFlags ( ) . trustedClusters ) { return ; } ctx . storeNav . addSideItem ( { group : 'clusters' , title : 'Trust' , Icon : Icons . Cluster , getLink ( ) { return cfg . routes . trustedClusters ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureDatabases { getTopNavTitle ( ) { return '' ; } route = { title : 'Databases' , path : cfg . routes . databases , exact : true , component : Databases , } ; register ( ctx ) { if ( ! ctx . getFeatureFlags ( ) . databases ) { return ; } ctx . storeNav . addSideItem ( { title : 'Databases' , Icon : Icons . Database , exact : true , getLink ( clusterId ) { return cfg . getDatabasesRoute ( clusterId ) ; } , } ) ; ctx . features . push ( this ) ; } } export class FeatureDesktops { getTopNavTitle ( ) { return '' ; } route = { title : 'Desktops (preview)' , path : cfg . routes . desktops , exact : true , component : Desktops , } ; register ( ctx ) { if ( ! ctx . getFeatureFlags ( ) . desktops ) { return ; } ctx . storeNav . addSideItem ( { title : 'Desktops (preview)' , Icon : Icons . Desktop , exact : true , getLink ( clusterId ) { return cfg . getDesktopsRoute ( clusterId ) ; } , } ) ; ctx . features . push ( this ) ; } } export default function getFeatures ( ) { return [ new FeatureNodes ( ) , new FeatureApps ( ) , new FeatureKubes ( ) , new FeatureDatabases ( ) , new FeatureDesktops ( ) , new FeatureSessions ( ) , new FeatureRecordings ( ) , new FeatureAudit ( ) , new FeatureUsers ( ) , new FeatureRoles ( ) , new FeatureAuthConnectors ( ) , new FeatureAccount ( ) , new FeatureHelpAndSupport ( ) , new FeatureClusters ( ) , new FeatureTrust ( ) , ] ; }