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

Feat/environment view #1053

Merged
merged 64 commits into from Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
2a463cc
wip(wip): add environment information dialog
EmilK15 Jun 22, 2020
da3d335
wip(wip): add surrounding text to api links
EmilK15 Jun 22, 2020
7feb620
feat(headless): add info icon and style environment information dialog
EmilK15 Jun 22, 2020
9079106
wip(wip): add environment info dialog to environment aliases menu
EmilK15 Jun 23, 2020
9bddab7
wip(headless): add api information dialog to accessTokensDataList
EmilK15 Jun 23, 2020
ba9f211
wip: add info dialog next to info icon
EmilK15 Jun 24, 2020
0f693ad
wip(headless): remove unneeded dialog from access tokens list
EmilK15 Jun 24, 2020
c24f4c3
feat(headless): add all environment aliases to info and styling
EmilK15 Jun 25, 2020
2283f95
fix(headless): add dependency for apollo hooks
EmilK15 Jun 25, 2020
162e008
wip(headless): move info icon to menu footer
EmilK15 Jun 29, 2020
08faf18
merge(headless): merge with master and fix @apollo/react-hooks dep
EmilK15 Jun 29, 2020
8569cd7
wip(headless): fix cyclical dependency for app-admin
EmilK15 Jun 29, 2020
983466b
wip(headless): add call to get current environment
EmilK15 Jun 30, 2020
eab4424
Merge branch 'feat/environment-view' of https://github.com/webiny/web…
EmilK15 Jun 30, 2020
eab29e8
merge: merge from feat/environment-view
EmilK15 Jun 30, 2020
49e3e77
wip: add apollo react hooks to app-headless-cms
EmilK15 Jun 30, 2020
ff6f742
merge: merge with remote origin
EmilK15 Jun 30, 2020
c776109
fix(app-plugin-admin-welcome-screen): override route-root to render a…
Pavel910 Jun 30, 2020
ad29ab1
fix: remove "AdminMenuContentSectionPlugin" type
adrians5j Jun 29, 2020
066b6b3
fix: replace "Content" section in the main menu with "Page Builder" a…
adrians5j Jun 29, 2020
7e46209
fix(app-template): sort routes so * is always the last item
Pavel910 Jun 30, 2020
a6f2396
fix(app-template-site): remove root route
Pavel910 Jun 30, 2020
1373dcc
fix(app-template-admin): remove root route
Pavel910 Jun 30, 2020
e39cc12
feat(api-headless-cms): add `environmentAliases`
Ashu96 Jun 29, 2020
16442b2
test(api-headless-cms): update `environments` test
Ashu96 Jun 29, 2020
a217870
feat(app-headless-cms): add `environmentAliases`
Ashu96 Jun 29, 2020
752753b
fix: make sure newly added ref fields cannot reference a model with n…
adrians5j Jun 30, 2020
485a05c
feat(app-page-builder): remove `domain` input
Ashu96 Jun 19, 2020
03b438b
feat(app-page-builder): add `configure domain` confirmation
Ashu96 Jun 19, 2020
e9b98f4
feat(app-page-builder): add `useSiteStatus` hook
Ashu96 Jun 19, 2020
00e2cee
feat(app-page-builder): add `DialogContainer`
Ashu96 Jun 26, 2020
d740954
feat(app-page-builder): add `useConfigureDomainDialog` hook
Ashu96 Jun 26, 2020
d671577
refactor(app-page-builder): use `useConfigureDomainDialog`
Ashu96 Jun 26, 2020
6043926
feat(app-page-builder): add `useSiteStatus`
Ashu96 Jun 26, 2020
674d5ae
refactor(app-page-builder): remove `useSiteStatus`
Ashu96 Jun 26, 2020
acc0adf
refactor(app-page-builder): move `useSiteStatus` into a separate file
Ashu96 Jun 29, 2020
dd21a64
refactor(app-page-builder): rename `configureDomain` file
Ashu96 Jun 29, 2020
0707946
refactor(app-page-builder): move `useConfigureDomain` to hooks
Ashu96 Jun 30, 2020
b6667c9
refactor(app-page-builder): move `url` outside of `handlePreviewClick`
Ashu96 Jun 30, 2020
2fa3063
docs: add development overview doc (#1087)
AlbionaHoti Jun 30, 2020
d7c3316
test: improve test utils
adrians5j Jun 30, 2020
4e0c451
fix: export mock IDs for direct usage in tests
adrians5j Jun 30, 2020
fc02d55
test: rely on isEqual and mocks, instead of checking properties separ…
adrians5j Jun 30, 2020
6512d07
fix(headless): fix load of environment api for aliases
EmilK15 Jun 30, 2020
d8c7c3a
merge: master into feat/environment-view
EmilK15 Jun 30, 2020
6cf1a34
wip(headless): change location of dialog so background is grey
EmilK15 Jul 2, 2020
3a14ecf
refactor(headless): add styling to info dialog and links to api urls
EmilK15 Jul 2, 2020
8689fc2
fix(headless): add tooltip and label for headless api links
EmilK15 Jul 6, 2020
83845fd
wip(headless): refactor plugin for alias and non alias use
EmilK15 Jul 9, 2020
023bb17
wip(headless): add type to dialog to handle use of graphql api
EmilK15 Jul 9, 2020
5ad1317
style(headless): add break with key to graphql url for proper spacing
EmilK15 Jul 9, 2020
c9784c8
style(headless): run prettier for types in app admin
EmilK15 Jul 9, 2020
49063eb
wip(headless): fix build and runtime checks
EmilK15 Jul 9, 2020
bcca08f
fix: remove @apollo/react-hooks
adrians5j Jul 9, 2020
3ec898a
fix: rename ApiInformationDialog to ApiInformationDialogPlugin
adrians5j Jul 9, 2020
22444a3
chore: remove old file
adrians5j Jul 9, 2020
3a6f8d0
fix: create ApiUrlsDialog component
adrians5j Jul 9, 2020
cdad245
fix: create HeadlessCmsApiUrls component
adrians5j Jul 9, 2020
d7edc0a
fix: use `HeadlessCmsApiUrls` component
adrians5j Jul 9, 2020
757d906
fix: simplify ApiInformationDialog component
adrians5j Jul 9, 2020
3ebd4e7
fix: remove properties
adrians5j Jul 9, 2020
8d989df
fix: simplify "ApiInformationDialog" component
adrians5j Jul 9, 2020
654a62f
fix: create "admin-api-information-dialog-graphql" plugin
adrians5j Jul 9, 2020
58ef8b1
merge: merge with master
EmilK15 Jul 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/future/secure-site/handler/handler.js
Expand Up @@ -55,7 +55,9 @@ module.exports.handler = async event => {
try {
const buffer = await new Promise((resolve, reject) => {
fs.readFile(filePath, (err, data) => {
if (err) return reject(err);
if (err) {
return reject(err);
}
resolve(data);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/api-headless-cms/__tests__/mocks/contentModels.js
Expand Up @@ -218,5 +218,5 @@ export default [
validation: []
}
]
},
}
];
Expand Up @@ -156,7 +156,7 @@ const mocks = {
}
]
}
},
}
]
}
})
Expand Down
8 changes: 8 additions & 0 deletions packages/app-admin/src/assets/icons/info.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions packages/app-admin/src/components/ApiInformationDialog.tsx
@@ -0,0 +1,43 @@
import React from "react";
import { css } from "emotion";
import { i18n } from "@webiny/app/i18n";
import { Dialog, DialogTitle, DialogContent } from "@webiny/ui/Dialog";
import { getPlugins } from "@webiny/plugins";
import { ApiInformationDialogPlugin } from "@webiny/app-admin/types";

export type NewContentModelDialogProps = {
open: boolean;
onClose: () => void;
};

const t = i18n.ns("app-admin/navigation");

const style = {
narrowDialog: css({
".mdc-dialog__surface": {
width: 800,
minWidth: 800
}
})
};

const ApiInformationDialog: React.FC<NewContentModelDialogProps> = ({ open, onClose }) => {
const adminInfoPlugins = getPlugins<ApiInformationDialogPlugin>("admin-api-information-dialog");
return (
<Dialog
open={open}
onClose={onClose}
className={style.narrowDialog}
data-testid="environment-info-modal"
>
<DialogTitle>{t`API Information`}</DialogTitle>
<DialogContent>
{adminInfoPlugins.map(pl => (
<div key={pl.name}>{pl.render()}</div>
))}
</DialogContent>
</Dialog>
);
};

export default ApiInformationDialog;
33 changes: 31 additions & 2 deletions packages/app-admin/src/plugins/Menu/Navigation/index.tsx
@@ -1,9 +1,10 @@
import React, { useMemo, useEffect } from "react";
import React, { useMemo, useState, useEffect } from "react";
import { sortBy } from "lodash";
import { Drawer, DrawerContent, DrawerHeader } from "@webiny/ui/Drawer";
import { List, ListItem, ListItemGraphic } from "@webiny/ui/List";
import { IconButton } from "@webiny/ui/Button";
import { Icon } from "@webiny/ui/Icon";
import { css } from "emotion";
import { getPlugin, getPlugins } from "@webiny/plugins";
import { AdminMenuLogoPlugin, AdminMenuPlugin } from "@webiny/app-admin/types";
import { useNavigation, Menu, Item, Section } from "./components";
Expand All @@ -12,15 +13,26 @@ import { ReactComponent as MenuIcon } from "@webiny/app-admin/assets/icons/basel
import { ReactComponent as DocsIcon } from "@webiny/app-admin/assets/icons/icon-documentation.svg";
import { ReactComponent as CommunityIcon } from "@webiny/app-admin/assets/icons/icon-community.svg";
import { ReactComponent as GithubIcon } from "@webiny/app-admin/assets/icons/github-brands.svg";
import { ReactComponent as InfoIcon } from "@webiny/app-admin/assets/icons/info.svg";
import ApiInformationDialog from "@webiny/app-admin/components/ApiInformationDialog";

import { i18n } from "@webiny/app/i18n";
const t = i18n.ns("app-admin/navigation");

const style = {
environmentContainer: css({
color: "var(--mdc-theme-text-secondary-on-background)"
}),
infoContainer: css({
alignSelf: "center"
})
};

const Navigation = () => {
const { hideMenu, menuIsShown, initSections } = useNavigation();
const [infoOpened, setInfoOpened] = useState(false);

useEffect(initSections, []);

const logo = useMemo(() => {
const logoPlugin = getPlugin<AdminMenuLogoPlugin>("admin-menu-logo");
if (logoPlugin) {
Expand Down Expand Up @@ -54,6 +66,21 @@ const Navigation = () => {
<DrawerContent className={navContent}>{menus}</DrawerContent>
<MenuFooter>
<List nonInteractive>
<div
className={style.infoContainer}
onClick={e => {
e.preventDefault();
e.stopPropagation();
setInfoOpened(true);
}}
>
<ListItem ripple={false}>
<ListItemGraphic>
<Icon icon={<InfoIcon />} />
</ListItemGraphic>
{t`API information`}
</ListItem>
</div>
<a href="https://docs.webiny.com/" rel="noopener noreferrer" target="_blank">
<ListItem ripple={false}>
<ListItemGraphic>
Expand Down Expand Up @@ -103,6 +130,8 @@ const Navigation = () => {
</div>
</ListItem>
</List>

<ApiInformationDialog open={infoOpened} onClose={() => setInfoOpened(false)} />
</MenuFooter>
</Drawer>
);
Expand Down
58 changes: 58 additions & 0 deletions packages/app-admin/src/plugins/Menu/gqlApiInformation.tsx
@@ -0,0 +1,58 @@
import React from "react";
import { ApiInformationDialogPlugin } from "@webiny/app-admin/types";
import { useSnackbar } from "@webiny/app-admin/hooks/useSnackbar";
import { Tooltip } from "@webiny/ui/Tooltip";
import { Typography } from "@webiny/ui/Typography";
import { CopyButton } from "@webiny/ui/Button";
import { css } from "emotion";

const style = {
apiUrl: css({
display: "flex",
alignItems: "center"
}),
api: css({
fontWeight: "bold",
minWidth: "200px"
})
};

const plugin: ApiInformationDialogPlugin = {
type: "admin-api-information-dialog",
name: "admin-api-information-dialog-graphql",
render() {
const { showSnackbar } = useSnackbar();

return (
<>
<div className={style.apiUrl}>
<Tooltip
className={style.api}
content={
<span>
This link allows you to access content created by different
application across Webiny like Page Builder or Form Builder.
</span>
}
>
<Typography use={"headline6"}>GraphQL API:</Typography>
</Tooltip>
<a
href={process.env.REACT_APP_GRAPHQL_API_URL}
rel="noopener noreferrer"
target="_blank"
>
{process.env.REACT_APP_GRAPHQL_API_URL}
</a>
<CopyButton
value={process.env.REACT_APP_GRAPHQL_API_URL}
onCopy={() => showSnackbar("Successfully copied!")}
/>
</div>
<br key="graphql-break"/>
</>
);
}
};

export default plugin;
20 changes: 12 additions & 8 deletions packages/app-admin/src/plugins/Menu/index.tsx
@@ -1,13 +1,17 @@
import React from "react";
import Hamburger from "./Hamburger";
import { AdminHeaderLeftPlugin } from "@webiny/app-admin/types";
import gqlApiInformation from "./gqlApiInformation";
import { AdminHeaderLeftPlugin, ApiInformationDialogPlugin } from "@webiny/app-admin/types";

const plugin: AdminHeaderLeftPlugin = {
name: "admin-header-main-menu-icon",
type: "admin-header-left",
render() {
return <Hamburger />;
}
};
const plugin = [
{
name: "admin-header-main-menu-icon",
type: "admin-header-left",
render() {
return <Hamburger />;
}
} as AdminHeaderLeftPlugin,
gqlApiInformation as ApiInformationDialogPlugin
];

export default plugin;
5 changes: 5 additions & 0 deletions packages/app-admin/src/types.ts
Expand Up @@ -112,3 +112,8 @@ export type AdminInstallationPlugin = Plugin & {
secure: boolean;
render({ onInstalled }): React.ReactNode;
};

export type ApiInformationDialogPlugin = Plugin & {
type: "admin-api-information-dialog";
render(): React.ReactNode;
};
41 changes: 41 additions & 0 deletions packages/app-headless-cms/src/admin/components/ApiUrlsDialog.tsx
@@ -0,0 +1,41 @@
import React from "react";
import { css } from "emotion";
import { i18n } from "@webiny/app/i18n";
import { Dialog, DialogTitle, DialogContent } from "@webiny/ui/Dialog";
import HeadlessCmsApiUrls from "@webiny/app-headless-cms/admin/plugins/apiInformationDialog/HeadlessCmsApiUrls";

export type ApiUrlsDialogProps = {
open: boolean;
onClose: () => void;
name?: string;
type?: string;
};

const t = i18n.ns("app-headless-cms/admin/components/environment-selector-dialog");

const style = {
narrowDialog: css({
".mdc-dialog__surface": {
width: 800,
minWidth: 800
}
})
};

const ApiUrlsDialog: React.FC<ApiUrlsDialogProps> = ({ open, onClose, name, type }) => {
return (
<Dialog
open={open}
onClose={onClose}
className={style.narrowDialog}
data-testid="environment-selector-modal"
>
<DialogTitle>{t`Environment: {name}`({ name: name })}</DialogTitle>
<DialogContent>
<HeadlessCmsApiUrls name={name} type={type} />
</DialogContent>
</Dialog>
);
};

export default ApiUrlsDialog;
5 changes: 5 additions & 0 deletions packages/app-headless-cms/src/admin/contexts/Cms/graphql.ts
Expand Up @@ -13,6 +13,11 @@ export const LIST_ENVIRONMENTS_SELECTOR_ENVIRONMENTS = gql`
id
name
isProduction
url {
manage
read
preview
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions packages/app-headless-cms/src/admin/icons/info.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,13 @@
import React from "react";
import { ApiInformationDialogPlugin } from "@webiny/app-admin/types";
import HeadlessCmsApiUrls from "./apiInformationDialog/HeadlessCmsApiUrls";

const plugin: ApiInformationDialogPlugin = {
type: "admin-api-information-dialog",
name: "admin-api-information-dialog-headless-cms",
render() {
return <HeadlessCmsApiUrls />;
}
};

export default plugin;