forked from saleor/saleor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request saleor#8959 from saleor/add-new-app-extensions
Add new type of App's extensions' targets
- Loading branch information
Showing
24 changed files
with
487 additions
and
419 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,37 @@ | ||
{ | ||
"id": "saleor.app.sample", | ||
"version": "1.0.0", | ||
"name": "My Wonderful App", | ||
"about": "My Wonderful App is a wonderful App for Saleor.", | ||
"permissions": ["MANAGE_USERS", "MANAGE_STAFF"], | ||
"appUrl": "http://localhost:3000/app", | ||
"configurationUrl": "htpp://localhost:3000/configuration", | ||
"tokenTargetUrl": "http://localhost:3000/register", | ||
"dataPrivacy": "Lorem ipsum", | ||
"dataPrivacyUrl": "http://localhost:3000/app-data-privacy", | ||
"homepageUrl": "http://localhost:3000/homepage", | ||
"supportUrl": "http://localhost:3000/support" | ||
"name": "Saleor App", | ||
"version": "1.0.0", | ||
"about": "", | ||
"dataPrivacy": "", | ||
"dataPrivacyUrl": "", | ||
"homepageUrl": "https://example.com/homepage", | ||
"supportUrl": "https://example.com/support", | ||
"id": "sample-app", | ||
"permissions": [ | ||
"MANAGE_PRODUCTS", | ||
"MANAGE_ORDERS" | ||
], | ||
"appUrl": "https://example.com/app", | ||
"extensions": [ | ||
{ | ||
"label": "Create with Sample app", | ||
"mount": "PRODUCT_OVERVIEW_CREATE", | ||
"target": "POPUP", | ||
"permissions": [ | ||
"MANAGE_PRODUCTS" | ||
], | ||
"url": "https://example.com/extension/" | ||
}, | ||
{ | ||
"label": "Create with App and redirect", | ||
"mount": "PRODUCT_OVERVIEW_MORE_ACTIONS", | ||
"target": "APP_PAGE", | ||
"permissions": [ | ||
"MANAGE_PRODUCTS" | ||
], | ||
"url": "/extension/redirect" | ||
} | ||
], | ||
"configurationUrl": "https://example.com/configuration/", | ||
"tokenTargetUrl": "https://example.com/configuration/install" | ||
} |
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
49 changes: 49 additions & 0 deletions
49
saleor/app/migrations/0006_convert_extension_enums_into_one.py
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,49 @@ | ||
# Generated by Django 3.2.6 on 2022-01-27 08:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def migrate_enum_values_to_single_enum(apps, schema_editor): | ||
AppExtension = apps.get_model("app", "AppExtension") | ||
app_extensions = AppExtension.objects.all() | ||
for extension in app_extensions: | ||
if extension.type == "overview": | ||
if extension.target == "more_actions": | ||
extension.mount = "product_overview_more_actions" | ||
else: | ||
extension.mount = "product_overview_create" | ||
else: | ||
extension.mount = "product_details_more_actions" | ||
# simple save as there aren't a lot of app extensions. | ||
extension.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("app", "0005_appextension"), | ||
] | ||
operations = [ | ||
migrations.AddField( | ||
model_name="appextension", | ||
name="mount", | ||
field=models.CharField( | ||
choices=[ | ||
("product_overview_create", "product_overview_create"), | ||
("product_overview_more_actions", "product_overview_more_actions"), | ||
("product_details_more_actions", "product_details_more_actions"), | ||
("navigation_catalog", "navigation_catalog"), | ||
("navigation_orders", "navigation_orders"), | ||
("navigation_customers", "navigation_customers"), | ||
("navigation_discounts", "navigation_discounts"), | ||
("navigation_translations", "navigation_translations"), | ||
("navigation_pages", "navigation_pages"), | ||
], | ||
max_length=256, | ||
null=True, | ||
), | ||
), | ||
migrations.RunPython( | ||
migrate_enum_values_to_single_enum, migrations.RunPython.noop | ||
), | ||
] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,22 @@ | ||
# Generated by Django 3.2.6 on 2022-01-27 09:42 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("app", "0007_auto_20220127_0942"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="appextension", | ||
name="target", | ||
field=models.CharField( | ||
choices=[("popup", "popup"), ("app_page", "app_page")], | ||
default="popup", | ||
max_length=128, | ||
), | ||
), | ||
] |
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
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
Oops, something went wrong.