mirror of https://github.com/harness/drone.git
feat: [code-1882] support to delete failed import (#2092)
parent
2f7e665267
commit
cdd7478cb2
|
@ -334,7 +334,9 @@ export interface StringsMap {
|
|||
deleteBranchConfirm: string
|
||||
deleteBranchText: string
|
||||
deleteCommentConfirm: string
|
||||
deleteFailedImport: string
|
||||
deleteFile: string
|
||||
deleteImport: string
|
||||
deleteNotAllowed: string
|
||||
deleteRepoText: string
|
||||
deleteRepoTitle: string
|
||||
|
@ -345,6 +347,7 @@ export interface StringsMap {
|
|||
deleteTokenMsg: string
|
||||
deleteUser: string
|
||||
deleted: string
|
||||
deletedImport: string
|
||||
deployKeys: string
|
||||
descending: string
|
||||
description: string
|
||||
|
@ -442,6 +445,7 @@ export interface StringsMap {
|
|||
failedToCreateRepo: string
|
||||
failedToCreateSpace: string
|
||||
failedToDeleteBranch: string
|
||||
failedToDeleteImport: string
|
||||
failedToDeleteWebhook: string
|
||||
failedToFetchFileContent: string
|
||||
failedToImportSpace: string
|
||||
|
|
|
@ -12,8 +12,11 @@ public: Public
|
|||
private: Private
|
||||
cancel: Cancel
|
||||
cancelImport: Cancel Import
|
||||
deleteImport: Delete Import
|
||||
cancelledImport: Cancelled Import
|
||||
failedToCancelImport: failed to cancel import
|
||||
deletedImport: Deleted Import
|
||||
failedToCancelImport: Failed to cancel import
|
||||
failedToDeleteImport: Failed to delete import
|
||||
name: Name
|
||||
value: Value
|
||||
help: help
|
||||
|
@ -174,6 +177,7 @@ deleteTag: Delete Tag
|
|||
deleteTagConfirm: Are you sure you want to delete tag <strong>{{name}}</strong>? You can't undo this action.
|
||||
deleteBranchConfirm: Are you sure you want to delete branch <strong>{{name}}</strong>? You can't undo this action.
|
||||
cancelImportConfirm: Are you sure you want to abort import for <strong>{{name}}</strong>? You can't undo this action.
|
||||
deleteFailedImport: Are you sure you want to delete <strong>{{name}}</strong>?
|
||||
browse: Browse
|
||||
browseFiles: Browse Files
|
||||
compare: Compare
|
||||
|
|
|
@ -224,47 +224,85 @@ export default function RepositoriesListing() {
|
|||
const confirmCancelImport = useConfirmAct()
|
||||
return (
|
||||
<Container onClick={Utils.stopEvent}>
|
||||
{row?.original?.importProgress === ImportStatus.FAILED
|
||||
? null
|
||||
: row.original.importing && (
|
||||
<OptionsMenuButton
|
||||
isDark
|
||||
width="100px"
|
||||
items={[
|
||||
{
|
||||
text: getString('cancelImport'),
|
||||
onClick: () =>
|
||||
confirmCancelImport({
|
||||
title: getString('cancelImport'),
|
||||
confirmText: getString('cancelImport'),
|
||||
intent: Intent.DANGER,
|
||||
message: (
|
||||
<Text
|
||||
style={{ wordBreak: 'break-word' }}
|
||||
font={{ variation: FontVariation.BODY2_SEMI, size: 'small' }}>
|
||||
<String
|
||||
useRichText
|
||||
stringID="cancelImportConfirm"
|
||||
vars={{ name: row.original?.uid }}
|
||||
tagName="div"
|
||||
/>
|
||||
</Text>
|
||||
),
|
||||
action: async () => {
|
||||
deleteRepo(`${row.original?.path as string}/+/`)
|
||||
.then(() => {
|
||||
showSuccess(getString('cancelledImport'), 2000)
|
||||
refetch()
|
||||
})
|
||||
.catch(err => {
|
||||
showError(getErrorMessage(err), 0, getString('failedToCancelImport'))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
{row?.original?.importProgress === ImportStatus.FAILED ? (
|
||||
<OptionsMenuButton
|
||||
isDark
|
||||
width="100px"
|
||||
items={[
|
||||
{
|
||||
text: getString('deleteImport'),
|
||||
onClick: () =>
|
||||
confirmCancelImport({
|
||||
title: getString('deleteImport'),
|
||||
confirmText: getString('delete'),
|
||||
intent: Intent.DANGER,
|
||||
message: (
|
||||
<Text
|
||||
style={{ wordBreak: 'break-word' }}
|
||||
font={{ variation: FontVariation.BODY2_SEMI, size: 'small' }}>
|
||||
<String
|
||||
useRichText
|
||||
stringID="deleteFailedImport"
|
||||
vars={{ name: row.original?.uid }}
|
||||
tagName="div"
|
||||
/>
|
||||
</Text>
|
||||
),
|
||||
action: async () => {
|
||||
deleteRepo(`${row.original?.path as string}/+/`)
|
||||
.then(() => {
|
||||
showSuccess(getString('deletedImport'), 2000)
|
||||
refetch()
|
||||
})
|
||||
.catch(err => {
|
||||
showError(getErrorMessage(err), 0, getString('failedToDeleteImport'))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
]}
|
||||
/>
|
||||
) : (
|
||||
row.original.importing && (
|
||||
<OptionsMenuButton
|
||||
isDark
|
||||
width="100px"
|
||||
items={[
|
||||
{
|
||||
text: getString('cancelImport'),
|
||||
onClick: () =>
|
||||
confirmCancelImport({
|
||||
title: getString('cancelImport'),
|
||||
confirmText: getString('cancelImport'),
|
||||
intent: Intent.DANGER,
|
||||
message: (
|
||||
<Text
|
||||
style={{ wordBreak: 'break-word' }}
|
||||
font={{ variation: FontVariation.BODY2_SEMI, size: 'small' }}>
|
||||
<String
|
||||
useRichText
|
||||
stringID="cancelImportConfirm"
|
||||
vars={{ name: row.original?.uid }}
|
||||
tagName="div"
|
||||
/>
|
||||
</Text>
|
||||
),
|
||||
action: async () => {
|
||||
deleteRepo(`${row.original?.path as string}/+/`)
|
||||
.then(() => {
|
||||
showSuccess(getString('cancelledImport'), 2000)
|
||||
refetch()
|
||||
})
|
||||
.catch(err => {
|
||||
showError(getErrorMessage(err), 0, getString('failedToCancelImport'))
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
]}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue