portainer/app/kubernetes/components/kubernetes-configuration-data/kubernetesConfigurationData...

98 lines
4.5 KiB
HTML

<ng-form name="kubernetesConfigurationDataCreationForm">
<div class="col-sm-12 form-section-title" style="margin-top: 10px;">
Data
</div>
<div class="form-group">
<div class="col-sm-12">
<p>
<a class="small interactive" ng-if="$ctrl.formValues.IsSimple" ng-click="$ctrl.formValues.IsSimple = false">
<i class="fa fa-list-ol space-right" aria-hidden="true"></i> Advanced mode
</a>
<a class="small interactive" ng-if="!$ctrl.formValues.IsSimple" ng-click="$ctrl.formValues.IsSimple = true">
<i class="fa fa-edit space-right" aria-hidden="true"></i> Simple mode
</a>
</p>
</div>
<div class="col-sm-12 small text-muted" ng-if="$ctrl.formValues.IsSimple">
<i class="fa fa-info-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i>
Switch to advanced mode to copy and paste multiple key/values
</div>
<div class="col-sm-12 small text-muted" ng-if="!$ctrl.formValues.IsSimple">
<i class="fa fa-info-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i>
Generate a configuration entry per line, use YAML format
</div>
</div>
<div class="form-group" ng-if="$ctrl.formValues.IsSimple">
<div class="col-sm-12">
<button type="button" class="btn btn-sm btn-default" style="margin-left: 0;" ng-click="$ctrl.addEntry()">
<i class="fa fa-plus-circle" aria-hidden="true"></i> Create entry
</button>
<button type="button" class="btn btn-sm btn-default" ngf-select="$ctrl.addEntryFromFile($file)" style="margin-left: 0;">
<i class="fa fa-file-upload" aria-hidden="true"></i> Create entry from file
</button>
</div>
</div>
<div ng-repeat="(index, entry) in $ctrl.formValues.Data" ng-if="$ctrl.formValues.IsSimple">
<div class="form-group">
<label for="configuration_data_key_{{ index }}" class="col-sm-1 control-label text-left">Key</label>
<div class="col-sm-11">
<input
type="text"
class="form-control"
id="configuration_data_key_{{ index }}"
name="configuration_data_key_{{ index }}"
ng-model="$ctrl.formValues.Data[index].Key"
required
ng-change="$ctrl.onChangeKey()"
/>
</div>
<div
class="col-sm-11 small text-warning"
style="margin-top: 5px;"
ng-show="kubernetesConfigurationDataCreationForm['configuration_data_key_' + index].$invalid || $ctrl.state.duplicateKeys[index] !== undefined"
>
<ng-messages for="kubernetesConfigurationDataCreationForm['configuration_data_key_' + index].$error">
<p ng-message="required"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> This field is required.</p>
</ng-messages>
<p ng-if="$ctrl.state.duplicateKeys[index] !== undefined"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> This key is already defined.</p>
</div>
</div>
<div class="form-group" ng-if="$ctrl.formValues.IsSimple">
<label for="configuration_data_value_{{ index }}" class="col-sm-1 control-label text-left">Value</label>
<div class="col-sm-11">
<textarea
class="form-control"
rows="5"
id="configuration_data_value_{{ index }}"
name="configuration_data_value_{{ index }}"
ng-model="$ctrl.formValues.Data[index].Value"
required
></textarea>
</div>
<div class="col-sm-11 small text-warning" style="margin-top: 5px;" ng-show="kubernetesConfigurationDataCreationForm['configuration_data_value_' + index].$invalid">
<ng-messages for="kubernetesConfigurationDataCreationForm['configuration_data_value_' + index].$error">
<p ng-message="required"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> This field is required.</p>
</ng-messages>
</div>
</div>
<div class="form-group" ng-if="$ctrl.formValues.IsSimple">
<div class="col-sm-1"></div>
<div class="col-sm-11">
<button type="button" class="btn btn-sm btn-danger" style="margin-left: 0;" ng-click="$ctrl.removeEntry(index)">
<i class="fa fa-trash" aria-hidden="true"></i> Remove entry
</button>
</div>
</div>
</div>
<div class="form-group" ng-if="!$ctrl.formValues.IsSimple">
<input type="text" ng-model="$ctrl.formValues.DataYaml" required style="display: none;" />
<code-editor identifier="kubernetes-configuration-editor" value="$ctrl.formValues.DataYaml" read-only="false" yml="true" on-change="($ctrl.editorUpdate)"></code-editor>
</div>
</ng-form>