š„š„š„ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
[WEB-5059] feat: add page creation functionality to workspace seeding process (#7948)
Nikhil151674687cac
diff --git a/apps/api/plane/bgtasks/workspace_seed_task.py b/apps/api/plane/bgtasks/workspace_seed_task.pyindex 848646e5a9..6f342bb2a3 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", "<p></p>"),+ 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_taskdef 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 issuescreate_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")returnexcept Exception as e:diff --git a/apps/api/plane/seeds/data/pages.json b/apps/api/plane/seeds/data/pages.jsonnew file mode 100644index 0000000000..2cffeafe7c--- /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": "<p xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-paragraph-block\">Bye, bye, Notion, Google Docs, Evernote, Keep, and Apple Notes. Plane Pages are here!</p><h2 xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-heading-block\">What is Pages?</h2><p xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-paragraph-block\"><span>Pages is exactly what it sounds like---just an open space for your thoughts, notes, and something more intentful.</span><br /><br /><span>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.</span></p><h2 xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-heading-block\">How to get to Pages</h2><p xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-paragraph-block\"><span>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.</span></p><blockquote xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"editor-paragraph-block\">Like I said \"Easy\"</p></blockquote><h3 xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-heading-block\">What can I do with Pages ?</h3><p xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-paragraph-block\">Anything you want to write, you can write on Pages.</p><blockquote xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"editor-paragraph-block\"><strong><span>Want to format something a quote? </span></strong><br /><strong><span>Easy.</span></strong></p></blockquote><ul xmlns=\"http://www.w3.org/1999/xhtml\" class=\"not-prose pl-2 space-y-2\" data-type=\"taskList\"><li class=\"flex\" data-checked=\"false\" data-type=\"taskItem\"><label><input type=\"checkbox\" /><span></span></label><div><p class=\"editor-paragraph-block\">How about a to-do list ?</p></div></li><li class=\"flex\" data-checked=\"false\" data-type=\"taskItem\"><label><input type=\"checkbox\" /><span></span></label><div><p class=\"editor-paragraph-block\">How about another Item on the list ? </p></div></li><li class=\"flex\" data-checked=\"false\" data-type=\"taskItem\"><label><input type=\"checkbox\" /><span></span></label><div><p class=\"editor-paragraph-block\">How about I stop being stupid ? </p></div></li></ul><ul xmlns=\"http://www.w3.org/1999/xhtml\" class=\"list-disc pl-7 space-y-[--list-spacing-y]\"><li class=\"not-prose space-y-2\"><p class=\"editor-paragraph-block\">Bullets ? Yep. </p><ul class=\"list-disc pl-7 space-y-[--list-spacing-y]\"><li class=\"not-prose space-y-2\"><p class=\"editor-paragraph-block\">Netsted bullets ? We got you. </p><ul class=\"list-disc pl-7 space-y-[--list-spacing-y]\"><li class=\"not-prose space-y-2\"><p class=\"editor-paragraph-block\">Even more nesting in bullets? Sure.</p></li></ul></li></ul></li><li class=\"not-prose space-y-2\"><p class=\"editor-paragraph-block\">And Tab or Shift + Tab work, too.</p></li></ul><p xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-paragraph-block\"></p><ol xmlns=\"http://www.w3.org/1999/xhtml\" class=\"list-decimal pl-7 space-y-[--list-spacing-y]\"><li class=\"not-prose space-y-2\"><p class=\"editor-paragraph-block\"><span>Ah, yes, thereās numbered lists, too. </span></p></li><li class=\"not-prose space-y-2\"><p class=\"editor-paragraph-block\"><span>And they align nicely so you donāt have to battle with the screen.</span></p></li></ol><pre xmlns=\"http://www.w3.org/1999/xhtml\"><code>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.</code></pre><table xmlns=\"http://www.w3.org/1999/xhtml\"><tbody><tr background=\"#D9E4FF\" textcolor=\"#171717\" style=\"background-color: #D9E4FF; color: #171717;\"><td colspan=\"1\" rowspan=\"1\" colwidth=\"238\" hidecontent=\"false\" class=\"\" style=\"\"><p class=\"editor-paragraph-block\">There is a table too</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"196\" background=\"#DCFCE7\" textcolor=\"#171717\" hidecontent=\"false\" class=\"\" style=\"background-color: #DCFCE7; color: #171717;\"><p class=\"editor-paragraph-block\"></p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"285\" hidecontent=\"false\" class=\"\" style=\"\"><p class=\"editor-paragraph-block\"></p></td></tr><tr background=\"#FEF3C7\" textcolor=\"#171717\" style=\"background-color: #FEF3C7; color: #171717;\"><td colspan=\"1\" rowspan=\"1\" colwidth=\"238\" hidecontent=\"false\" class=\"\" style=\"\"><p class=\"editor-paragraph-block\">You can also color rows<br />different from columns</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"196\" background=\"#DCFCE7\" textcolor=\"#171717\" hidecontent=\"false\" class=\"\" style=\"background-color: #DCFCE7; color: #171717;\"><p class=\"editor-paragraph-block\"></p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"285\" hidecontent=\"false\" class=\"\" style=\"\"><p class=\"editor-paragraph-block\"></p></td></tr><tr style=\"\"><td colspan=\"1\" rowspan=\"1\" colwidth=\"238\" hidecontent=\"false\" class=\"\" style=\"\"><p class=\"editor-paragraph-block\"></p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"196\" background=\"#DCFCE7\" textcolor=\"#171717\" hidecontent=\"false\" class=\"\" style=\"background-color: #DCFCE7; color: #171717;\"><p class=\"editor-paragraph-block\">Or color columns different</p></td><td colspan=\"1\" rowspan=\"1\" colwidth=\"285\" hidecontent=\"false\" class=\"\" style=\"\"><p class=\"editor-paragraph-block\"></p></td></tr></tbody></table><h3 xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-heading-block\">Let's upload an image and make this line a heading 3.</h3><p xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-paragraph-block\"></p><p xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-paragraph-block\">Yep. Genius.</p><div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"py-4 border-custom-border-400\" data-type=\"horizontalRule\"><div></div></div><p xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-paragraph-block\">Life is already great with Plane. but it gets a little better with Pages, right?</p><p xmlns=\"http://www.w3.org/1999/xhtml\" class=\"editor-paragraph-block\">Give it a spin, tell us we were right... Or wrong. We will work to make Pages work for you.</p>",+ "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