1+ @using Elastic .Markdown .Myst .FrontMatter
2+ @inherits RazorSlice <Elastic .Markdown .Myst .FrontMatter .Deployment >
3+ <p class =" product-availability" >
4+ <span class =" applies-to-label sd-badge sd-outline-transparent sd-text-black" >
5+ Applies To:
6+ </span >
7+ @if (Model .SelfManaged is not null )
8+ {
9+ if (Model .SelfManaged .Stack is not null )
10+ {
11+ @RenderProduct (" Elastic Stack" , Model .SelfManaged .Stack )
12+ }
13+ if (Model .SelfManaged .Ece is not null )
14+ {
15+ @RenderProduct (" Elastic Cloud Enterprise" , Model .SelfManaged .Ece )
16+ }
17+ if (Model .SelfManaged .Eck is not null )
18+ {
19+ @RenderProduct (" Elastic Cloud Kubernetes" , Model .SelfManaged .Eck )
20+ }
21+ }
22+ @if (Model .Cloud is not null )
23+ {
24+ if (Model .Cloud .Hosted is not null )
25+ {
26+ @RenderProduct (" Elastic Cloud Hosted" , Model .Cloud .Hosted )
27+ }
28+ if (Model .Cloud .Serverless is not null )
29+ {
30+ @RenderProduct (" Serverless" , Model .Cloud .Serverless )
31+ }
32+ }
33+ </p >
34+
35+ @functions {
36+
37+ private string GetLifeCycleClass (ProductLifecycle cycle )
38+ {
39+ switch (cycle )
40+ {
41+ case ProductLifecycle .Deprecated :
42+ case ProductLifecycle .Coming :
43+ case ProductLifecycle .Discontinued :
44+ case ProductLifecycle .Unavailable :
45+ return " muted" ;
46+ case ProductLifecycle .GenerallyAvailable :
47+ case ProductLifecycle .TechnicalPreview :
48+ case ProductLifecycle .Beta :
49+ case ProductLifecycle .Development :
50+ return " primary" ;
51+ default :
52+ throw new ArgumentOutOfRangeException (nameof (cycle ), cycle , null );
53+ }
54+ }
55+ private string GetLifeCycleName (ProductLifecycle cycle )
56+ {
57+ switch (cycle )
58+ {
59+ case ProductLifecycle .TechnicalPreview :
60+ return " Technical Preview" ;
61+ case ProductLifecycle .Beta :
62+ return " Beta" ;
63+ case ProductLifecycle .Development :
64+ return " Development" ;
65+ case ProductLifecycle .Deprecated :
66+ return " Deprecated" ;
67+ case ProductLifecycle .Coming :
68+ return " Coming" ;
69+ case ProductLifecycle .Discontinued :
70+ return " Discontinued" ;
71+ case ProductLifecycle .Unavailable :
72+ return " Unavailable" ;
73+ case ProductLifecycle .GenerallyAvailable :
74+ return " GA" ;
75+ default :
76+ throw new ArgumentOutOfRangeException (nameof (cycle ), cycle , null );
77+ }
78+ }
79+
80+ private IHtmlContent RenderProduct (string name , ProductAvailability product )
81+ {
82+ var c = GetLifeCycleClass (product .Lifecycle );
83+ <span class =" sd-badge sd-outline-@c sd-text-@c applies-badge" >
84+ @name
85+ @if (product .Lifecycle != ProductLifecycle .GenerallyAvailable )
86+ {
87+ <span class =" sd-text-secondary" >@GetLifeCycleName(product.Lifecycle) </span >
88+ }
89+ @if (product .Version is not null and not AllVersions )
90+ {
91+ <span class =" sd-text-success" >(@product .Version )</span >
92+ }
93+ </span >
94+ return HtmlString .Empty ;
95+ }
96+ }
0 commit comments