Skip to content

Commit

Permalink
Fix tests, polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Apr 27, 2022
1 parent f887105 commit af1bc4b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ export default defineComponent({
}
},
onFileError(error) {
console.error(error)
onFileError(file) {
this.showMessage({
title: this.$gettext('Failed to upload'),
status: 'danger'
Expand Down
35 changes: 31 additions & 4 deletions packages/web-runtime/src/components/UploadInfo.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div id="upload-info" class="oc-rounded oc-box-shadow-medium" :class="{ 'oc-hidden': !showInfo }">
<div class="upload-info-title oc-flex oc-flex-between oc-flex-middle oc-px-m oc-pt-m">
<div class="upload-info-title oc-flex oc-flex-between oc-flex-middle oc-p-m">
<span class="oc-flex oc-flex-middle">
<oc-icon
v-if="!filesUploading && !uploadCancelled"
Expand All @@ -21,8 +21,11 @@
<oc-icon name="close" />
</oc-button>
</div>
<div class="upload-info-status-bar oc-px-m" />
<div class="upload-info-successful-uploads oc-p-m">
<div
class="upload-info-status-bar oc-px-m"
:class="{ 'oc-mb-m': successfulUploads.length && filesUploading.length }"
/>
<div class="upload-info-successful-uploads oc-px-m oc-pb-m">
<ul id="files-collaborators-list" class="oc-list">
<li
v-for="(item, idx) in successfulUploads"
Expand Down Expand Up @@ -181,7 +184,7 @@ export default {
}
</script>
<style lang="scss" scoped>
<style lang="scss">
#upload-info {
position: absolute;
right: 20px;
Expand All @@ -193,4 +196,28 @@ export default {
max-height: 50vh;
overflow-y: auto;
}
.upload-info-status-bar .uppy-StatusBar,
.upload-info-status-bar .uppy-StatusBar-actionBtn--retry:hover {
background-color: unset !important;
}
.upload-info-status-bar .uppy-StatusBar-content {
padding-left: 0.25rem !important;
color: var(--oc-color-text-default);
}
.upload-info-status-bar .uppy-StatusBar-actions {
right: 0.25rem !important;
}
.upload-info-status-bar .uppy-c-btn {
color: var(--oc-color-text-default);
}
.upload-info-status-bar .uppy-StatusBar-statusSecondary {
color: var(--oc-color-swatch-passive-default);
}
.upload-info-status-bar .uppy-StatusBar-details,
.upload-info-status-bar .uppy-StatusBar-actionBtn--retry svg {
display: none;
}
.upload-info-status-bar .uppy-StatusBar-statusPrimary {
font-size: 0.9rem;
}
</style>
4 changes: 2 additions & 2 deletions packages/web-runtime/src/composables/upload/useUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function useUpload(options: UploadOptions): UploadResult {
const store = useStore()
const publicLinkPassword = computed((): string => store.getters['Files/publicLinkPassword'])
const isPublicLocation = useActiveLocation(isLocationPublicActive, 'files-public-files')
const isPublicDropLocation = useActiveLocation(isLocationPublicActive, 'files-public-drop')
const clientService = useClientService()
const getToken = computed((): string => store.getters.getToken)

Expand All @@ -47,9 +48,8 @@ export function useUpload(options: UploadOptions): UploadResult {
const uploadChunkSize = computed((): number => store.getters.configuration.uploadChunkSize)

const headers = computed((): { [key: string]: string } => {
if (unref(isPublicLocation)) {
if (unref(isPublicLocation) || unref(isPublicDropLocation)) {
const password = unref(publicLinkPassword)

if (password) {
return { Authorization: 'Basic ' + Buffer.from('public:' + password).toString('base64') }
}
Expand Down
9 changes: 4 additions & 5 deletions packages/web-runtime/src/services/uppyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class UppyService extends Vue {
chunkSize: chunkSize,
removeFingerprintOnSuccess: true,
overridePatchMethod: !!tusHttpMethodOverride,
retryDelays: [0, 3000, 5000, 10000, 20000]
retryDelays: [0]
}

const xhrPlugin = this.uppy.getPlugin('XHRUpload')
Expand Down Expand Up @@ -177,7 +177,9 @@ export class UppyService extends Vue {
this.$emit('uploadSuccess', file)
this.uppy.removeFile(file.id)
})

result.failed.forEach((file) => {
this.$emit('uploadError', file)
})
this.uploadInputs.forEach((item) => {
item.value = null
})
Expand All @@ -200,9 +202,6 @@ export class UppyService extends Vue {
})
}
})
this.uppy.on('upload-error', () => {
this.$emit('uploadError')
})
}

registerUploadInput(el: HTMLInputElement) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sunday,monday

0 comments on commit af1bc4b

Please sign in to comment.