-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Implemented: Updated the DataManager Logs page to be dynamic in Job Manager(#680)
- Loading branch information
Showing
16 changed files
with
655 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<template> | ||
<ion-content> | ||
<ion-list> | ||
<ion-list-header>{{ dataManagerLog.logId }}</ion-list-header> | ||
<ion-item button @click="downloadFile('logFile')"> | ||
{{ translate('Log file') }} | ||
</ion-item> | ||
<ion-item button @click="downloadFile('uploadedFile')"> | ||
{{ translate('Uploaded file') }} | ||
</ion-item> | ||
<ion-item button :disabled="!dataManagerLog?.errorRecordContentId" lines="none" @click="downloadFile('failedRecords')"> | ||
{{ translate('Failed records') }} | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { | ||
IonContent, | ||
IonItem, | ||
IonList, | ||
IonListHeader, | ||
popoverController | ||
} from "@ionic/vue"; | ||
import { defineComponent } from "vue"; | ||
import { translate } from "@hotwax/dxp-components"; | ||
import { JobService } from "@/services/JobService"; | ||
import { saveDataFile, showToast } from '@/utils'; | ||
import logger from "@/logger"; | ||
export default defineComponent({ | ||
name: "DownloadLogsFilePopover", | ||
components: { | ||
IonContent, | ||
IonItem, | ||
IonList, | ||
IonListHeader | ||
}, | ||
props: ["dataManagerLog"], | ||
methods: { | ||
async downloadFile(type: string) { | ||
let dataResource = {} as any; | ||
if (type === 'logFile') { | ||
dataResource.dataResourceId = this.dataManagerLog.logFileDataResourceId | ||
dataResource.name = this.dataManagerLog.logFileContentName | ||
} else if (type === 'uploadedFile') { | ||
dataResource.name = this.dataManagerLog.contentName | ||
dataResource.dataResourceId = this.dataManagerLog.dataResourceId | ||
} else if (type === 'failedRecords') { | ||
dataResource.dataResourceId = this.dataManagerLog.errorRecordDataResourceId | ||
dataResource.name = this.dataManagerLog.errorRecordContentName | ||
} | ||
if (dataResource.dataResourceId) { | ||
try { | ||
const response = await JobService.fetchFileData({ | ||
dataResourceId: dataResource.dataResourceId | ||
}); | ||
saveDataFile(response.data, dataResource.name); | ||
} catch (error) { | ||
showToast(translate('Error downloading file')) | ||
logger.error(error) | ||
} | ||
} | ||
popoverController.dismiss(); | ||
} | ||
}, | ||
setup() { | ||
return { | ||
translate | ||
} | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.