fleet/frontend/interfaces/user.ts

117 lines
2.4 KiB
TypeScript
Raw Normal View History

2021-04-14 16:52:15 +00:00
import PropTypes from "prop-types";
import teamInterface, { ITeam } from "./team";
export default PropTypes.shape({
created_at: PropTypes.string,
updated_at: PropTypes.string,
id: PropTypes.number,
name: PropTypes.string,
email: PropTypes.string,
2021-10-26 14:24:16 +00:00
role: PropTypes.string,
force_password_reset: PropTypes.bool,
gravatar_url: PropTypes.string,
sso_enabled: PropTypes.bool,
global_role: PropTypes.string,
api_only: PropTypes.bool,
implement user table with new table and hook up create and edit and delete users (#587) * hook up user and invite data together for data table * added client derived data to user table * hooked up action dropdown to table * hooked up edit modal and password reset * started adding editing user functiaonlity * add query params to /invite call * clean up editing teams * update select team from to handle existing users with teams * update closes modal now * reuse getUser to clean up code in userManagementpage * pass form data to updating user that is not the current User * add dynamic userform submit text and fix tests * fix lint error in table component * added empty state for user table * clean up unused data table props * added delete modal * add delete user functionality * add delete option for invite * Add styles for rows in user table and action dropdown cell * hook up user and invite data together for data table * added client derived data to user table * hooked up action dropdown to table * hooked up edit modal and password reset * started adding editing user functiaonlity * add query params to /invite call * clean up editing teams * update select team from to handle existing users with teams * update closes modal now * reuse getUser to clean up code in userManagementpage * pass form data to updating user that is not the current User * add dynamic userform submit text and fix tests * fix lint error in table component * added empty state for user table * clean up unused data table props * added delete modal * add delete user functionality * add delete option for invite * Merge in generateClassTag * Refactor table styles * Add newline to DropdownCell style sheet Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com> * update checking for admin through global_role in nav * added defaultGloablRole for creat user modal * remove unused comment * fix broken tests * reenabled search for users tests Co-authored-by: noahtalerman <47070608+noahtalerman@users.noreply.github.com>
2021-04-09 10:44:57 +00:00
teams: PropTypes.arrayOf(teamInterface),
});
export const USERS_ROLES = [
"admin",
"maintainer",
"observer",
"observer_plus",
] as const;
export type IUserRole = typeof USERS_ROLES[number];
export type UserRole =
| "admin"
| "maintainer"
| "observer"
| "observer_plus"
| "gitops"
| "Admin"
| "Maintainer"
| "Observer"
| "Observer+"
| "GitOps"
| "Unassigned"
| ""
| "Various";
export interface IUser {
created_at?: string;
updated_at?: string;
id: number;
name: string;
2021-04-14 16:52:15 +00:00
email: string;
role: UserRole;
2021-04-14 16:52:15 +00:00
force_password_reset: boolean;
gravatar_url?: string;
gravatar_url_dark?: string;
sso_enabled: boolean;
global_role: UserRole | null;
api_only: boolean;
implement user table with new table and hook up create and edit and delete users (#587) * hook up user and invite data together for data table * added client derived data to user table * hooked up action dropdown to table * hooked up edit modal and password reset * started adding editing user functiaonlity * add query params to /invite call * clean up editing teams * update select team from to handle existing users with teams * update closes modal now * reuse getUser to clean up code in userManagementpage * pass form data to updating user that is not the current User * add dynamic userform submit text and fix tests * fix lint error in table component * added empty state for user table * clean up unused data table props * added delete modal * add delete user functionality * add delete option for invite * Add styles for rows in user table and action dropdown cell * hook up user and invite data together for data table * added client derived data to user table * hooked up action dropdown to table * hooked up edit modal and password reset * started adding editing user functiaonlity * add query params to /invite call * clean up editing teams * update select team from to handle existing users with teams * update closes modal now * reuse getUser to clean up code in userManagementpage * pass form data to updating user that is not the current User * add dynamic userform submit text and fix tests * fix lint error in table component * added empty state for user table * clean up unused data table props * added delete modal * add delete user functionality * add delete option for invite * Merge in generateClassTag * Refactor table styles * Add newline to DropdownCell style sheet Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com> * update checking for admin through global_role in nav * added defaultGloablRole for creat user modal * remove unused comment * fix broken tests * reenabled search for users tests Co-authored-by: noahtalerman <47070608+noahtalerman@users.noreply.github.com>
2021-04-09 10:44:57 +00:00
teams: ITeam[];
}
/**
* The shape of the request body when updating a user.
*/
export interface IUserUpdateBody {
global_role?: UserRole | null;
teams?: ITeam[];
name: string;
email?: string;
sso_enabled?: boolean;
role?: UserRole;
id: number;
}
2021-10-26 14:24:16 +00:00
export interface IUserFormErrors {
email?: string | null;
name?: string | null;
password?: string | null;
sso_enabled?: boolean | null;
2021-10-26 14:24:16 +00:00
}
export interface IResetPasswordFormErrors {
new_password?: string | null;
new_password_confirmation?: string | null;
}
export interface IResetPasswordForm {
new_password: string;
new_password_confirmation: string;
}
export interface ILoginUserData {
email: string;
password: string;
}
export interface ICreateUserFormData {
email: string;
global_role: UserRole | null;
name: string;
password?: string | null;
sso_enabled?: boolean | undefined;
teams: ITeam[];
}
export interface IUpdateUserFormData {
currentUserId?: number;
email?: string;
global_role?: UserRole | null;
name?: string;
password?: string | null;
sso_enabled?: boolean;
teams?: ITeam[];
}
export interface ICreateUserWithInvitationFormData {
email: string;
invite_token: string;
name: string;
password: string;
password_confirmation: string;
}