Fix marvinjs loading and speedup creating of the wopi files [SCI-9409]

This commit is contained in:
Andrej 2023-09-29 15:35:33 +02:00
parent 9b9c370bc3
commit e1ca9175b7
5 changed files with 37 additions and 33 deletions

View file

@ -268,8 +268,6 @@ class AssetsController < ApplicationController
render_404 and return
end
# Prepare file preview in advance
asset.medium_preview.processed && asset.large_preview.processed
# Return edit url and asset info
render json: {
attributes: AssetSerializer.new(asset, scope: { user: current_user }).as_json,

View file

@ -71,7 +71,7 @@
class="new-marvinjs-upload-button hidden"
:data-object-id="step.id"
ref="marvinJsButton"
:data-marvin-url="step.attributes.marvinjs_context.marvin_js_asset_url"
:data-marvin-url="step.attributes.marvinjs_context?.marvin_js_asset_url"
:data-object-type="step.attributes.type"
tabindex="0"
></span> <!-- Hidden element to support legacy code -->

View file

@ -54,7 +54,7 @@
<a
class="new-marvinjs-upload-button btn btn-light"
:data-object-id="step.id"
:data-marvin-url="step.attributes.marvinjs_context.marvin_js_asset_url"
:data-marvin-url="step.attributes.marvinjs_context?.marvin_js_asset_url"
data-object-type="Step"
@click="openMarvinJsModal"
tabindex="0"

View file

@ -45,7 +45,7 @@
class="new-marvinjs-upload-button hidden"
:data-object-id="result.id"
ref="marvinJsButton"
:data-marvin-url="result.attributes.marvinjs_context.marvin_js_asset_url"
:data-marvin-url="result.attributes.marvinjs_context?.marvin_js_asset_url"
:data-object-type="result.attributes.type"
tabindex="0"
></span> <!-- Hidden element to support legacy code -->

View file

@ -1,4 +1,4 @@
/* global HelperModule */
/* global HelperModule animateSpinner renderFormError I18n */
const FILENAME_MAX_LENGTH = 100;
@ -19,9 +19,14 @@ export default {
}
});
$wopiModal.find('form').on(
$wopiModal.find('form')
.on('submit', () => {
animateSpinner(null, true);
})
.on(
'ajax:success',
(e, data, status) => {
animateSpinner(null, false);
if (status === 'success') {
$wopiModal.modal('hide');
window.open(data.edit_url, '_blank');
@ -32,9 +37,10 @@ export default {
requestCallback(e, data, status);
}
).on('ajax:error', function(ev, response) {
var element;
var msg;
let element;
let msg;
animateSpinner(null, false);
$(this).clearFormErrors();
if (response.status === 400) {