Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/app/components/bulk/BulkResultStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ const { query, makePageInfo, makeIndicators } = useBulk()
const toast = useToast()

const { handleFetchError } = useErrorHandling()
const { data: status, execute: executeStatus }
const { data: status, refresh: refreshStatus }
= await useFetch<BulkProcessingStatus>(`/api/bulk/execute/status/${properties.taskId}`,
{
method: 'GET',
lazy: true,
immediate: false,
onResponseError({ response }) {
switch (response.status) {
case 404: {
Expand All @@ -33,7 +32,7 @@ const isPolling = ref(false)
const pollExecuteStatus = async () => {
isPolling.value = true
for (let index = 0; index < maxAttempts; index++) {
await executeStatus()
await refreshStatus()
const st = (status.value?.status)
if (st === 'SUCCESS') {
isPolling.value = false
Expand All @@ -60,13 +59,12 @@ const pollExecuteStatus = async () => {
isPolling.value = false
}

const { data: executeResult, execute: fetchExecuteResult, status: getResultStatus }
const { data: executeResult, refresh: refreshExecuteResult, status: getResultStatus }
= await useFetch<ExecuteResults>(`/api/bulk/result/${properties.historyId}`, {
method: 'GET',
query,
lazy: true,
server: false,
immediate: false,
onResponseError({ response }) {
switch (response.status) {
case 403: {
Expand Down Expand Up @@ -95,7 +93,7 @@ const { data: executeResult, execute: fetchExecuteResult, status: getResultStatu
onMounted(async () => {
if (properties.taskId)
await pollExecuteStatus()
await fetchExecuteResult()
await refreshExecuteResult()
})

const indicators = computed(() => makeIndicators(executeResult.value))
Expand Down
12 changes: 5 additions & 7 deletions src/app/components/bulk/BulkValidationStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@ const {
const { makePageInfo, makeIndicators } = useBulk()
const { polling: { interval, maxAttempts } } = useAppConfig()
const { handleFetchError } = useErrorHandling()
const { data: status, execute: getValidateStatus }
const { data: status, refresh: refreshValidateStatus }
= await useFetch<BulkProcessingStatus>(`/api/bulk/validate/status/${taskId.value}`,
{
method: 'GET',
lazy: true,
server: false,
immediate: false,
onResponseError({ response }) {
switch (response.status) {
case 404: {
showError({
status: 404,
statusText: 'Not Found',
message: $t('error-page.not-found.bulk-validation'),
message: $t('bulk.validation.fetch_failed'),
})
break
}
Expand All @@ -46,7 +45,7 @@ const isPolling = ref(false)
const pollValidationStatus = async () => {
isPolling.value = true
for (let index = 0; index < maxAttempts; index++) {
await getValidateStatus()
await refreshValidateStatus()
const st = (status.value?.status)
if (st === 'SUCCESS') {
isPolling.value = false
Expand Down Expand Up @@ -74,13 +73,12 @@ const pollValidationStatus = async () => {
isPolling.value = false
}

const { data: validationResults, execute: getValidateResult, status: getResultStatus }
const { data: validationResults, refresh: refreshValidateResult, status: getResultStatus }
= await useFetch<ValidationResults>(`/api/bulk/validate/result/${taskId.value}`, {
method: 'GET',
query,
lazy: true,
server: false,
immediate: false,
onResponseError({ response }) {
switch (response.status) {
case 400: {
Expand Down Expand Up @@ -118,7 +116,7 @@ const { data: validationResults, execute: getValidateResult, status: getResultSt

onMounted(async () => {
await pollValidationStatus()
getValidateResult()
refreshValidateResult()
})

const offset = computed(() => (validationResults.value?.offset ?? 1))
Expand Down
4 changes: 3 additions & 1 deletion src/app/composables/useHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ const useHistory = () => {

function sortableHeader(key: 'timestamp') {
const label = key === 'timestamp'
? (tab.value === 'download' ? $t('history.download.date') : $t('history.upload.date'))
? (tab.value === 'download'
? $t('history.table.column.download-date')
: $t('history.table.column.upload-date'))
: ''
const iconSet = {
asc: 'i-lucide-arrow-down-0-1',
Expand Down
39 changes: 4 additions & 35 deletions src/app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"about-description3": "You can choose to delete users who are not included in the file.",
"about-description4": "Supported formats: TSV, CSV, Excel.",
"column": {
"email": "E-mail",
"eppn": "ePPN",
"groups": "Group ID",
"row": "row",
Expand All @@ -21,13 +20,10 @@
},
"execute": {
"failed": "User update failed.",
"result_failed": "Failed to get execution results.",
"timeout": "Bulk update process timed out."
},
"file-format-error": "The file format is not supported. \nChoose TSV, CSV, or Excel file.",
"file-required": "Please select file.",
"file-validate-error": "File validation failed.",
"filter": "filter",
"import": {
},
"import-results": "Batch operation results",
Expand Down Expand Up @@ -58,7 +54,6 @@
"validate": "data validation",
"validate_description": "Confirm changes"
},
"target-repository": "Operation target repository",
"title": "Bulk user operations",
"upload": {
"execute": "Execute upload"
Expand All @@ -74,8 +69,7 @@
"fix_error": "Please fix the error.",
"results": "data preview",
"timeout": "File validation timed out."
},
"view-all": "Show all"
}
},
"button": {
"add": "Add",
Expand Down Expand Up @@ -109,7 +103,6 @@
},
"error-page": {
"failed": {
"bulk-validation": "File validation failed",
"load-more": "Failed to retrieve download history again"
},
"forbidden": {
Expand Down Expand Up @@ -218,8 +211,8 @@
"public": "Public Status",
"users-count": "Users"
},
"search-placeholder": "Search by group name...",
"no-groupss-description": "Your repository does not have any groups. Please create a group first.",
"search-placeholder": "Search by group name...",
"title": "Groups List"
},
"title": "Groups"
Expand All @@ -236,28 +229,16 @@
"logoAlt": "Header App Logo"
},
"history": {
"available": "Re-download",
"cancel": "Number of cancellations",
"date": "Execution date and time",
"description": "You can check the history of file uploads and downloads.",
"download": {
"date": "Download date and time"
},
"empty": "No data matching your search criteria was found.",
"empty-data": "No data.",
"expired": "Expired",
"failed": "failure",
"failed-count": "Number of failures",
"file": "file",
"file_not_available": "File download failed.",
"filter": {
"options_not_found": "Failed to get filter.",
"title": "filter"
},
"first-download": "First download",
"group-count": "Number of groups",
"more": "Show more",
"operation": "Execution conditions",
"operator": "Execution user",
"private": "make private",
"progress": "Processing",
Expand All @@ -268,33 +249,21 @@
"show-detail": "Show details",
"status": "status",
"success": "success",
"success-count": "Number of successes",
"sum": "Total number of downloads | Total number of uploads",
"tab": {
"download": "Download history",
"upload": "Upload history"
},
"table": {
"column": {
"download-date": "Download date and time",
"eppns": "eppn",
"groups": "group",
"operator": "Execution user",
"re-download": "re-download",
"users": "user"
"upload-date": "Upload date and time"
}
},
"table-title": "History list",
"target": "Download target | Upload target",
"title": "History",
"toggle_public_status_failed": "Failed to update publishing status.",
"unavailable": "Expired",
"upload": {
"date": "Upload date and time"
},
"uploaded-at": "Upload date and time",
"user-count": "Number of users",
"view": "Number of items displayed"
"user-count": "Number of users"
},
"login": {
"dev-account": "Account",
Expand Down
36 changes: 3 additions & 33 deletions src/app/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"about-description3": "ファイルに含まれていないユーザーの削除を選択できます。",
"about-description4": "対応形式: TSV, CSV, Excel",
"column": {
"email": "E-maile",
"eppn": "ePPN",
"groups": "グループ ID",
"row": "行",
Expand All @@ -21,13 +20,10 @@
},
"execute": {
"failed": "ユーザーの更新に失敗しました。",
"result_failed": "実行結果の取得に失敗しました。",
"timeout": "一括更新処理がタイムアウトしました。"
},
"file-format-error": "対応していないファイル形式です。TSV、CSV、またはExcelファイルを選択してください。",
"file-required": "ファイルを選択してください。",
"file-validate-error": "ファイルの検証に失敗しました。",
"filter": "フィルター",
"import": {
},
"import-results": "一括操作結果",
Expand Down Expand Up @@ -58,7 +54,6 @@
"validate": "データ検証",
"validate_description": "変更内容の確認"
},
"target-repository": "操作対象リポジトリ",
"title": "ユーザー一括操作",
"upload": {
"execute": "アップロード実行"
Expand All @@ -74,8 +69,7 @@
"fix_error": "エラーを修正してください。",
"results": "データプレビュー",
"timeout": "ファイルの検証がタイムアウトしました。"
},
"view-all": "すべて表示"
}
},
"button": {
"add": "追加",
Expand All @@ -99,7 +93,6 @@
},
"error-page": {
"failed": {
"bulk-validation": "ファイルの検証に失敗しました",
"load-more": "再ダウンロード履歴の取得に失敗しました"
},
"forbidden": {
Expand Down Expand Up @@ -222,27 +215,16 @@
"logoAlt": "ヘッダーロゴ"
},
"history": {
"available": "再ダウンロード",
"date": "実行日時",
"description": "ファイルのアップロード・ダウウンロードの履歴を確認できます。",
"download": {
"date": "ダウンロード日時"
},
"empty": "検索条件に一致するデータが見つかりませんでした。",
"empty-data": "データがありません。",
"expired": "期限切れ",
"failed": "失敗",
"failed-count": "失敗件数",
"file": "ファイル",
"file_not_available": "ファイルのダウンロードに失敗しました。",
"filter": {
"options_not_found": "フィルターの取得に失敗しました。",
"title": "フィルター"
},
"first-download": "初回ダウンロード",
"group-count": "グループ数",
"more": "さらに表示",
"operation": "実行条件",
"operator": "実行ユーザー",
"private": "非公開にする",
"progress": "処理中",
Expand All @@ -253,33 +235,21 @@
"show-detail": "詳細を表示",
"status": "ステータス",
"success": "成功",
"success-count": "成功件数",
"sum": "総ダウンロード回数 | 総アップロード回数",
"tab": {
"download": "ダウンロード履歴",
"upload": "アップロード履歴"
},
"table": {
"column": {
"download-date": "ダウンロード日時",
"eppns": "eppn",
"groups": "グループ",
"operator": "実行ユーザー",
"re-download": "再ダウンロード",
"users": "ユーザー"
"upload-date": "アップロード日時"
}
},
"table-title": "履歴一覧",
"target": "ダウンロード対象 | アップロード対象",
"title": "履歴",
"toggle_public_status_failed": "公開状態の更新に失敗しました。",
"unavailable": "期限切れ",
"upload": {
"date": "アップロード日時"
},
"uploaded-at": "アップロード日時",
"user-count": "ユーザー数",
"view": "表示件数"
"user-count": "ユーザー数"
},
"login": {
"dev-account": "アカウント",
Expand Down
22 changes: 0 additions & 22 deletions src/server/api/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,3 @@ def files(file_id: UUID) -> Response | tuple[ErrorResponse, int]:
current_app.logger.error(E.FILE_NOT_FOUND, {"path": file_path})
return ErrorResponse(message=E.FILE_NOT_FOUND % {"path": file_path}), 404
return send_file(path_or_file=file_path)


@bp.get("/files/<file_id>/exists")
@login_required
@roles_required(USER_ROLES.SYSTEM_ADMIN, USER_ROLES.REPOSITORY_ADMIN)
@validate(response_by_alias=True)
def is_exist_files(file_id: UUID) -> tuple[bool | ErrorResponse, int]:
"""Check if the file exists.

Args:
file_id (UUID): Unique identifier of the file

Returns:
bool:Whether to check if the file exists
"""
try:
file_path = Path(history.get_file_path(file_id))
except RecordNotFound as exc:
return ErrorResponse(message=exc.message), 404
if not Path(file_path).exists():
return False, 200
return True, 200
10 changes: 0 additions & 10 deletions src/server/api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,3 @@ class FileQuery(UsersQuery):

model_config = ignore_extra_config
"""Configure to ignore extra fields."""


class ExportBody(BaseModel):
"""Body for user export request."""

user_ids: list[str]
"""List of user IDs to export."""

model_config = camel_case_config
"""Configure to use camelCase aliasing."""
Loading
Loading