new file system updates
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col col-md-12">
|
||||
<h3>{{ $t('Files') }} <span class="float-right"><file-editor @change="loadInitial()" ></file-editor></span>
|
||||
<h3>{{ $t('Files') }} <span class="float-right"><file-editor @change="loadInitial()"></file-editor></span>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<div class="row" style="margin-top: 2vh">
|
||||
<div class="col col-md-12">
|
||||
<b-progress :max="max_file_size_mb">
|
||||
<b-progress-bar :value="current_file_size_mb" >
|
||||
<b-progress-bar :value="current_file_size_mb">
|
||||
<span><strong class="text-dark ">{{ current_file_size_mb.toFixed(2) }} / {{ max_file_size_mb }} MB</strong></span>
|
||||
</b-progress-bar>
|
||||
</b-progress>
|
||||
@ -29,15 +29,18 @@
|
||||
<tr>
|
||||
<th>{{ $t('Name') }}</th>
|
||||
<th>{{ $t('Size') }} (MB)</th>
|
||||
<th>{{ $t('Download') }}</th>
|
||||
<th>{{ $t('Edit') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="f in files" v-bind:key="f.id">
|
||||
<td>{{ f.name }}</td>
|
||||
<td>{{ f.file_size_kb / 1000 }}</td>
|
||||
<td><a :href="f.file" target="_blank" rel="noreferrer nofollow">{{$t('Download')}}</a></td>
|
||||
<td><a :href="f.file" target="_blank" rel="noreferrer nofollow">{{ $t('Download') }}</a></td>
|
||||
<td>
|
||||
|
||||
<file-editor @change="loadInitial()" :file_id="f.id"></file-editor>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -10,10 +10,26 @@
|
||||
<template v-if="file!==undefined">
|
||||
{{ $t('Name') }}
|
||||
<b-input v-model="file.name"></b-input>
|
||||
|
||||
<br/>
|
||||
{{ $t('File') }}
|
||||
<b-form-file v-model="file.file"></b-form-file>
|
||||
</template>
|
||||
<br/>
|
||||
<br/>
|
||||
<template #modal-footer="">
|
||||
<b-button size="sm" variant="success" @click="modalOk()">
|
||||
{{ $t('Ok') }}
|
||||
</b-button>
|
||||
|
||||
<b-button size="sm" variant="secondary" @click="$bvModal.hide('modal-file-editor'+file_id)">
|
||||
{{ $t('Cancel') }}
|
||||
</b-button>
|
||||
|
||||
<b-button size="sm" variant="danger" @click="deleteFile()">
|
||||
{{ $t('Delete') }}
|
||||
</b-button>
|
||||
</template>
|
||||
|
||||
</b-modal>
|
||||
</div>
|
||||
</template>
|
||||
@ -66,13 +82,12 @@ export default {
|
||||
if (!(typeof this.file.file === 'string' || this.file.file instanceof String)) { // only update file if it was changed
|
||||
passedFile = this.file.file
|
||||
}
|
||||
console.log(passedFile)
|
||||
|
||||
apiClient.updateUserFile(this.file.id, this.file.name, passedFile).then(request => {
|
||||
makeToast(this.$t('Success'), this.$t('success_updating_resource'), 'success')
|
||||
this.$emit('change',)
|
||||
}).catch(err => {
|
||||
makeToast(this.$t('Error'), this.$t('err_updating_resource'), 'danger')
|
||||
makeToast(this.$t('Error'), this.$t('err_updating_resource') + '\n' + err.response.data, 'danger')
|
||||
console.log(err.request, err.response)
|
||||
})
|
||||
},
|
||||
@ -81,10 +96,24 @@ export default {
|
||||
|
||||
apiClient.createUserFile(this.file.name, this.file.file).then(request => {
|
||||
makeToast(this.$t('Success'), this.$t('success_creating_resource'), 'success')
|
||||
this.$emit('change',)
|
||||
this.file = {
|
||||
name: '',
|
||||
file: undefined
|
||||
}
|
||||
}).catch(err => {
|
||||
makeToast(this.$t('Error'), this.$t('err_creating_resource') + '\n' + err.response.data, 'danger')
|
||||
console.log(err.request, err.response)
|
||||
})
|
||||
},
|
||||
deleteFile: function () {
|
||||
let apiClient = new ApiApiFactory()
|
||||
|
||||
apiClient.destroyUserFile(this.file.id).then(results => {
|
||||
makeToast(this.$t('Success'), this.$t('success_deleting_resource'), 'success')
|
||||
this.$emit('change',)
|
||||
}).catch(err => {
|
||||
makeToast(this.$t('Error'), this.$t('err_creating_resource'), 'danger')
|
||||
makeToast(this.$t('Error'), this.$t('err_deleting_resource') + '\n' + err.response.data, 'danger')
|
||||
console.log(err.request, err.response)
|
||||
})
|
||||
}
|
||||
|
@ -2,9 +2,11 @@
|
||||
"err_fetching_resource": "There was an error fetching a resource!",
|
||||
"err_creating_resource": "There was an error creating a resource!",
|
||||
"err_updating_resource": "There was an error updating a resource!",
|
||||
"err_deleting_resource": "There was an error deleting a resource!",
|
||||
"success_fetching_resource": "Successfully fetched a resource!",
|
||||
"success_creating_resource": "Successfully created a resource!",
|
||||
"success_updating_resource": "Successfully updated a resource!",
|
||||
"success_deleting_resource": "Successfully deleted a resource!",
|
||||
|
||||
"import_running": "Import running, please wait!",
|
||||
"all_fields_optional": "All fields are optional and can be left empty.",
|
||||
@ -60,7 +62,10 @@
|
||||
"Files": "Files",
|
||||
"File": "File",
|
||||
"Edit": "Edit",
|
||||
"Cancel": "Cancel",
|
||||
"Delete": "Delete",
|
||||
"Open": "Open",
|
||||
"Ok": "Open",
|
||||
"Save": "Save",
|
||||
"Step": "Step",
|
||||
"Search": "Search",
|
||||
|
Reference in New Issue
Block a user