diff --git a/apps/api/plane/bgtasks/workspace_seed_task.py b/apps/api/plane/bgtasks/workspace_seed_task.py index 848646e5a..6f342bb2a 100644 --- a/apps/api/plane/bgtasks/workspace_seed_task.py +++ b/apps/api/plane/bgtasks/workspace_seed_task.py @@ -25,6 +25,8 @@ from plane.db.models import ( IssueLabel, IssueSequence, IssueActivity, + Page, + ProjectPage, ) logger = logging.getLogger("plane.worker") @@ -272,6 +274,47 @@ def create_project_issues( return +def create_pages(workspace: Workspace, project_map: Dict[int, uuid.UUID]) -> None: + """Creates pages for each project in the workspace. + + Args: + workspace: The workspace containing the projects + project_map: Mapping of seed project IDs to actual project IDs + """ + page_seeds = read_seed_file("pages.json") + + if not page_seeds: + return + + for page_seed in page_seeds: + page_id = page_seed.pop("id") + + page = Page.objects.create( + workspace_id=workspace.id, + is_global=False, + name=page_seed.get("name"), + description=page_seed.get("description", {}), + description_html=page_seed.get("description_html", "

"), + description_binary=page_seed.get("description_binary", None), + description_stripped=page_seed.get("description_stripped", None), + created_by_id=workspace.created_by_id, + updated_by_id=workspace.created_by_id, + owned_by_id=workspace.created_by_id, + ) + + logger.info(f"Task: workspace_seed_task -> Page {page_id} created") + if page_seed.get("project_id") and page_seed.get("type") == "project": + ProjectPage.objects.create( + workspace_id=workspace.id, + project_id=project_map[page_seed.get("project_id")], + page_id=page.id, + created_by_id=workspace.created_by_id, + updated_by_id=workspace.created_by_id, + ) + + logger.info(f"Task: workspace_seed_task -> Project Page {page_id} created") + return + @shared_task def workspace_seed(workspace_id: uuid.UUID) -> None: """Seeds a new workspace with initial project data. @@ -302,6 +345,9 @@ def workspace_seed(workspace_id: uuid.UUID) -> None: # create project issues create_project_issues(workspace, project_map, state_map, label_map) + # create project pages + create_pages(workspace, project_map) + logger.info(f"Task: workspace_seed_task -> Workspace {workspace_id} seeded successfully") return except Exception as e: diff --git a/apps/api/plane/seeds/data/pages.json b/apps/api/plane/seeds/data/pages.json new file mode 100644 index 000000000..2cffeafe7 --- /dev/null +++ b/apps/api/plane/seeds/data/pages.json @@ -0,0 +1,11 @@ +[ + { + "id": 1, + "name": "Pages Introduction", + "project_id": 1, + "description_stripped":"Bye, bye, Notion, Google Docs, Evernote, Keep, and Apple Notes. Plane Pages are here!What is Pages?Pages is exactly what it sounds like---just an open space for your thoughts, notes, and something more intentful.With Pages, you can now start jotting down meeting notes, create docs for issues, and format for presentation. You see a table of contents on the right when you use headings and you can lock the page so it’s not accidentally editable.How to get to PagesEasy. Just find pages under any project on the left nav of your Plane workspace, click Create page, give your new page a cool name, like I have for this page, and start clacking away.No flipping screens, no copy-pasting from anywhere else, no additional hoops.Like I said \"Easy\"What can I do with Pages ?Anything you want to write, you can write on Pages.Want to format something a quote? Easy.How about a to-do list ?How about another Item on the list ? How about I stop being stupid ? Bullets ? Yep. Netsted bullets ? We got you. Even more nesting in bullets? Sure.And Tab or Shift + Tab work, too.Ah, yes, there’s numbered lists, too. And they align nicely so you don’t have to battle with the screen.There's code snippets that can go as long or as short as you want and \ninclude API docs you want to reference. You can even copy code from \nsomewhere and paste it inside Plane to have it show up like this.There is a table tooYou can also color rowsdifferent from columnsOr color columns differentLet's upload an image and make this line a heading 3.Yep. Genius.Life is already great with Plane. but it gets a little better with Pages, right?Give it a spin, tell us we were right... Or wrong. We will work to make Pages work for you.", + "description_html": "

Bye, bye, Notion, Google Docs, Evernote, Keep, and Apple Notes. Plane Pages are here!

What is Pages?

Pages is exactly what it sounds like---just an open space for your thoughts, notes, and something more intentful.

With Pages, you can now start jotting down meeting notes, create docs for issues, and format for presentation. You see a table of contents on the right when you use headings and you can lock the page so it’s not accidentally editable.

How to get to Pages

Easy. Just find pages under any project on the left nav of your Plane workspace, click Create page, give your new page a cool name, like I have for this page, and start clacking away.No flipping screens, no copy-pasting from anywhere else, no additional hoops.

Like I said \"Easy\"

What can I do with Pages ?

Anything you want to write, you can write on Pages.

Want to format something a quote?
Easy.

  1. Ah, yes, there’s numbered lists, too.

  2. And they align nicely so you don’t have to battle with the screen.

There's code snippets that can go as long or as short as you want and \ninclude API docs you want to reference. You can even copy code from \nsomewhere and paste it inside Plane to have it show up like this.

There is a table too

You can also color rows
different from columns

Or color columns different

Let's upload an image and make this line a heading 3.

Yep. Genius.

Life is already great with Plane. but it gets a little better with Pages, right?

Give it a spin, tell us we were right... Or wrong. We will work to make Pages work for you.

", + "description": "{\"type\": \"doc\", \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Bye, bye, Notion, Google Docs, Evernote, Keep, and Apple Notes. Plane Pages are here!\", \"type\": \"text\"}]}, {\"type\": \"heading\", \"attrs\": {\"level\": 2, \"textAlign\": null}, \"content\": [{\"text\": \"What is Pages?\", \"type\": \"text\"}]}, {\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Pages is exactly what it sounds like---just an open space for your thoughts, notes, and something more intentful.\", \"type\": \"text\", \"marks\": [{\"type\": \"customColor\", \"attrs\": {\"color\": null, \"backgroundColor\": null}}]}, {\"type\": \"hardBreak\"}, {\"type\": \"hardBreak\"}, {\"text\": \"With Pages, you can now start jotting down meeting notes, create docs for issues, and format for presentation. You see a table of contents on the right when you use headings and you can lock the page so it’s not accidentally editable.\", \"type\": \"text\", \"marks\": [{\"type\": \"customColor\", \"attrs\": {\"color\": null, \"backgroundColor\": null}}]}]}, {\"type\": \"heading\", \"attrs\": {\"level\": 2, \"textAlign\": null}, \"content\": [{\"text\": \"How to get to Pages\", \"type\": \"text\"}]}, {\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Easy. Just find pages under any project on the left nav of your Plane workspace, click Create page, give your new page a cool name, like I have for this page, and start clacking away.No flipping screens, no copy-pasting from anywhere else, no additional hoops.\", \"type\": \"text\", \"marks\": [{\"type\": \"customColor\", \"attrs\": {\"color\": null, \"backgroundColor\": null}}]}]}, {\"type\": \"blockquote\", \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Like I said \\\"Easy\\\"\", \"type\": \"text\"}]}]}, {\"type\": \"heading\", \"attrs\": {\"level\": 3, \"textAlign\": null}, \"content\": [{\"text\": \"What can I do with Pages ?\", \"type\": \"text\"}]}, {\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Anything you want to write, you can write on Pages.\", \"type\": \"text\"}]}, {\"type\": \"blockquote\", \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Want to format something a quote? \", \"type\": \"text\", \"marks\": [{\"type\": \"bold\"}, {\"type\": \"customColor\", \"attrs\": {\"color\": null, \"backgroundColor\": null}}]}, {\"type\": \"hardBreak\"}, {\"text\": \"Easy.\", \"type\": \"text\", \"marks\": [{\"type\": \"bold\"}, {\"type\": \"customColor\", \"attrs\": {\"color\": null, \"backgroundColor\": null}}]}]}]}, {\"type\": \"taskList\", \"content\": [{\"type\": \"taskItem\", \"attrs\": {\"checked\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"How about a to-do list ?\", \"type\": \"text\"}]}]}, {\"type\": \"taskItem\", \"attrs\": {\"checked\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"How about another Item on the list ? \", \"type\": \"text\"}]}]}, {\"type\": \"taskItem\", \"attrs\": {\"checked\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"How about I stop being stupid ? \", \"type\": \"text\"}]}]}]}, {\"type\": \"bulletList\", \"content\": [{\"type\": \"listItem\", \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Bullets ? Yep. \", \"type\": \"text\"}]}, {\"type\": \"bulletList\", \"content\": [{\"type\": \"listItem\", \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Netsted bullets ? We got you. \", \"type\": \"text\"}]}, {\"type\": \"bulletList\", \"content\": [{\"type\": \"listItem\", \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Even more nesting in bullets? Sure.\", \"type\": \"text\"}]}]}]}]}]}]}, {\"type\": \"listItem\", \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"And Tab or Shift + Tab work, too.\", \"type\": \"text\"}]}]}]}, {\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}}, {\"type\": \"orderedList\", \"attrs\": {\"type\": null, \"start\": 1}, \"content\": [{\"type\": \"listItem\", \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Ah, yes, there’s numbered lists, too. \", \"type\": \"text\", \"marks\": [{\"type\": \"customColor\", \"attrs\": {\"color\": null, \"backgroundColor\": null}}]}]}]}, {\"type\": \"listItem\", \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"And they align nicely so you don’t have to battle with the screen.\", \"type\": \"text\", \"marks\": [{\"type\": \"customColor\", \"attrs\": {\"color\": null, \"backgroundColor\": null}}]}]}]}]}, {\"type\": \"codeBlock\", \"attrs\": {\"language\": null}, \"content\": [{\"text\": \"There's code snippets that can go as long or as short as you want and \\ninclude API docs you want to reference. You can even copy code from \\nsomewhere and paste it inside Plane to have it show up like this.\", \"type\": \"text\"}]}, {\"type\": \"table\", \"content\": [{\"type\": \"tableRow\", \"attrs\": {\"textColor\": \"#171717\", \"background\": \"#D9E4FF\"}, \"content\": [{\"type\": \"tableCell\", \"attrs\": {\"colspan\": 1, \"rowspan\": 1, \"colwidth\": [238], \"textColor\": null, \"background\": null, \"hideContent\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"There is a table too\", \"type\": \"text\"}]}]}, {\"type\": \"tableCell\", \"attrs\": {\"colspan\": 1, \"rowspan\": 1, \"colwidth\": [196], \"textColor\": \"#171717\", \"background\": \"#DCFCE7\", \"hideContent\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}}]}, {\"type\": \"tableCell\", \"attrs\": {\"colspan\": 1, \"rowspan\": 1, \"colwidth\": [285], \"textColor\": null, \"background\": null, \"hideContent\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}}]}]}, {\"type\": \"tableRow\", \"attrs\": {\"textColor\": \"#171717\", \"background\": \"#FEF3C7\"}, \"content\": [{\"type\": \"tableCell\", \"attrs\": {\"colspan\": 1, \"rowspan\": 1, \"colwidth\": [238], \"textColor\": null, \"background\": null, \"hideContent\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"You can also color rows\", \"type\": \"text\"}, {\"type\": \"hardBreak\"}, {\"text\": \"different from columns\", \"type\": \"text\"}]}]}, {\"type\": \"tableCell\", \"attrs\": {\"colspan\": 1, \"rowspan\": 1, \"colwidth\": [196], \"textColor\": \"#171717\", \"background\": \"#DCFCE7\", \"hideContent\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}}]}, {\"type\": \"tableCell\", \"attrs\": {\"colspan\": 1, \"rowspan\": 1, \"colwidth\": [285], \"textColor\": null, \"background\": null, \"hideContent\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}}]}]}, {\"type\": \"tableRow\", \"attrs\": {\"textColor\": null, \"background\": null}, \"content\": [{\"type\": \"tableCell\", \"attrs\": {\"colspan\": 1, \"rowspan\": 1, \"colwidth\": [238], \"textColor\": null, \"background\": null, \"hideContent\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}}]}, {\"type\": \"tableCell\", \"attrs\": {\"colspan\": 1, \"rowspan\": 1, \"colwidth\": [196], \"textColor\": \"#171717\", \"background\": \"#DCFCE7\", \"hideContent\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Or color columns different\", \"type\": \"text\"}]}]}, {\"type\": \"tableCell\", \"attrs\": {\"colspan\": 1, \"rowspan\": 1, \"colwidth\": [285], \"textColor\": null, \"background\": null, \"hideContent\": false}, \"content\": [{\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}}]}]}]}, {\"type\": \"heading\", \"attrs\": {\"level\": 3, \"textAlign\": null}, \"content\": [{\"text\": \"Let's upload an image and make this line a heading 3.\", \"type\": \"text\"}]}, {\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}}, {\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Yep. Genius.\", \"type\": \"text\"}]}, {\"type\": \"horizontalRule\"}, {\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Life is already great with Plane. but it gets a little better with Pages, right?\", \"type\": \"text\"}]}, {\"type\": \"paragraph\", \"attrs\": {\"textAlign\": null}, \"content\": [{\"text\": \"Give it a spin, tell us we were right... Or wrong. We will work to make Pages work for you.\", \"type\": \"text\"}]}]}", + "type": "PROJECT" + } +] \ No newline at end of file