MCPcopy Create free account
hub / github.com/bytebase/bytebase / handleRestore

Function handleRestore

frontend/src/react/pages/settings/UsersPage.tsx:144–168  ·  view source on GitHub ↗
(user: User)

Source from the content-addressed store, hash-verified

142 };
143
144 const handleRestore = async (user: User) => {
145 const accountType = getAccountTypeByEmail(user.email);
146 const fullName = getUserFullNameByType(user);
147
148 try {
149 if (accountType === AccountType.SERVICE_ACCOUNT) {
150 await undeleteServiceAccount(fullName);
151 } else if (accountType === AccountType.WORKLOAD_IDENTITY) {
152 await undeleteWorkloadIdentity(fullName);
153 } else {
154 await restoreUser(fullName);
155 }
156
157 const updated = create(UserSchema, { ...user, state: State.ACTIVE });
158 onUserUpdated(updated);
159
160 pushNotification({
161 module: "bytebase",
162 style: "SUCCESS",
163 title: t("common.updated"),
164 });
165 } catch {
166 // error already shown by store
167 }
168 };
169
170 const handleView = (user: User) => {
171 const accountType = getAccountTypeByEmail(user.email);

Callers 4

ProjectActionDropdownFunction · 0.70
InstanceActionDropdownFunction · 0.70
UserTableFunction · 0.70
TableListFunction · 0.50

Calls 4

getAccountTypeByEmailFunction · 0.90
getUserFullNameByTypeFunction · 0.90
pushNotificationFunction · 0.90
tFunction · 0.50

Tested by

no test coverage detected