// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
// with the License. A copy of the License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
// limitations under the License.
// Fameworks
import * as React from 'react'
// UI Elements
import {
Button,
Container,
ExpandableSection,
FormField,
Header,
Input,
Link,
SpaceBetween,
Checkbox,
} from '@cloudscape-design/components'
// State
import {setState, useState, getState, clearState} from '../../store'
// Components
import {HelpTextInput} from './Components'
import {Trans, useTranslation} from 'react-i18next'
import TitleDescriptionHelpPanel from '../../components/help-panel/TitleDescriptionHelpPanel'
import InfoLink from '../../components/InfoLink'
// Constants
const errorsPath = ['app', 'wizard', 'errors', 'multiUser']
const dsPath = ['app', 'wizard', 'config', 'DirectoryService']
function multiUserValidate() {
let valid = true
const checkRequired = (key: any) => {
const value = getState([...dsPath, key])
if (!value || value === '') {
console.log('invalid: ', key, 'setting: ', [...errorsPath, key])
setState([...errorsPath, key], `You must specify a value for ${key}.`)
valid = false
} else {
clearState([...errorsPath, key])
}
}
checkRequired('DomainName')
checkRequired('DomainAddr')
checkRequired('PasswordSecretArn')
checkRequired('DomainReadOnlyUser')
return valid
}
function HelpToggle({name, configKey, description, help, defaultValue}: any) {
let value = useState([...dsPath, configKey])
let error = useState([...errorsPath, configKey])
return (