Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Add INVITED and ACTIVE to user status

Tianzhou Chen5eaaec662230
diff --git a/frontend/src/components/MemberTable.vue b/frontend/src/components/MemberTable.vue
index c42256aeb8..902b6293b1 100644
--- a/frontend/src/components/MemberTable.vue
+++ b/frontend/src/components/MemberTable.vue
@@ -35,6 +35,12 @@
>
You
</span>
+ <span
+ v-if="'INVITED' == roleMapping.principal.status"
+ class="inline-flex items-center px-2 py-0.5 rounded-lg text-xs font-semibold bg-main text-main-text"
+ >
+ Invited
+ </span>
</div>
<span class="textlabel">
{{ roleMapping.principal.email }}
diff --git a/frontend/src/miragejs/factories/user.js b/frontend/src/miragejs/factories/user.js
index 6deeae0e2d..20d271c82e 100644
--- a/frontend/src/miragejs/factories/user.js
+++ b/frontend/src/miragejs/factories/user.js
@@ -6,14 +6,14 @@ export default {
name() {
return faker.fake("{{name.findName}}");
},
+ status() {
+ return "INVITED";
+ },
email() {
return faker.fake("{{internet.email}}");
},
passwordHash() {
return faker.fake("{{internet.password}}");
},
- mobile() {
- return faker.fake("{{phone.phoneNumber}}");
- },
}),
};
diff --git a/frontend/src/miragejs/fixtures/roleMappingList.json b/frontend/src/miragejs/fixtures/roleMappingList.json
index 5b9588ff3a..08da2d21e1 100644
--- a/frontend/src/miragejs/fixtures/roleMappingList.json
+++ b/frontend/src/miragejs/fixtures/roleMappingList.json
@@ -52,5 +52,14 @@
"role": "DEVELOPER",
"principalId": "5",
"updaterId": "1"
+ },
+ {
+ "id": "7",
+ "workspaceId": "1",
+ "createdTs": 1609603200000,
+ "lastUpdatedTs": 1609646400000,
+ "role": "DEVELOPER",
+ "principalId": "6",
+ "updaterId": "1"
}
]
diff --git a/frontend/src/miragejs/fixtures/userList.json b/frontend/src/miragejs/fixtures/userList.json
index ba0f570718..3924c56ab4 100644
--- a/frontend/src/miragejs/fixtures/userList.json
+++ b/frontend/src/miragejs/fixtures/userList.json
@@ -1,32 +1,44 @@
[
{
"id": "1",
+ "status": "ACTIVE",
"name": "Demo Owner",
"email": "[email protected]",
"passwordHash": "1024"
},
{
"id": "2",
+ "status": "ACTIVE",
"name": "Jerry DBA",
"email": "[email protected]",
"passwordHash": "aaa"
},
{
"id": "3",
+ "status": "ACTIVE",
"name": "Tom Dev",
"email": "[email protected]",
"passwordHash": "aaa"
},
{
"id": "4",
+ "status": "ACTIVE",
"name": "Alice DBA",
"email": "[email protected]",
"passwordHash": "aaa"
},
{
"id": "5",
+ "status": "ACTIVE",
"name": "Jane Dev",
"email": "[email protected]",
"passwordHash": "aaa"
+ },
+ {
+ "id": "6",
+ "status": "INVITED",
+ "name": "Bob Invited",
+ "email": "[email protected]",
+ "passwordHash": "aaa"
}
]
diff --git a/frontend/src/store/modules/principal.ts b/frontend/src/store/modules/principal.ts
index 9633fef9d8..a81200534b 100644
--- a/frontend/src/store/modules/principal.ts
+++ b/frontend/src/store/modules/principal.ts
@@ -4,12 +4,14 @@ import {
PrincipalId,
Principal,
PrincipalState,
+ PrincipalStatus,
ResourceObject,
} from "../../types";
function convert(user: ResourceObject): Principal {
return {
id: user.id,
+ status: user.attributes.status as PrincipalStatus,
name: user.attributes.name as string,
email: user.attributes.email as string,
};
@@ -30,6 +32,7 @@ const getters = {
if (!principalId) {
return {
id: "-1",
+ status: "UNKNOWN",
name: "<<ID Missing>>",
email: "",
};
@@ -44,6 +47,7 @@ const getters = {
// Return id as the name if no matching is found.
return {
id: principalId,
+ status: "UNKNOWN",
name: principalId,
email: "",
};
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index 9d8c215b40..f8a6060f58 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -33,15 +33,22 @@ export type CommandRegisterId = string;
// Persistent State Models
// User
+export type UserStatus = "INVITED" | "ACTIVE";
+
export type User = {
id: UserId;
+ status: UserStatus;
name: string;
+ email: string;
};
export type NewUser = Omit<User, "id">;
// Principal
+export type PrincipalStatus = "UNKNOWN" | "INVITED" | "ACTIVE";
+
export type Principal = {
id: PrincipalId;
+ status: PrincipalStatus;
name: string;
email: string;
};