mirror of https://github.com/portainer/portainer
139 lines
6.6 KiB
HTML
139 lines
6.6 KiB
HTML
<ng-form name="kubernetesConfigurationDataCreationForm">
|
|
<div class="col-sm-12 form-section-title" style="margin-top: 10px"> Data </div>
|
|
|
|
<div class="form-group" ng-if="$ctrl.isCreation">
|
|
<div class="col-sm-12">
|
|
<button type="button" class="btn btn-link btn-sm hover:no-underline !ml-0 p-0" ng-if="$ctrl.formValues.IsSimple" ng-click="$ctrl.showAdvancedMode()">
|
|
<pr-icon icon="'list'" feather="true"></pr-icon> Advanced mode
|
|
</button>
|
|
<button type="button" class="btn btn-link btn-sm hover:no-underline !ml-0 p-0" ng-if="!$ctrl.formValues.IsSimple" ng-click="$ctrl.showSimpleMode()">
|
|
<pr-icon icon="'edit'" feather="true"></pr-icon> Simple mode
|
|
</button>
|
|
</div>
|
|
<div class="col-sm-12 small text-muted vertical-center" ng-if="$ctrl.formValues.IsSimple">
|
|
<pr-icon icon="'info'" mode="'primary'" feather="true"></pr-icon>
|
|
Switch to advanced mode to copy and paste multiple key/values
|
|
</div>
|
|
<div class="col-sm-12 small text-muted vertical-center" ng-if="!$ctrl.formValues.IsSimple">
|
|
<pr-icon icon="'info'" mode="'primary'" feather="true"></pr-icon>
|
|
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()" data-cy="k8sConfigCreate-createEntryButton">
|
|
<pr-icon class="vertical-center" icon="'plus'" feather="true"></pr-icon> Create entry
|
|
</button>
|
|
<button type="button" class="btn btn-sm btn-default" ngf-select="$ctrl.addEntryFromFile($file)" style="margin-left: 0" data-cy="k8sConfigCreate-createConfigsFromFileButton">
|
|
<pr-icon class="vertical-center" icon="'upload'" feather="true"></pr-icon> Create key/value 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-3 col-lg-2 control-label text-left required">Key</label>
|
|
<div class="col-sm-8 col-lg-9">
|
|
<input
|
|
type="text"
|
|
class="form-control"
|
|
id="configuration_data_key_{{ index }}"
|
|
name="configuration_data_key_{{ index }}"
|
|
ng-model="$ctrl.formValues.Data[index].Key"
|
|
ng-disabled="entry.Used"
|
|
required
|
|
ng-change="$ctrl.onChangeKey(entry)"
|
|
/>
|
|
<div
|
|
class="small text-muted"
|
|
style="margin-top: 5px"
|
|
ng-show="
|
|
kubernetesConfigurationDataCreationForm['configuration_data_key_' + index].$invalid ||
|
|
(!entry.Used && $ctrl.state.duplicateKeys[index] !== undefined) ||
|
|
$ctrl.state.invalidKeys[index]
|
|
"
|
|
>
|
|
<ng-messages for="kubernetesConfigurationDataCreationForm['configuration_data_key_' + index].$error">
|
|
<p ng-message="required" class="vertical-center">
|
|
<pr-icon class="vertical-center" icon="'alert-triangle'" feather="true" mode="'warning'"></pr-icon> This field is required.
|
|
</p>
|
|
</ng-messages>
|
|
<div>
|
|
<p ng-if="$ctrl.state.duplicateKeys[index] !== undefined" class="vertical-center">
|
|
<pr-icon class="vertical-center" icon="'alert-triangle'" feather="true" mode="'warning'" class="vertical-center"></pr-icon>This key is already defined.
|
|
</p>
|
|
</div>
|
|
<p ng-if="$ctrl.state.invalidKeys[index]" class="vertical-center">
|
|
<pr-icon class="vertical-center" icon="'alert-triangle'" feather="true" mode="'warning'" class="vertical-center"></pr-icon> This key is invalid. A valid key must
|
|
consist of alphanumeric characters, '-', '_' or '.'
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-3 col-lg-2"></div>
|
|
</div>
|
|
|
|
<div class="form-group" ng-if="$ctrl.formValues.IsSimple && !entry.IsBinary">
|
|
<label for="configuration_data_value_{{ index }}" class="col-sm-3 col-lg-2 control-label text-left required">Value</label>
|
|
<div class="col-sm-8 col-lg-9">
|
|
<textarea
|
|
class="form-control"
|
|
rows="5"
|
|
id="configuration_data_value_{{ index }}"
|
|
name="configuration_data_value_{{ index }}"
|
|
ng-model="$ctrl.formValues.Data[index].Value"
|
|
ng-trim="false"
|
|
required
|
|
></textarea>
|
|
<div class="small text-muted" 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" class="vertical-center"
|
|
><pr-icon class="vertical-center" icon="'alert-triangle'" feather="true" mode="'warning'"></pr-icon> This field is required.</p
|
|
>
|
|
</ng-messages>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group" ng-if="$ctrl.formValues.IsSimple && entry.IsBinary">
|
|
<label for="configuration_data_value_{{ index }}" class="col-sm-3 col-lg-2 control-label text-left required">Value</label>
|
|
<div class="col-sm-8 control-label small text-muted text-left"
|
|
>Binary data <portainer-tooltip message="'This key holds binary data and cannot be displayed.'"></portainer-tooltip
|
|
></div>
|
|
</div>
|
|
|
|
<div class="form-group" ng-if="$ctrl.formValues.IsSimple">
|
|
<div class="col-sm-3 col-lg-2"></div>
|
|
<div class="col-sm-8">
|
|
<button
|
|
type="button"
|
|
class="btn btn-sm btn-dangerlight !ml-0"
|
|
style="margin-left: 0"
|
|
ng-disabled="entry.Used"
|
|
ng-click="$ctrl.removeEntry(index, entry)"
|
|
data-cy="k8sConfigDetail-removeEntryButton{{ index }}"
|
|
>
|
|
<pr-icon class="vertical-center" icon="'trash-2'" feather="true"></pr-icon> Remove entry
|
|
</button>
|
|
<span class="small text-muted" ng-if="entry.Used">
|
|
<pr-icon icon="'info'" feather="true" mode="'primary'"></pr-icon>
|
|
This key is currently used by one or more applications
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group !px-[15px]" ng-if="!$ctrl.formValues.IsSimple">
|
|
<input type="text" ng-model="$ctrl.formValues.DataYaml" required style="display: none" />
|
|
|
|
<web-editor-form
|
|
identifier="kubernetes-configuration-editor"
|
|
value="$ctrl.formValues.DataYaml"
|
|
on-change="($ctrl.editorUpdate)"
|
|
yml="true"
|
|
placeholder="# Define or paste key-value pairs, one pair per line"
|
|
>
|
|
</web-editor-form>
|
|
</div>
|
|
</ng-form>
|