fix for feature state shortcode

This commit is contained in:
Jim Angel
2020-05-11 11:01:05 -05:00
parent 4d5ddc5586
commit f3e733ecba
8 changed files with 5 additions and 90 deletions
-8
View File
@@ -1,8 +0,0 @@
This feature is currently in a *alpha* state, meaning:
* The version names contain alpha (e.g. v1alpha1).
* Might be buggy. Enabling the feature may expose bugs. Disabled by default.
* Support for feature may be dropped at any time without notice.
* The API may change in incompatible ways in a later software release without notice.
* Recommended for use only in short-lived testing clusters, due to increased risk of bugs and lack of long-term support.
-8
View File
@@ -1,8 +0,0 @@
This feature is currently in a *beta* state, meaning:
* The version names contain beta (e.g. v2beta3).
* Code is well tested. Enabling the feature is considered safe. Enabled by default.
* Support for the overall feature will not be dropped, though details may change.
* The schema and/or semantics of objects may change in incompatible ways in a subsequent beta or stable release. When this happens, we will provide instructions for migrating to the next version. This may require deleting, editing, and re-creating API objects. The editing process may require some thought. This may require downtime for applications that rely on the feature.
* Recommended for only non-business-critical uses because of potential for incompatible changes in subsequent releases. If you have multiple clusters that can be upgraded independently, you may be able to relax this restriction.
* **Please do try our beta features and give feedback on them! After they exit beta, it may not be practical for us to make more changes.**
@@ -1,2 +0,0 @@
This feature is *deprecated*. For more information on this state, see the [Kubernetes Deprecation Policy](/docs/reference/deprecation-policy/).
-5
View File
@@ -1,5 +0,0 @@
This feature is *stable*, meaning:
* The version name is vX where X is an integer.
* Stable versions of features will appear in released software for many subsequent versions.
-13
View File
@@ -1,13 +0,0 @@
---
headless: true
resources:
- src: "*alpha*"
title: "alpha"
- src: "*beta*"
title: "beta"
- src: "*deprecated*"
title: "deprecated"
- src: "*stable*"
title: "stable"
---
@@ -1,29 +0,0 @@
<a href="#" id="feature-state-dialog-link" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>{{ .page.Title }}</a>
<div id="feature-state-dialog" class="ui-dialog-content" title="{{ .page.Title }}">
{{ .page.Content | markdownify }}
</div>
<script>
$(function(){
$( "#feature-state-dialog" ).dialog({
autoOpen: false,
width: {{ .width | default "600" }},
buttons: [
{
text: "Ok",
click: function() {
$( this ).dialog( "close" );
}
}
]
});
// Link to open the dialog
$( "#feature-state-dialog-link" ).click(function( event ) {
$( "#feature-state-dialog" ).dialog( "open" );
event.preventDefault();
});
});
</script>
@@ -1,21 +0,0 @@
<div style="margin-top: 10px; margin-bottom: 10px;">
{{ $for_k8s_version := .for_k8s_version | default (.page.Param "version") }}
{{ $width := .width | default "600" }}
{{ $state := .state }}
<b>FEATURE STATE:</b> <code>Kubernetes {{ $for_k8s_version }}</code>
{{/* docs/templates is a Hugo page bundle */}}
{{ $templates_path := "docs/templates" }}
{{ $templates := site.GetPage "page" $templates_path }}
{{ with $templates.Resources }}
{{ $template_path := printf "**feature-state-%s*" $state }}
{{ $content_template := .GetMatch $template_path }}
{{ with $content_template }}
{{ $dialog := dict "page" $content_template "for_k8s_version" $for_k8s_version "width" $width }}
{{ partial "templates/feature-dialog.html" $dialog }}
{{ else }}
{{ errorf "[%s] template not found in %s" site.Language.Lang $template_path }}
{{ end }}
{{ else }}
{{ errorf "[%s] templates not found in docs/templates" site.Language.Lang }}
{{ end }}
</div>
+5 -4
View File
@@ -1,10 +1,11 @@
{{ $valid_states := "alpha, beta, deprecated, stable" }}
{{ $state := .Get "state" }}
{{ $for_k8s_version := .Get "for_k8s_version" }}
{{ $width := .Get "width" }}
{{ $for_k8s_version := .Get "for_k8s_version" | default (.Page.Param "version")}}
{{ $is_valid := strings.Contains $valid_states $state }}
{{ if not $is_valid }}
{{ errorf "%q is not a valid feature-state, use one of %q" $valid_states }}
{{ else }}
{{ partial "templates/feature-state.html" (dict "ctx" . "page" .Page "state" $state "for_k8s_version" $for_k8s_version "width" $width) }}
{{ end }}
<div style="margin-top: 10px; margin-bottom: 10px;">
<b>FEATURE STATE:</b> <code>Kubernetes {{ $for_k8s_version }} [{{ $state }}]</code>
</div>
{{ end }}