提交 97c00c7a 编写于 作者: P Piotr Bryk

Merge pull request #783 from taimir/i18n-localize3

Localization of the DeployLabels and PortMappings
......@@ -83,4 +83,28 @@
<translation id="3539277368227313625" key="MSG_DEPLOY_UPLOAD_FILE_USER_HELP" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="User help for the YAML/JSON file upload form on the deploy page.">Select a YAML or JSON file, specifying the resources to deploy.</translation>
<translation id="4100105138388508081" key="MSG_DEPLOY_UPLOAD_FILE_LEARN_MORE_ACTION" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="The text is used as a 'Learn more' link text besides the file upload on the deploy page.">Learn more</translation>
<translation id="5372554302338765680" key="MSG_DEPLOY_DASHBOARD_TOUR_USER_HELP" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="User help with a link redirecting to the &quot;Dashboard tour&quot; on the deploy page.">To learn more, <ph name="OPEN_LINK" /> take the Dashboard Tour <ph name="LINK_ICON" /> <ph name="CLOSE_LINK" /></translation>
</translationbundle>
<translation id="6458313634738030070" key="MSG_DEPLOY_LABEL_KEY_NOT_UNIQUE_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the key of a specified kubernetes label on the deploy page is not unique."><ph name="LABEL_KEY" /> is not unique.</translation>
<translation id="5942949269312477924" key="MSG_DEPLOY_LABEL_KEY_PREFIX_PATTERN_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the key of a specified kubernetes label (on the deploy page) does not start with a proper prefix.">Prefix is not a valid DNS subdomain prefix. Example: my-domain.com</translation>
<translation id="2202844148518919115" key="MSG_DEPLOY_LABEL_KEY_NAME_PATTERN_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the key name of a specified kubernetes label (on the deploy page) does not match the required pattern.">Label key name must be alphanumeric separated by '-', '_' or '.', optionally prefixed by a DNS subdomain and '/'</translation>
<translation id="5453986949828048308" key="MSG_DEPLOY_LABEL_KEY_PREFIX_MAX_LENGTH_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the key prefix of a specified kubernetes label (on the deploy page) is too long.">Prefix should not exceed 253 characters</translation>
<translation id="704934282074920058" key="MSG_DEPLOY_LABEL_KEY_NAME_MAX_LENGTH_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the key name of a specified kubernetes label (on the deploy page) is too long.">Label Key name should not exceed 63 characters</translation>
<translation id="2368273836200596195" key="MSG_DEPLOY_LABEL_VALUE_PATTERN_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the value of a specified kubernetes label (on the deploy page) does not match the required pattern.">Label value must be alphanumeric separated by '.' , '-' or '_'</translation>
<translation id="3530700384293436417" key="MSG_DEPLOY_LABEL_VALUE_MAX_LENGTH_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the value of a specified kubernetes label (on the deploy page) is too long.">Label Value must not exceed 253 characters</translation>
<translation id="2239228020495216701" key="MSG_PORT_MAPPINGS_SERVICE_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Service' above the service type selection box on the deploy page.">Service</translation>
<translation id="721797967401199865" key="MSG_PORT_MAPPINGS_SERVICE_TYPE_NONE_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'None', which appears as an option in the service type selection box on the deploy page.">None</translation>
<translation id="8050645543692471361" key="MSG_PORT_MAPPINGS_SERVICE_TYPE_INTERNAL_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Internal', which appears as an option in the service type selection box on the deploy page.">Internal</translation>
<translation id="2609771245063229855" key="MSG_PORT_MAPPINGS_SERVICE_TYPE_EXTERNAL_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'External', which appears as an option in the service type selection box on the deploy page.">External</translation>
<translation id="8712773463792545626" key="MSG_PORT_MAPPINGS_PORT_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Port', which serves as a placeholder for the port input field in the port mappings section on the deploy page.">Port</translation>
<translation id="7552176658498554111" key="MSG_PORT_MAPPINGS_PORT_INTEGER_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies a non-integer port number in the port mappings section on the deploy page.">Port must be an integer</translation>
<translation id="7607790311678378779" key="MSG_PORT_MAPPINGS_PORT_NEGATIVE_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies a negative port number in the port mappings section on the deploy page.">Port must greater than 0</translation>
<translation id="3681215085326163472" key="MSG_PORT_MAPPINGS_PORT_MAX_VALUE_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when a typed in port number exceeds the maximum allowed value (in the port mappings section on the deploy page).">Port must less than 65536</translation>
<translation id="6532475438704503011" key="MSG_PORT_MAPPINGS_PORT_EMPTY_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies an empty port number and a target port number is already there (in the port mappings section on the deploy page).">Port can't be empty when target port is specified.</translation>
<translation id="6886379315958130279" key="MSG_PORT_MAPPINGS_TARGET_PORT_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Target port', which serves as a placeholder for the target port input field in the port mappings section on the deploy page.">Target port</translation>
<translation id="675488554787346531" key="MSG_PORT_MAPPINGS_TARGET_PORT_INTEGER_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies a non-integer target port number in the port mappings section on the deploy page.">Target port must be an integer</translation>
<translation id="4283436343708019746" key="MSG_PORT_MAPPINGS_TARGET_PORT_NEGATIVE_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies a negative target port number in the port mappings section on the deploy page.">Target port must greater than 0</translation>
<translation id="1828566570474734407" key="MSG_PORT_MAPPINGS_TARGET_PORT_MAX_VALUE_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when a typed in target port number exceeds the maximum allowed value (in the port mappings section on the deploy page).">Target port must less than 65536</translation>
<translation id="958102129872905095" key="MSG_PORT_MAPPINGS_TARGET_PORT_EMPTY_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies an empty target port number and a port number is already there (in the port mappings section on the deploy page).">Target port can't be empty when port is specified.</translation>
<translation id="1603454081570532220" key="MSG_PORT_MAPPINGS_PROTOCOL_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Protocol' above the protocol selection box in the port mappings section, on the deploy page.">Protocol</translation>
<translation id="520366299646638360" key="MSG_PORT_MAPPINGS_PROTOCOL_REQUIRED_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user does not specify a protocol for an existing port mapping (in the port mappings section, on the deploy page).">Protocol is required</translation>
<translation id="1660903123116357917" key="MSG_PORT_MAPPINGS_PROTOCOL_INVALID_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies an invalid protocol for a port mapping (in the port mappings section, on the deploy page).">Invalid protocol</translation>
</translationbundle>
\ No newline at end of file
......@@ -83,4 +83,28 @@
<translation id="3539277368227313625" key="MSG_DEPLOY_UPLOAD_FILE_USER_HELP" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="User help for the YAML/JSON file upload form on the deploy page.">Select a YAML or JSON file, specifying the resources to deploy.</translation>
<translation id="4100105138388508081" key="MSG_DEPLOY_UPLOAD_FILE_LEARN_MORE_ACTION" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="The text is used as a 'Learn more' link text besides the file upload on the deploy page.">Learn more</translation>
<translation id="5372554302338765680" key="MSG_DEPLOY_DASHBOARD_TOUR_USER_HELP" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="User help with a link redirecting to the &quot;Dashboard tour&quot; on the deploy page.">To learn more, <ph name="OPEN_LINK" /> take the Dashboard Tour <ph name="LINK_ICON" /> <ph name="CLOSE_LINK" /></translation>
</translationbundle>
<translation id="6458313634738030070" key="MSG_DEPLOY_LABEL_KEY_NOT_UNIQUE_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the key of a specified kubernetes label on the deploy page is not unique."><ph name="LABEL_KEY" /> is not unique.</translation>
<translation id="5942949269312477924" key="MSG_DEPLOY_LABEL_KEY_PREFIX_PATTERN_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the key of a specified kubernetes label (on the deploy page) does not start with a proper prefix.">Prefix is not a valid DNS subdomain prefix. Example: my-domain.com</translation>
<translation id="2202844148518919115" key="MSG_DEPLOY_LABEL_KEY_NAME_PATTERN_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the key name of a specified kubernetes label (on the deploy page) does not match the required pattern.">Label key name must be alphanumeric separated by '-', '_' or '.', optionally prefixed by a DNS subdomain and '/'</translation>
<translation id="5453986949828048308" key="MSG_DEPLOY_LABEL_KEY_PREFIX_MAX_LENGTH_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the key prefix of a specified kubernetes label (on the deploy page) is too long.">Prefix should not exceed 253 characters</translation>
<translation id="704934282074920058" key="MSG_DEPLOY_LABEL_KEY_NAME_MAX_LENGTH_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the key name of a specified kubernetes label (on the deploy page) is too long.">Label Key name should not exceed 63 characters</translation>
<translation id="2368273836200596195" key="MSG_DEPLOY_LABEL_VALUE_PATTERN_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the value of a specified kubernetes label (on the deploy page) does not match the required pattern.">Label value must be alphanumeric separated by '.' , '-' or '_'</translation>
<translation id="3530700384293436417" key="MSG_DEPLOY_LABEL_VALUE_MAX_LENGTH_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the value of a specified kubernetes label (on the deploy page) is too long.">Label Value must not exceed 253 characters</translation>
<translation id="2239228020495216701" key="MSG_PORT_MAPPINGS_SERVICE_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Service' above the service type selection box on the deploy page.">Service</translation>
<translation id="721797967401199865" key="MSG_PORT_MAPPINGS_SERVICE_TYPE_NONE_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'None', which appears as an option in the service type selection box on the deploy page.">None</translation>
<translation id="8050645543692471361" key="MSG_PORT_MAPPINGS_SERVICE_TYPE_INTERNAL_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Internal', which appears as an option in the service type selection box on the deploy page.">Internal</translation>
<translation id="2609771245063229855" key="MSG_PORT_MAPPINGS_SERVICE_TYPE_EXTERNAL_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'External', which appears as an option in the service type selection box on the deploy page.">External</translation>
<translation id="8712773463792545626" key="MSG_PORT_MAPPINGS_PORT_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Port', which serves as a placeholder for the port input field in the port mappings section on the deploy page.">Port</translation>
<translation id="7552176658498554111" key="MSG_PORT_MAPPINGS_PORT_INTEGER_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies a non-integer port number in the port mappings section on the deploy page.">Port must be an integer</translation>
<translation id="7607790311678378779" key="MSG_PORT_MAPPINGS_PORT_NEGATIVE_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies a negative port number in the port mappings section on the deploy page.">Port must greater than 0</translation>
<translation id="3681215085326163472" key="MSG_PORT_MAPPINGS_PORT_MAX_VALUE_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when a typed in port number exceeds the maximum allowed value (in the port mappings section on the deploy page).">Port must less than 65536</translation>
<translation id="6532475438704503011" key="MSG_PORT_MAPPINGS_PORT_EMPTY_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies an empty port number and a target port number is already there (in the port mappings section on the deploy page).">Port can't be empty when target port is specified.</translation>
<translation id="6886379315958130279" key="MSG_PORT_MAPPINGS_TARGET_PORT_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Target port', which serves as a placeholder for the target port input field in the port mappings section on the deploy page.">Target port</translation>
<translation id="675488554787346531" key="MSG_PORT_MAPPINGS_TARGET_PORT_INTEGER_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies a non-integer target port number in the port mappings section on the deploy page.">Target port must be an integer</translation>
<translation id="4283436343708019746" key="MSG_PORT_MAPPINGS_TARGET_PORT_NEGATIVE_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies a negative target port number in the port mappings section on the deploy page.">Target port must greater than 0</translation>
<translation id="1828566570474734407" key="MSG_PORT_MAPPINGS_TARGET_PORT_MAX_VALUE_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when a typed in target port number exceeds the maximum allowed value (in the port mappings section on the deploy page).">Target port must less than 65536</translation>
<translation id="958102129872905095" key="MSG_PORT_MAPPINGS_TARGET_PORT_EMPTY_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies an empty target port number and a port number is already there (in the port mappings section on the deploy page).">Target port can't be empty when port is specified.</translation>
<translation id="1603454081570532220" key="MSG_PORT_MAPPINGS_PROTOCOL_LABEL" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="Label 'Protocol' above the protocol selection box in the port mappings section, on the deploy page.">Protocol</translation>
<translation id="520366299646638360" key="MSG_PORT_MAPPINGS_PROTOCOL_REQUIRED_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user does not specify a protocol for an existing port mapping (in the port mappings section, on the deploy page).">Protocol is required</translation>
<translation id="1660903123116357917" key="MSG_PORT_MAPPINGS_PROTOCOL_INVALID_WARNING" source="/home/mirchev/go_workspace/src/github.com/kubernetes/dashboard/.tmp/serve/app-dev.js" desc="This warning appears when the user specifies an invalid protocol for a port mapping (in the port mappings section, on the deploy page).">Invalid protocol</translation>
</translationbundle>
\ No newline at end of file
......@@ -21,16 +21,17 @@ limitations under the License.
kd-validate="labelKeyNameLength,labelKeyPrefixLength,labelKeyNamePattern,labelKeyPrefixPattern"
ng-model-options="{allowInvalid: true}">
<ng-messages for="labelForm.key.$error" ng-if="labelForm.key.$touched && labelForm.key.$invalid">
<ng-message when="unique">{{labelCtrl.label.key}} is not unique.</ng-message>
<ng-message when="unique">
{{labelCtrl.label.key}} {{::labelCtrl.i18n.MSG_DEPLOY_LABEL_KEY_NOT_UNIQUE_WARNING}}
</ng-message>
<ng-message when="kdValidLabelKeyPrefixPattern">
Prefix is not a valid DNS subdomain prefix. Example: my-domain.com
{{::labelCtrl.i18n.MSG_DEPLOY_LABEL_KEY_PREFIX_PATTERN_WARNING}}
</ng-message>
<ng-message when="kdValidLabelKeyNamePattern">
Label key name must be alphanumeric separated by '-', '_' or '.',
optionally prefixed by a DNS subdomain and '/'
{{::labelCtrl.i18n.MSG_DEPLOY_LABEL_KEY_NAME_PATTERN_WARNING}}
</ng-message>
<ng-message when="kdValidLabelKeyPrefixLength">Prefix should not exceed 253 characters</ng-message>
<ng-message when="kdValidLabelKeyNameLength">Label Key name should not exceed 63 characters</ng-message>
<ng-message when="kdValidLabelKeyPrefixLength">{{::labelCtrl.i18n.MSG_DEPLOY_LABEL_KEY_PREFIX_MAX_LENGTH_WARNING}}</ng-message>
<ng-message when="kdValidLabelKeyNameLength">{{::labelCtrl.i18n.MSG_DEPLOY_LABEL_KEY_NAME_MAX_LENGTH_WARNING}}</ng-message>
</ng-messages>
</md-input-container>
<p flex="5"></p>
......@@ -41,9 +42,9 @@ limitations under the License.
ng-model-options="{ getterSetter: true, allowInvalid: true }">
<ng-messages for="labelForm.value.$error" ng-if="labelForm.value.$touched && labelForm.value.$invalid">
<ng-message when="kdValidLabelValuePattern">
Label value must be alphanumeric separated by '.' , '-' or '_'
{{::labelCtrl.i18n.MSG_DEPLOY_LABEL_VALUE_PATTERN_WARNING}}
</ng-message>
<ng-message when="maxlength">Label Value must not exceed 253 characters</ng-message>
<ng-message when="maxlength">{{::labelCtrl.i18n.MSG_DEPLOY_LABEL_VALUE_MAX_LENGTH_WARNING}}</ng-message>
</ng-messages>
</md-input-container>
<md-button type="button" ng-show="labelCtrl.isRemovable()"
......
......@@ -28,6 +28,9 @@ export default class DeployLabelController {
/** @export {!Array<!DeployLabel>} Initialized from the scope. */
this.labels;
/** @export */
this.i18n = i18n;
}
/**
......@@ -131,3 +134,29 @@ export default class DeployLabelController {
*/
isFilled_(label) { return label.key.length !== 0 && label.value().length !== 0; }
}
const i18n = {
/** @export {string} @desc This warning appears when the key of a specified kubernetes label on the deploy page is not unique.*/
MSG_DEPLOY_LABEL_KEY_NOT_UNIQUE_WARNING:
goog.getMsg('{$labelKey} is not unique.', {labelKey: ''}),
/** @export {string} @desc This warning appears when the key of a specified kubernetes label (on the deploy page) does not start with a proper prefix. */
MSG_DEPLOY_LABEL_KEY_PREFIX_PATTERN_WARNING:
goog.getMsg('Prefix is not a valid DNS subdomain prefix. Example: my-domain.com'),
/** @export {string} @desc This warning appears when the key name of a specified kubernetes label (on the deploy page) does not match the required pattern.*/
MSG_DEPLOY_LABEL_KEY_NAME_PATTERN_WARNING: goog.getMsg(
`Label key name must be alphanumeric separated by '-', '_' or '.', ` +
`optionally prefixed by a DNS subdomain and '/'`),
/** @export {string} @desc This warning appears when the key prefix of a specified kubernetes label (on the deploy page) is too long.*/
MSG_DEPLOY_LABEL_KEY_PREFIX_MAX_LENGTH_WARNING:
goog.getMsg('Prefix should not exceed 253 characters'),
/** @export {string} @desc This warning appears when the key name of a specified kubernetes label (on the deploy page) is too long.*/
MSG_DEPLOY_LABEL_KEY_NAME_MAX_LENGTH_WARNING:
goog.getMsg('Label Key name should not exceed 63 characters'),
/** @export {string} @desc This warning appears when the value of a specified kubernetes label (on the deploy page) does not match the required pattern.*/
MSG_DEPLOY_LABEL_VALUE_PATTERN_WARNING:
goog.getMsg(`Label value must be alphanumeric separated by '.' , '-' or '_'`),
/** @export {string} @desc This warning appears when the value of a specified kubernetes label (on the deploy page) is too long.*/
MSG_DEPLOY_LABEL_VALUE_MAX_LENGTH_WARNING:
goog.getMsg('Label Value must not exceed 253 characters'),
};
......@@ -15,7 +15,7 @@ limitations under the License.
-->
<md-input-container class="md-block">
<label>Service</label>
<label>{{::ctrl.i18n.MSG_PORT_MAPPINGS_SERVICE_LABEL}}</label>
<md-select ng-model="ctrl.serviceType" ng-change="ctrl.changeServiceType()" required>
<md-option ng-repeat="serviceType in ctrl.serviceTypes" ng-value="serviceType">
{{serviceType.label}}
......@@ -25,32 +25,32 @@ limitations under the License.
<div ng-repeat="portMapping in ctrl.portMappings">
<ng-form name="portMappingForm" layout="row">
<md-input-container flex="50" class="kd-deploy-input-row">
<label>Port</label>
<label>{{::ctrl.i18n.MSG_PORT_MAPPINGS_PORT_LABEL}}</label>
<input ng-model="portMapping.port" ng-change="ctrl.checkPortMapping(portMappingForm, $index)"
type="number" min="1" max="65535" name="port" ng-required="ctrl.isFirst($index)">
<ng-messages for="portMappingForm.port.$error" role="alert" >
<ng-message when="number">Port must be an integer.</ng-message>
<ng-message when="min">Port must greater than 0.</ng-message>
<ng-message when="max">Port must less than 65536.</ng-message>
<ng-message when="empty">Port can't be empty when target port is specified.</ng-message>
<ng-message when="number">{{::ctrl.i18n.MSG_PORT_MAPPINGS_PORT_INTEGER_WARNING}}</ng-message>
<ng-message when="min">{{::ctrl.i18n.MSG_PORT_MAPPINGS_PORT_NEGATIVE_WARNING}}</ng-message>
<ng-message when="max">{{::ctrl.i18n.MSG_PORT_MAPPINGS_PORT_MAX_VALUE_WARNING}}</ng-message>
<ng-message when="empty">{{::ctrl.i18n.MSG_PORT_MAPPINGS_PORT_EMPTY_WARNING}}</ng-message>
</ng-messages>
</md-input-container>
<div flex="5"></div>
<md-input-container flex="50" class="kd-deploy-input-row">
<label>Target port</label>
<label>{{::ctrl.i18n.MSG_PORT_MAPPINGS_TARGET_PORT_LABEL}}</label>
<input ng-model="portMapping.targetPort"
ng-change="ctrl.checkPortMapping(portMappingForm, $index)"
type="number" min="1" max="65535" name="targetPort" ng-required="ctrl.isFirst($index)">
<ng-messages for="portMappingForm.targetPort.$error" role="alert" >
<ng-message when="number">Target port must be an integer.</ng-message>
<ng-message when="min">Target port must greater than 0.</ng-message>
<ng-message when="max">Target port must less than 65536.</ng-message>
<ng-message when="empty">Target port can't be empty when port is specified.</ng-message>
<ng-message when="number">{{::ctrl.i18n.MSG_PORT_MAPPINGS_TARGET_PORT_INTEGER_WARNING}}</ng-message>
<ng-message when="min">{{::ctrl.i18n.MSG_PORT_MAPPINGS_TARGET_PORT_NEGATIVE_WARNING}}</ng-message>
<ng-message when="max">{{::ctrl.i18n.MSG_PORT_MAPPINGS_TARGET_PORT_MAX_VALUE_WARNING}}</ng-message>
<ng-message when="empty">{{::ctrl.i18n.MSG_PORT_MAPPINGS_TARGET_PORT_EMPTY_WARNING}}</ng-message>
</ng-messages>
</md-input-container>
<div flex="5"></div>
<md-input-container flex="none" class="kd-deploy-input-row">
<label>Protocol</label>
<label>{{::ctrl.i18n.MSG_PORT_MAPPINGS_PROTOCOL_LABEL}}</label>
<md-select ng-model="portMapping.protocol" name="protocol" is-external="ctrl.isExternal"
required kd-valid-protocol>
<md-option ng-repeat="protocol in ctrl.protocols" ng-value="protocol">
......@@ -61,8 +61,8 @@ limitations under the License.
ng-show="portMappingForm.protocol.$pending">
</md-progress-linear>
<ng-messages for="portMappingForm.protocol.$error" role="alert" multiple>
<ng-message when="required">Protocol is required.</ng-message>
<ng-message when="validProtocol">Invalid protocol.</ng-message>
<ng-message when="required">{{::ctrl.i18n.MSG_PORT_MAPPINGS_PROTOCOL_REQUIRED_WARNING}}</ng-message>
<ng-message when="validProtocol">{{::ctrl.i18n.MSG_PORT_MAPPINGS_PROTOCOL_INVALID_WARNING}}</ng-message>
</md-input-container>
<div flex="10">
<md-button type="button" ng-if="ctrl.isRemovable($index)"
......
......@@ -12,25 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/** @final */
class ServiceType {
constructor(label, external) {
/** @export {string} */
this.label = label;
/** @export {boolean} */
this.external = external;
}
}
/** @type {ServiceType} */
export const NO_SERVICE = new ServiceType('None', false);
/** @type {ServiceType} */
export const INT_SERVICE = new ServiceType('Internal', false);
/** @type {ServiceType} */
export const EXT_SERVICE = new ServiceType('External', true);
/**
* Controller for the port mappings directive.
*
......@@ -68,6 +49,9 @@ export default class PortMappingsController {
* @export {ServiceType}
*/
this.serviceType = NO_SERVICE;
/** @export */
this.i18n = i18n;
}
/**
......@@ -181,3 +165,63 @@ export default class PortMappingsController {
*/
isFirst(index) { return (index === 0); }
}
const i18n = {
/** @export {string} @desc Label 'Service' above the service type selection box on the deploy page.*/
MSG_PORT_MAPPINGS_SERVICE_LABEL: goog.getMsg('Service'),
/** @export {string} @desc Label 'None', which appears as an option in the service type selection box on the deploy page.*/
MSG_PORT_MAPPINGS_SERVICE_TYPE_NONE_LABEL: goog.getMsg('None'),
/** @export {string} @desc Label 'Internal', which appears as an option in the service type selection box on the deploy page.*/
MSG_PORT_MAPPINGS_SERVICE_TYPE_INTERNAL_LABEL: goog.getMsg('Internal'),
/** @export {string} @desc Label 'External', which appears as an option in the service type selection box on the deploy page.*/
MSG_PORT_MAPPINGS_SERVICE_TYPE_EXTERNAL_LABEL: goog.getMsg('External'),
/** @export {string} @desc Label 'Port', which serves as a placeholder for the port input field in the port mappings section on the deploy page.*/
MSG_PORT_MAPPINGS_PORT_LABEL: goog.getMsg('Port'),
/** @export {string} @desc This warning appears when the user specifies a non-integer port number in the port mappings section on the deploy page.*/
MSG_PORT_MAPPINGS_PORT_INTEGER_WARNING: goog.getMsg('Port must be an integer'),
/** @export {string} @desc This warning appears when the user specifies a negative port number in the port mappings section on the deploy page.*/
MSG_PORT_MAPPINGS_PORT_NEGATIVE_WARNING: goog.getMsg('Port must greater than 0'),
/** @export {string} @desc This warning appears when a typed in port number exceeds the maximum allowed value (in the port mappings section on the deploy page).*/
MSG_PORT_MAPPINGS_PORT_MAX_VALUE_WARNING: goog.getMsg('Port must less than 65536'),
/** @export {string} @desc This warning appears when the user specifies an empty port number and a target port number is already there (in the port mappings section on the deploy page).*/
MSG_PORT_MAPPINGS_PORT_EMPTY_WARNING:
goog.getMsg(`Port can't be empty when target port is specified.`),
/** @export {string} @desc Label 'Target port', which serves as a placeholder for the target port input field in the port mappings section on the deploy page.*/
MSG_PORT_MAPPINGS_TARGET_PORT_LABEL: goog.getMsg('Target port'),
/** @export {string} @desc This warning appears when the user specifies a non-integer target port number in the port mappings section on the deploy page.*/
MSG_PORT_MAPPINGS_TARGET_PORT_INTEGER_WARNING: goog.getMsg('Target port must be an integer'),
/** @export {string} @desc This warning appears when the user specifies a negative target port number in the port mappings section on the deploy page.*/
MSG_PORT_MAPPINGS_TARGET_PORT_NEGATIVE_WARNING: goog.getMsg('Target port must greater than 0'),
/** @export {string} @desc This warning appears when a typed in target port number exceeds the maximum allowed value (in the port mappings section on the deploy page).*/
MSG_PORT_MAPPINGS_TARGET_PORT_MAX_VALUE_WARNING: goog.getMsg('Target port must less than 65536'),
/** @export {string} @desc This warning appears when the user specifies an empty target port number and a port number is already there (in the port mappings section on the deploy page).*/
MSG_PORT_MAPPINGS_TARGET_PORT_EMPTY_WARNING:
goog.getMsg(`Target port can't be empty when port is specified.`),
/** @export {string} @desc Label 'Protocol' above the protocol selection box in the port mappings section, on the deploy page.*/
MSG_PORT_MAPPINGS_PROTOCOL_LABEL: goog.getMsg('Protocol'),
/** @export {string} @desc This warning appears when the user does not specify a protocol for an existing port mapping (in the port mappings section, on the deploy page).*/
MSG_PORT_MAPPINGS_PROTOCOL_REQUIRED_WARNING: goog.getMsg('Protocol is required'),
/** @export {string} @desc This warning appears when the user specifies an invalid protocol for a port mapping (in the port mappings section, on the deploy page).*/
MSG_PORT_MAPPINGS_PROTOCOL_INVALID_WARNING: goog.getMsg('Invalid protocol'),
};
/** @final */
class ServiceType {
constructor(label, external) {
/** @export {string} */
this.label = label;
/** @export {boolean} */
this.external = external;
}
}
/** @type {ServiceType} */
export const NO_SERVICE = new ServiceType(i18n.MSG_PORT_MAPPINGS_SERVICE_TYPE_NONE_LABEL, false);
/** @type {ServiceType} */
export const INT_SERVICE =
new ServiceType(i18n.MSG_PORT_MAPPINGS_SERVICE_TYPE_INTERNAL_LABEL, false);
/** @type {ServiceType} */
export const EXT_SERVICE =
new ServiceType(i18n.MSG_PORT_MAPPINGS_SERVICE_TYPE_EXTERNAL_LABEL, true);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册