Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finaliza observer #3804

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
.idea
.DS_Store
.vscode
.turbo
.turbo
run.sh
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "packages/illa-public-component"]
path = packages/illa-public-component
url = https://github.com/illacloud/illa-public-component.git
url = https://github.com/viniciussousaazevedo/illa-public-component
branch = beta
[submodule "packages/illa-design"]
path = packages/illa-design
url = https://github.com/illacloud/illa-design.git
url = https://github.com/viniciussousaazevedo/illa-design
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
2. 🤖 **自动化支持:** 连接一切组件,并在 5 秒内实现自动化。
3. 🖥 **本地部署:** 支持Docker和k8s
4. 📝 **Page支持:** 创建内容丰富且 UI 友好的工具的基础。
5. 🎨 **由 [ILLA Design](https://github.com/illacloud/illa-design) 提供支持:** 组件不应限制您的想象力。
5. 🎨 **由 [ILLA Design](https://github.com/viniciussousaazevedo/illa-design) 提供支持:** 组件不应限制您的想象力。

## 本地部署

Expand Down
2 changes: 1 addition & 1 deletion README-DE.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Sie können ILLA-Utilities auch manuell bereitstellen und selbst hosten [Docker,
2. 🤖 **Automatisierte Unterstützungt:** Verbinden Sie alles und automatisieren Sie es in 5 Sekunden
3. 🖥 **Selbst gehostet:** unterstützt Docker & k8s
4. 📝 **eitenunterstützung:** Die Basis für die Erstellung eines inhaltsreichen und UI-freundlichen Tools.
5. 🎨 ** [Angetrieben von ILLA Design](https://github.com/illacloud/illa-design):** : Komponenten sollten Ihre Fantasie nicht einschränken..
5. 🎨 ** [Angetrieben von ILLA Design](https://github.com/viniciussousaazevedo/illa-design):** : Komponenten sollten Ihre Fantasie nicht einschränken..

## Selbst gehostet

Expand Down
2 changes: 1 addition & 1 deletion README-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
2. 🤖 **サポートの自動化:** すべてを接続して 5 秒で自動化します。
3. 🖥 **自己ホスト型:** Docker と k8s をサポート
4. 📝 **ページのサポート:** コンテンツが豊富で UI に適したツールを作成するための基盤。
5. 🎨 **[ILLA Design](https://github.com/illacloud/illa-design) を利用:** コンポーネントによって想像力が制約されることはありません。
5. 🎨 **[ILLA Design](https://github.com/viniciussousaazevedo/illa-design) を利用:** コンポーネントによって想像力が制約されることはありません。
## Self-hosted

ILLA CLI を使用すると、ILLA Builder を想像よりも速く展開できます。 [ここをクリック](https://docs.illacloud.com/self-hosted-deployment) 詳細については。
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ You can also deploy and [self-host](https://docs.illacloud.com/self-hosted-deplo
2. 🤖 **Automate Support:** Connect everything and automate them in 5 seconds.
3. 🖥 **Self-hosted:** supports Docker & k8s
4. 📝 **Page Support:** The base of creating a content-rich and UI-friendly tool.
5. 🎨 **Powered by [ILLA Design](https://github.com/illacloud/illa-design):** Components should not constrain your imagination.
5. 🎨 **Powered by [ILLA Design](https://github.com/viniciussousaazevedo/illa-design):** Components should not constrain your imagination.

## Self-hosted

Expand Down
8 changes: 7 additions & 1 deletion apps/builder/.env.self
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
ILLA_API_BASE_URL=localhost:8000
ILLA_INSTANCE_ID=SELF_HOST_CLOUD
ILLA_APP_ENV=production
ILLA_APP_VERSION=0.0.0
ILLA_APP_ENV=development
ILLA_USE_HTTPS=false
ILLA_BUILDER_URL=http://localhost:8000/build
ILLA_CLOUD_URL=http://localhost:8000/cloud
ILLA_BASE_PATH=/build
6 changes: 5 additions & 1 deletion apps/cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"dependencies": {
"@emotion/cache": "^11.10.5",
"@emotion/core": "^11.0.0",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
"@illa-design/react": "workspace:*",
"@illa-design/table": "workspace:*",
"@illa-public/avatar": "workspace:*",
Expand All @@ -35,6 +37,8 @@
"@illa-public/user-data": "workspace:*",
"@illa-public/user-role-utils": "workspace:*",
"@illa-public/utils": "workspace:*",
"@mui/icons-material": "^5.14.18",
"@mui/material": "^5.15.21",
"@reduxjs/toolkit": "^2.0.1",
"axios": "^1.6.2",
"dayjs": "^1.11.10",
Expand All @@ -46,7 +50,7 @@
"react-hook-form": "^7.40.0",
"react-i18next": "^13.5.0",
"react-redux": "^9.0.4",
"react-router-dom": "^6.14.0",
"react-router-dom": "^6.16.0",
"swr": "^2.2.4",
"uuid": "^9.0.0"
},
Expand Down
29 changes: 29 additions & 0 deletions apps/cloud/src/page/user/SignUpPage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.signup-page-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f2f5;
}

.signup-title {
font-size: 36px;
font-weight: bold;
margin-bottom: 20px;
text-align: center;
}

.signup-form-container {
background-color: #fff;
padding: 40px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 400px;
}

.button-container {
display: flex;
justify-content: center;
}

9 changes: 7 additions & 2 deletions apps/cloud/src/page/user/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FC, useState } from "react"
import { SubmitHandler } from "react-hook-form"
import { useTranslation } from "react-i18next"
import { useNavigate, useSearchParams } from "react-router-dom"
import { useMessage } from "@illa-design/react"
import { Button, useMessage } from "@illa-design/react"
import { fetchSignIn } from "@/services/auth"

export type LoginErrorMsg = Record<keyof LoginFields, string>
Expand Down Expand Up @@ -78,7 +78,12 @@ const UserLogin: FC = () => {
}
}

return <LoginPage loading={loading} errorMsg={errorMsg} onSubmit={onSubmit} />
return (
<div>
<LoginPage loading={loading} errorMsg={errorMsg} onSubmit={onSubmit} />
<Button onClick={() => navigate("/signup")}>Sign Up</Button>
</div>
)
}

export default UserLogin
146 changes: 146 additions & 0 deletions apps/cloud/src/page/user/signup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import { setAuthToken } from "@illa-public/utils"
import { FC, useState } from "react"
import { SubmitHandler, useForm } from "react-hook-form"
import { useTranslation } from "react-i18next"
import { useNavigate } from "react-router-dom"
import { Button, Input, Select, Space } from "@illa-design/react"
import { useMessage } from "@illa-design/react"
import { fetchSignUp } from "@/services/auth"
import "./SignUpPage.css"

interface SignUpFields {
nickname: string
email: string
password: string
confirmPassword: string
role: string
}

const SignUpPage: FC = () => {
const message = useMessage()
const { t } = useTranslation()
const navigate = useNavigate()
const { register, handleSubmit, setValue } = useForm<SignUpFields>()
const [loading, setLoading] = useState(false)

const roleToNumber = (role: string): number => {
switch (role) {
case "OWNER":
return 1
case "ADMIN":
return 2
case "EDITOR":
return 3
case "VIEWER":
return 4
case "OBSERVER":
return 5
default:
return 0 // ou algum valor padrão ou erro
}
}

const onSubmit: SubmitHandler<SignUpFields> = async (data) => {
setLoading(true)
try {
console.log(data)

// Convertendo a role para número
const formattedData = {
...data,
role: roleToNumber(data.role),
}

const response = await fetchSignUp(formattedData)
const token = response.headers["illa-token"]
if (!token) return
setAuthToken(token)
message.success({
content: t("page.user.sign_up.tips.success"),
})
navigate("/login")
} catch (error) {
console.error(error)
} finally {
setLoading(false)
}
}

const handleRoleChange = (value?: string | undefined) => {
if (value) {
setValue("role", value)
}
}

return (
<div className="signup-page-container">
<h1 className="signup-title">Sign Up</h1>
<div className="signup-form-container">
<form onSubmit={handleSubmit(onSubmit)}>
<Space direction="vertical" size="large">
<div>
<label>Nickname</label>
<Input
{...register("nickname")}
onChange={(value) =>
register("nickname").onChange({ target: { value } })
}
/>
</div>

<div>
<label>e-mail</label>
<Input
type="email"
{...register("email")}
onChange={(value) =>
register("email").onChange({ target: { value } })
}
/>
</div>

<div>
<label>Password</label>
<Input
type="password"
{...register("password")}
onChange={(value) => ({ target: { value } })}
/>
</div>

<div>
<label>Password confirmation</label>
<Input
type="password"
{...register("confirmPassword")}
onChange={(value) => ({ target: { value } })}
/>
</div>

<div>
<label>Role</label>
<Select
options={[
{ label: "OWNER", value: "OWNER" },
{ label: "ADMIN", value: "ADMIN" },
{ label: "EDITOR", value: "EDITOR" },
{ label: "VIEWER", value: "VIEWER" },
{ label: "OBSERVER", value: "OBSERVER" },
]}
onChange={(value) => handleRoleChange(value as string)}
/>
</div>

<div className="button-container">
<Button type="submit" loading={loading}>
Register
</Button>
</div>
</Space>
</form>
</div>
</div>
)
}

export default SignUpPage
5 changes: 2 additions & 3 deletions apps/cloud/src/page/workspace/apps/pc/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ export const PCAppWorkspace = () => {
const currentTeamID = useSelector(getCurrentId)!
const currentTeamInfo = useSelector(getCurrentTeamInfo)
const userInfo = useSelector(getCurrentUser)

const canAccessApps = canAccess(
currentTeamInfo?.myRole ?? USER_ROLE.VIEWER,
currentTeamInfo?.myRole ?? USER_ROLE.OBSERVER,
ATTRIBUTE_GROUP.APP,
getPlanUtils(currentTeamInfo),
ACTION_ACCESS.VIEW,
Expand Down Expand Up @@ -195,7 +194,7 @@ export const PCAppWorkspace = () => {
return (
<div css={appContainerStyle}>
<DashboardHeader
titleName={t("page.workspace.menu.apps")}
titleName={t("page.workspace.menu.apps")} // MARCUS
actionGroupComponent={
<>
<Search
Expand Down
21 changes: 18 additions & 3 deletions apps/cloud/src/page/workspace/components/DynamicMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export const DashBoardDynamicMenu: FC<DashBoardDynamicMenuProps> = (props) => {
const { pathname } = useLocation()
const { teamIdentifier } = useParams()
const { t } = useTranslation()

// talvez ajude
const dynamicMenuConfig: MenuItemShape[] = [
{
labelKey: "app",
labelName: t("page.workspace.menu.apps"),
labelName: t("page.workspace.menu.apps"), // Marcus
href: `/workspace/${teamIdentifier}/apps`,
inStation: true,
icon: <AppIcon />,
Expand All @@ -28,7 +28,7 @@ export const DashBoardDynamicMenu: FC<DashBoardDynamicMenuProps> = (props) => {
},
{
labelKey: "resource",
labelName: t("page.workspace.menu.resources"),
labelName: t("page.workspace.menu.resources"), // Marcus
href: `/workspace/${teamIdentifier}/resources`,
inStation: true,
icon: <ResourceIcon />,
Expand All @@ -39,6 +39,21 @@ export const DashBoardDynamicMenu: FC<DashBoardDynamicMenuProps> = (props) => {
),
onClickCallback: onClickMenuItemCallback,
},

{
labelKey: "TeamManagement",
labelName: t("page.workspace.menu.TeamManagement"), // Marcus
href: `/workspace/${teamIdentifier}/resources`,
inStation: true,
icon: <AppIcon />,
hidden:
!teamIdentifier ||
![USER_ROLE.OWNER, USER_ROLE.ADMIN, USER_ROLE.EDITOR].includes(
// Mexer aqui
currentTeamInfo?.myRole ?? USER_ROLE.VIEWER,
),
onClickCallback: onClickMenuItemCallback,
},
]

const selectedKey = dynamicMenuConfig.find((item) =>
Expand Down
2 changes: 1 addition & 1 deletion apps/cloud/src/page/workspace/resources/mobile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const MobileResourcesWorkspace: FC = () => {
return (
<div css={resourceContainerStyle}>
<MobileDashboardHeader
titleName={t("page.workspace.menu.resources")}
titleName={t("page.workspace.menu.resources")} // Marcus
actionGroupComponent={
<Search
w="100%"
Expand Down
2 changes: 1 addition & 1 deletion apps/cloud/src/page/workspace/resources/pc/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const PCResourcesWorkspace: FC = () => {
return (
<div css={resourceContainerStyle}>
<DashboardHeader
titleName={t("page.workspace.menu.resources")}
titleName={t("page.workspace.menu.resources")} // Marcus
actionGroupComponent={
<>
<Search
Expand Down
9 changes: 9 additions & 0 deletions apps/cloud/src/router/routerConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const PasswordSettingPage = lazy(
() => import("@/page/setting/account/password"),
)
const LoginPage = lazy(() => import("@/page/user/login"))
const SignUpPage = lazy(() => import("@/page/user/signup"))

export const routerConfig: ILLARoutesObject[] = [
{
Expand All @@ -37,6 +38,14 @@ export const routerConfig: ILLARoutesObject[] = [
</Suspense>
),
},
{
path: "/signup",
element: (
<Suspense fallback={<FullPageLoading />}>
<SignUpPage />
</Suspense>
),
},
{
path: "/workspace",
element: (
Expand Down
Loading