Merged PR 316: dev動作確認で発見した修正対象

## 概要
[Task2368: dev動作確認で発見した修正対象](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2368)

- デザイン周り
  - ラジオボタン・チェックボックスのラべルを押下しても状態を変更できるように修正

- 機能
  - もともとパスワードがあったとき、フォーカスを当てて伏字がなくなった状態になった場合は、値をチェックするように修正
  - Encryption:ON→パスワード入力→Encryption:OFFにしてユーザー追加したとき、入力していたパスワードがServerに送られてしまっていたので、Encryption:OFFにしたらパスワードをundefinedにするように修正
  - ポップアップが閉じたときにユーザー一覧画面を更新する挙動になっていたため、閉じたときは何もしないように修正

## レビューポイント
- 修正箇所・修正対応に問題はないか
- 確認しておいた方が良い挙動はあるか

## UIの変更
-https://ndstokyo.sharepoint.com/:f:/r/sites/Piranha/Shared%20Documents/General/OMDS/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88/Task2368?csf=1&web=1&e=pyfaXd

## 動作確認状況
- ローカルで確認

## 補足
- 相談、参考資料などがあれば
This commit is contained in:
saito.k 2023-08-08 09:43:04 +00:00
parent 98e9937d9d
commit ee783585ae
6 changed files with 44 additions and 33 deletions

View File

@ -59,16 +59,17 @@ export const addUserAsync = createAsyncThunk<
const config = new Configuration(configuration);
const usersApi = new UsersApi(config);
const { addUser } = state.user.apps;
const newUser = { ...addUser };
// roleがAUTHOR以外の場合、不要なプロパティをundefinedにする
if (addUser.role !== USER_ROLES.AUTHOR) {
addUser.authorId = undefined;
addUser.encryption = undefined;
addUser.prompt = undefined;
addUser.encryptionPassword = undefined;
if (newUser.role !== USER_ROLES.AUTHOR) {
newUser.authorId = undefined;
newUser.encryption = undefined;
newUser.prompt = undefined;
newUser.encryptionPassword = undefined;
}
try {
await usersApi.signup(addUser, {
await usersApi.signup(newUser, {
headers: { authorization: `Bearer ${accessToken}` },
});
thunkApi.dispatch(

View File

@ -63,11 +63,8 @@ export const selectUpdateValidationErrors = (state: RootState) => {
);
if (passwordError) {
// 最初にEncryptionがfasleで、Encryptionがtrueに変更された場合、EncryptionPasswordが必須
if (!initEncryption) {
hasErrorIncorrectEncryptionPassword = true;
// Encryptionがある状態で変更がある場合、EncryptionPasswordが空でもエラーにしない
} else if (!encryptionPassword || encryptionPassword === "") {
// 最初にEncryptionがtrueで、EncryptionPassword変更されていない場合はエラーとしない
if (initEncryption && encryptionPassword === undefined) {
hasErrorIncorrectEncryptionPassword = false;
} else {
hasErrorIncorrectEncryptionPassword = true;

View File

@ -90,6 +90,9 @@ export const userSlice = createSlice({
) => {
const { encryption } = action.payload;
state.apps.addUser.encryption = encryption;
if (!encryption) {
state.apps.addUser.encryptionPassword = undefined;
}
},
changePrompt: (state, action: PayloadAction<{ prompt: boolean }>) => {
const { prompt } = action.payload;
@ -170,14 +173,16 @@ export const userSlice = createSlice({
if (initEncryption && encryption && !password) {
state.apps.hasPasswordMask = true;
}
if (!encryption) {
state.apps.updateUser.encryptionPassword = undefined;
}
},
changeUpdateEncryptionPassword: (
state,
action: PayloadAction<{ encryptionPassword: string }>
) => {
const { encryptionPassword } = action.payload;
state.apps.updateUser.encryptionPassword =
encryptionPassword === "" ? undefined : encryptionPassword;
state.apps.updateUser.encryptionPassword = encryptionPassword;
},
changeUpdatePrompt: (state, action: PayloadAction<{ prompt: boolean }>) => {
const { prompt } = action.payload;

View File

@ -59,14 +59,12 @@ const UserListPage: React.FC = (): JSX.Element => {
isOpen={isUpdatePopupOpen}
onClose={() => {
setIsUpdatePopupOpen(false);
dispatch(listUsersAsync());
}}
/>
<UserAddPopup
isOpen={isPopupOpen}
onClose={() => {
setIsPopupOpen(false);
dispatch(listUsersAsync());
}}
/>
<div className={styles.wrap}>

View File

@ -20,6 +20,7 @@ import {
changePrompt,
changeEncryption,
changeEncryptionPassword,
listUsersAsync,
} from "features/user";
import { USER_ROLES } from "components/auth/constants";
import close from "../../assets/images/close.svg";
@ -75,6 +76,7 @@ export const UserAddPopup: React.FC<UserAddPopupProps> = (props) => {
if (meta.requestStatus === "fulfilled") {
closePopup();
dispatch(listUsersAsync());
}
}, [
hasErrorEmptyName,
@ -146,9 +148,9 @@ export const UserAddPopup: React.FC<UserAddPopupProps> = (props) => {
</dd>
<dt>{t(getTranslationID("userListPage.label.role"))}</dt>
<dd>
<label htmlFor={USER_ROLES.AUTHOR}>
<label htmlFor={`add_${USER_ROLES.AUTHOR}`}>
<input
id={USER_ROLES.AUTHOR}
id={`add_${USER_ROLES.AUTHOR}`}
type="radio"
name="role"
className={styles.formRadio}
@ -159,9 +161,9 @@ export const UserAddPopup: React.FC<UserAddPopupProps> = (props) => {
/>
{t(getTranslationID("userListPage.label.author"))}
</label>
<label htmlFor={USER_ROLES.TYPIST}>
<label htmlFor={`add_${USER_ROLES.TYPIST}`}>
<input
id={USER_ROLES.TYPIST}
id={`add_${USER_ROLES.TYPIST}`}
type="radio"
name="role"
className={styles.formRadio}
@ -172,9 +174,9 @@ export const UserAddPopup: React.FC<UserAddPopupProps> = (props) => {
/>
{t(getTranslationID("userListPage.label.transcriptionist"))}
</label>
<label htmlFor={USER_ROLES.NONE}>
<label htmlFor={`add_${USER_ROLES.NONE}`}>
<input
id={USER_ROLES.NONE}
id={`add_${USER_ROLES.NONE}`}
type="radio"
name="role"
className={styles.formRadio}
@ -303,9 +305,10 @@ export const UserAddPopup: React.FC<UserAddPopupProps> = (props) => {
<dt>{t(getTranslationID("userListPage.label.setting"))}</dt>
<dd className={styles.last}>
<p>
<label htmlFor="Auto renew">
<label htmlFor="add_AutoRenew">
<input
type="checkbox"
id="add_AutoRenew"
className={styles.formCheck}
checked={addUser.autoRenew}
onChange={(e) => {
@ -318,9 +321,10 @@ export const UserAddPopup: React.FC<UserAddPopupProps> = (props) => {
</label>
</p>
<p>
<label htmlFor="License Alert">
<label htmlFor="add_LicenseAlert">
<input
type="checkbox"
id="add_LicenseAlert"
checked={addUser.licenseAlert}
className={styles.formCheck}
onChange={(e) => {
@ -333,9 +337,10 @@ export const UserAddPopup: React.FC<UserAddPopupProps> = (props) => {
</label>
</p>
<p>
<label htmlFor="Notification">
<label htmlFor="add_Notification">
<input
type="checkbox"
id="add_Notification"
checked={addUser.notification}
className={styles.formCheck}
onChange={(e) => {

View File

@ -20,6 +20,7 @@ import {
selectUpdateUser,
selectUpdateValidationErrors,
updateUserAsync,
listUsersAsync,
} from "features/user";
import { getTranslationID } from "translation";
import close from "../../assets/images/close.svg";
@ -79,6 +80,7 @@ export const UserUpdatePopup: React.FC<UserUpdatePopupProps> = (props) => {
if (meta.requestStatus === "fulfilled") {
closePopup();
dispatch(listUsersAsync());
}
}, [
dispatch,
@ -124,9 +126,9 @@ export const UserUpdatePopup: React.FC<UserUpdatePopupProps> = (props) => {
</dd>
<dt>{t(getTranslationID("userListPage.label.role"))}</dt>
<dd>
<label htmlFor={USER_ROLES.AUTHOR}>
<label htmlFor={`edit_${USER_ROLES.AUTHOR}`}>
<input
id={USER_ROLES.AUTHOR}
id={`edit_${USER_ROLES.AUTHOR}`}
type="radio"
name="role"
className={styles.formRadio}
@ -138,9 +140,9 @@ export const UserUpdatePopup: React.FC<UserUpdatePopupProps> = (props) => {
/>
{t(getTranslationID("userListPage.label.author"))}
</label>
<label htmlFor={USER_ROLES.TYPIST}>
<label htmlFor={`edit_${USER_ROLES.TYPIST}`}>
<input
id={USER_ROLES.TYPIST}
id={`edit_${USER_ROLES.TYPIST}`}
type="radio"
name="role"
className={styles.formRadio}
@ -152,9 +154,9 @@ export const UserUpdatePopup: React.FC<UserUpdatePopupProps> = (props) => {
/>
{t(getTranslationID("userListPage.label.transcriptionist"))}
</label>
<label htmlFor={USER_ROLES.NONE}>
<label htmlFor={`edit_${USER_ROLES.NONE}`}>
<input
id={USER_ROLES.NONE}
id={`edit_${USER_ROLES.NONE}`}
type="radio"
name="role"
className={styles.formRadio}
@ -315,9 +317,10 @@ export const UserUpdatePopup: React.FC<UserUpdatePopupProps> = (props) => {
<dt>{t(getTranslationID("userListPage.label.setting"))}</dt>
<dd className="last">
<p>
<label htmlFor="Auto renew">
<label htmlFor="edit_AutoRenew">
<input
type="checkbox"
id="edit_AutoRenew"
className={styles.formCheck}
checked={user.autoRenew}
onChange={(e) => {
@ -332,9 +335,10 @@ export const UserUpdatePopup: React.FC<UserUpdatePopupProps> = (props) => {
</label>
</p>
<p>
<label htmlFor="License Alert">
<label htmlFor="edit_LicenseAlert">
<input
type="checkbox"
id="edit_LicenseAlert"
className={styles.formCheck}
checked={user.licenseAlert}
onChange={(e) => {
@ -349,9 +353,10 @@ export const UserUpdatePopup: React.FC<UserUpdatePopupProps> = (props) => {
</label>
</p>
<p>
<label htmlFor="Notification">
<label htmlFor="edit_Notification">
<input
type="checkbox"
id="edit_Notification"
className={styles.formCheck}
checked={user.notification}
onChange={(e) => {