updated API response to get IsComposeFormat and show appropriate text.

pull/5563/head
Felix Han 2021-08-31 15:39:44 +12:00
parent 47c32df77a
commit b5c59c8982
3 changed files with 24 additions and 11 deletions

View File

@ -72,6 +72,18 @@
on-change="(ctrl.onChangeFileContent)" on-change="(ctrl.onChangeFileContent)"
> >
<editor-description> <editor-description>
<span class="text-muted small" ng-show="ctrl.stack.IsComposeFormat">
<p>
<i class="fa fa-exclamation-circle orange-icon" aria-hidden="true" style="margin-right: 2px;"></i>
Portainer uses <a href="https://kompose.io/" target="_blank">Kompose</a> to convert your Compose manifest to a Kubernetes compliant manifest. Be wary that not
all the Compose format options are supported by Kompose at the moment.
</p>
<p>
You can get more information about Compose file format in the
<a href="https://docs.docker.com/compose/compose-file/" target="_blank">official documentation</a>.
</p>
</span>
<span class="text-muted small" ng-show="!ctrl.stack.IsComposeFormat">
<p> <p>
<i class="fa fa-info-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i> <i class="fa fa-info-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i>
This feature allows you to deploy any kind of Kubernetes resource in this environment (Deployment, Secret, ConfigMap...). This feature allows you to deploy any kind of Kubernetes resource in this environment (Deployment, Secret, ConfigMap...).
@ -80,6 +92,7 @@
You can get more information about Kubernetes file format in the You can get more information about Kubernetes file format in the
<a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/" target="_blank">official documentation</a>. <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/" target="_blank">official documentation</a>.
</p> </p>
</span>
</editor-description> </editor-description>
</web-editor-form> </web-editor-form>
<!-- #endregion --> <!-- #endregion -->

View File

@ -1024,9 +1024,8 @@ class KubernetesCreateApplicationController {
if (this.application.ApplicationKind) { if (this.application.ApplicationKind) {
this.state.appType = this.KubernetesDeploymentTypes[this.application.ApplicationKind.toUpperCase()]; this.state.appType = this.KubernetesDeploymentTypes[this.application.ApplicationKind.toUpperCase()];
if (this.application.StackId) { if (this.application.StackId) {
if (this.application.ApplicationKind === this.KubernetesDeploymentTypes.GIT) {
this.stack = await this.StackService.stack(this.application.StackId); this.stack = await this.StackService.stack(this.application.StackId);
} else if (this.application.ApplicationKind === this.KubernetesDeploymentTypes.CONTENT) { if (this.application.ApplicationKind === this.KubernetesDeploymentTypes.CONTENT) {
this.stackFileContent = await this.StackService.getStackFile(this.application.StackId); this.stackFileContent = await this.StackService.getStackFile(this.application.StackId);
} }
} }

View File

@ -7,6 +7,7 @@ export function StackViewModel(data) {
this.EndpointId = data.EndpointId; this.EndpointId = data.EndpointId;
this.SwarmId = data.SwarmId; this.SwarmId = data.SwarmId;
this.Env = data.Env ? data.Env : []; this.Env = data.Env ? data.Env : [];
this.IsComposeFormat = data.IsComposeFormat;
if (data.ResourceControl && data.ResourceControl.Id !== 0) { if (data.ResourceControl && data.ResourceControl.Id !== 0) {
this.ResourceControl = new ResourceControlViewModel(data.ResourceControl); this.ResourceControl = new ResourceControlViewModel(data.ResourceControl);
} }