Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
471 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,5 +218,5 @@ export default [ | |
validation: [] | ||
} | ||
] | ||
}, | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,7 +156,7 @@ const mocks = { | |
} | ||
] | ||
} | ||
}, | ||
} | ||
] | ||
} | ||
}) | ||
|
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
43
packages/app-admin/src/components/ApiInformationDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/app-headless-cms/src/admin/components/ApiUrlsDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
packages/app-headless-cms/src/admin/plugins/apiInformationDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Oops, something went wrong.