Skip to content

Commit

Permalink
feat(domains): review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jvaumoroovh committed Sep 6, 2024
1 parent 86a73bc commit 6e36d77
Show file tree
Hide file tree
Showing 16 changed files with 246 additions and 240 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<form
class="oui-inline-adder__form"
ng-submit="addDnsForm.$valid && $ctrl.onFormSubmit()"
name="addDnsForm"
data-ng-submit="addDnsForm.$valid && $ctrl.onFormSubmit()"
>
<fieldset class="oui-inline-adder__fieldset">
<div class="oui-inline-adder__row">
<div class="oui-inline-adder__field">
<oui-field
label="{{ ::'domain_dns_name' | translate }}"
error-messages="::{
data-label="{{ ::'domain_dns_name' | translate }}"
data-error-messages="::{
hostnameRequired: ('domain_dns_add_dns_form_hostname_required_error' | translate),
hostnamePattern: ('domain_dns_add_dns_form_hostname_pattern_error' | translate),
hostnameExternal: ('domain_dns_add_dns_form_hostname_external_error' | translate),
Expand All @@ -20,17 +20,17 @@
inputmode="url"
class="oui-input"
name="nameServerField"
ng-model="$ctrl.dnsEntry.nameServer"
data-ng-model="$ctrl.dnsEntry.nameServer"
placeholder="ns1.my-domain-is-gre.at"
hostname-validator
ng-required="{{$ctrl.isNameServerRequired}}"
web-domain-dns-modify-hostname-validator
data-ng-required="{{$ctrl.isNameServerRequired}}"
/>
</oui-field>
</div>
<div class="oui-inline-adder__field">
<oui-field
label="{{ ::'domain_dns_ip' | translate }}"
error-messages="::{
data-label="{{ ::'domain_dns_ip' | translate }}"
data-error-messages="::{
ipPattern: ('domain_dns_add_dns_form_ip_pattern_error' | translate),
}"
>
Expand All @@ -39,9 +39,9 @@
inputmode="decimal"
class="oui-input"
name="ipField"
ng-model="$ctrl.dnsEntry.ip"
data-ng-model="$ctrl.dnsEntry.ip"
placeholder="198.27.92.1"
ip-validator
web-domain-dns-modify-ip-validator
/>
</oui-field>
</div>
Expand All @@ -51,7 +51,7 @@
<button
type="submit"
class="oui-inline-adder__action oui-button oui-button_primary oui-button_s"
ng-attr-title="{{ ::'domain_dns_add_tooltip' | translate }}"
data-ng-attr-title="{{ ::'domain_dns_add_tooltip' | translate }}"
>
<span class="oui-icon oui-icon-add"></span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import DnsFormController from './add-dns-form.controller';
import { hostnameValidator, ipValidator } from './add-dns-form.directive';
import template from './add-dns-form.html';

const moduleName = 'addDnsFormModule';
const moduleName = 'webDomainDnsModifyAddDnsFormModule';

angular
.module(moduleName, ['pascalprecht.translate'])
.directive('hostnameValidator', ['WucValidator', hostnameValidator])
.directive('ipValidator', ['WucValidator', ipValidator])
.component('addDnsForm', {
.directive('webDomainDnsModifyhostnameValidator', ['WucValidator', hostnameValidator])
.directive('webDomainDnsModifyipValidator', ['WucValidator', ipValidator])
.component('webDomainDnsModifyAddDnsForm', {
template,
controller: DnsFormController,
bindings: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
<div class="mt-2" ng-form>
<oui-message type="info" class="mt-2">
{{ ::"domain_dns_min_max_number_requirements" | translate:{ minNumber:
$ctrl.minNumberOfDns, maxNumber: $ctrl.maxNumberOfDns, } }}
<oui-message data-type="info" class="mt-2">
<span
data-translate="domain_dns_min_max_number_requirements"
data-translate-values="{ minNumber: $ctrl.minNumberOfDns, maxNumber: $ctrl.maxNumberOfDns }"
></span>
</oui-message>
<form
ng-repeat="ns in $ctrl.modifiedDnsList"
data-ng-repeat="ns in $ctrl.modifiedDnsList"
novalidate
name="displayDnsForm"
class="oui-inline-adder__form oui-inline-adder__form_added"
ng-attr-name="currentDnsFormName_{{::$index}}"
ng-attr-id="currentDnsFormId_{{::$index}}"
data-ng-attr-name="currentDnsFormName_{{::$index}}"
data-ng-attr-id="currentDnsFormId_{{::$index}}"
>
<fieldset class="oui-inline-adder__fieldset">
<div class="oui-inline-adder__row">
<div class="oui-inline-adder__field">
<oui-field label="{{ ::'domain_dns_name' | translate }}">
<oui-field
data-label="{{ ::'domain_dns_name' | translate }}"
>
<!-- Here, the input is used for display only, and should always be disabled -->
<input
type="text"
class="oui-input"
ng-model="ns.nameServer"
name="name"
ng-disabled="true"
data-ng-model="ns.nameServer"
data-ng-disabled="true"
/>
</oui-field>
</div>
Expand All @@ -31,9 +35,9 @@
<input
type="text"
class="oui-input"
ng-model="ns.ip"
name="ip"
ng-disabled="true"
data-ng-model="ns.ip"
data-ng-disabled="true"
/>
</oui-field>
</div>
Expand All @@ -43,34 +47,35 @@
<button
type="button"
class="oui-inline-adder__action oui-button oui-button_primary oui-button_s"
ng-attr-title="{{ ::'domain_dns_add_dns_forms_delete_tooltip' | translate }}"
ng-attr-aria-label="{{ ::$ctrl.translations.ariaRemoveItem }}"
ng-click="$ctrl.onFormRemove($index)"
data-ng-attr-title="{{ ::'domain_dns_add_dns_forms_delete_tooltip' | translate }}"
data-ng-attr-aria-label="{{ ::$ctrl.translations.ariaRemoveItem }}"
data-ng-click="$ctrl.onFormRemove($index)"
>
<span class="oui-icon oui-icon-trash" aria-hidden="true"></span>
</button>
</footer>
</form>

<add-dns-form
<web-domain-dns-modify-add-dns-form
data-ng-if="$ctrl.showForm"
modified-dns-list="$ctrl.modifiedDnsList"
min-dns-size="$ctrl.minNumberOfDns"
configuration-type="$ctrl.configurationType"
on-submit="$ctrl.onSubmit({ dnsEntry })"
should-clear-form="$ctrl.shouldClearForm"
data-modified-dns-list="$ctrl.modifiedDnsList"
data-min-dns-size="$ctrl.minNumberOfDns"
data-configuration-type="$ctrl.configurationType"
data-on-submit="$ctrl.onSubmit({ dnsEntry })"
data-should-clear-form="$ctrl.shouldClearForm"
/>

<oui-message data-ng-if="$ctrl.updateError" type="error">
<oui-message data-ng-if="$ctrl.updateError" data-type="error">
<span
ng-bind-html="$ctrl.updateError.message | translate:$ctrl.updateError.data"
data-translate="$ctrl.updateError.message"
data-translate-values="$ctrl.updateError.data"
></span>
</oui-message>

<validation-buttons
open-validation-modal="$ctrl.openValidationModal()"
cancel-modifications="$ctrl.cancelModifications()"
show-cancel-modifications-button="$ctrl.showCancelModificationsButton"
can-submit="$ctrl.canSubmit"
<web-domain-dns-modify-validation-buttons
data-open-validation-modal="$ctrl.openValidationModal()"
data-cancel-modifications="$ctrl.cancelModifications()"
data-show-cancel-modifications-button="$ctrl.showCancelModificationsButton"
data-can-submit="$ctrl.canSubmit"
/>
</div>
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import angular from 'angular';
import addDnsFormModule from './add-dns-form/add-dns-form.module';
import webDomainModifyAddDnsFormModule from './add-dns-form/add-dns-form.module';
import controller from './add-dns-forms.controller';
import template from './add-dns-forms.html';

const moduleName = 'addDnsFormsModule';
const moduleName = 'webDomainDnsModifyAddDnsFormsModule';

angular
.module(moduleName, ['oui', 'pascalprecht.translate', addDnsFormModule])
.component('addDnsForms', {
.module(moduleName, [
'oui',
'pascalprecht.translate',
webDomainModifyAddDnsFormModule,
])
.component('webDomainDnsModifyAddDnsForms', {
template,
controller,
bindings: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
<oui-radio
name="dns_configuration_types"
value="::$ctrl.constants.CONFIGURATION_TYPES.EXTERNAL"
model="$ctrl.selectedConfigurationType"
on-change="$ctrl.onConfigurationTypeChange()"
data-name="dns_configuration_types"
data-value="::$ctrl.constants.CONFIGURATION_TYPES.EXTERNAL"
data-model="$ctrl.selectedConfigurationType"
data-on-change="$ctrl.onConfigurationTypeChange()"
>
<oui-radio-label>
<span>
{{ ::"domain_dns_use_my_own_name_servers_title" | translate }}
</span>
<span data-translate="domain_dns_use_my_own_name_servers_title"></span>
<span
data-ng-if="$ctrl.currentConfigurationType === $ctrl.constants.CONFIGURATION_TYPES.EXTERNAL"
class="oui-badge oui-badge_success oui-badge_s"
>
{{ ::"domain_dns_active_label" | translate }}
</span>
data-translate="domain_dns_active_label"
></span>
</oui-radio-label>
<oui-radio-description>
<span>
{{ ::"domain_dns_use_my_own_name_servers_description" | translate }}
</span>
<add-dns-forms
<span
data-translate="domain_dns_use_my_own_name_servers_description"
></span>
<web-domain-dns-modify-add-dns-forms
data-ng-if="$ctrl.selectedConfigurationType === $ctrl.constants.CONFIGURATION_TYPES.EXTERNAL"
configuration-type="::$ctrl.constants.CONFIGURATION_TYPES.EXTERNAL"
min-number-of-dns="::$ctrl.dns.registryConfiguration.minNumberOfDns"
max-number-of-dns="::$ctrl.dns.registryConfiguration.maxNumberOfDns"
modified-dns-list="$ctrl.modifiedDnsList"
update-error="alerts.update"
show-form="$ctrl.showAddForm"
can-submit="$ctrl.canSubmit"
show-cancel-modifications-button="$ctrl.showCancelModificationsButton"
open-validation-modal="$ctrl.openValidationModal()"
cancel-modifications="$ctrl.cancelModifications()"
on-submit="$ctrl.onSubmit(dnsEntry)"
on-remove="$ctrl.onRemove(index)"
should-clear-form="$ctrl.shouldClearForm"
data-configuration-type="::$ctrl.constants.CONFIGURATION_TYPES.EXTERNAL"
data-min-number-of-dns="::$ctrl.dns.registryConfiguration.minNumberOfDns"
data-max-number-of-dns="::$ctrl.dns.registryConfiguration.maxNumberOfDns"
data-modified-dns-list="$ctrl.modifiedDnsList"
data-update-error="alerts.update"
data-show-form="$ctrl.showAddForm"
data-can-submit="$ctrl.canSubmit"
data-show-cancel-modifications-button="$ctrl.showCancelModificationsButton"
data-open-validation-modal="$ctrl.openValidationModal()"
data-cancel-modifications="$ctrl.cancelModifications()"
data-on-submit="$ctrl.onSubmit(dnsEntry)"
data-on-remove="$ctrl.onRemove(index)"
data-should-clear-form="$ctrl.shouldClearForm"
/>
</oui-radio-description>
</oui-radio>
Original file line number Diff line number Diff line change
@@ -1,55 +1,59 @@
<oui-message data-ng-if="!$ctrl.isZone" type="info">
<span>
{{ ::"domain_dns_default_config_activate_zone_message" | translate }}
</span>
<a ng-href="{{::$ctrl.links.zoneActivate}}">
{{ ::'domain_dns_config_activate_zone_message_link' | translate }}
<oui-message data-ng-if="!$ctrl.isZone" data-type="info">
<span
data-translate="domain_dns_default_config_activate_zone_message"
></span>
<a data-ng-href="{{::$ctrl.links.zoneActivate}}">
<span
data-translate="domain_dns_config_activate_zone_message_link"
></span>
</a>
</oui-message>

<oui-radio
disabled="!$ctrl.isZone"
name="dns_configuration_types"
value="::$ctrl.constants.CONFIGURATION_TYPES.INTERNAL"
model="$ctrl.selectedConfigurationType"
on-change="$ctrl.onConfigurationTypeChange()"
data-model="$ctrl.selectedConfigurationType"
data-on-change="$ctrl.onConfigurationTypeChange()"
>
<oui-radio-label>
<span>
{{ ::"domain_dns_use_default_ovh_name_servers_title" | translate }}
</span>
<span
data-translate="domain_dns_use_default_ovh_name_servers_title"
></span>
<span
data-ng-if="$ctrl.currentConfigurationType !== $ctrl.constants.CONFIGURATION_TYPES.INTERNAL"
class="oui-badge oui-badge_info oui-badge_s"
>
{{ ::"domain_dns_recommended_label" | translate }}
</span>
data-translate="domain_dns_recommended_label"
></span>
<span
data-ng-if="$ctrl.currentConfigurationType === $ctrl.constants.CONFIGURATION_TYPES.INTERNAL"
class="oui-badge oui-badge_success oui-badge_s"
>
{{ ::"domain_dns_active_label" | translate }}
</span>
data-translate="domain_dns_active_label"
></span>
</oui-radio-label>
<oui-radio-description>
<span>
{{ ::"domain_dns_use_default_ovh_name_servers_description" |
translate }}
</span>
<span
data-translate="domain_dns_use_default_ovh_name_servers_description"
></span>
<div
data-ng-if="$ctrl.selectedConfigurationType === $ctrl.constants.CONFIGURATION_TYPES.INTERNAL"
>
<oui-message data-ng-if="alerts.update" type="error" class="mt-3">
<oui-message
data-ng-if="alerts.update"
data-type="error"
class="mt-3"
>
<span
ng-bind-html="alerts.update.message | translate:alerts.update.data"
data-translate="alerts.update.message"
data-translate-values="alerts.update.data"
></span>
</oui-message>

<validation-buttons
data-ng-if="$ctrl.currentConfigurationType !== $ctrl.constants.CONFIGURATION_TYPES.INTERNAL"
can-submit="true"
open-validation-modal="$ctrl.openValidationModal()"
show-cancel-modifications-button="$ctrl.showCancelModificationsButton"
data-can-submit="true"
data-open-validation-modal="$ctrl.openValidationModal()"
data-show-cancel-modifications-button="$ctrl.showCancelModificationsButton"
/>
</div>
</oui-radio-description>
Expand Down
Loading

0 comments on commit 6e36d77

Please sign in to comment.