1. fix dns zone api fetch in the zone list page 2. udpate create dns zone 3. update dns zone list 4. update dns zone detail 5. update edit dns zone 6. update delete dns zone Closes-Bug: #2032857 Change-Id: Ieb5023f8596c1c401ad2d0868c99f0155c1c45a8
40 lines
914 B
JavaScript
40 lines
914 B
JavaScript
import { getOptions } from 'utils';
|
|
|
|
export const ZONE_TYPE_ENUM = {
|
|
primary: 'PRIMARY',
|
|
secondary: 'SECONDARY',
|
|
};
|
|
|
|
export const ZONE_TYPES = {
|
|
[ZONE_TYPE_ENUM.primary]: t('Primary'),
|
|
[ZONE_TYPE_ENUM.secondary]: t('Secondary'),
|
|
};
|
|
|
|
export const zoneTypeOptions = getOptions(ZONE_TYPES);
|
|
|
|
export const zoneNameRegex = /^.+\.$/;
|
|
|
|
export const zoneNameMessage = t('The zone name should end with "."');
|
|
|
|
export const validateZoneName = (rule, value) => {
|
|
if (!value) {
|
|
return Promise.resolve();
|
|
}
|
|
if (!zoneNameRegex.test(value)) {
|
|
return Promise.reject(zoneNameMessage);
|
|
}
|
|
const labels = value.trim().split('.');
|
|
if (labels.length <= 1) {
|
|
return Promise.reject(
|
|
new Error(t('More than one label is required, such as: "example.org."'))
|
|
);
|
|
}
|
|
return Promise.resolve();
|
|
};
|
|
|
|
export const ZONE_STATUS = {
|
|
ACTIVE: t('Active'),
|
|
PENDING: t('Pending'),
|
|
ERROR: t('Error'),
|
|
};
|