Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

UN-2718 [FEAT] Add role and organization info to Profile page with enterprise design (#1741)

ali0f76cede545a
diff --git a/backend/tenant_account_v2/users_view.py b/backend/tenant_account_v2/users_view.py
index 3cfa42bb0..22fc47187 100644
--- a/backend/tenant_account_v2/users_view.py
+++ b/backend/tenant_account_v2/users_view.py
@@ -98,6 +98,16 @@ class OrganizationUserViewSet(viewsets.ViewSet):
org_member.is_prompt_studio_onboarding_msg
)
+ # Add role and organization details
+ serialized_user_info["role"] = role.role
+
+ org_id = UserSessionUtils.get_organization_id(request)
+ if org_id:
+ org = auth_controller.get_organization_info(org_id)
+ if org:
+ serialized_user_info["organization_name"] = org.display_name
+ serialized_user_info["organization_id"] = org.organization_id
+
return Response(
status=status.HTTP_200_OK, data={"user": serialized_user_info}
)
diff --git a/frontend/src/assets/index.js b/frontend/src/assets/index.js
index 9375b0e4a..d24e0e7c8 100644
--- a/frontend/src/assets/index.js
+++ b/frontend/src/assets/index.js
@@ -77,3 +77,5 @@ export {
ETLIcon,
Task,
};
+
+export { ReactComponent as OrganizationIcon } from "./organization-icon.svg";
diff --git a/frontend/src/assets/organization-icon.svg b/frontend/src/assets/organization-icon.svg
new file mode 100644
index 000000000..ff93792a8
--- /dev/null
+++ b/frontend/src/assets/organization-icon.svg
@@ -0,0 +1,9 @@
+<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M5 18.3333V3.33334C5 2.89131 5.17559 2.46739 5.48816 2.15483C5.80072 1.84227 6.22464 1.66667 6.66667 1.66667H13.3333C13.7754 1.66667 14.1993 1.84227 14.5118 2.15483C14.8244 2.46739 15 2.89131 15 3.33334V18.3333H5Z" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M5.00002 10H3.33335C2.89133 10 2.4674 10.1756 2.15484 10.4882C1.84228 10.8007 1.66669 11.2246 1.66669 11.6667V16.6667C1.66669 17.1087 1.84228 17.5326 2.15484 17.8452C2.4674 18.1577 2.89133 18.3333 3.33335 18.3333H5.00002" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M15 7.5H16.6667C17.1087 7.5 17.5326 7.6756 17.8452 7.98816C18.1577 8.30072 18.3333 8.72464 18.3333 9.16667V16.6667C18.3333 17.1087 18.1577 17.5326 17.8452 17.8452C17.5326 18.1577 17.1087 18.3333 16.6667 18.3333H15" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M8.33331 5H11.6666" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M8.33331 8.33333H11.6666" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M8.33331 11.6667H11.6666" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M8.33331 15H11.6666" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/frontend/src/components/profile/Profile.css b/frontend/src/components/profile/Profile.css
index 1859feff7..274cbce6a 100644
--- a/frontend/src/components/profile/Profile.css
+++ b/frontend/src/components/profile/Profile.css
@@ -1,19 +1,243 @@
-.grey-body {
+.profile-page {
background-color: var(--page-bg-2);
- height: 100%;
- padding: 14px;
+ min-height: 100%;
+ padding: 0;
}
-.paper-layout {
+/* Outer white container */
+.profile-outer-container {
+ background: #fff !important;
+ border-radius: 0;
+ border: 1px solid #d0d5dd !important;
+ overflow: hidden;
+ min-height: calc(100vh - 160px);
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
+ margin: 0 16px 16px 16px;
+}
+
+/* Secondary header bar - outside white container per Figma */
+.profile-secondary-header {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 12px 16px;
+ background: #f5f7f9;
+ box-shadow: 0px 1px 3px 0px rgba(24, 50, 71, 0.08);
+ margin-bottom: 16px;
+}
+
+.profile-secondary-header .ant-btn {
+ padding: 0;
+ width: 16px;
+ height: 16px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ color: rgba(0, 0, 0, 0.88);
+}
+
+.profile-secondary-header .ant-btn:hover {
+ color: rgba(0, 0, 0, 0.88);
+ background: transparent;
+}
+
+.profile-header-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: rgba(0, 0, 0, 0.88);
+ line-height: 24px;
+}
+
+/* Content area - has padding for cards */
+.profile-content {
+ padding: 18px;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 24px;
+}
+
+/* Override Ant Design grid to use flexbox layout */
+.profile-content > .ant-row {
+ display: contents;
+}
+
+.profile-content .ant-col {
+ display: contents;
+}
+
+.profile-loading {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ min-height: 300px;
background-color: var(--white);
- height: 100%;
- padding: 14px;
+ border-radius: 14px;
+}
+
+/* Cards */
+.profile-card {
+ width: 364px;
+ min-height: 352px;
+ flex-shrink: 0;
+ border-radius: 14px;
+ border: 1px solid #e5e7eb;
+ box-shadow: 0 1px 2px -1px rgba(0, 0, 0, 0.1),
+ 0 1px 3px 0 rgba(0, 0, 0, 0.1);
+ overflow: hidden;
+}
+
+/* Responsive: stack cards vertically on smaller screens */
+@media (max-width: 800px) {
+ .profile-card {
+ width: 100%;
+ max-width: 364px;
+ }
+}
+
+.profile-card.ant-card .ant-card-body {
+ padding: 0;
+}
+
+/* Card header with icon and title */
+.card-header {
+ padding: 24px 24px 16px;
+}
+
+.card-icon-circle {
+ width: 36px;
+ height: 36px;
+ border-radius: 10px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 18px;
+ flex-shrink: 0;
+}
+
+.card-icon-circle.user-icon {
+ background-color: #e6f6fd;
+ color: #0958d9;
+}
+
+.card-icon-circle.org-icon {
+ background-color: #f2f8e6;
+ color: #256d09;
+}
+
+.card-title {
+ font-size: 18px;
+ font-weight: 500;
+ color: #0a0a0a;
+ line-height: 28px;
+ margin: 0;
+}
+
+.card-subtitle {
+ font-size: 16px;
+ color: #717182;
+ line-height: 24px;
+ margin: 0;
+}
+
+/* Card content */
+.card-content {
+ padding: 16px 24px 24px;
+}
+
+.width-100 {
+ width: 100%;
+}
+
+/* Field groups */
+.field-group {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+
+.field-label {
+ font-size: 14px;
+ color: #6a7282;
+ font-weight: 500;
+ line-height: 14px;
+}
+
+/* Field boxes with subtle shadow like Figma */
+.field-box {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ height: 36px;
+ padding: 4px 12px;
+ background: #f9fafb;
+ border: 1px solid #e5e7eb;
+ border-radius: 8px;
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
+}
+
+.field-value {
+ font-size: 14px;
+ color: #101828;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.field-value.org-id {
+ font-family: monospace;
+ font-size: 13px;
+}
+
+.field-icon {
+ color: #9ca3af;
+ font-size: 14px;
+ flex-shrink: 0;
+}
+
+/* Field with action button (copy) */
+.field-with-action {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.field-with-action .field-box {
+ flex: 1;
+}
+
+.copy-button {
+ color: #9ca3af;
+ padding: 4px 8px;
+ height: 36px;
+ width: 36px !important;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border: 1px solid rgba(0, 0, 0, 0.1);
+ border-radius: 8px;
+}
+
+.copy-button:hover {
+ color: var(--primary-color, #1890ff);
+ border-color: var(--primary-color, #1890ff);
}
-.header-text {
- margin-bottom: 20px;
+/* Role badge */
+.role-badge {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 4px 12px;
+ background-color: #eff6ff;
+ border: 1px solid #bedbff;
+ border-radius: 8px;
+ color: #1447e6;
+ font-size: 12px;
+ font-weight: 500;
+ width: fit-content;
+ height: 26px;
}
-.header-text .typo-text {
- font-size: 18px;
+.role-badge .anticon {
+ font-size: 12px;
}
diff --git a/frontend/src/components/profile/Profile.jsx b/frontend/src/components/profile/Profile.jsx
index fbafc30dd..d207342ea 100644
--- a/frontend/src/components/profile/Profile.jsx
+++ b/frontend/src/components/profile/Profile.jsx
@@ -1,38 +1,244 @@
-import { Button, Input, Space, Typography } from "antd";
+import { useState, useEffect } from "react";
+import { useNavigate } from "react-router-dom";
+import { Button, Card, Col, Row, Space, Spin, Tooltip, Typography } from "antd";
+import {
+ ArrowLeftOutlined,
+ CopyOutlined,
+ UserOutlined,
+ MailOutlined,
+ CheckCircleOutlined,
+} from "@ant-design/icons";
import "./Profile.css";
import { useSessionStore } from "../../store/session-store.js";
+import { useAlertStore } from "../../store/alert-store.js";
+import { OrganizationIcon } from "../../assets";
+import { useAxiosPrivate } from "../../hooks/useAxiosPrivate";
function Profile() {
+ const navigate = useNavigate();
const { sessionDetails } = useSessionStore();
+ const { setAlertDetails } = useAlertStore();
+ const axiosPrivate = useAxiosPrivate();
+ const [profileData, setProfileData] = useState(null);
+ const [isLoading, setIsLoading] = useState(true);
- return (
- <div className="grey-body">
- <div className="paper-layout">
- <div className="header-text">
- <Typography.Text className="typo-text" strong>
- User Profile
+ useEffect(() => {
+ const fetchProfile = async () => {
+ if (!sessionDetails.orgId) {
+ setIsLoading(false);
+ return;
+ }
+
+ try {
+ const response = await axiosPrivate({
+ url: `/api/v1/unstract/${sessionDetails.orgId}/users/profile/`,
+ method: "GET",
+ });
+ setProfileData(response.data?.user);
+ } catch {
+ setAlertDetails({
+ type: "error",
+ content: "Could not refresh profile data",
+ });
+ } finally {
+ setIsLoading(false);
+ }
+ };
+
+ fetchProfile();
+ }, [sessionDetails.orgId, axiosPrivate, setAlertDetails]);
+
+ const handleCopy = async (text, label) => {
+ if (!text) {
+ setAlertDetails({
+ type: "error",
+ content: `No ${label} available to copy`,
+ });
+ return;
+ }
+
+ try {
+ await navigator.clipboard.writeText(text);
+ setAlertDetails({
+ type: "success",
+ content: `${label} copied to clipboard`,
+ });
+ } catch {
+ setAlertDetails({
+ type: "error",
+ content: `Failed to copy ${label}`,
+ });
+ }
+ };
+
+ if (isLoading) {
+ return (
+ <div className="profile-page">
+ {/* Secondary header bar - outside white container */}
+ <div className="profile-secondary-header">
+ <Button
+ type="text"
+ icon={<ArrowLeftOutlined />}
+ onClick={() => navigate(-1)}
+ />
+ <Typography.Text strong className="profile-header-title">
+ Profile
</Typography.Text>
</div>
-
- <Space direction="vertical" size="middle">
- <div>
- <Typography.Text strong>User Name:</Typography.Text>
- <Input defaultValue={sessionDetails.display_name} readOnly />
- </div>
- <div>
- <Typography.Text strong>Email:</Typography.Text>
- <Input defaultValue={sessionDetails.email} readOnly />
+ <div className="profile-outer-container">
+ <div className="profile-loading">
+ <Spin size="large" />
</div>
- {sessionDetails.roles && (
- <div>
- <Typography.Text strong>Roles:</Typography.Text>
- <Input defaultValue={sessionDetails.roles} readOnly />
- </div>
- )}
-
- <Button disabled>Reset Password</Button>
- </Space>
+ </div>
+ </div>
+ );
+ }
+
+ const userName = profileData?.display_name || sessionDetails.display_name;
+ const email = profileData?.email || sessionDetails.email;
+ const orgName = profileData?.organization_name || sessionDetails.orgName;
+ const orgId = profileData?.organization_id || sessionDetails.orgId;
+ const role = profileData?.role || sessionDetails.role;
+
+ return (
+ <div className="profile-page">
+ {/* Secondary header bar - outside white container */}
+ <div className="profile-secondary-header">
+ <Button
+ type="text"
+ icon={<ArrowLeftOutlined />}
+ onClick={() => navigate(-1)}
+ />
+ <Typography.Text strong className="profile-header-title">
+ Profile
+ </Typography.Text>
+ </div>
+ {/* White container with cards only */}
+ <div className="profile-outer-container">
+ <div className="profile-content">
+ <Row gutter={[16, 16]}>
+ {/* User Information Card */}
+ <Col xs={24} md={12}>
+ <Card className="profile-card">
+ <Space size={12} className="card-header">
+ <div className="card-icon-circle user-icon">
+ <UserOutlined />
+ </div>
+ <Space direction="vertical" size={0}>
+ <Typography.Text strong className="card-title">
+ User Information
+ </Typography.Text>
+ <Typography.Text type="secondary" className="card-subtitle">
+ Your personal account details
+ </Typography.Text>
+ </Space>
+ </Space>
+ <Space
+ direction="vertical"
+ size={16}
+ className="card-content width-100"
+ >
+ <div className="field-group">
+ <Typography.Text type="secondary" className="field-label">
+ Full Name
+ </Typography.Text>
+ <div className="field-box">
+ <Typography.Text className="field-value">
+ {userName}
+ </Typography.Text>
+ <UserOutlined className="field-icon" />
+ </div>
+ </div>
+ <div className="field-group">
+ <Typography.Text type="secondary" className="field-label">
+ Email Address
+ </Typography.Text>
+ <div className="field-box">
+ <Typography.Text className="field-value">
+ {email}
+ </Typography.Text>
+ <MailOutlined className="field-icon" />
+ </div>
+ </div>
+ </Space>
+ </Card>
+ </Col>
+
+ {/* Organization Card */}
+ <Col xs={24} md={12}>
+ <Card className="profile-card">
+ <Space size={12} className="card-header">
+ <div className="card-icon-circle org-icon">
+ <OrganizationIcon />
+ </div>
+ <Space direction="vertical" size={0}>
+ <Typography.Text strong className="card-title">
+ Organization
+ </Typography.Text>
+ <Typography.Text type="secondary" className="card-subtitle">
+ Workspace and role information
+ </Typography.Text>
+ </Space>
+ </Space>
+ <Space
+ direction="vertical"
+ size={16}
+ className="card-content width-100"
+ >
+ <div className="field-group">
+ <Typography.Text type="secondary" className="field-label">
+ Organization Name
+ </Typography.Text>
+ <div className="field-box">
+ <Typography.Text className="field-value">
+ {orgName}
+ </Typography.Text>
+ </div>
+ </div>
+ <div className="field-group">
+ <Typography.Text type="secondary" className="field-label">
+ Organization ID
+ </Typography.Text>
+ <div className="field-with-action">
+ <div className="field-box">
+ <Typography.Text className="field-value org-id">
+ {orgId}
+ </Typography.Text>
+ </div>
+ <Tooltip
+ title={
+ orgId
+ ? "Copy Organization ID"
+ : "No Organization ID available"
+ }
+ >
+ <Button
+ type="text"
+ icon={<CopyOutlined />}
+ className="copy-button"
+ onClick={() => handleCopy(orgId, "Organization ID")}
+ disabled={!orgId}
+ />
+ </Tooltip>
+ </div>
+ </div>
+ {role && (
+ <div className="field-group">
+ <Typography.Text type="secondary" className="field-label">
+ Your Role
+ </Typography.Text>
+ <Typography.Text strong className="role-badge">
+ <CheckCircleOutlined />
+ {role}
+ </Typography.Text>
+ </div>
+ )}
+ </Space>
+ </Card>
+ </Col>
+ </Row>
+ </div>
</div>
</div>
);
diff --git a/frontend/src/hooks/useAxiosPrivate.js b/frontend/src/hooks/useAxiosPrivate.js
index 26e4cea96..2937462a2 100644
--- a/frontend/src/hooks/useAxiosPrivate.js
+++ b/frontend/src/hooks/useAxiosPrivate.js
@@ -1,11 +1,11 @@
import axios from "axios";
-import { useEffect } from "react";
+import { useEffect, useMemo } from "react";
import useLogout from "./useLogout";
function useAxiosPrivate() {
- const axiosPrivate = axios.create();
const logout = useLogout();
+ const axiosPrivate = useMemo(() => axios.create(), []);
useEffect(() => {
const responseInterceptor = axiosPrivate.interceptors.response.use(