Skip to content

Commit

Permalink
Merge pull request #362 from ONLYOFFICE/bugfix/webdav-reconnect
Browse files Browse the repository at this point in the history
Bugfix/webdav reconnect
  • Loading branch information
AlexeySafronov authored Sep 30, 2021
2 parents f08c1fc + 73c6409 commit 7c3c40c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 25 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ const PureConnectDialogContainer = (props) => {
personal,
getSubfolders,
} = props;
const {
corporate,
title,
link,
token,
provider_id,
provider_key,
key,
} = item;
const { corporate, title, link, token, provider_id, provider_key } = item;

const provider = providers.find((el) => el.provider_id === item.provider_id);
const folderTitle = provider ? provider.customer_title : title;
Expand All @@ -58,7 +50,8 @@ const PureConnectDialogContainer = (props) => {
const [isLoading, setIsLoading] = useState(false);

const isAccount = !!link;
const showUrlField = key === "WebDav" || key === "SharePoint";
const showUrlField =
provider_key === "WebDav" || provider_key === "SharePoint";

const onChangeUrl = (e) => {
setIsUrlValid(true);
Expand Down Expand Up @@ -116,7 +109,7 @@ const PureConnectDialogContainer = (props) => {
oAuthToken,
isCorporate,
customerTitle,
provider_key || key,
provider_key,
provider_id
)
.then(async () => {
Expand Down Expand Up @@ -160,7 +153,7 @@ const PureConnectDialogContainer = (props) => {

const onReconnect = () => {
let authModal = window.open("", "Authorization", "height=600, width=1020");
openConnectWindow(title, authModal).then((modal) =>
openConnectWindow(provider_key, authModal).then((modal) =>
getOAuthToken(modal).then((token) => {
authModal.close();
setToken(token);
Expand Down Expand Up @@ -236,6 +229,7 @@ const PureConnectDialogContainer = (props) => {
errorMessage={t("Common:RequiredField")}
>
<TextInput
isAutoFocussed={!showUrlField}
hasError={!isLoginValid}
isDisabled={isLoading}
tabIndex={2}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const ServiceItem = (props) => {
const ThirdPartyDialog = (props) => {
const {
t,
i18n,
tReady,
isAdmin,
googleConnectItem,
Expand Down Expand Up @@ -123,6 +124,11 @@ const ThirdPartyDialog = (props) => {
setThirdPartyDialogVisible(false);
};

const yandexLogoUrl =
i18n && i18n.language === "ru-RU"
? "images/services/logo_yandex_ru.svg"
: "images/services/logo_yandex_en.svg";

return (
<ModalDialog
isLoading={!tReady}
Expand Down Expand Up @@ -223,15 +229,15 @@ const ThirdPartyDialog = (props) => {
<ServiceItem
capability={yandexConnectItem}
onClick={onShowService}
src="images/services/logo_yandex_ru.svg"
src={yandexLogoUrl}
/>
)}
{webDavConnectItem && (
<Text
onClick={onShowService}
className="service-item service-text"
data-title={webDavConnectItem[0]}
data-key={webDavConnectItem[0]}
data-provider_key={webDavConnectItem[0]}
noSelect
>
{t("ConnextOtherAccount")}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,21 @@ class ConnectClouds extends React.Component {
};

onChangeThirdPartyInfo = (e) => {
const { capabilities, providers } = this.props;
const { dataset } = (e.originalEvent || e).currentTarget;
const { provider_id } = dataset;
const capabilitiesItem = this.props.capabilities.find(
(x) => x[0] === provider_id
);
const providerItem = this.props.providers.find(
(x) => x.provider_id === provider_id
);
const { providerId } = dataset;

const providerItem = providers.find((x) => x.provider_id === providerId);

const { corporate, customer_title, provider_key } = providerItem;

const capabilitiesItem = capabilities.find((x) => x[0] === provider_key);

const item = {
title: capabilitiesItem ? capabilitiesItem[0] : customer_title,
title: customer_title || (capabilitiesItem && capabilitiesItem[0]),
link: capabilitiesItem ? capabilitiesItem[1] : " ",
corporate,
provider_id,
provider_id: providerId,
provider_key,
};

Expand Down Expand Up @@ -155,14 +155,16 @@ class ConnectClouds extends React.Component {
} = this.props;

const provider = e.currentTarget.dataset.providerKey;
const providerId = e.currentTarget.dataset.providerId;

const isCorporate =
!!providers.length &&
providers.find((p) => p.provider_key === provider).corporate;
const dirId = isCorporate ? commonFolderId : myFolderId;

getSubfolders(dirId).then((subfolders) => {
const id = subfolders
.filter((f) => f.providerKey === provider)
.filter((f) => f.providerKey === provider && f.providerId == providerId)
.map((f) => f.id)
.join();

Expand All @@ -184,7 +186,7 @@ class ConnectClouds extends React.Component {
return [
{
key: `${index}_change`,
"data-provider_id": item.provider_id,
"data-provider-id": item.provider_id,
label: t("Translations:ThirdPartyInfo"),
onClick: this.onChangeThirdPartyInfo,
},
Expand All @@ -207,6 +209,7 @@ class ConnectClouds extends React.Component {
<>
<Button
size="base"
style={{ marginBottom: "8px" }}
onClick={this.onShowThirdPartyDialog}
label={t("ConnectedCloud")}
primary
Expand All @@ -218,6 +221,7 @@ class ConnectClouds extends React.Component {
item.provider_key,
t
);

return (
<Row
key={index}
Expand Down Expand Up @@ -257,6 +261,7 @@ class ConnectClouds extends React.Component {
fontWeight={400}
truncate={true}
data-provider-key={item.provider_key}
data-provider-id={item.provider_id}
onClick={this.openLocation}
>
{item.customer_title}
Expand Down

0 comments on commit 7c3c40c

Please sign in to comment.