Merged PR 848: パートナー一覧画面修正
## 概要 [Task3833: パートナー一覧画面修正](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3833) - パートナー一覧画面のパートナーにカーソルを合わせた際に、Delete Partnerリンクが表示される。 押下した場合は、本当に削除するのかを確認するメッセージが表示され、どのPartnerを削除するかメッセージ欄に表示されること。 ## レビューポイント - 特筆する点はなし ## UIの変更 https://ndstokyo.sharepoint.com/sites/Piranha/Shared%20Documents/Forms/AllItems.aspx?csf=1&web=1&e=hzPw9b&cid=e8e0702d%2D3730%2D4295%2Dbb9d%2D40e6b1998906&FolderCTID=0x012000C0DCEE65AC2177479C3C761CD137C9C9&id=%2Fsites%2FPiranha%2FShared%20Documents%2FGeneral%2FOMDS%2F%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%2FTask3833&viewid=786a81cf%2Dd15f%2D4dc2%2D9e55%2Dc7a729fbc72f ## クエリの変更 なし ## 動作確認状況 - ローカルで確認(APIからの返却値を直接指定する方式で確認) - 行った修正がデグレを発生させていないことを確認できるか 新規機能追加のみなので問題なし ## 補足 - 相談、参考資料などがあれば
This commit is contained in:
parent
6e93a5be79
commit
eb6b413adb
@ -693,6 +693,19 @@ export interface DeleteAccountRequest {
|
||||
*/
|
||||
'accountId': number;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface DeletePartnerAccountRequest
|
||||
*/
|
||||
export interface DeletePartnerAccountRequest {
|
||||
/**
|
||||
* 削除対象のアカウントID
|
||||
* @type {number}
|
||||
* @memberof DeletePartnerAccountRequest
|
||||
*/
|
||||
'targetAccountId': number;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -2857,6 +2870,46 @@ export const AccountsApiAxiosParamCreator = function (configuration?: Configurat
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary
|
||||
* @param {DeletePartnerAccountRequest} deletePartnerAccountRequest
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
deletePartnerAccount: async (deletePartnerAccountRequest: DeletePartnerAccountRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'deletePartnerAccountRequest' is not null or undefined
|
||||
assertParamExists('deletePartnerAccount', 'deletePartnerAccountRequest', deletePartnerAccountRequest)
|
||||
const localVarPath = `/accounts/partner/delete`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication bearer required
|
||||
// http bearer authentication required
|
||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
||||
|
||||
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(deletePartnerAccountRequest, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
* ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを削除します
|
||||
* @summary
|
||||
@ -3886,6 +3939,19 @@ export const AccountsApiFp = function(configuration?: Configuration) {
|
||||
const operationBasePath = operationServerMap['AccountsApi.deleteAccountAndData']?.[index]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary
|
||||
* @param {DeletePartnerAccountRequest} deletePartnerAccountRequest
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async deletePartnerAccount(deletePartnerAccountRequest: DeletePartnerAccountRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.deletePartnerAccount(deletePartnerAccountRequest, options);
|
||||
const index = configuration?.serverIndex ?? 0;
|
||||
const operationBasePath = operationServerMap['AccountsApi.deletePartnerAccount']?.[index]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
* ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを削除します
|
||||
* @summary
|
||||
@ -4276,6 +4342,16 @@ export const AccountsApiFactory = function (configuration?: Configuration, baseP
|
||||
deleteAccountAndData(deleteAccountRequest: DeleteAccountRequest, options?: any): AxiosPromise<object> {
|
||||
return localVarFp.deleteAccountAndData(deleteAccountRequest, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary
|
||||
* @param {DeletePartnerAccountRequest} deletePartnerAccountRequest
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
deletePartnerAccount(deletePartnerAccountRequest: DeletePartnerAccountRequest, options?: any): AxiosPromise<object> {
|
||||
return localVarFp.deletePartnerAccount(deletePartnerAccountRequest, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
* ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを削除します
|
||||
* @summary
|
||||
@ -4608,6 +4684,18 @@ export class AccountsApi extends BaseAPI {
|
||||
return AccountsApiFp(this.configuration).deleteAccountAndData(deleteAccountRequest, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary
|
||||
* @param {DeletePartnerAccountRequest} deletePartnerAccountRequest
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof AccountsApi
|
||||
*/
|
||||
public deletePartnerAccount(deletePartnerAccountRequest: DeletePartnerAccountRequest, options?: AxiosRequestConfig) {
|
||||
return AccountsApiFp(this.configuration).deletePartnerAccount(deletePartnerAccountRequest, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
* ログインしているユーザーのアカウント配下でIDで指定されたタイピストグループを削除します
|
||||
* @summary
|
||||
|
||||
@ -81,4 +81,5 @@ export const errorCodes = [
|
||||
"E017002", // 親アカウント変更不可エラー(階層関係が不正)
|
||||
"E017003", // 親アカウント変更不可エラー(リージョンが同一でない)
|
||||
"E017004", // 親アカウント変更不可エラー(国が同一でない)
|
||||
"E018001", // パートナーアカウント削除エラー(削除条件を満たしていない)
|
||||
] as const;
|
||||
|
||||
@ -8,6 +8,7 @@ import {
|
||||
AccountsApi,
|
||||
CreatePartnerAccountRequest,
|
||||
GetPartnersResponse,
|
||||
DeletePartnerAccountRequest,
|
||||
} from "../../api/api";
|
||||
import { Configuration } from "../../api/configuration";
|
||||
|
||||
@ -116,3 +117,62 @@ export const getPartnerInfoAsync = createAsyncThunk<
|
||||
return thunkApi.rejectWithValue({ error });
|
||||
}
|
||||
});
|
||||
|
||||
// パートナーアカウント削除
|
||||
export const deletePartnerAccountAsync = createAsyncThunk<
|
||||
{
|
||||
/* Empty Object */
|
||||
},
|
||||
{
|
||||
// パラメータ
|
||||
accountId: number;
|
||||
},
|
||||
{
|
||||
// rejectした時の返却値の型
|
||||
rejectValue: {
|
||||
error: ErrorObject;
|
||||
};
|
||||
}
|
||||
>("partner/deletePartnerAccountAsync", async (args, thunkApi) => {
|
||||
const { accountId } = args;
|
||||
// apiのConfigurationを取得する
|
||||
const { getState } = thunkApi;
|
||||
const state = getState() as RootState;
|
||||
const { configuration } = state.auth;
|
||||
const accessToken = getAccessToken(state.auth);
|
||||
const config = new Configuration(configuration);
|
||||
const accountApi = new AccountsApi(config);
|
||||
|
||||
try {
|
||||
const deletePartnerAccountRequest: DeletePartnerAccountRequest = {
|
||||
targetAccountId: accountId,
|
||||
};
|
||||
await accountApi.deletePartnerAccount(deletePartnerAccountRequest, {
|
||||
headers: { authorization: `Bearer ${accessToken}` },
|
||||
});
|
||||
thunkApi.dispatch(
|
||||
openSnackbar({
|
||||
level: "info",
|
||||
message: getTranslationID("common.message.success"),
|
||||
})
|
||||
);
|
||||
return {};
|
||||
} catch (e) {
|
||||
const error = createErrorObject(e);
|
||||
|
||||
let errorMessage = getTranslationID("common.message.internalServerError");
|
||||
if (error.code === "E018001") {
|
||||
errorMessage = getTranslationID(
|
||||
"partnerPage.message.partnerDeleteFailedError"
|
||||
);
|
||||
}
|
||||
thunkApi.dispatch(
|
||||
openSnackbar({
|
||||
level: "error",
|
||||
message: errorMessage,
|
||||
})
|
||||
);
|
||||
|
||||
return thunkApi.rejectWithValue({ error });
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { PartnerState } from "./state";
|
||||
import { createPartnerAccountAsync, getPartnerInfoAsync } from "./operations";
|
||||
import {
|
||||
createPartnerAccountAsync,
|
||||
getPartnerInfoAsync,
|
||||
deletePartnerAccountAsync,
|
||||
} from "./operations";
|
||||
import { LIMIT_PARTNER_VIEW_NUM } from "./constants";
|
||||
|
||||
const initialState: PartnerState = {
|
||||
@ -97,6 +101,15 @@ export const partnerSlice = createSlice({
|
||||
builder.addCase(getPartnerInfoAsync.rejected, (state) => {
|
||||
state.apps.isLoading = false;
|
||||
});
|
||||
builder.addCase(deletePartnerAccountAsync.pending, (state) => {
|
||||
state.apps.isLoading = true;
|
||||
});
|
||||
builder.addCase(deletePartnerAccountAsync.fulfilled, (state) => {
|
||||
state.apps.isLoading = false;
|
||||
});
|
||||
builder.addCase(deletePartnerAccountAsync.rejected, (state) => {
|
||||
state.apps.isLoading = false;
|
||||
});
|
||||
},
|
||||
});
|
||||
export const {
|
||||
|
||||
@ -16,6 +16,7 @@ import {
|
||||
selectTotalPage,
|
||||
getPartnerInfoAsync,
|
||||
selectPartnersInfo,
|
||||
deletePartnerAccountAsync,
|
||||
} from "features/partner/index";
|
||||
import {
|
||||
changeDelegateAccount,
|
||||
@ -109,6 +110,31 @@ const PartnerPage: React.FC = (): JSX.Element => {
|
||||
[dispatch, navigate, t]
|
||||
);
|
||||
|
||||
// delete account押下時処理
|
||||
const onDeleteAccount = useCallback(
|
||||
async (accountId: number, companyName: string) => {
|
||||
// ダイアログ確認
|
||||
if (
|
||||
/* eslint-disable-next-line no-alert */
|
||||
!window.confirm(
|
||||
`${t(
|
||||
getTranslationID("partnerPage.message.partnerDeleteConfirm")
|
||||
)} ${companyName}`
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { meta } = await dispatch(deletePartnerAccountAsync({ accountId }));
|
||||
if (meta.requestStatus === "fulfilled") {
|
||||
dispatch(
|
||||
getPartnerInfoAsync({ limit: LIMIT_PARTNER_VIEW_NUM, offset })
|
||||
);
|
||||
}
|
||||
},
|
||||
[dispatch, t, offset]
|
||||
);
|
||||
|
||||
// HTML
|
||||
return (
|
||||
<>
|
||||
@ -185,10 +211,14 @@ const PartnerPage: React.FC = (): JSX.Element => {
|
||||
<tr>
|
||||
<td className={styles.clm0}>
|
||||
<ul className={styles.menuInTable}>
|
||||
{/* パートナーアカウント削除はCCB後回し分なので非表示
|
||||
{isVisibleButton && (
|
||||
<li>
|
||||
<a>
|
||||
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
|
||||
<a
|
||||
onClick={() => {
|
||||
onDeleteAccount(x.accountId, x.name);
|
||||
}}
|
||||
>
|
||||
{t(
|
||||
getTranslationID(
|
||||
"partnerPage.label.deleteAccount"
|
||||
@ -197,7 +227,6 @@ const PartnerPage: React.FC = (): JSX.Element => {
|
||||
</a>
|
||||
</li>
|
||||
)}
|
||||
*/}
|
||||
{isVisibleDealerManagement && (
|
||||
<li>
|
||||
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
|
||||
|
||||
@ -537,7 +537,9 @@
|
||||
"message": {
|
||||
"delegateNotAllowedError": "Aktionen im Namen des Partners sind nicht zulässig. Bitte aktualisieren Sie den Bildschirm und überprüfen Sie ihn erneut.",
|
||||
"deleteFailedError": "Der Delegierungsvorgang ist fehlgeschlagen. Bitte aktualisieren Sie den Bildschirm und überprüfen Sie ihn erneut.",
|
||||
"delegateCancelError": "Der delegierte Vorgang wurde beendet, da die Berechtigung für den delegierten Vorgang widerrufen wurde."
|
||||
"delegateCancelError": "Der delegierte Vorgang wurde beendet, da die Berechtigung für den delegierten Vorgang widerrufen wurde.",
|
||||
"partnerDeleteConfirm": "(de)選択したアカウントを削除します。削除したアカウントは復元できませんが本当によろしいですか?対象アカウント:",
|
||||
"partnerDeleteFailedError": "(de)削除対象アカウントにLower layerアカウントが存在するため削除できません。Lower layerアカウントに対して削除や階層構造変更を行ってください。"
|
||||
}
|
||||
},
|
||||
"accountPage": {
|
||||
|
||||
@ -537,7 +537,9 @@
|
||||
"message": {
|
||||
"delegateNotAllowedError": "Actions on behalf of partner are not allowed. Please refresh the screen and check again.",
|
||||
"deleteFailedError": "Delegate operation failed. Please refresh the screen and check again.",
|
||||
"delegateCancelError": "The delegated operation has been terminated because permission for the delegated operation has been revoked."
|
||||
"delegateCancelError": "The delegated operation has been terminated because permission for the delegated operation has been revoked.",
|
||||
"partnerDeleteConfirm": "(en)選択したアカウントを削除します。削除したアカウントは復元できませんが本当によろしいですか?対象アカウント:",
|
||||
"partnerDeleteFailedError": "(en)削除対象アカウントにLower layerアカウントが存在するため削除できません。Lower layerアカウントに対して削除や階層構造変更を行ってください。"
|
||||
}
|
||||
},
|
||||
"accountPage": {
|
||||
|
||||
@ -537,7 +537,9 @@
|
||||
"message": {
|
||||
"delegateNotAllowedError": "No se permiten acciones en nombre del socio. Actualice la pantalla y verifique nuevamente.",
|
||||
"deleteFailedError": "La operación del delegado falló. Actualice la pantalla y verifique nuevamente.",
|
||||
"delegateCancelError": "La operación delegada finalizó porque se revocó el permiso para la operación delegada."
|
||||
"delegateCancelError": "La operación delegada finalizó porque se revocó el permiso para la operación delegada.",
|
||||
"partnerDeleteConfirm": "(es)選択したアカウントを削除します。削除したアカウントは復元できませんが本当によろしいですか?対象アカウント:",
|
||||
"partnerDeleteFailedError": "(es)削除対象アカウントにLower layerアカウントが存在するため削除できません。Lower layerアカウントに対して削除や階層構造変更を行ってください。"
|
||||
}
|
||||
},
|
||||
"accountPage": {
|
||||
|
||||
@ -537,7 +537,9 @@
|
||||
"message": {
|
||||
"delegateNotAllowedError": "Les actions au nom du partenaire ne sont pas autorisées. Veuillez actualiser l'écran et vérifier à nouveau.",
|
||||
"deleteFailedError": "L’opération de délégation a échoué. Veuillez actualiser l'écran et vérifier à nouveau.",
|
||||
"delegateCancelError": "L'opération déléguée a été interrompue car l'autorisation pour l'opération déléguée a été révoquée."
|
||||
"delegateCancelError": "L'opération déléguée a été interrompue car l'autorisation pour l'opération déléguée a été révoquée.",
|
||||
"partnerDeleteConfirm": "(fr)選択したアカウントを削除します。削除したアカウントは復元できませんが本当によろしいですか?対象アカウント:",
|
||||
"partnerDeleteFailedError": "(fr)削除対象アカウントにLower layerアカウントが存在するため削除できません。Lower layerアカウントに対して削除や階層構造変更を行ってください。"
|
||||
}
|
||||
},
|
||||
"accountPage": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user