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/headless cms installation #825

Merged
merged 5 commits into from
May 7, 2020

Conversation

Ashu96
Copy link
Contributor

@Ashu96 Ashu96 commented May 7, 2020

Related Issue

Issue #808
Headless CMS - Create Installation

Your solution

Implement installation plugin for headless cms

How Has This Been Tested?

Manually, by following these steps:

  1. Add a new DB URL in env file
  2. Deploy API to local env and run/visit admin app
  3. Headless cms installation should appear as the last step of the admin app installation process
  4. After successful installation/login user should be able to
    • A production environment created for him to use
    • A production environment alias created for him to use
    • A generic content model group created for him to use when creating a new content model

Screenshots (if relevant):

https://www.loom.com/share/89d7d51051f24e1f91739a3527f7bd6a

Ashu96 added 3 commits May 7, 2020 13:12
add `cmsSettings` and `cmsContentModelGroup` models to plugins models
implement `cmsInstall` typeDefs and resolvers
implement `InstallationPlugin` for cms
@Ashu96 Ashu96 requested a review from adrians5j May 7, 2020 07:51
@Ashu96 Ashu96 self-assigned this May 7, 2020
@adrians5j
Copy link
Member

Starting with this...

Copy link
Member

@adrians5j adrians5j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at a couple of things (nothing major).


export default {
typeDefs: /* GraphQL */ `
type CmsBooleanResponse {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this into the main graphql file, which imports all of these smaller ones. Just so it's more clear that CmsBooleanResponse is there, and other files can rely on it.

import { GraphQLFieldResolver } from "@webiny/graphql/types";

const initialEnvironment = {
id: mdbid(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this, id will automatically get generated.

const initialEnvironment = {
id: mdbid(),
name: "Production",
description: "Ready to go live",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with something like "This is the production environment".

const initialEnvironmentAlias = {
slug: "production",
name: "Production",
description: "Ready to go live"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with something like "This is the "production" environment alias".

if (await settings.data.installed) {
return new ErrorResponse({
code: "CMS_INSTALL_ABORTED",
message: "Cms is already installed."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cms -> The app is already installed.

}
// Create a production environment
const cmsEnvironmentProduction = await cmsEnvironment.populate({
id: initialEnvironment.id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this.

id: initialEnvironment.id,
name: initialEnvironment.name,
description: initialEnvironment.description,
createdFrom: initialEnvironment.createdFrom
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have this prop, right? Anyways, for the initial production environment, it should be null.

// import header from "./contentDetails/header";
import revisionContent from "./contentDetails/revisionContent";
import previewContent from "./contentDetails/contentForm";
import header from "./contentDetails/header";
import pageRevisions from "./contentDetails/pageRevisions";
// import pageRevisions from "./contentDetails/pageRevisions";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I also remove the other commented out code?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, remove it, and I'll check these files that are commented. They are part of the content model form, which I'm currently working on. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆒
Thanks @doitadrian

@Ashu96 Ashu96 marked this pull request as ready for review May 7, 2020 09:09
Copy link
Member

@adrians5j adrians5j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can merge this.

@adrians5j adrians5j merged commit 5ee8165 into feat/headless-latest May 7, 2020
@adrians5j adrians5j deleted the feat/headless-cms-installation branch May 7, 2020 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants