Skip to content

Commit

Permalink
update support page
Browse files Browse the repository at this point in the history
  • Loading branch information
rudream committed Oct 3, 2024
1 parent d41e1ec commit 6e8cbd6
Show file tree
Hide file tree
Showing 13 changed files with 1,141 additions and 916 deletions.
1,683 changes: 872 additions & 811 deletions api/client/proto/authservice.pb.go

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions api/proto/teleport/legacy/client/proto/authservice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,12 @@ message PingResponse {

reserved 6; // LicenseWarnings, jsontag "license_warnings"
reserved "LicenseWarnings";

// LicenseExpiry is the expiry date of the enterprise license, if applicable.
google.protobuf.Timestamp LicenseExpiry = 10 [
(gogoproto.stdtime) = true,
(gogoproto.jsontag) = "licenseExpiry"
];
}

// ProductType is the type of product.
Expand Down
3 changes: 3 additions & 0 deletions lib/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6334,6 +6334,8 @@ func (a *Server) Ping(ctx context.Context) (proto.PingResponse, error) {
return proto.PingResponse{}, nil
}

licenseExpiry := modules.GetModules().LicenseExpiry()

return proto.PingResponse{
ClusterName: cn.GetClusterName(),
ServerVersion: teleport.Version,
Expand All @@ -6342,6 +6344,7 @@ func (a *Server) Ping(ctx context.Context) (proto.PingResponse, error) {
IsBoring: modules.GetModules().IsBoringBinary(),
LoadAllCAs: a.loadAllCAs,
SignatureAlgorithmSuite: authPref.GetSignatureAlgorithmSuite(),
LicenseExpiry: &licenseExpiry,
}, nil
}

Expand Down
8 changes: 8 additions & 0 deletions lib/modules/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ type Modules interface {
EnableAccessGraph()
// EnableAccessMonitoring enables the usage of access monitoring.
EnableAccessMonitoring()
// LicenseExpiry returns the expiry date of the enterprise license, if applicable.
LicenseExpiry() time.Time
}

const (
Expand Down Expand Up @@ -379,6 +381,12 @@ func (p *defaultModules) PrintVersion() {
fmt.Printf("Teleport v%s git:%s %s\n", teleport.Version, teleport.Gitref, runtime.Version())
}

// LicenseExpiry returns the expiry date of the enterprise license, if applicable.
// Returns the zero value for time.Time for OSS.
func (p *defaultModules) LicenseExpiry() time.Time {
return time.Time{}
}

// Features returns supported features for default modules which is applied for OSS users
// todo (michellescripts) remove deprecated features
func (p *defaultModules) Features() Features {
Expand Down
7 changes: 7 additions & 0 deletions lib/web/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,13 @@ func (h *Handler) getUserContext(w http.ResponseWriter, r *http.Request, p httpr
if err != nil {
return nil, trace.Wrap(err)
}
pingResp, err := clt.Ping(r.Context())
if err != nil {
return nil, trace.Wrap(err)
}
if !pingResp.LicenseExpiry.IsZero() {
userContext.Cluster.LicenseExpiry = pingResp.LicenseExpiry
}

userContext.ConsumedAccessRequestID = c.cfg.Session.GetConsumedAccessRequestID()

Expand Down
2 changes: 2 additions & 0 deletions lib/web/ui/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ type Cluster struct {
// ProxyVersion is the cluster proxy's service version,
// or possibly empty if no proxies could be loaded.
ProxyVersion string `json:"proxyVersion"`
// LicenseExpiry is the expiry date of the enterprise license, if applicable.
LicenseExpiry *time.Time `json:"licenseExpiry,omitempty"`
}

// NewClusters creates a slice of Cluster's, containing data about each cluster.
Expand Down
5 changes: 5 additions & 0 deletions tool/teleport/testenv/test_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ func (p *cliModules) BuildType() string {
return "CLI"
}

// LicenseExpiry returns the expiry date of the enterprise license, if applicable.
func (p *cliModules) LicenseExpiry() time.Time {
return time.Time{}
}

// IsEnterpriseBuild returns false for [cliModules].
func (p *cliModules) IsEnterpriseBuild() bool {
return false
Expand Down
5 changes: 5 additions & 0 deletions tool/tsh/common/tsh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ func (p *cliModules) IsOSSBuild() bool {
return false
}

// LicenseExpiry returns the expiry date of the enterprise license, if applicable.
func (p *cliModules) LicenseExpiry() time.Time {
return time.Time{}
}

// PrintVersion prints the Teleport version.
func (p *cliModules) PrintVersion() {
fmt.Printf("Teleport CLI\n")
Expand Down
8 changes: 6 additions & 2 deletions web/packages/teleport/src/Support/Support.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { MemoryRouter } from 'react-router';
import { ContextProvider } from 'teleport';

import { createTeleportContext } from 'teleport/mocks/contexts';
import { ContentMinWidth } from 'teleport/Main/Main';

import { Props, Support } from './Support';

Expand All @@ -31,7 +32,9 @@ export default {

const Provider = ({ children }) => (
<ContextProvider ctx={ctx}>
<MemoryRouter>{children}</MemoryRouter>
<ContentMinWidth>
<MemoryRouter>{children}</MemoryRouter>
</ContentMinWidth>
</ContextProvider>
);

Expand All @@ -49,7 +52,7 @@ export const SupportOSSWithCTA = () => (

export const SupportCloud = () => (
<Provider>
<Support {...props} isCloud={true} />;
<Support {...props} isCloud={true} />
</Provider>
);

Expand Down Expand Up @@ -81,4 +84,5 @@ const props: Props = {
isCloud: false,
tunnelPublicAddress: null,
showPremiumSupportCTA: false,
licenseExpiryDateText: '2027-05-09 06:52:58',
};
Loading

0 comments on commit 6e8cbd6

Please sign in to comment.