Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/restore files convertation #278

Merged
merged 32 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0551bf6
Web: Files: moved convert dialog to store
gopienkonikita May 31, 2021
ce9f697
Merge branch 'develop' into feature/restore-files-convertation
gopienkonikita Jun 1, 2021
4d44cca
Merge branch 'develop' into feature/restore-files-convertation
gopienkonikita Jun 2, 2021
5e8751d
Web: Files: added convert file icon, refactoring convert dialog
gopienkonikita Jun 2, 2021
ce77c27
Web: Files: added conversion progress for file
gopienkonikita Jun 2, 2021
581df1c
Web: Files: added update after converting the file
gopienkonikita Jun 2, 2021
a7edb11
Web: Files: added conversion for upload action
gopienkonikita Jun 3, 2021
62b57fa
Web: Files: refactoring UploadDataStore
gopienkonikita Jun 3, 2021
531233a
Web: Files: added new translations, fixed conversion
gopienkonikita Jun 3, 2021
ba41a5a
Merge branch 'develop' into feature/restore-files-convertation
gopienkonikita Jun 3, 2021
209f3b1
Web: Files: added tReady to ConvertDialog
gopienkonikita Jun 3, 2021
9a6f281
Web: Files: fixed conversion of files, added conversion loaders
gopienkonikita Jun 7, 2021
2d56421
Web: Files: fixed mobx warnings
gopienkonikita Jun 7, 2021
4d9c265
Web: Files: added conversion progress
gopienkonikita Jun 7, 2021
31423dd
Web: Files: fixed upload panel visibility
gopienkonikita Jun 7, 2021
83d4bfd
Web: Files: added conversion for uploaded files
gopienkonikita Jun 8, 2021
d598912
Web: Files: fixed conversion progress
gopienkonikita Jun 8, 2021
59bab6a
Web: Files: fixed conversion progress
gopienkonikita Jun 9, 2021
29733f0
Wen: Files: fixed upload panel style
vafomin Jun 9, 2021
fdc71ec
Merge branch 'feature/restore-files-convertation' of github.com:ONLYO…
vafomin Jun 9, 2021
a47b94b
Web: Files: removed useless uploadStatus, fixed upload bugs
gopienkonikita Jun 9, 2021
ed16125
Files: fix convert
pavelbannov Jun 10, 2021
9bb8e9b
Web: Files: fixed getConversationPercent
gopienkonikita Jun 10, 2021
64b6c97
Web: Files: fixed conversion
gopienkonikita Jun 10, 2021
e0d076a
Merge branch 'develop' into feature/restore-files-convertation
gopienkonikita Jun 11, 2021
ef59a2a
Web: Files: added hideConfirmConvert setting
gopienkonikita Jun 11, 2021
92f3177
Merge branch 'develop' into feature/restore-files-convertation
gopienkonikita Jun 11, 2021
e074c0c
Web: Files: changed color of conversion
gopienkonikita Jun 11, 2021
68f8802
Web: Files: added dialog for converting to context actions
gopienkonikita Jun 11, 2021
5db2e8a
Merge branch 'develop' into feature/restore-files-convertation
gopienkonikita Jun 11, 2021
4a154db
Web: removed useless translations
gopienkonikita Jun 11, 2021
a66e3af
Web: Tests: Commented "Save empty 'EN' keys to not found files"
AlexeySafronov Jun 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/asc-web-common/api/files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,3 +734,11 @@ export function setRecentSetting(set) {
data: { set },
});
}

export function hideConfirmConvert(save) {
return request({
method: "put",
url: "/files/hideconfirmconvert.json",
data: { save },
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const FloatingButton = ({ id, className, style, ...rest }) => {
return (
<StyledCircleWrap
id={id}
className={className}
className={`${className} not-selectable`}
style={style}
icon={icon}
onClick={onClick}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"ConversionMessage": "All the documents you upload will be converted into Office Open XML format (docx, xlsx or pptx) for faster editing.",
"ConversionFileMessage": "The document file you open will be converted to the Office Open XML format for faster viewing and editing.",
"ConversionTitle": "Document uploading",
"ConvertAndOpenTitle": "Convert and open document",
"ConvertingLabel": "Converting files: {{file}} of {{totalFiles}}",
"HideMessage": "Do not show this message again",
"SaveOriginalFormatMessage": "Save the file copy in the original format"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"ConversionMessage": "Все документы, которые Вы загружаете, будут сконвертированы в соответствующий формат Office Open XML (docx, xlsx или pptx) для быстрого редактирования.",
"ConversionFileMessage": "Файл документа, который Вы открываете, будет сконвертирован в формат Office Open XML для быстрого просмотра и редактирования.",
"ConversionTitle": "Загрузка документа",
"ConvertAndOpenTitle": "Конвертация и открытие документа",
"ConvertingLabel": "Сконвертировано файлов: {{file}} из {{totalFiles}}",
"HideMessage": "Больше не показывать это сообщение",
"SaveOriginalFormatMessage": "Сохранить также копию файла в исходном формате"
}
}
56 changes: 15 additions & 41 deletions products/ASC.Files/Client/src/HOCs/withBadges.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@ import {
} from "@appserver/common/constants";
import toastr from "studio/toastr";
import { combineUrl } from "@appserver/common/utils";
import {
convertFile,
getFileConversationProgress,
} from "@appserver/common/api/files";
import { getFileConversationProgress } from "@appserver/common/api/files";

import Badges from "../components/Badges";
import config from "../../package.json";

export default function withBadges(WrappedComponent) {
class WithBadges extends React.Component {
constructor(props) {
super(props);
this.state = { showConvertDialog: false };
}
onClickLock = () => {
const { item, lockFileAction, isAdmin } = this.props;
const { locked, id, access } = item;
Expand Down Expand Up @@ -74,27 +67,6 @@ export default function withBadges(WrappedComponent) {
}
};

setConvertDialogVisible = () =>
this.setState({ showConvertDialog: !this.state.showConvertDialog });

onConvert = () => {
const { item, t, setSecondaryProgressBarData } = this.props;
setSecondaryProgressBarData({
icon: "file",
visible: true,
percent: 0,
label: t("Convert"),
alert: false,
});
this.setState({ showConvertDialog: false }, () =>
convertFile(item.id).then((convertRes) => {
if (convertRes && convertRes[0] && convertRes[0].progress !== 100) {
this.getConvertProgress(item.id);
}
})
);
};

getConvertProgress = (fileId) => {
const {
selectedFolderId,
Expand Down Expand Up @@ -147,8 +119,13 @@ export default function withBadges(WrappedComponent) {
}
});
};

setConvertDialogVisible = () => {
this.props.setConvertItem(this.props.item);
this.props.setConvertDialogVisible(true);
};

render() {
const { showConvertDialog } = this.state;
const {
t,
item,
Expand Down Expand Up @@ -188,16 +165,7 @@ export default function withBadges(WrappedComponent) {
);

return (
<>
{showConvertDialog && (
<ConvertDialog
visible={showConvertDialog}
onClose={this.setConvertDialogVisible}
onConvert={this.onConvert}
/>
)}
<WrappedComponent badgesComponent={badgesComponent} {...this.props} />
</>
<WrappedComponent badgesComponent={badgesComponent} {...this.props} />
);
}
}
Expand Down Expand Up @@ -226,7 +194,11 @@ export default function withBadges(WrappedComponent) {
} = filesActionsStore;
const { isTabletView } = auth.settingsStore;
const { setIsVerHistoryPanel, fetchFileVersions } = versionHistoryStore;
const { setNewFilesPanelVisible } = dialogsStore;
const {
setNewFilesPanelVisible,
setConvertDialogVisible,
setConvertItem,
} = dialogsStore;
const { filter, setIsLoading, fetchFiles } = filesStore;
const { secondaryProgressDataStore } = uploadDataStore;
const {
Expand Down Expand Up @@ -258,6 +230,8 @@ export default function withBadges(WrappedComponent) {
setIsLoading,
clearSecondaryProgressData,
fetchFiles,
setConvertDialogVisible,
setConvertItem,
};
}
)(observer(WithBadges));
Expand Down
19 changes: 18 additions & 1 deletion products/ASC.Files/Client/src/HOCs/withContextOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,25 @@ export default function withContextOptions(WrappedComponent) {
};

onClickLinkEdit = () => {
const {
item,
canConvert,
setConvertItem,
setConvertDialogVisible,
} = this.props;

if (canConvert) {
setConvertItem(item);
setConvertDialogVisible(true);
} else {
onPreviewClick();
}
};

onPreviewClick = () => {
const { item, openDocEditor } = this.props;
const { id, providerKey } = item;

openDocEditor(id, providerKey);
};

Expand Down Expand Up @@ -300,7 +317,7 @@ export default function withContextOptions(WrappedComponent) {
key: option,
label: t("Preview"),
icon: "/static/images/eye.react.svg",
onClick: this.onClickLinkEdit,
onClick: this.onPreviewClick,
disabled: false,
};
case "view":
Expand Down
19 changes: 18 additions & 1 deletion products/ASC.Files/Client/src/HOCs/withFileActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,16 @@ export default function withFileActions(WrappedFileItem) {
isImage,
isSound,
isVideo,
canConvert,
canWebEdit,
item,
isTrashFolder,
openDocEditor,
expandedKeys,
addExpandedKeys,
setMediaViewerData,
setConvertItem,
setConvertDialogVisible,
} = this.props;
const {
id,
Expand Down Expand Up @@ -172,6 +175,12 @@ export default function withFileActions(WrappedFileItem) {
})
.finally(() => setIsLoading(false));
} else {
if (canConvert) {
setConvertItem(item);
setConvertDialogVisible(true);
return;
}

if (fileStatus === 2) this.onMarkAsRead(id);

if (canWebEdit) {
Expand Down Expand Up @@ -269,7 +278,11 @@ export default function withFileActions(WrappedFileItem) {
{ item, t, history }
) => {
const { selectRowAction, onSelectItem, markAsRead } = filesActionsStore;
const { setSharingPanelVisible } = dialogsStore;
const {
setSharingPanelVisible,
setConvertDialogVisible,
setConvertItem,
} = dialogsStore;
const {
isPrivacyFolder,
isRecycleBinFolder,
Expand Down Expand Up @@ -318,6 +331,7 @@ export default function withFileActions(WrappedFileItem) {
const isSound = iconFormatsStore.isSound(item.fileExst);
const isVideo = mediaViewersFormatsStore.isVideo(item.fileExst);
const canWebEdit = docserviceStore.canWebEdit(item.fileExst);
const canConvert = docserviceStore.canConvert(item.fileExst);

return {
t,
Expand Down Expand Up @@ -349,13 +363,16 @@ export default function withFileActions(WrappedFileItem) {
isSound,
isVideo,
canWebEdit,
canConvert,
isTrashFolder: isRecycleBinFolder,
openDocEditor,
expandedKeys,
addExpandedKeys,
setMediaViewerData,
getFolderInfo,
markAsRead,
setConvertItem,
setConvertDialogVisible,
};
}
)(observer(WithFileActions));
Expand Down
38 changes: 21 additions & 17 deletions products/ASC.Files/Client/src/components/Badges.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ const Badges = ({
item,
canWebEdit,
isTrashFolder,
/* canConvert, */
canConvert,
accessToEdit,
showNew,
onFilesClick,
onClickLock,
onClickFavorite,
onShowVersionHistory,
onBadgeClick,
/*setConvertDialogVisible*/
setConvertDialogVisible,
}) => {
const { id, locked, fileStatus, versionGroup, title, fileExst } = item;

Expand All @@ -32,28 +32,32 @@ const Badges = ({

return fileExst ? (
<div className="badges additional-badges">
{/* TODO: Uncomment after fix conversation {canConvert && !isTrashFolder && (
<IconButton
onClick={setConvertDialogVisible}
iconName="FileActionsConvertIcon"
className="badge"
size="small"
isfill={true}
color="#A3A9AE"
hoverColor="#3B72A7"
/>
)} */}
{canWebEdit && !isTrashFolder && accessToEdit && showEditBadge && (
{canConvert && !isTrashFolder && (
<IconButton
onClick={onFilesClick}
iconName="/static/images/access.edit.react.svg"
className="badge icons-group"
onClick={setConvertDialogVisible}
iconName="/static/images/refresh.react.svg"
className="badge"
size="small"
isfill={true}
color="#A3A9AE"
hoverColor="#3B72A7"
/>
)}
{canWebEdit &&
!isTrashFolder &&
accessToEdit &&
showEditBadge &&
!canConvert && (
<IconButton
onClick={onFilesClick}
iconName="/static/images/access.edit.react.svg"
className="badge icons-group"
size="small"
isfill={true}
color="#A3A9AE"
hoverColor="#3B72A7"
/>
)}
{locked && accessToEdit && (
<StyledFileActionsLockedIcon
className="badge lock-file icons-group"
Expand Down
5 changes: 5 additions & 0 deletions products/ASC.Files/Client/src/components/FilesPanels/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
DownloadDialog,
ThirdPartyDialog,
ConflictResolveDialog,
ConvertDialog,
} from "../dialogs";

const Panels = (props) => {
Expand All @@ -36,6 +37,7 @@ const Panels = (props) => {
thirdPartyDialogVisible,
newFilesPanelVisible,
conflictResolveDialogVisible,
convertDialogVisible,
} = props;

return [
Expand Down Expand Up @@ -68,6 +70,7 @@ const Panels = (props) => {
conflictResolveDialogVisible && (
<ConflictResolveDialog key="conflict-resolve-dialog" />
),
convertDialogVisible && <ConvertDialog key="convert-dialog" />,
];
};

Expand All @@ -87,6 +90,7 @@ export default inject(
thirdPartyDialogVisible,
newFilesPanelVisible,
conflictResolveDialogVisible,
convertDialogVisible,

connectItem, //TODO:
} = dialogsStore;
Expand All @@ -110,6 +114,7 @@ export default inject(
thirdPartyDialogVisible,
newFilesPanelVisible,
conflictResolveDialogVisible,
convertDialogVisible,
};
}
)(observer(Panels));
Loading