[SSE mobile] Add error controller, add long actions controller
This commit is contained in:
parent
d66852e540
commit
0d82918ed5
|
@ -6,6 +6,103 @@
|
||||||
"textAnonymous": "Anonymous"
|
"textAnonymous": "Anonymous"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"LongActions": {
|
||||||
|
"openTitleText": "Opening Document",
|
||||||
|
"openTextText": "Opening document...",
|
||||||
|
"saveTitleText": "Saving Document",
|
||||||
|
"saveTextText": "Saving document...",
|
||||||
|
"loadFontsTitleText": "Loading Data",
|
||||||
|
"loadFontsTextText": "Loading data...",
|
||||||
|
"loadImagesTitleText": "Loading Images",
|
||||||
|
"loadImagesTextText": "Loading images...",
|
||||||
|
"loadFontTitleText": "Loading Data",
|
||||||
|
"loadFontTextText": "Loading data...",
|
||||||
|
"loadImageTitleText": "Loading Image",
|
||||||
|
"loadImageTextText": "Loading image...",
|
||||||
|
"downloadTitleText": "Downloading Document",
|
||||||
|
"downloadTextText": "Downloading document...",
|
||||||
|
"printTitleText": "Printing Document",
|
||||||
|
"printTextText": "Printing document...",
|
||||||
|
"uploadImageTitleText": "Uploading Image",
|
||||||
|
"uploadImageTextText": "Uploading image...",
|
||||||
|
"applyChangesTitleText": "Loading Data",
|
||||||
|
"applyChangesTextText": "Loading data...",
|
||||||
|
"savePreparingText": "Preparing to save",
|
||||||
|
"savePreparingTitle": "Preparing to save. Please wait...",
|
||||||
|
"waitText": "Please, wait...",
|
||||||
|
"txtEditingMode": "Set editing mode...",
|
||||||
|
"loadingDocumentTitleText": "Loading document",
|
||||||
|
"loadingDocumentTextText": "Loading document...",
|
||||||
|
"textLoadingDocument": "Loading document"
|
||||||
|
},
|
||||||
|
"Error": {
|
||||||
|
"criticalErrorTitle": "Error",
|
||||||
|
"unknownErrorText": "Unknown error.",
|
||||||
|
"convertationTimeoutText": "Convertation timeout exceeded.",
|
||||||
|
"openErrorText": "An error has occurred while opening the file",
|
||||||
|
"saveErrorText": "An error has occurred while saving the file",
|
||||||
|
"downloadErrorText": "Download failed.",
|
||||||
|
"uploadImageSizeMessage": "Maximium image size limit exceeded.",
|
||||||
|
"uploadImageExtMessage": "Unknown image format.",
|
||||||
|
"uploadImageFileCountMessage": "No images uploaded.",
|
||||||
|
"errorKeyEncrypt": "Unknown key descriptor",
|
||||||
|
"errorKeyExpire": "Key descriptor expired",
|
||||||
|
"errorUsersExceed": "Count of users was exceed",
|
||||||
|
"errorViewerDisconnect": "Connection is lost. You can still view the document,<br>but will not be able to download until the connection is restored and page is reloaded.",
|
||||||
|
"errorFilePassProtect": "The file is password protected and could not be opened.",
|
||||||
|
"errorStockChart": "Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",
|
||||||
|
"errorDataRange": "Incorrect data range.",
|
||||||
|
"errorDatabaseConnection": "External error.<br>Database connection error. Please, contact support.",
|
||||||
|
"errorUserDrop": "The file cannot be accessed right now.",
|
||||||
|
"errorConnectToServer": " The document could not be saved. Please check connection settings or contact your administrator.<br>When you click the 'OK' button, you will be prompted to download the document.",
|
||||||
|
"errorBadImageUrl": "Image url is incorrect",
|
||||||
|
"errorSessionAbsolute": "The document editing session has expired. Please reload the page.",
|
||||||
|
"errorSessionIdle": "The document has not been edited for quite a long time. Please reload the page.",
|
||||||
|
"errorSessionToken": "The connection to the server has been interrupted. Please reload the page.",
|
||||||
|
"errorDataEncrypted": "Encrypted changes have been received, they cannot be deciphered.",
|
||||||
|
"errorAccessDeny": "You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.",
|
||||||
|
"errorEditingDownloadas": "An error occurred during the work with the document.<br>Use the 'Download' option to save the file backup copy to your computer hard drive.",
|
||||||
|
"errorFileSizeExceed": "The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.",
|
||||||
|
"errorUpdateVersionOnDisconnect": "Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.",
|
||||||
|
"errorDefaultMessage": "Error code: %1",
|
||||||
|
"criticalErrorExtText": "Press 'OK' to back to document list.",
|
||||||
|
"notcriticalErrorTitle": "Warning",
|
||||||
|
"scriptLoadError": "The connection is too slow, some of the components could not be loaded. Please reload the page.",
|
||||||
|
"pastInMergeAreaError": "Cannot change part of a merged cell",
|
||||||
|
"errorWrongBracketsCount": "Found an error in the formula entered.<br>Wrong cout of brackets.",
|
||||||
|
"errorWrongOperator": "An error in the entered formula. Wrong operator is used.<br>Please correct the error or use the Esc button to cancel the formula editing.",
|
||||||
|
"errorCountArgExceed": "Found an error in the formula entered.<br>Count of arguments exceeded.",
|
||||||
|
"errorCountArg": "Found an error in the formula entered.<br>Invalid number of arguments.",
|
||||||
|
"errorFormulaName": "Found an error in the formula entered.<br>Incorrect formula name.",
|
||||||
|
"errorFormulaParsing": "Internal error while the formula parsing.",
|
||||||
|
"errorArgsRange": "Found an error in the formula entered.<br>Incorrect arguments range.",
|
||||||
|
"errorUnexpectedGuid": "External error.<br>Unexpected Guid. Please, contact support.",
|
||||||
|
"errorFileRequest": "External error.<br>File Request. Please, contact support.",
|
||||||
|
"errorFileVKey": "External error.<br>Incorrect securety key. Please, contact support.",
|
||||||
|
"errorMaxPoints": "The maximum number of points in series per chart is 4096.",
|
||||||
|
"errorOperandExpected": "The entered function syntax is not correct. Please check if you are missing one of the parentheses - '(' or ')'.",
|
||||||
|
"errorMoveRange": "Cann't change a part of merged cell",
|
||||||
|
"errorAutoFilterDataRange": "The operation could not be done for the selected range of cells.<br>Select a uniform data range inside or outside the table and try again.",
|
||||||
|
"errorAutoFilterChangeFormatTable": "The operation could not be done for the selected cells as you cannot move a part of the table.<br>Select another data range so that the whole table was shifted and try again.",
|
||||||
|
"errorAutoFilterChange": "The operation is not allowed, as it is attempting to shift cells in a table on your worksheet.",
|
||||||
|
"errorAutoFilterHiddenRange": "The operation cannot be performed because the area contains filtered cells.<br>Please unhide the filtered elements and try again.",
|
||||||
|
"errorFillRange": "Could not fill the selected range of cells.<br>All the merged cells need to be the same size.",
|
||||||
|
"errorInvalidRef": "Enter a correct name for the selection or a valid reference to go to.",
|
||||||
|
"errorCreateDefName": "The existing named ranges cannot be edited and the new ones cannot be created<br>at the moment as some of them are being edited.",
|
||||||
|
"errorPasteMaxRange": "The copy and paste area does not match. Please select an area with the same size or click the first cell in a row to paste the copied cells.",
|
||||||
|
"errorLockedAll": "The operation could not be done as the sheet has been locked by another user.",
|
||||||
|
"errorLockedWorksheetRename": "The sheet cannot be renamed at the moment as it is being renamed by another user",
|
||||||
|
"errorOpenWarning": "The length of one of the formulas in the file exceeded<br>the allowed number of characters and it was removed.",
|
||||||
|
"errorFrmlWrongReferences": "The function refers to a sheet that does not exist.<br>Please check the data and try again.",
|
||||||
|
"errorCopyMultiselectArea": "This command cannot be used with multiple selections.<br>Select a single range and try again.",
|
||||||
|
"errorPrintMaxPagesCount": "Unfortunately, it’s not possible to print more than 1500 pages at once in the current version of the program.<br>This restriction will be eliminated in upcoming releases.",
|
||||||
|
"errorChangeArray": "You cannot change part of an array.",
|
||||||
|
"errorMultiCellFormula": "Multi-cell array formulas are not allowed in tables.",
|
||||||
|
"errorFrmlMaxTextLength": "Text values in formulas are limited to 255 characters.<br>Use the CONCATENATE function or concatenation operator (&)",
|
||||||
|
"errorFrmlMaxLength": "You cannot add this formula as its length exceeded the allowed number of characters.<br>Please edit it and try again.",
|
||||||
|
"errorFrmlMaxReference": "You cannot enter this formula because it has too many values,<br>cell references, and/or names.",
|
||||||
|
"errorDataValidate":"The value you entered is not valid.<br>A user has restricted values that can be entered into this cell."
|
||||||
|
},
|
||||||
"ContextMenu": {
|
"ContextMenu": {
|
||||||
"menuViewComment": "View Comment",
|
"menuViewComment": "View Comment",
|
||||||
"menuAddComment": "Add Comment",
|
"menuAddComment": "Add Comment",
|
||||||
|
|
355
apps/spreadsheeteditor/mobile/src/controller/Error.jsx
Normal file
355
apps/spreadsheeteditor/mobile/src/controller/Error.jsx
Normal file
|
@ -0,0 +1,355 @@
|
||||||
|
import React, { useEffect } from 'react';
|
||||||
|
import { inject } from 'mobx-react';
|
||||||
|
import { f7 } from 'framework7-react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
const ErrorController = inject('storeAppOptions')(({storeAppOptions, LoadingDocument}) => {
|
||||||
|
const {t} = useTranslation();
|
||||||
|
const _t = t("Error", { returnObjects: true });
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
Common.Notifications.on('engineCreated', (api) => {
|
||||||
|
api.asc_registerCallback('asc_onError', onError);
|
||||||
|
});
|
||||||
|
return () => {
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
api.asc_unregisterCallback('asc_onError', onError);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const onError = (id, level, errData) => {
|
||||||
|
|
||||||
|
if (id === Asc.c_oAscError.ID.LoadingScriptError) {
|
||||||
|
f7.notification.create({
|
||||||
|
title: _t.criticalErrorTitle,
|
||||||
|
text: _t.scriptLoadError,
|
||||||
|
closeButton: true
|
||||||
|
}).open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Common.Notifications.trigger('preloader:close');
|
||||||
|
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
||||||
|
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
closable: false
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case Asc.c_oAscError.ID.Unknown:
|
||||||
|
config.msg = _t.unknownErrorText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.ConvertationTimeout:
|
||||||
|
config.msg = _t.convertationTimeoutText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.ConvertationOpenError:
|
||||||
|
config.msg = _t.openErrorText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.ConvertationSaveError:
|
||||||
|
config.msg = _t.saveErrorText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.DownloadError:
|
||||||
|
config.msg = _t.downloadErrorText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.UplImageSize:
|
||||||
|
config.msg = _t.uploadImageSizeMessage;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.UplImageExt:
|
||||||
|
config.msg = _t.uploadImageExtMessage;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.UplImageFileCount:
|
||||||
|
config.msg = _t.uploadImageFileCountMessage;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.PastInMergeAreaError:
|
||||||
|
config.msg = _t.pastInMergeAreaError;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlWrongCountParentheses:
|
||||||
|
config.msg = _t.errorWrongBracketsCount;
|
||||||
|
config.closable = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlWrongOperator:
|
||||||
|
config.msg = _t.errorWrongOperator;
|
||||||
|
config.closable = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlWrongMaxArgument:
|
||||||
|
config.msg = _t.errorCountArgExceed;
|
||||||
|
config.closable = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlWrongCountArgument:
|
||||||
|
config.msg = _t.errorCountArg;
|
||||||
|
config.closable = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlWrongFunctionName:
|
||||||
|
config.msg = _t.errorFormulaName;
|
||||||
|
config.closable = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlAnotherParsingError:
|
||||||
|
config.msg = _t.errorFormulaParsing;
|
||||||
|
config.closable = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlWrongArgumentRange:
|
||||||
|
config.msg = _t.errorArgsRange;
|
||||||
|
config.closable = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.UnexpectedGuid:
|
||||||
|
config.msg = _t.errorUnexpectedGuid;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FileRequest:
|
||||||
|
config.msg = _t.errorFileRequest;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FileVKey:
|
||||||
|
config.msg = _t.errorFileVKey;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.MaxDataPointsError:
|
||||||
|
config.msg = _t.errorMaxPoints;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlOperandExpected:
|
||||||
|
config.msg = _t.errorOperandExpected;
|
||||||
|
config.closable = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.CannotMoveRange:
|
||||||
|
config.msg = _t.errorMoveRange;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.AutoFilterDataRangeError:
|
||||||
|
config.msg = _t.errorAutoFilterDataRange;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.AutoFilterChangeFormatTableError:
|
||||||
|
config.msg = _t.errorAutoFilterChangeFormatTable;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.AutoFilterChangeError:
|
||||||
|
config.msg = _t.errorAutoFilterChange;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.AutoFilterMoveToHiddenRangeError:
|
||||||
|
config.msg = _t.errorAutoFilterHiddenRange;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.CannotFillRange:
|
||||||
|
config.msg = _t.errorFillRange;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.InvalidReferenceOrName:
|
||||||
|
config.msg = _t.errorInvalidRef;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.LockCreateDefName:
|
||||||
|
config.msg = _t.errorCreateDefName;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.PasteMaxRangeError:
|
||||||
|
config.msg = _t.errorPasteMaxRange;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.LockedAllError:
|
||||||
|
config.msg = _t.errorLockedAll;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.LockedWorksheetRename:
|
||||||
|
config.msg = _t.errorLockedWorksheetRename;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.OpenWarning:
|
||||||
|
config.msg = _t.errorOpenWarning;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlWrongReferences:
|
||||||
|
config.msg = _t.errorFrmlWrongReferences;
|
||||||
|
config.closable = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.CopyMultiselectAreaError:
|
||||||
|
config.msg = _t.errorCopyMultiselectArea;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.PrintMaxPagesCount:
|
||||||
|
config.msg = _t.errorPrintMaxPagesCount;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.CannotChangeFormulaArray:
|
||||||
|
config.msg = _t.errorChangeArray;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.MultiCellsInTablesFormulaArray:
|
||||||
|
config.msg = _t.errorMultiCellFormula;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlMaxTextLength:
|
||||||
|
config.msg = _t.errorFrmlMaxTextLength;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlMaxLength:
|
||||||
|
config.msg = _t.errorFrmlMaxLength;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.FrmlMaxReference:
|
||||||
|
config.msg = _t.errorFrmlMaxReference;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.DataValidate:
|
||||||
|
errData && errData.asc_getErrorTitle() && (config.title = Common.Utils.String.htmlEncode(errData.asc_getErrorTitle()));
|
||||||
|
config.msg = errData && errData.asc_getError() ? Common.Utils.String.htmlEncode(errData.asc_getError()) : _t.errorDataValidate;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.VKeyEncrypt:
|
||||||
|
config.msg = _t.errorKeyEncrypt;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.KeyExpire:
|
||||||
|
config.msg = _t.errorKeyExpire;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.UserCountExceed:
|
||||||
|
config.msg = _t.errorUsersExceed;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.CoAuthoringDisconnect:
|
||||||
|
config.msg = _t.errorViewerDisconnect;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.ConvertationPassword:
|
||||||
|
config.msg = _t.errorFilePassProtect;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.StockChartError:
|
||||||
|
config.msg = _t.errorStockChart;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.DataRangeError:
|
||||||
|
config.msg = _t.errorDataRange;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.Database:
|
||||||
|
config.msg = _t.errorDatabaseConnection;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.UserDrop:
|
||||||
|
const lostEditingRights = storeAppOptions.lostEditingRights;
|
||||||
|
if (lostEditingRights) {
|
||||||
|
storeAppOptions.changeEditingRights(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
storeAppOptions.changeEditingRights(true);
|
||||||
|
config.msg = _t.errorUserDrop;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.Warning:
|
||||||
|
config.msg = _t.errorConnectToServer;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.UplImageUrl:
|
||||||
|
config.msg = _t.errorBadImageUrl;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.SessionAbsolute:
|
||||||
|
config.msg = _t.errorSessionAbsolute;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.SessionIdle:
|
||||||
|
config.msg = _t.errorSessionIdle;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.SessionToken:
|
||||||
|
config.msg = _t.errorSessionToken;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.DataEncrypted:
|
||||||
|
config.msg = _t.errorDataEncrypted;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.AccessDeny:
|
||||||
|
config.msg = _t.errorAccessDeny;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.EditingError:
|
||||||
|
config.msg = _t.errorEditingDownloadas;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.ConvertationOpenLimitError:
|
||||||
|
config.msg = _t.errorFileSizeExceed;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.UpdateVersion:
|
||||||
|
config.msg = _t.errorUpdateVersionOnDisconnect;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
config.msg = _t.errorDefaultMessage.replace('%1', id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (level === Asc.c_oAscError.Level.Critical) {
|
||||||
|
|
||||||
|
// report only critical errors
|
||||||
|
Common.Gateway.reportError(id, config.msg);
|
||||||
|
|
||||||
|
config.title = _t.criticalErrorTitle;
|
||||||
|
|
||||||
|
if (storeAppOptions.canBackToFolder && !storeAppOptions.isDesktopApp) {
|
||||||
|
config.msg += '</br></br>' + _t.criticalErrorExtText;
|
||||||
|
config.callback = function() {
|
||||||
|
Common.Notifications.trigger('goback', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (id === Asc.c_oAscError.ID.DataEncrypted) {
|
||||||
|
api.asc_coAuthoringDisconnect();
|
||||||
|
Common.Notifications.trigger('api:disconnect');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Common.Gateway.reportWarning(id, config.msg);
|
||||||
|
|
||||||
|
config.title = config.title || _t.notcriticalErrorTitle;
|
||||||
|
config.callback = (btn) => {
|
||||||
|
if (id == Asc.c_oAscError.ID.DataValidate) {
|
||||||
|
api.asc_closeCellEditor(true);
|
||||||
|
}
|
||||||
|
storeAppOptions.changeEditingRights(false);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
f7.dialog.create({
|
||||||
|
cssClass: 'error-dialog',
|
||||||
|
title : config.title,
|
||||||
|
text : config.msg,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: 'OK',
|
||||||
|
onClick: config.callback
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}).open();
|
||||||
|
|
||||||
|
Common.component.Analytics.trackEvent('Internal Error', id.toString());
|
||||||
|
};
|
||||||
|
|
||||||
|
return null
|
||||||
|
});
|
||||||
|
|
||||||
|
export default ErrorController;
|
190
apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx
Normal file
190
apps/spreadsheeteditor/mobile/src/controller/LongActions.jsx
Normal file
|
@ -0,0 +1,190 @@
|
||||||
|
import React, { useEffect } from 'react';
|
||||||
|
import { f7 } from 'framework7-react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import IrregularStack from "../../../../common/mobile/utils/IrregularStack";
|
||||||
|
|
||||||
|
const LongActionsController = () => {
|
||||||
|
const {t} = useTranslation();
|
||||||
|
const _t = t("LongActions", { returnObjects: true });
|
||||||
|
|
||||||
|
const stackLongActions = new IrregularStack({
|
||||||
|
strongCompare : function(obj1, obj2){return obj1.id === obj2.id && obj1.type === obj2.type;},
|
||||||
|
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
|
||||||
|
});
|
||||||
|
|
||||||
|
let loadMask = null;
|
||||||
|
|
||||||
|
const closePreloader = () => {
|
||||||
|
if (loadMask && loadMask.el) {
|
||||||
|
f7.dialog.close(loadMask.el);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect( () => {
|
||||||
|
Common.Notifications.on('engineCreated', (api) => {
|
||||||
|
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
|
||||||
|
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
|
||||||
|
api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument);
|
||||||
|
});
|
||||||
|
Common.Notifications.on('preloader:endAction', onLongActionEnd);
|
||||||
|
Common.Notifications.on('preloader:beginAction', onLongActionBegin);
|
||||||
|
Common.Notifications.on('preloader:close', closePreloader);
|
||||||
|
|
||||||
|
return ( () => {
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
api.asc_unregisterCallback('asc_onStartAction', onLongActionBegin);
|
||||||
|
api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd);
|
||||||
|
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
|
||||||
|
|
||||||
|
Common.Notifications.off('preloader:endAction', onLongActionEnd);
|
||||||
|
Common.Notifications.off('preloader:beginAction', onLongActionBegin);
|
||||||
|
Common.Notifications.off('preloader:close', closePreloader);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
const onLongActionBegin = (type, id) => {
|
||||||
|
const action = {id: id, type: type};
|
||||||
|
stackLongActions.push(action);
|
||||||
|
setLongActionView(action);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onLongActionEnd = (type, id) => {
|
||||||
|
let action = {id: id, type: type};
|
||||||
|
stackLongActions.pop(action);
|
||||||
|
|
||||||
|
//this.updateWindowTitle(true);
|
||||||
|
|
||||||
|
action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information});
|
||||||
|
|
||||||
|
if (action) {
|
||||||
|
this.setLongActionView(action)
|
||||||
|
}
|
||||||
|
|
||||||
|
action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
|
||||||
|
|
||||||
|
if (action) {
|
||||||
|
setLongActionView(action)
|
||||||
|
} else {
|
||||||
|
loadMask && loadMask.el && loadMask.el.classList.contains('modal-in') && f7.dialog.close(loadMask.el);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const setLongActionView = (action) => {
|
||||||
|
let title = '';
|
||||||
|
let text = '';
|
||||||
|
switch (action.id) {
|
||||||
|
case Asc.c_oAscAsyncAction['Open']:
|
||||||
|
title = _t.openTitleText;
|
||||||
|
text = _t.openTextText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['Save']:
|
||||||
|
title = _t.saveTitleText;
|
||||||
|
text = _t.saveTextText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['LoadDocumentFonts']:
|
||||||
|
title = _t.loadFontsTitleText;
|
||||||
|
text = _t.loadFontsTextText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['LoadDocumentImages']:
|
||||||
|
title = _t.loadImagesTitleText;
|
||||||
|
text = _t.loadImagesTextText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['LoadFont']:
|
||||||
|
title = _t.loadFontTitleText;
|
||||||
|
text = _t.loadFontTextText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['LoadImage']:
|
||||||
|
title = _t.loadImageTitleText;
|
||||||
|
text = _t.loadImageTextText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['DownloadAs']:
|
||||||
|
title = _t.downloadTitleText;
|
||||||
|
text = _t.downloadTextText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['Print']:
|
||||||
|
title = _t.printTitleText;
|
||||||
|
text = _t.printTextText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['UploadImage']:
|
||||||
|
title = _t.uploadImageTitleText;
|
||||||
|
text = _t.uploadImageTextText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['ApplyChanges']:
|
||||||
|
title = _t.applyChangesTitleText;
|
||||||
|
text = _t.applyChangesTextText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['PrepareToSave']:
|
||||||
|
title = _t.savePreparingText;
|
||||||
|
text = _t.savePreparingTitle;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['MailMergeLoadFile']:
|
||||||
|
title = _t.mailMergeLoadFileText;
|
||||||
|
text = _t.mailMergeLoadFileTitle;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['DownloadMerge']:
|
||||||
|
title = _t.downloadMergeTitle;
|
||||||
|
text = _t.downloadMergeText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['SendMailMerge']:
|
||||||
|
title = _t.sendMergeTitle;
|
||||||
|
text = _t.sendMergeText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscAsyncAction['Waiting']:
|
||||||
|
title = _t.waitText;
|
||||||
|
text = _t.waitText;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ApplyEditRights:
|
||||||
|
title = _t.txtEditingMode;
|
||||||
|
text = _t.txtEditingMode;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LoadingDocument:
|
||||||
|
title = _t.loadingDocumentTitleText;
|
||||||
|
text = _t.loadingDocumentTextText;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (typeof action.id == 'string'){
|
||||||
|
title = action.id;
|
||||||
|
text = action.id;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action.type == Asc.c_oAscAsyncActionType.BlockInteraction) {
|
||||||
|
if (loadMask && loadMask.el && loadMask.el.classList.contains('modal-in')) {
|
||||||
|
loadMask.el.getElementsByClassName('dialog-title')[0].innerHTML = title;
|
||||||
|
} else {
|
||||||
|
loadMask = f7.dialog.preloader(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const onOpenDocument = (progress) => {
|
||||||
|
if (loadMask && loadMask.el) {
|
||||||
|
const $title = loadMask.el.getElementsByClassName('dialog-title')[0];
|
||||||
|
const proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount());
|
||||||
|
|
||||||
|
$title.innerHTML = `${_t.textLoadingDocument}: ${Math.min(Math.round(proc * 100), 100)}%`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LongActionsController;
|
|
@ -12,12 +12,16 @@ import {
|
||||||
EditCommentController,
|
EditCommentController,
|
||||||
ViewCommentsController
|
ViewCommentsController
|
||||||
} from "../../../../common/mobile/lib/controller/collaboration/Comments";
|
} from "../../../../common/mobile/lib/controller/collaboration/Comments";
|
||||||
|
import LongActionsController from "./LongActions";
|
||||||
|
import ErrorController from "./Error";
|
||||||
|
|
||||||
@inject("storeAppOptions", "storeFocusObjects", "storeCellSettings", "storeTextSettings", "storeChartSettings", "storeSpreadsheetSettings", "storeSpreadsheetInfo")
|
@inject("storeAppOptions", "storeFocusObjects", "storeCellSettings", "storeTextSettings", "storeChartSettings", "storeSpreadsheetSettings", "storeSpreadsheetInfo")
|
||||||
class MainController extends Component {
|
class MainController extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
window.editorType = 'sse';
|
window.editorType = 'sse';
|
||||||
|
|
||||||
|
this.LoadingDocument = -256;
|
||||||
}
|
}
|
||||||
|
|
||||||
initSdk() {
|
initSdk() {
|
||||||
|
@ -300,6 +304,8 @@ class MainController extends Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
<LongActionsController />
|
||||||
|
<ErrorController LoadingDocument={this.LoadingDocument}/>
|
||||||
<CollaborationController />
|
<CollaborationController />
|
||||||
<CommentsController />
|
<CommentsController />
|
||||||
<AddCommentController />
|
<AddCommentController />
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import '../../../../common/Gateway.js';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import {App,Views,View,Navbar,NavLeft,NavRight,Link} from 'framework7-react';
|
import {App,Views,View,Navbar,NavLeft,NavRight,Link} from 'framework7-react';
|
||||||
import { f7ready } from 'framework7-react';
|
import { f7ready } from 'framework7-react';
|
||||||
|
|
||||||
|
import '../../../../common/Analytics.js';
|
||||||
|
|
||||||
|
import '../../../../common/Gateway.js';
|
||||||
|
|
||||||
import routes from '../router/routes.js';
|
import routes from '../router/routes.js';
|
||||||
|
|
||||||
import '../../../../common/main/lib/util/utils.js';
|
import '../../../../common/main/lib/util/utils.js';
|
||||||
|
|
Loading…
Reference in a new issue