feat: add supportsConnections support in App
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/discord/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/discord/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/discord",
|
"docUrl": "https://automatisch.io/docs/discord",
|
||||||
"primaryColor": "5865f2",
|
"primaryColor": "5865f2",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "oAuthRedirectUrl",
|
"key": "oAuthRedirectUrl",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/firebase/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/firebase/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/firebase",
|
"docUrl": "https://automatisch.io/docs/firebase",
|
||||||
"primaryColor": "ffca28",
|
"primaryColor": "ffca28",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "oAuthRedirectUrl",
|
"key": "oAuthRedirectUrl",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/flickr/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/flickr/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/flickr",
|
"docUrl": "https://automatisch.io/docs/flickr",
|
||||||
"primaryColor": "000000",
|
"primaryColor": "000000",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "oAuthRedirectUrl",
|
"key": "oAuthRedirectUrl",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/github/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/github/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/github",
|
"docUrl": "https://automatisch.io/docs/github",
|
||||||
"primaryColor": "000000",
|
"primaryColor": "000000",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "oAuthRedirectUrl",
|
"key": "oAuthRedirectUrl",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/gitlab/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/gitlab/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/gitlab",
|
"docUrl": "https://automatisch.io/docs/gitlab",
|
||||||
"primaryColor": "2DAAE1",
|
"primaryColor": "2DAAE1",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "oAuthRedirectUrl",
|
"key": "oAuthRedirectUrl",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/postgresql/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/postgresql/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/postgresql",
|
"docUrl": "https://automatisch.io/docs/postgresql",
|
||||||
"primaryColor": "2DAAE1",
|
"primaryColor": "2DAAE1",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "host",
|
"key": "host",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/scheduler/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/scheduler/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/scheduler",
|
"docUrl": "https://automatisch.io/docs/scheduler",
|
||||||
"primaryColor": "0059F7",
|
"primaryColor": "0059F7",
|
||||||
|
"supportsConnections": false,
|
||||||
"requiresAuthentication": false,
|
"requiresAuthentication": false,
|
||||||
"triggers": [
|
"triggers": [
|
||||||
{
|
{
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/slack/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/slack/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/slack",
|
"docUrl": "https://automatisch.io/docs/slack",
|
||||||
"primaryColor": "2DAAE1",
|
"primaryColor": "2DAAE1",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "accessToken",
|
"key": "accessToken",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/smtp/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/smtp/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/smtp",
|
"docUrl": "https://automatisch.io/docs/smtp",
|
||||||
"primaryColor": "2DAAE1",
|
"primaryColor": "2DAAE1",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "host",
|
"key": "host",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/twilio/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/twilio/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/twilio",
|
"docUrl": "https://automatisch.io/docs/twilio",
|
||||||
"primaryColor": "f22f46",
|
"primaryColor": "f22f46",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "accountSid",
|
"key": "accountSid",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/twitch/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/twitch/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/twitch",
|
"docUrl": "https://automatisch.io/docs/twitch",
|
||||||
"primaryColor": "2DAAE1",
|
"primaryColor": "2DAAE1",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "oAuthRedirectUrl",
|
"key": "oAuthRedirectUrl",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/twitter/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/twitter/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/twitter",
|
"docUrl": "https://automatisch.io/docs/twitter",
|
||||||
"primaryColor": "2DAAE1",
|
"primaryColor": "2DAAE1",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "oAuthRedirectUrl",
|
"key": "oAuthRedirectUrl",
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
"iconUrl": "{BASE_URL}/apps/typeform/assets/favicon.svg",
|
"iconUrl": "{BASE_URL}/apps/typeform/assets/favicon.svg",
|
||||||
"docUrl": "https://automatisch.io/docs/typeform",
|
"docUrl": "https://automatisch.io/docs/typeform",
|
||||||
"primaryColor": "5865f2",
|
"primaryColor": "5865f2",
|
||||||
|
"supportsConnections": true,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"key": "oAuthRedirectUrl",
|
"key": "oAuthRedirectUrl",
|
||||||
|
@@ -87,6 +87,7 @@ type App {
|
|||||||
iconUrl: String
|
iconUrl: String
|
||||||
docUrl: String
|
docUrl: String
|
||||||
primaryColor: String
|
primaryColor: String
|
||||||
|
supportsConnections: Boolean
|
||||||
fields: [Field]
|
fields: [Field]
|
||||||
authenticationSteps: [AuthenticationStep]
|
authenticationSteps: [AuthenticationStep]
|
||||||
reconnectionSteps: [ReconnectionStep]
|
reconnectionSteps: [ReconnectionStep]
|
||||||
|
1
packages/types/index.d.ts
vendored
1
packages/types/index.d.ts
vendored
@@ -142,6 +142,7 @@ export interface IApp {
|
|||||||
iconUrl: string;
|
iconUrl: string;
|
||||||
docUrl: string;
|
docUrl: string;
|
||||||
primaryColor: string;
|
primaryColor: string;
|
||||||
|
supportsConnections: boolean;
|
||||||
fields: IField[];
|
fields: IField[];
|
||||||
authenticationSteps: IAuthenticationStep[];
|
authenticationSteps: IAuthenticationStep[];
|
||||||
reconnectionSteps: IAuthenticationStep[];
|
reconnectionSteps: IAuthenticationStep[];
|
||||||
|
@@ -23,6 +23,14 @@ import AppIcon from 'components/AppIcon';
|
|||||||
import { GET_APPS } from 'graphql/queries/get-apps';
|
import { GET_APPS } from 'graphql/queries/get-apps';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
|
|
||||||
|
function createConnectionOrFlow(appKey: string, supportsConnections = false) {
|
||||||
|
if (!supportsConnections) {
|
||||||
|
return URLS.CREATE_FLOW_WITH_APP(appKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return URLS.APP_ADD_CONNECTION(appKey);
|
||||||
|
};
|
||||||
|
|
||||||
type AddNewAppConnectionProps = {
|
type AddNewAppConnectionProps = {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
};
|
};
|
||||||
@@ -70,7 +78,7 @@ export default function AddNewAppConnection(props: AddNewAppConnectionProps): Re
|
|||||||
<List sx={{ pt: 2 }}>
|
<List sx={{ pt: 2 }}>
|
||||||
{data?.getApps?.map((app: IApp) => (
|
{data?.getApps?.map((app: IApp) => (
|
||||||
<ListItem disablePadding key={app.name}>
|
<ListItem disablePadding key={app.name}>
|
||||||
<ListItemButton component={Link} to={URLS.APP_ADD_CONNECTION(app.name.toLowerCase())}>
|
<ListItemButton component={Link} to={createConnectionOrFlow(app.name.toLowerCase(), app.supportsConnections)}>
|
||||||
<ListItemIcon sx={{ minWidth: 74 }}>
|
<ListItemIcon sx={{ minWidth: 74 }}>
|
||||||
<AppIcon color="transparent" url={app.iconUrl} name={app.name} />
|
<AppIcon color="transparent" url={app.iconUrl} name={app.name} />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
@@ -8,6 +8,7 @@ export const GET_APP = gql`
|
|||||||
iconUrl
|
iconUrl
|
||||||
docUrl
|
docUrl
|
||||||
primaryColor
|
primaryColor
|
||||||
|
supportsConnections
|
||||||
fields {
|
fields {
|
||||||
key
|
key
|
||||||
label
|
label
|
||||||
|
@@ -9,6 +9,7 @@ export const GET_APPS = gql`
|
|||||||
docUrl
|
docUrl
|
||||||
primaryColor
|
primaryColor
|
||||||
connectionCount
|
connectionCount
|
||||||
|
supportsConnections
|
||||||
fields {
|
fields {
|
||||||
key
|
key
|
||||||
label
|
label
|
||||||
|
@@ -9,6 +9,7 @@ export const GET_CONNECTED_APPS = gql`
|
|||||||
docUrl
|
docUrl
|
||||||
primaryColor
|
primaryColor
|
||||||
connectionCount
|
connectionCount
|
||||||
|
supportsConnections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
@@ -40,7 +40,7 @@ const ReconnectConnection = (props: any): React.ReactElement => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Application(): React.ReactElement {
|
export default function Application(): React.ReactElement | null {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), { noSsr: true });
|
const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md'), { noSsr: true });
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
@@ -48,7 +48,7 @@ export default function Application(): React.ReactElement {
|
|||||||
const flowsPathMatch = useMatch({ path: URLS.APP_FLOWS_PATTERN, end: false });
|
const flowsPathMatch = useMatch({ path: URLS.APP_FLOWS_PATTERN, end: false });
|
||||||
const { appKey } = useParams() as ApplicationParams;
|
const { appKey } = useParams() as ApplicationParams;
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { data } = useQuery(GET_APP, { variables: { key: appKey } });
|
const { data, loading } = useQuery(GET_APP, { variables: { key: appKey } });
|
||||||
|
|
||||||
const goToApplicationPage = () => navigate('connections');
|
const goToApplicationPage = () => navigate('connections');
|
||||||
const app = data?.getApp || {};
|
const app = data?.getApp || {};
|
||||||
@@ -75,6 +75,8 @@ export default function Application(): React.ReactElement {
|
|||||||
[appKey],
|
[appKey],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (loading) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box sx={{ py: 3 }}>
|
<Box sx={{ py: 3 }}>
|
||||||
@@ -142,6 +144,7 @@ export default function Application(): React.ReactElement {
|
|||||||
label={formatMessage('app.connections')}
|
label={formatMessage('app.connections')}
|
||||||
to={URLS.APP_CONNECTIONS(appKey)}
|
to={URLS.APP_CONNECTIONS(appKey)}
|
||||||
value={URLS.APP_CONNECTIONS_PATTERN}
|
value={URLS.APP_CONNECTIONS_PATTERN}
|
||||||
|
disabled={!app.supportsConnections}
|
||||||
component={Link}
|
component={Link}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -159,7 +162,12 @@ export default function Application(): React.ReactElement {
|
|||||||
|
|
||||||
<Route path={`${URLS.CONNECTIONS}/*`} element={<AppConnections appKey={appKey} />} />
|
<Route path={`${URLS.CONNECTIONS}/*`} element={<AppConnections appKey={appKey} />} />
|
||||||
|
|
||||||
<Route path="/" element={<Navigate to={URLS.APP_CONNECTIONS(appKey)} />} />
|
<Route
|
||||||
|
path="/"
|
||||||
|
element={(
|
||||||
|
<Navigate to={app.supportsConnections ? URLS.APP_CONNECTIONS(appKey) : URLS.APP_FLOWS(appKey)} />
|
||||||
|
)}
|
||||||
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
Reference in New Issue
Block a user