mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
apply prettier, removed flow related config and added tsconfig
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import PluginActionModal from './PluginActionModal';
|
||||
import { PendingPlugins } from '@scm-manager/ui-types';
|
||||
import { apiClient } from '@scm-manager/ui-components';
|
||||
import { translate } from 'react-i18next';
|
||||
import React from "react";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
import { PendingPlugins } from "@scm-manager/ui-types";
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
onClose: () => void;
|
||||
@@ -19,8 +19,8 @@ class CancelPendingActionModal extends React.Component<Props> {
|
||||
|
||||
return (
|
||||
<PluginActionModal
|
||||
description={t('plugins.modal.cancelPending')}
|
||||
label={t('plugins.cancelPending')}
|
||||
description={t("plugins.modal.cancelPending")}
|
||||
label={t("plugins.cancelPending")}
|
||||
onClose={onClose}
|
||||
pendingPlugins={pendingPlugins}
|
||||
execute={this.cancelPending}
|
||||
@@ -37,4 +37,4 @@ class CancelPendingActionModal extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate('admin')(CancelPendingActionModal);
|
||||
export default translate("admin")(CancelPendingActionModal);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { Button } from '@scm-manager/ui-components';
|
||||
import { PendingPlugins } from '@scm-manager/ui-types';
|
||||
import { translate } from 'react-i18next';
|
||||
import ExecutePendingModal from './ExecutePendingModal';
|
||||
import React from "react";
|
||||
import { Button } from "@scm-manager/ui-components";
|
||||
import { PendingPlugins } from "@scm-manager/ui-types";
|
||||
import { translate } from "react-i18next";
|
||||
import ExecutePendingModal from "./ExecutePendingModal";
|
||||
|
||||
type Props = {
|
||||
pendingPlugins: PendingPlugins;
|
||||
@@ -19,19 +19,19 @@ class ExecutePendingAction extends React.Component<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
showModal: false,
|
||||
showModal: false
|
||||
};
|
||||
}
|
||||
|
||||
openModal = () => {
|
||||
this.setState({
|
||||
showModal: true,
|
||||
showModal: true
|
||||
});
|
||||
};
|
||||
|
||||
closeModal = () => {
|
||||
this.setState({
|
||||
showModal: false,
|
||||
showModal: false
|
||||
});
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ class ExecutePendingAction extends React.Component<Props, State> {
|
||||
{this.renderModal()}
|
||||
<Button
|
||||
color="primary"
|
||||
label={t('plugins.executePending')}
|
||||
label={t("plugins.executePending")}
|
||||
action={this.openModal}
|
||||
/>
|
||||
</>
|
||||
@@ -64,4 +64,4 @@ class ExecutePendingAction extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate('admin')(ExecutePendingAction);
|
||||
export default translate("admin")(ExecutePendingAction);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import PluginActionModal from './PluginActionModal';
|
||||
import { PendingPlugins } from '@scm-manager/ui-types';
|
||||
import waitForRestart from './waitForRestart';
|
||||
import { apiClient, Notification } from '@scm-manager/ui-components';
|
||||
import { translate } from 'react-i18next';
|
||||
import React from "react";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
import { PendingPlugins } from "@scm-manager/ui-types";
|
||||
import waitForRestart from "./waitForRestart";
|
||||
import { apiClient, Notification } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
onClose: () => void;
|
||||
@@ -19,14 +19,14 @@ class ExecutePendingActionModal extends React.Component<Props> {
|
||||
|
||||
return (
|
||||
<PluginActionModal
|
||||
description={t('plugins.modal.executePending')}
|
||||
label={t('plugins.modal.executeAndRestart')}
|
||||
description={t("plugins.modal.executePending")}
|
||||
label={t("plugins.modal.executeAndRestart")}
|
||||
onClose={onClose}
|
||||
pendingPlugins={pendingPlugins}
|
||||
execute={this.executeAndRestart}
|
||||
>
|
||||
<Notification type="warning">
|
||||
{t('plugins.modal.restartNotification')}
|
||||
{t("plugins.modal.restartNotification")}
|
||||
</Notification>
|
||||
</PluginActionModal>
|
||||
);
|
||||
@@ -40,4 +40,4 @@ class ExecutePendingActionModal extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate('admin')(ExecutePendingActionModal);
|
||||
export default translate("admin")(ExecutePendingActionModal);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
import {
|
||||
apiClient,
|
||||
Button,
|
||||
ButtonGroup,
|
||||
ErrorNotification,
|
||||
Modal,
|
||||
Notification,
|
||||
} from '@scm-manager/ui-components';
|
||||
import { PendingPlugins } from '@scm-manager/ui-types';
|
||||
import { translate } from 'react-i18next';
|
||||
import waitForRestart from './waitForRestart';
|
||||
import SuccessNotification from './SuccessNotification';
|
||||
Notification
|
||||
} from "@scm-manager/ui-components";
|
||||
import { PendingPlugins } from "@scm-manager/ui-types";
|
||||
import { translate } from "react-i18next";
|
||||
import waitForRestart from "./waitForRestart";
|
||||
import SuccessNotification from "./SuccessNotification";
|
||||
|
||||
type Props = {
|
||||
onClose: () => void;
|
||||
@@ -31,7 +31,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: false,
|
||||
success: false,
|
||||
success: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
} else {
|
||||
return (
|
||||
<Notification type="warning">
|
||||
{t('plugins.modal.restartNotification')}
|
||||
{t("plugins.modal.restartNotification")}
|
||||
</Notification>
|
||||
);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
executeAndRestart = () => {
|
||||
const { pendingPlugins } = this.props;
|
||||
this.setState({
|
||||
loading: true,
|
||||
loading: true
|
||||
});
|
||||
|
||||
apiClient
|
||||
@@ -64,14 +64,14 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
this.setState({
|
||||
success: true,
|
||||
loading: false,
|
||||
error: undefined,
|
||||
error: undefined
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
this.setState({
|
||||
success: false,
|
||||
loading: false,
|
||||
error: error,
|
||||
error: error
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -82,7 +82,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
<>
|
||||
{pendingPlugins._embedded && pendingPlugins._embedded.new.length > 0 && (
|
||||
<>
|
||||
<strong>{t('plugins.modal.installQueue')}</strong>
|
||||
<strong>{t("plugins.modal.installQueue")}</strong>
|
||||
<ul>
|
||||
{pendingPlugins._embedded.new.map(plugin => (
|
||||
<li key={plugin.name}>{plugin.name}</li>
|
||||
@@ -101,7 +101,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
{pendingPlugins._embedded &&
|
||||
pendingPlugins._embedded.update.length > 0 && (
|
||||
<>
|
||||
<strong>{t('plugins.modal.updateQueue')}</strong>
|
||||
<strong>{t("plugins.modal.updateQueue")}</strong>
|
||||
<ul>
|
||||
{pendingPlugins._embedded.update.map(plugin => (
|
||||
<li key={plugin.name}>{plugin.name}</li>
|
||||
@@ -120,7 +120,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
{pendingPlugins._embedded &&
|
||||
pendingPlugins._embedded.uninstall.length > 0 && (
|
||||
<>
|
||||
<strong>{t('plugins.modal.uninstallQueue')}</strong>
|
||||
<strong>{t("plugins.modal.uninstallQueue")}</strong>
|
||||
<ul>
|
||||
{pendingPlugins._embedded.uninstall.map(plugin => (
|
||||
<li key={plugin.name}>{plugin.name}</li>
|
||||
@@ -138,7 +138,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
<>
|
||||
<div className="media">
|
||||
<div className="content">
|
||||
<p>{t('plugins.modal.executePending')}</p>
|
||||
<p>{t("plugins.modal.executePending")}</p>
|
||||
{this.renderInstallQueue()}
|
||||
{this.renderUpdateQueue()}
|
||||
{this.renderUninstallQueue()}
|
||||
@@ -156,12 +156,12 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
<ButtonGroup>
|
||||
<Button
|
||||
color="warning"
|
||||
label={t('plugins.modal.executeAndRestart')}
|
||||
label={t("plugins.modal.executeAndRestart")}
|
||||
loading={loading}
|
||||
action={this.executeAndRestart}
|
||||
disabled={error || success}
|
||||
/>
|
||||
<Button label={t('plugins.modal.abort')} action={onClose} />
|
||||
<Button label={t("plugins.modal.abort")} action={onClose} />
|
||||
</ButtonGroup>
|
||||
);
|
||||
};
|
||||
@@ -170,7 +170,7 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
const { onClose, t } = this.props;
|
||||
return (
|
||||
<Modal
|
||||
title={t('plugins.modal.executeAndRestart')}
|
||||
title={t("plugins.modal.executeAndRestart")}
|
||||
closeFunction={onClose}
|
||||
body={this.renderBody()}
|
||||
footer={this.renderFooter()}
|
||||
@@ -180,4 +180,4 @@ class ExecutePendingModal extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate('admin')(ExecutePendingModal);
|
||||
export default translate("admin")(ExecutePendingModal);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import * as React from "react";
|
||||
import {
|
||||
Button,
|
||||
ButtonGroup,
|
||||
ErrorNotification,
|
||||
Modal,
|
||||
} from '@scm-manager/ui-components';
|
||||
import { PendingPlugins, PluginCollection } from '@scm-manager/ui-types';
|
||||
import { translate } from 'react-i18next';
|
||||
import SuccessNotification from './SuccessNotification';
|
||||
Modal
|
||||
} from "@scm-manager/ui-components";
|
||||
import { PendingPlugins, PluginCollection } from "@scm-manager/ui-types";
|
||||
import { translate } from "react-i18next";
|
||||
import SuccessNotification from "./SuccessNotification";
|
||||
|
||||
type Props = {
|
||||
onClose: () => void;
|
||||
@@ -36,7 +36,7 @@ class PluginActionModal extends React.Component<Props, State> {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: false,
|
||||
success: false,
|
||||
success: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class PluginActionModal extends React.Component<Props, State> {
|
||||
|
||||
executeAction = () => {
|
||||
this.setState({
|
||||
loading: true,
|
||||
loading: true
|
||||
});
|
||||
|
||||
this.props
|
||||
@@ -62,14 +62,14 @@ class PluginActionModal extends React.Component<Props, State> {
|
||||
.then(() => {
|
||||
this.setState({
|
||||
success: true,
|
||||
loading: false,
|
||||
loading: false
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
this.setState({
|
||||
success: false,
|
||||
loading: false,
|
||||
error: error,
|
||||
error: error
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -93,7 +93,7 @@ class PluginActionModal extends React.Component<Props, State> {
|
||||
installedPlugins._embedded &&
|
||||
installedPlugins._embedded.plugins && (
|
||||
<>
|
||||
<strong>{t('plugins.modal.updateQueue')}</strong>
|
||||
<strong>{t("plugins.modal.updateQueue")}</strong>
|
||||
<ul>
|
||||
{installedPlugins._embedded.plugins
|
||||
.filter(plugin => plugin._links && plugin._links.update)
|
||||
@@ -115,7 +115,7 @@ class PluginActionModal extends React.Component<Props, State> {
|
||||
pendingPlugins._embedded &&
|
||||
pendingPlugins._embedded.new.length > 0 && (
|
||||
<>
|
||||
<strong>{t('plugins.modal.installQueue')}</strong>
|
||||
<strong>{t("plugins.modal.installQueue")}</strong>
|
||||
<ul>
|
||||
{pendingPlugins._embedded.new.map(plugin => (
|
||||
<li key={plugin.name}>{plugin.name}</li>
|
||||
@@ -135,7 +135,7 @@ class PluginActionModal extends React.Component<Props, State> {
|
||||
pendingPlugins._embedded &&
|
||||
pendingPlugins._embedded.update.length > 0 && (
|
||||
<>
|
||||
<strong>{t('plugins.modal.updateQueue')}</strong>
|
||||
<strong>{t("plugins.modal.updateQueue")}</strong>
|
||||
<ul>
|
||||
{pendingPlugins._embedded.update.map(plugin => (
|
||||
<li key={plugin.name}>{plugin.name}</li>
|
||||
@@ -155,7 +155,7 @@ class PluginActionModal extends React.Component<Props, State> {
|
||||
pendingPlugins._embedded &&
|
||||
pendingPlugins._embedded.uninstall.length > 0 && (
|
||||
<>
|
||||
<strong>{t('plugins.modal.uninstallQueue')}</strong>
|
||||
<strong>{t("plugins.modal.uninstallQueue")}</strong>
|
||||
<ul>
|
||||
{pendingPlugins._embedded.uninstall.map(plugin => (
|
||||
<li key={plugin.name}>{plugin.name}</li>
|
||||
@@ -193,7 +193,7 @@ class PluginActionModal extends React.Component<Props, State> {
|
||||
action={this.executeAction}
|
||||
disabled={error || success}
|
||||
/>
|
||||
<Button label={t('plugins.modal.abort')} action={onClose} />
|
||||
<Button label={t("plugins.modal.abort")} action={onClose} />
|
||||
</ButtonGroup>
|
||||
);
|
||||
};
|
||||
@@ -212,4 +212,4 @@ class PluginActionModal extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate('admin')(PluginActionModal);
|
||||
export default translate("admin")(PluginActionModal);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { ExtensionPoint } from '@scm-manager/ui-extensions';
|
||||
import { Plugin } from '@scm-manager/ui-types';
|
||||
import { Image } from '@scm-manager/ui-components';
|
||||
import React from "react";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { Plugin } from "@scm-manager/ui-types";
|
||||
import { Image } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
plugin: Plugin;
|
||||
@@ -15,11 +15,11 @@ export default class PluginAvatar extends React.Component<Props> {
|
||||
<ExtensionPoint
|
||||
name="plugins.plugin-avatar"
|
||||
props={{
|
||||
plugin,
|
||||
plugin
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
src={plugin.avatarUrl ? plugin.avatarUrl : '/images/blib.jpg'}
|
||||
src={plugin.avatarUrl ? plugin.avatarUrl : "/images/blib.jpg"}
|
||||
alt="Logo"
|
||||
/>
|
||||
</ExtensionPoint>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import * as React from "react";
|
||||
import styled from "styled-components";
|
||||
|
||||
type Props = {
|
||||
children?: React.Node;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import React from 'react';
|
||||
import { translate } from 'react-i18next';
|
||||
import classNames from 'classnames';
|
||||
import styled from 'styled-components';
|
||||
import { Plugin } from '@scm-manager/ui-types';
|
||||
import { CardColumn, Icon } from '@scm-manager/ui-components';
|
||||
import PluginAvatar from './PluginAvatar';
|
||||
import PluginModal from './PluginModal';
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
import styled from "styled-components";
|
||||
import { Plugin } from "@scm-manager/ui-types";
|
||||
import { CardColumn, Icon } from "@scm-manager/ui-components";
|
||||
import PluginAvatar from "./PluginAvatar";
|
||||
import PluginModal from "./PluginModal";
|
||||
|
||||
export const PluginAction = {
|
||||
INSTALL: 'install',
|
||||
UPDATE: 'update',
|
||||
UNINSTALL: 'uninstall',
|
||||
INSTALL: "install",
|
||||
UPDATE: "update",
|
||||
UNINSTALL: "uninstall"
|
||||
};
|
||||
|
||||
type Props = {
|
||||
@@ -53,7 +53,7 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
this.state = {
|
||||
showInstallModal: false,
|
||||
showUpdateModal: false,
|
||||
showUninstallModal: false,
|
||||
showUninstallModal: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
toggleModal = (showModal: string) => {
|
||||
const oldValue = this.state[showModal];
|
||||
this.setState({
|
||||
[showModal]: !oldValue,
|
||||
[showModal]: !oldValue
|
||||
});
|
||||
};
|
||||
|
||||
@@ -96,10 +96,10 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
{this.isInstallable() && (
|
||||
<IconWrapper
|
||||
className="level-item"
|
||||
onClick={() => this.toggleModal('showInstallModal')}
|
||||
onClick={() => this.toggleModal("showInstallModal")}
|
||||
>
|
||||
<Icon
|
||||
title={t('plugins.modal.install')}
|
||||
title={t("plugins.modal.install")}
|
||||
name="download"
|
||||
color="info"
|
||||
/>
|
||||
@@ -108,10 +108,10 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
{this.isUninstallable() && (
|
||||
<IconWrapper
|
||||
className="level-item"
|
||||
onClick={() => this.toggleModal('showUninstallModal')}
|
||||
onClick={() => this.toggleModal("showUninstallModal")}
|
||||
>
|
||||
<Icon
|
||||
title={t('plugins.modal.uninstall')}
|
||||
title={t("plugins.modal.uninstall")}
|
||||
name="trash"
|
||||
color="info"
|
||||
/>
|
||||
@@ -120,10 +120,10 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
{this.isUpdatable() && (
|
||||
<IconWrapper
|
||||
className="level-item"
|
||||
onClick={() => this.toggleModal('showUpdateModal')}
|
||||
onClick={() => this.toggleModal("showUpdateModal")}
|
||||
>
|
||||
<Icon
|
||||
title={t('plugins.modal.update')}
|
||||
title={t("plugins.modal.update")}
|
||||
name="sync-alt"
|
||||
color="info"
|
||||
/>
|
||||
@@ -141,7 +141,7 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
plugin={plugin}
|
||||
pluginAction={PluginAction.INSTALL}
|
||||
refresh={refresh}
|
||||
onClose={() => this.toggleModal('showInstallModal')}
|
||||
onClose={() => this.toggleModal("showInstallModal")}
|
||||
/>
|
||||
);
|
||||
} else if (this.state.showUpdateModal && this.isUpdatable()) {
|
||||
@@ -150,7 +150,7 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
plugin={plugin}
|
||||
pluginAction={PluginAction.UPDATE}
|
||||
refresh={refresh}
|
||||
onClose={() => this.toggleModal('showUpdateModal')}
|
||||
onClose={() => this.toggleModal("showUpdateModal")}
|
||||
/>
|
||||
);
|
||||
} else if (this.state.showUninstallModal && this.isUninstallable()) {
|
||||
@@ -159,7 +159,7 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
plugin={plugin}
|
||||
pluginAction={PluginAction.UNINSTALL}
|
||||
refresh={refresh}
|
||||
onClose={() => this.toggleModal('showUninstallModal')}
|
||||
onClose={() => this.toggleModal("showUninstallModal")}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
@@ -173,7 +173,7 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
<Icon
|
||||
className="fa-spin fa-lg"
|
||||
name="spinner"
|
||||
color={plugin.markedForUninstall ? 'danger' : 'info'}
|
||||
color={plugin.markedForUninstall ? "danger" : "info"}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -191,7 +191,7 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
<CardColumn
|
||||
action={
|
||||
this.isInstallable()
|
||||
? () => this.toggleModal('showInstallModal')
|
||||
? () => this.toggleModal("showInstallModal")
|
||||
: null
|
||||
}
|
||||
avatar={avatar}
|
||||
@@ -210,4 +210,4 @@ class PluginEntry extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate('admin')(PluginEntry);
|
||||
export default translate("admin")(PluginEntry);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { CardColumnGroup } from '@scm-manager/ui-components';
|
||||
import { PluginGroup } from '@scm-manager/ui-types';
|
||||
import PluginEntry from './PluginEntry';
|
||||
import React from "react";
|
||||
import { CardColumnGroup } from "@scm-manager/ui-components";
|
||||
import { PluginGroup } from "@scm-manager/ui-types";
|
||||
import PluginEntry from "./PluginEntry";
|
||||
|
||||
type Props = {
|
||||
group: PluginGroup;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Plugin } from '@scm-manager/ui-types';
|
||||
import PluginGroupEntry from '../components/PluginGroupEntry';
|
||||
import groupByCategory from './groupByCategory';
|
||||
import React from "react";
|
||||
import { Plugin } from "@scm-manager/ui-types";
|
||||
import PluginGroupEntry from "../components/PluginGroupEntry";
|
||||
import groupByCategory from "./groupByCategory";
|
||||
|
||||
type Props = {
|
||||
plugins: Plugin[];
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { translate } from 'react-i18next';
|
||||
import classNames from 'classnames';
|
||||
import styled from 'styled-components';
|
||||
import { Plugin } from '@scm-manager/ui-types';
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
import styled from "styled-components";
|
||||
import { Plugin } from "@scm-manager/ui-types";
|
||||
import {
|
||||
apiClient,
|
||||
Button,
|
||||
@@ -10,11 +10,11 @@ import {
|
||||
Checkbox,
|
||||
ErrorNotification,
|
||||
Modal,
|
||||
Notification,
|
||||
} from '@scm-manager/ui-components';
|
||||
import waitForRestart from './waitForRestart';
|
||||
import SuccessNotification from './SuccessNotification';
|
||||
import { PluginAction } from './PluginEntry';
|
||||
Notification
|
||||
} from "@scm-manager/ui-components";
|
||||
import waitForRestart from "./waitForRestart";
|
||||
import SuccessNotification from "./SuccessNotification";
|
||||
import { PluginAction } from "./PluginEntry";
|
||||
|
||||
type Props = {
|
||||
plugin: Plugin;
|
||||
@@ -36,7 +36,7 @@ type State = {
|
||||
const ListParent = styled.div`
|
||||
margin-right: 0;
|
||||
min-width: ${props =>
|
||||
props.pluginAction === PluginAction.INSTALL ? '5.5em' : '10em'};
|
||||
props.pluginAction === PluginAction.INSTALL ? "5.5em" : "10em"};
|
||||
text-align: left;
|
||||
`;
|
||||
|
||||
@@ -50,7 +50,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
this.state = {
|
||||
loading: false,
|
||||
restart: false,
|
||||
success: false,
|
||||
success: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
|
||||
const newState = {
|
||||
loading: false,
|
||||
error: undefined,
|
||||
error: undefined
|
||||
};
|
||||
|
||||
if (restart) {
|
||||
@@ -68,14 +68,14 @@ class PluginModal extends React.Component<Props, State> {
|
||||
.then(() => {
|
||||
this.setState({
|
||||
...newState,
|
||||
success: true,
|
||||
success: true
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
this.setState({
|
||||
loading: false,
|
||||
success: false,
|
||||
error,
|
||||
error
|
||||
});
|
||||
});
|
||||
} else {
|
||||
@@ -90,7 +90,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
const { plugin, pluginAction } = this.props;
|
||||
const { restart } = this.state;
|
||||
|
||||
let pluginActionLink = '';
|
||||
let pluginActionLink = "";
|
||||
|
||||
if (pluginAction === PluginAction.INSTALL) {
|
||||
pluginActionLink = plugin._links.install.href;
|
||||
@@ -99,12 +99,12 @@ class PluginModal extends React.Component<Props, State> {
|
||||
} else if (pluginAction === PluginAction.UNINSTALL) {
|
||||
pluginActionLink = plugin._links.uninstall.href;
|
||||
}
|
||||
return pluginActionLink + '?restart=' + restart.toString();
|
||||
return pluginActionLink + "?restart=" + restart.toString();
|
||||
};
|
||||
|
||||
handlePluginAction = (e: Event) => {
|
||||
this.setState({
|
||||
loading: true,
|
||||
loading: true
|
||||
});
|
||||
e.preventDefault();
|
||||
apiClient
|
||||
@@ -114,7 +114,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
this.setState({
|
||||
loading: false,
|
||||
success: false,
|
||||
error: error,
|
||||
error: error
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -123,10 +123,10 @@ class PluginModal extends React.Component<Props, State> {
|
||||
const { pluginAction, onClose, t } = this.props;
|
||||
const { loading, error, restart, success } = this.state;
|
||||
|
||||
let color = pluginAction === PluginAction.UNINSTALL ? 'warning' : 'primary';
|
||||
let color = pluginAction === PluginAction.UNINSTALL ? "warning" : "primary";
|
||||
let label = `plugins.modal.${pluginAction}`;
|
||||
if (restart) {
|
||||
color = 'warning';
|
||||
color = "warning";
|
||||
label = `plugins.modal.${pluginAction}AndRestart`;
|
||||
}
|
||||
return (
|
||||
@@ -138,7 +138,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
loading={loading}
|
||||
disabled={!!error || success}
|
||||
/>
|
||||
<Button label={t('plugins.modal.abort')} action={onClose} />
|
||||
<Button label={t("plugins.modal.abort")} action={onClose} />
|
||||
</ButtonGroup>
|
||||
);
|
||||
};
|
||||
@@ -151,7 +151,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
dependencies = (
|
||||
<div className="media">
|
||||
<Notification type="warning">
|
||||
<strong>{t('plugins.modal.dependencyNotification')}</strong>
|
||||
<strong>{t("plugins.modal.dependencyNotification")}</strong>
|
||||
<ul>
|
||||
{plugin.dependencies.map((dependency, index) => {
|
||||
return <li key={index}>{dependency}</li>;
|
||||
@@ -183,7 +183,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
return (
|
||||
<div className="media">
|
||||
<Notification type="warning">
|
||||
{t('plugins.modal.restartNotification')}
|
||||
{t("plugins.modal.restartNotification")}
|
||||
</Notification>
|
||||
</div>
|
||||
);
|
||||
@@ -193,7 +193,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
|
||||
handleRestartChange = (value: boolean) => {
|
||||
this.setState({
|
||||
restart: value,
|
||||
restart: value
|
||||
});
|
||||
};
|
||||
|
||||
@@ -212,25 +212,25 @@ class PluginModal extends React.Component<Props, State> {
|
||||
<div className="media-content">
|
||||
<div className="field is-horizontal">
|
||||
<ListParent
|
||||
className={classNames('field-label', 'is-inline-flex')}
|
||||
className={classNames("field-label", "is-inline-flex")}
|
||||
pluginAction={pluginAction}
|
||||
>
|
||||
{t('plugins.modal.author')}:
|
||||
{t("plugins.modal.author")}:
|
||||
</ListParent>
|
||||
<ListChild className={classNames('field-body', 'is-inline-flex')}>
|
||||
<ListChild className={classNames("field-body", "is-inline-flex")}>
|
||||
{plugin.author}
|
||||
</ListChild>
|
||||
</div>
|
||||
{pluginAction === PluginAction.INSTALL && (
|
||||
<div className="field is-horizontal">
|
||||
<ListParent
|
||||
className={classNames('field-label', 'is-inline-flex')}
|
||||
className={classNames("field-label", "is-inline-flex")}
|
||||
pluginAction={pluginAction}
|
||||
>
|
||||
{t('plugins.modal.version')}:
|
||||
{t("plugins.modal.version")}:
|
||||
</ListParent>
|
||||
<ListChild
|
||||
className={classNames('field-body', 'is-inline-flex')}
|
||||
className={classNames("field-body", "is-inline-flex")}
|
||||
>
|
||||
{plugin.version}
|
||||
</ListChild>
|
||||
@@ -240,12 +240,12 @@ class PluginModal extends React.Component<Props, State> {
|
||||
pluginAction === PluginAction.UNINSTALL) && (
|
||||
<div className="field is-horizontal">
|
||||
<ListParent
|
||||
className={classNames('field-label', 'is-inline-flex')}
|
||||
className={classNames("field-label", "is-inline-flex")}
|
||||
>
|
||||
{t('plugins.modal.currentVersion')}:
|
||||
{t("plugins.modal.currentVersion")}:
|
||||
</ListParent>
|
||||
<ListChild
|
||||
className={classNames('field-body', 'is-inline-flex')}
|
||||
className={classNames("field-body", "is-inline-flex")}
|
||||
>
|
||||
{plugin.version}
|
||||
</ListChild>
|
||||
@@ -254,12 +254,12 @@ class PluginModal extends React.Component<Props, State> {
|
||||
{pluginAction === PluginAction.UPDATE && (
|
||||
<div className="field is-horizontal">
|
||||
<ListParent
|
||||
className={classNames('field-label', 'is-inline-flex')}
|
||||
className={classNames("field-label", "is-inline-flex")}
|
||||
>
|
||||
{t('plugins.modal.newVersion')}:
|
||||
{t("plugins.modal.newVersion")}:
|
||||
</ListParent>
|
||||
<ListChild
|
||||
className={classNames('field-body', 'is-inline-flex')}
|
||||
className={classNames("field-body", "is-inline-flex")}
|
||||
>
|
||||
{plugin.newVersion}
|
||||
</ListChild>
|
||||
@@ -272,7 +272,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
<div className="media-content">
|
||||
<Checkbox
|
||||
checked={restart}
|
||||
label={t('plugins.modal.restart')}
|
||||
label={t("plugins.modal.restart")}
|
||||
onChange={this.handleRestartChange}
|
||||
disabled={false}
|
||||
/>
|
||||
@@ -285,7 +285,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
return (
|
||||
<Modal
|
||||
title={t(`plugins.modal.title.${pluginAction}`, {
|
||||
name: plugin.displayName ? plugin.displayName : plugin.name,
|
||||
name: plugin.displayName ? plugin.displayName : plugin.name
|
||||
})}
|
||||
closeFunction={() => onClose()}
|
||||
body={body}
|
||||
@@ -296,4 +296,4 @@ class PluginModal extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate('admin')(PluginModal);
|
||||
export default translate("admin")(PluginModal);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import styled from 'styled-components';
|
||||
import * as React from "react";
|
||||
import classNames from "classnames";
|
||||
import styled from "styled-components";
|
||||
|
||||
type Props = {
|
||||
children?: React.Node;
|
||||
@@ -17,10 +17,10 @@ export default class PluginTopActions extends React.Component<Props> {
|
||||
return (
|
||||
<ChildWrapper
|
||||
className={classNames(
|
||||
'column',
|
||||
'is-flex',
|
||||
'is-one-fifths',
|
||||
'is-mobile-action-spacing',
|
||||
"column",
|
||||
"is-flex",
|
||||
"is-one-fifths",
|
||||
"is-mobile-action-spacing"
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { translate } from 'react-i18next';
|
||||
import { Notification } from '@scm-manager/ui-components';
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { Notification } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
// context props
|
||||
@@ -12,13 +12,13 @@ class InstallSuccessNotification extends React.Component<Props> {
|
||||
const { t } = this.props;
|
||||
return (
|
||||
<Notification type="success">
|
||||
{t('plugins.modal.successNotification')}{' '}
|
||||
{t("plugins.modal.successNotification")}{" "}
|
||||
<a onClick={e => window.location.reload(true)}>
|
||||
{t('plugins.modal.reload')}
|
||||
{t("plugins.modal.reload")}
|
||||
</a>
|
||||
</Notification>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default translate('admin')(InstallSuccessNotification);
|
||||
export default translate("admin")(InstallSuccessNotification);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import PluginActionModal from './PluginActionModal';
|
||||
import { PluginCollection } from '@scm-manager/ui-types';
|
||||
import { apiClient } from '@scm-manager/ui-components';
|
||||
import { translate } from 'react-i18next';
|
||||
import React from "react";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
import { PluginCollection } from "@scm-manager/ui-types";
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
onClose: () => void;
|
||||
@@ -19,8 +19,8 @@ class UpdateAllActionModal extends React.Component<Props> {
|
||||
|
||||
return (
|
||||
<PluginActionModal
|
||||
description={t('plugins.modal.updateAll')}
|
||||
label={t('plugins.updateAll')}
|
||||
description={t("plugins.modal.updateAll")}
|
||||
label={t("plugins.updateAll")}
|
||||
onClose={onClose}
|
||||
installedPlugins={installedPlugins}
|
||||
execute={this.updateAll}
|
||||
@@ -37,4 +37,4 @@ class UpdateAllActionModal extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate('admin')(UpdateAllActionModal);
|
||||
export default translate("admin")(UpdateAllActionModal);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Plugin, PluginGroup } from '@scm-manager/ui-types';
|
||||
import { Plugin, PluginGroup } from "@scm-manager/ui-types";
|
||||
|
||||
export default function groupByCategory(plugins: Plugin[]): PluginGroup[] {
|
||||
let groups = {};
|
||||
@@ -9,7 +9,7 @@ export default function groupByCategory(plugins: Plugin[]): PluginGroup[] {
|
||||
if (!group) {
|
||||
group = {
|
||||
name: groupName,
|
||||
plugins: [],
|
||||
plugins: []
|
||||
};
|
||||
groups[groupName] = group;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { apiClient } from '@scm-manager/ui-components';
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
|
||||
const waitForRestart = () => {
|
||||
const endTime = Number(new Date()) + 10000;
|
||||
@@ -11,13 +11,13 @@ const waitForRestart = () => {
|
||||
setTimeout(executor, 1000, resolve, reject);
|
||||
} else {
|
||||
apiClient
|
||||
.get('')
|
||||
.get("")
|
||||
.then(resolve)
|
||||
.catch(() => {
|
||||
if (Number(new Date()) < endTime) {
|
||||
setTimeout(executor, 500, resolve, reject);
|
||||
} else {
|
||||
reject(new Error('timeout reached'));
|
||||
reject(new Error("timeout reached"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user