Show workspace name rules (#2217)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2022-07-06 16:12:46 +06:00 committed by GitHub
parent 1bc3e96df6
commit ca750eb123
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 11 deletions

View File

@ -6,12 +6,13 @@
import Label from './Label.svelte'
export let status: Status
export let overflow: boolean = true
</script>
<div class="flex-center overflow-label container {status.severity}">
<div class="flex-center container {status.severity}" class:overflow-label={overflow}>
{#if status.severity !== Severity.OK}
<Info size={'small'} />
<div class="text-sm ml-2 overflow-label"><Label label={status.code} params={status.params} /></div>
<div class="text-sm ml-2" class:overflow-label={overflow}><Label label={status.code} params={status.params} /></div>
{/if}
</div>

View File

@ -3,7 +3,7 @@
"RequiredField": "Required field {field}",
"FieldsDoNotMatch": "{field} don't match {field2}",
"ConnectingToServer": "Connecting to server....",
"IncorrectValue": "Incorrect value {field}"
"IncorrectValue": "Incorrect value {field}. {descr}"
},
"string": {
"LogIn": "Login",
@ -27,6 +27,7 @@
"InviteNote": "Link is valid for 1 hour",
"WantAnotherWorkspace": "Want to create another workspace?",
"ChangeAccount": "Change account",
"NotSeeingWorkspace": "Not seeing your workspace?"
"NotSeeingWorkspace": "Not seeing your workspace?",
"WorksaceNameRule": "The workspace name can contains lowercase letters, numbers, and symbols !@#%&^-"
}
}

View File

@ -3,7 +3,7 @@
"RequiredField": "Требуется заполнить {field}",
"FieldsDoNotMatch": "{field} не совпадает {field2}",
"ConnectingToServer": "Подключение к серверу....",
"IncorrectValue": "Неправильное значение {field}"
"IncorrectValue": "Неправильное значение {field}. {descr}"
},
"string": {
"LogIn": "Вход",
@ -27,6 +27,7 @@
"InviteNote": "Ссылка действительна 1 час",
"WantAnotherWorkspace": "Хотите создать другое рабочее пространство?",
"ChangeAccount": "Сменить пользователя",
"NotSeeingWorkspace": "Не видите ваше рабочее пространство?"
"NotSeeingWorkspace": "Не видите ваше рабочее пространство?",
"WorksaceNameRule": "Название рабочего пространства должно состояить из строчных латинских букв, цифр и символов !@#%&^-"
}
}

View File

@ -29,7 +29,14 @@
import { workbenchId } from '@anticrm/workbench'
import InviteLink from './InviteLink.svelte'
const fields = [{ name: 'workspace', i18n: login.string.Workspace, rule: /^[0-9a-z#%&^\-@!)(]{3,63}$/ }]
const fields = [
{
name: 'workspace',
i18n: login.string.Workspace,
rule: /^[0-9a-z#%&^\-@!)(]{3,63}$/,
ruleDescr: login.string.WorksaceNameRule
}
]
const object = {
workspace: ''

View File

@ -30,6 +30,7 @@
optional?: boolean
short?: boolean
rule?: RegExp
ruleDescr?: IntlString
}
interface Action {
@ -71,7 +72,10 @@
}
if (f.rule !== undefined) {
if (!f.rule.test(v)) {
status = new Status(Severity.INFO, login.status.IncorrectValue, { field: await translate(field.i18n, {}) })
status = new Status(Severity.INFO, login.status.IncorrectValue, {
field: await translate(field.i18n, {}),
descr: field.ruleDescr ? await translate(field.ruleDescr, {}) : ''
})
return
}
}

View File

@ -23,7 +23,7 @@
{#if status.severity !== Severity.OK}
<div class="flex-row-center container" class:error={status.severity === Severity.ERROR}>
<StatusControl {status} />
<StatusControl {status} overflow={false} />
</div>
{/if}

View File

@ -24,7 +24,7 @@ export default mergeIds(loginId, login, {
RequiredField: '' as StatusCode<{ field: string }>,
FieldsDoNotMatch: '' as StatusCode<{ field: string, field2: string }>,
ConnectingToServer: '' as StatusCode,
IncorrectValue: '' as StatusCode<{ field: string }>
IncorrectValue: '' as StatusCode<{ field: string, descr: string }>
},
string: {
CreateWorkspace: '' as IntlString,
@ -48,6 +48,7 @@ export default mergeIds(loginId, login, {
WantAnotherWorkspace: '' as IntlString,
NotSeeingWorkspace: '' as IntlString,
ChangeAccount: '' as IntlString,
InviteNote: '' as IntlString
InviteNote: '' as IntlString,
WorksaceNameRule: '' as IntlString
}
})