mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
TSK-887 InviteSettings should not depend on login-resources (#2799)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
b0abf93487
commit
d7265f033f
@ -45,7 +45,7 @@
|
||||
"@hcengineering/panel": "^0.6.1",
|
||||
"@hcengineering/view-resources": "^0.6.0",
|
||||
"@hcengineering/attachment": "^0.6.1",
|
||||
"@hcengineering/login-resources": "^0.6.2",
|
||||
"@hcengineering/login": "^0.6.1",
|
||||
"@hcengineering/templates": "^0.6.0",
|
||||
"@hcengineering/image-cropper": "^0.6.0"
|
||||
}
|
||||
|
@ -16,7 +16,8 @@
|
||||
<script lang="ts">
|
||||
import { Employee, EmployeeAccount, getFirstName, getLastName, Person } from '@hcengineering/contact'
|
||||
import { AccountRole, getCurrentAccount, Ref, Space } from '@hcengineering/core'
|
||||
import { changeName } from '@hcengineering/login-resources'
|
||||
import login from '@hcengineering/login'
|
||||
import { getResource } from '@hcengineering/platform'
|
||||
import { AttributeEditor, createQuery, getClient } from '@hcengineering/presentation'
|
||||
import setting, { IntegrationType } from '@hcengineering/setting'
|
||||
import { createFocusManager, EditBox, FocusHandler } from '@hcengineering/ui'
|
||||
@ -55,12 +56,14 @@
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
function firstNameChange () {
|
||||
changeName(firstName, getLastName(object.name))
|
||||
async function firstNameChange () {
|
||||
const changeName = await getResource(login.function.ChangeName)
|
||||
await changeName(firstName, getLastName(object.name))
|
||||
}
|
||||
|
||||
function lastNameChange () {
|
||||
changeName(getFirstName(object.name), lastName)
|
||||
async function lastNameChange () {
|
||||
const changeName = await getResource(login.function.ChangeName)
|
||||
await changeName(getFirstName(object.name), lastName)
|
||||
}
|
||||
|
||||
function changeDisplayName () {
|
||||
|
@ -15,7 +15,8 @@
|
||||
<script lang="ts">
|
||||
import { Channel, ChannelProvider, Employee, getName } from '@hcengineering/contact'
|
||||
import core, { Doc, DocumentUpdate, Mixin, Ref, TxProcessor } from '@hcengineering/core'
|
||||
import { leaveWorkspace } from '@hcengineering/login-resources'
|
||||
import login from '@hcengineering/login'
|
||||
import { getResource } from '@hcengineering/platform'
|
||||
import { Card, createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { DatePresenter, Grid, Toggle } from '@hcengineering/ui'
|
||||
import { isCollectionAttr, StringEditor } from '@hcengineering/view-resources'
|
||||
@ -113,7 +114,8 @@
|
||||
}
|
||||
const account = await client.findOne(contact.class.EmployeeAccount, { employee: value._id })
|
||||
if (account !== undefined) {
|
||||
leaveWorkspace(account.email)
|
||||
const leaveWorkspace = await getResource(login.function.LeaveWorkspace)
|
||||
await leaveWorkspace(account.email)
|
||||
}
|
||||
dispatch('close')
|
||||
}
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
import { Channel, Contact, Employee, getGravatarUrl, getName } from '@hcengineering/contact'
|
||||
import { Class, Client, DocumentQuery, Ref, RelatedDocument, WithLookup } from '@hcengineering/core'
|
||||
import { leaveWorkspace } from '@hcengineering/login-resources'
|
||||
import { IntlString, Resources } from '@hcengineering/platform'
|
||||
import login from '@hcengineering/login'
|
||||
import { getResource, IntlString, Resources } from '@hcengineering/platform'
|
||||
import { getClient, getFileUrl, MessageBox, ObjectSearchResult } from '@hcengineering/presentation'
|
||||
import { AnyComponent, AnySvelteComponent, showPopup } from '@hcengineering/ui'
|
||||
import AccountArrayEditor from './components/AccountArrayEditor.svelte'
|
||||
@ -194,7 +194,9 @@ async function kickEmployee (doc: Employee): Promise<void> {
|
||||
(res?: boolean) => {
|
||||
if (res === true) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
leaveWorkspace(email.email)
|
||||
getResource(login.function.LeaveWorkspace).then(async (f) => {
|
||||
await f(email.email)
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -27,8 +27,6 @@ export default mergeIds(contactId, contact, {
|
||||
CreatePerson: '' as IntlString,
|
||||
OrganizationNamePlaceholder: '' as IntlString,
|
||||
OrganizationsNamePlaceholder: '' as IntlString,
|
||||
PersonFirstNamePlaceholder: '' as IntlString,
|
||||
PersonLastNamePlaceholder: '' as IntlString,
|
||||
PersonLocationPlaceholder: '' as IntlString,
|
||||
PersonsNamePlaceholder: '' as IntlString,
|
||||
Organizations: '' as IntlString,
|
||||
@ -65,7 +63,6 @@ export default mergeIds(contactId, contact, {
|
||||
Inactive: '' as IntlString,
|
||||
NotSpecified: '' as IntlString,
|
||||
MergeEmployee: '' as IntlString,
|
||||
DisplayName: '' as IntlString,
|
||||
SelectAvatar: '' as IntlString,
|
||||
GravatarsManaged: '' as IntlString,
|
||||
|
||||
|
@ -241,7 +241,10 @@ export const contactPlugin = plugin(contactId, {
|
||||
CreateOrganization: '' as IntlString,
|
||||
UseImage: '' as IntlString,
|
||||
UseGravatar: '' as IntlString,
|
||||
UseColor: '' as IntlString
|
||||
UseColor: '' as IntlString,
|
||||
PersonFirstNamePlaceholder: '' as IntlString,
|
||||
PersonLastNamePlaceholder: '' as IntlString,
|
||||
DisplayName: '' as IntlString
|
||||
},
|
||||
viewlet: {
|
||||
TableMember: '' as Ref<Viewlet>,
|
||||
|
@ -38,6 +38,7 @@
|
||||
"EmailMask": "Email mask:",
|
||||
"InviteLimit": "Invite limit:",
|
||||
"GetLink": "Get invite link",
|
||||
"NoLimit": "No limit"
|
||||
"NoLimit": "No limit",
|
||||
"AlreadyJoined": "Already joined?"
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@
|
||||
"EmailMask": "Маска для электронной почты:",
|
||||
"InviteLimit": "Предел использований:",
|
||||
"GetLink": "Получить ссылку",
|
||||
"NoLimit": "Без предела использований"
|
||||
"NoLimit": "Без предела использований",
|
||||
"AlreadyJoined": "Уже подключены?"
|
||||
}
|
||||
}
|
||||
|
@ -13,15 +13,16 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { OK, Status, Severity, setMetadata } from '@hcengineering/platform'
|
||||
import { OK, setMetadata, Severity, Status } from '@hcengineering/platform'
|
||||
import { fetchMetadataLocalStorage, getCurrentLocation, navigate, setMetadataLocalStorage } from '@hcengineering/ui'
|
||||
|
||||
import Form from './Form.svelte'
|
||||
import { checkJoined, join, signUpJoin } from '../utils'
|
||||
import Form from './Form.svelte'
|
||||
|
||||
import presentation from '@hcengineering/presentation'
|
||||
import login from '../plugin'
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
import { onMount } from 'svelte'
|
||||
import login from '../plugin'
|
||||
|
||||
const location = getCurrentLocation()
|
||||
let page = 'login'
|
||||
@ -103,7 +104,7 @@
|
||||
}
|
||||
|
||||
const loginAction = {
|
||||
caption: login.string.HaveAccount,
|
||||
caption: login.string.AlreadyJoined,
|
||||
i18n: login.string.LogIn,
|
||||
func: () => {
|
||||
const loc = getCurrentLocation()
|
||||
|
@ -14,8 +14,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import LoginApp from './components/LoginApp.svelte'
|
||||
import InviteLink from './components/InviteLink.svelte'
|
||||
import LoginApp from './components/LoginApp.svelte'
|
||||
import { changeName, changePassword, getWorkspaces, leaveWorkspace, selectWorkspace } from './utils'
|
||||
/*!
|
||||
* Anticrm Platform™ Login Plugin
|
||||
* © 2020, 2021 Anticrm Platform Contributors.
|
||||
@ -27,6 +28,13 @@ export default async () => ({
|
||||
component: {
|
||||
LoginApp,
|
||||
InviteLink
|
||||
},
|
||||
function: {
|
||||
ChangeName: changeName,
|
||||
LeaveWorkspace: leaveWorkspace,
|
||||
ChangePassword: changePassword,
|
||||
SelectWorkspace: selectWorkspace,
|
||||
GetWorkspaces: getWorkspaces
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
*/
|
||||
|
||||
import type { StatusCode, IntlString } from '@hcengineering/platform'
|
||||
import type { IntlString, StatusCode } from '@hcengineering/platform'
|
||||
import { mergeIds } from '@hcengineering/platform'
|
||||
|
||||
import login, { loginId } from '@hcengineering/login'
|
||||
@ -55,10 +55,7 @@ export default mergeIds(loginId, login, {
|
||||
PasswordRecovery: '' as IntlString,
|
||||
RecoveryLinkSent: '' as IntlString,
|
||||
UseWorkspaceInviteSettings: '' as IntlString,
|
||||
LinkValidHours: '' as IntlString,
|
||||
EmailMask: '' as IntlString,
|
||||
InviteLimit: '' as IntlString,
|
||||
GetLink: '' as IntlString,
|
||||
NoLimit: '' as IntlString
|
||||
AlreadyJoined: '' as IntlString
|
||||
}
|
||||
})
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import login from '@hcengineering/login'
|
||||
import login, { LoginInfo, Workspace, WorkspaceLoginInfo } from '@hcengineering/login'
|
||||
import {
|
||||
getMetadata,
|
||||
OK,
|
||||
@ -36,20 +36,6 @@ import {
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
import presentation from '@hcengineering/presentation'
|
||||
|
||||
export interface WorkspaceLoginInfo extends LoginInfo {
|
||||
workspace: string
|
||||
}
|
||||
|
||||
export interface LoginInfo {
|
||||
token: string
|
||||
endpoint: string
|
||||
email: string
|
||||
}
|
||||
|
||||
export interface Workspace {
|
||||
workspace: string
|
||||
}
|
||||
|
||||
const DEV_WORKSPACE = 'DEV WORKSPACE'
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Plugin, Asset, Metadata } from '@hcengineering/platform'
|
||||
import type { Asset, IntlString, Metadata, Plugin, Resource, Status } from '@hcengineering/platform'
|
||||
import { plugin } from '@hcengineering/platform'
|
||||
import type { AnyComponent } from '@hcengineering/ui'
|
||||
|
||||
@ -22,6 +22,29 @@ import type { AnyComponent } from '@hcengineering/ui'
|
||||
*/
|
||||
export const loginId = 'login' as Plugin
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Workspace {
|
||||
workspace: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface WorkspaceLoginInfo extends LoginInfo {
|
||||
workspace: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface LoginInfo {
|
||||
token: string
|
||||
endpoint: string
|
||||
email: string
|
||||
}
|
||||
|
||||
export default plugin(loginId, {
|
||||
metadata: {
|
||||
AccountsUrl: '' as Asset,
|
||||
@ -37,5 +60,18 @@ export default plugin(loginId, {
|
||||
},
|
||||
icon: {
|
||||
InviteWorkspace: '' as Asset
|
||||
},
|
||||
string: {
|
||||
LinkValidHours: '' as IntlString,
|
||||
EmailMask: '' as IntlString,
|
||||
NoLimit: '' as IntlString,
|
||||
InviteLimit: '' as IntlString
|
||||
},
|
||||
function: {
|
||||
ChangeName: '' as Resource<(first: string, last: string) => Promise<void>>,
|
||||
LeaveWorkspace: '' as Resource<(email: string) => Promise<void>>,
|
||||
ChangePassword: '' as Resource<(oldPassword: string, password: string) => Promise<void>>,
|
||||
SelectWorkspace: '' as Resource<(workspace: string) => Promise<[Status, WorkspaceLoginInfo | undefined]>>,
|
||||
GetWorkspaces: '' as Resource<() => Promise<Workspace[]>>
|
||||
}
|
||||
})
|
||||
|
@ -42,7 +42,6 @@
|
||||
"@hcengineering/presentation": "^0.6.2",
|
||||
"@hcengineering/view": "^0.6.2",
|
||||
"@hcengineering/view-resources": "^0.6.0",
|
||||
"@hcengineering/login-resources": "^0.6.2",
|
||||
"@hcengineering/task": "^0.6.2",
|
||||
"@hcengineering/contact-resources": "^0.6.0",
|
||||
"@hcengineering/login": "^0.6.1",
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import login from '@hcengineering/login-resources/src/plugin'
|
||||
import login from '@hcengineering/login'
|
||||
import presentation, { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import setting, { InviteSettings } from '@hcengineering/setting'
|
||||
import { Button, EditBox, MiniToggle } from '@hcengineering/ui'
|
||||
|
@ -16,9 +16,10 @@
|
||||
import setting from '@hcengineering/setting'
|
||||
import presentation from '@hcengineering/presentation'
|
||||
import { Button, EditBox, Icon, Label } from '@hcengineering/ui'
|
||||
import { changePassword } from '@hcengineering/login-resources'
|
||||
import login from '@hcengineering/login'
|
||||
import Error from './icons/Error.svelte'
|
||||
import plugin from '../plugin'
|
||||
import { getResource } from '@hcengineering/platform'
|
||||
|
||||
let oldPassword: string = ''
|
||||
let password: string = ''
|
||||
@ -34,6 +35,7 @@
|
||||
label = setting.string.Saving
|
||||
saved = true
|
||||
try {
|
||||
const changePassword = await getResource(login.function.ChangePassword)
|
||||
await changePassword(oldPassword, password)
|
||||
label = setting.string.Saved
|
||||
} catch (e) {
|
||||
|
@ -13,14 +13,13 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { AttributeEditor, getClient } from '@hcengineering/presentation'
|
||||
|
||||
import contact, { EmployeeAccount, getFirstName, getLastName } from '@hcengineering/contact'
|
||||
import { ChannelsEditor, EditableAvatar, employeeByIdStore } from '@hcengineering/contact-resources'
|
||||
import contactRes from '@hcengineering/contact-resources/src/plugin'
|
||||
import { ChannelsEditor, employeeByIdStore } from '@hcengineering/contact-resources'
|
||||
import { getCurrentAccount } from '@hcengineering/core'
|
||||
import { changeName, leaveWorkspace } from '@hcengineering/login-resources'
|
||||
import { MessageBox } from '@hcengineering/presentation'
|
||||
import login from '@hcengineering/login'
|
||||
import { getResource } from '@hcengineering/platform'
|
||||
import { AttributeEditor, getClient, MessageBox } from '@hcengineering/presentation'
|
||||
import { EditableAvatar } from '@hcengineering/contact-resources'
|
||||
import { Button, createFocusManager, EditBox, FocusHandler, Icon, Label, showPopup } from '@hcengineering/ui'
|
||||
import setting from '../plugin'
|
||||
const client = getClient()
|
||||
@ -57,6 +56,7 @@
|
||||
undefined,
|
||||
async (res?: boolean) => {
|
||||
if (res === true) {
|
||||
const leaveWorkspace = await getResource(login.function.LeaveWorkspace)
|
||||
await leaveWorkspace(getCurrentAccount().email)
|
||||
}
|
||||
}
|
||||
@ -94,26 +94,28 @@
|
||||
</div>
|
||||
<div class="flex-grow flex-col">
|
||||
<EditBox
|
||||
placeholder={contactRes.string.PersonFirstNamePlaceholder}
|
||||
placeholder={contact.string.PersonFirstNamePlaceholder}
|
||||
bind:value={firstName}
|
||||
kind={'large-style'}
|
||||
focus
|
||||
focusIndex={1}
|
||||
on:change={() => {
|
||||
on:change={async () => {
|
||||
const changeName = await getResource(login.function.ChangeName)
|
||||
changeName(firstName, lastName)
|
||||
}}
|
||||
/>
|
||||
<EditBox
|
||||
placeholder={contactRes.string.PersonLastNamePlaceholder}
|
||||
placeholder={contact.string.PersonLastNamePlaceholder}
|
||||
bind:value={lastName}
|
||||
kind={'large-style'}
|
||||
focusIndex={2}
|
||||
on:change={() => {
|
||||
on:change={async () => {
|
||||
const changeName = await getResource(login.function.ChangeName)
|
||||
changeName(firstName, lastName)
|
||||
}}
|
||||
/>
|
||||
<EditBox
|
||||
placeholder={contactRes.string.DisplayName}
|
||||
placeholder={contact.string.DisplayName}
|
||||
bind:value={displayName}
|
||||
kind={'large-style'}
|
||||
focusIndex={2}
|
||||
|
@ -47,7 +47,6 @@
|
||||
"@hcengineering/notification-resources": "^0.6.0",
|
||||
"@hcengineering/preference": "^0.6.2",
|
||||
"@hcengineering/contact": "^0.6.11",
|
||||
"@hcengineering/view-resources": "^0.6.0",
|
||||
"@hcengineering/login-resources": "^0.6.2"
|
||||
"@hcengineering/view-resources": "^0.6.0"
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,8 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import login, { loginId } from '@hcengineering/login'
|
||||
import { getWorkspaces, selectWorkspace, Workspace } from '@hcengineering/login-resources'
|
||||
import login, { loginId, Workspace } from '@hcengineering/login'
|
||||
import { getResource } from '@hcengineering/platform'
|
||||
import {
|
||||
closePopup,
|
||||
fetchMetadataLocalStorage,
|
||||
@ -30,8 +30,9 @@
|
||||
import { workspacesStore } from '../utils'
|
||||
|
||||
onMount(() => {
|
||||
getWorkspaces().then((ws: Workspace[]) => {
|
||||
$workspacesStore = ws
|
||||
getResource(login.function.GetWorkspaces).then(async (f) => {
|
||||
const workspaces = await f()
|
||||
$workspacesStore = workspaces
|
||||
})
|
||||
})
|
||||
|
||||
@ -44,6 +45,7 @@
|
||||
const ws = p.workspace
|
||||
const token = tokens[ws]
|
||||
if (!token) {
|
||||
const selectWorkspace = await getResource(login.function.SelectWorkspace)
|
||||
const loginInfo = (await selectWorkspace(ws))[1]
|
||||
if (loginInfo !== undefined) {
|
||||
tokens[ws] = loginInfo?.token
|
||||
|
@ -59,6 +59,8 @@
|
||||
import NavHeader from './NavHeader.svelte'
|
||||
import Navigator from './Navigator.svelte'
|
||||
import SpaceView from './SpaceView.svelte'
|
||||
import login from '@hcengineering/login'
|
||||
import { workspacesStore } from '../utils'
|
||||
|
||||
let contentPanel: HTMLElement
|
||||
let shownMenu: boolean = false
|
||||
@ -101,6 +103,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
getResource(login.function.GetWorkspaces).then(async (f) => {
|
||||
const workspaces = await f()
|
||||
$workspacesStore = workspaces
|
||||
})
|
||||
})
|
||||
|
||||
let account = getCurrentAccount() as EmployeeAccount
|
||||
const accountQ = createQuery()
|
||||
accountQ.query(
|
||||
|
@ -25,7 +25,7 @@ import { getClient } from '@hcengineering/presentation'
|
||||
import type { Application } from '@hcengineering/workbench'
|
||||
import preference from '@hcengineering/preference'
|
||||
import { writable } from 'svelte/store'
|
||||
import { Workspace } from '@hcengineering/login-resources'
|
||||
import type { Workspace } from '@hcengineering/login'
|
||||
|
||||
export function classIcon (client: Client, _class: Ref<Class<Obj>>): Asset | undefined {
|
||||
return client.getHierarchy().getClass(_class).icon
|
||||
|
Loading…
Reference in New Issue
Block a user