diff --git a/www/api/data/components/component-remote/actions/syncRemoteComponent.js b/www/api/data/components/component-remote/actions/syncRemoteComponent.js
new file mode 100644
index 0000000..5bd8488
--- /dev/null
+++ b/www/api/data/components/component-remote/actions/syncRemoteComponent.js
@@ -0,0 +1,36 @@
+function(remote) {
+ let original = {
+ "url" : simplyRawApi.url,
+ "headers" : simplyRawApi.headers
+ };
+ simplyRawApi.url = remote.url;
+ simplyRawApi.headers = {
+ "accept" : "application/json"
+ };
+ let fetchFunctions = {
+ "base-component" : simplyDataApi.getBaseComponent,
+ "component" : simplyDataApi.getComponent,
+ "page" : simplyDataApi.getPage,
+ "page-frame" : simplyDataApi.getPageFrame
+ };
+
+ fetchFunctions[remote.type](remote.component)
+ .then(function(parts) {
+ parts.forEach(function(part) {
+ if (part.id == "meta") {
+ return;
+ }
+ editor.pageData.component.parts[part.id] = JSON.parse(part.contents);
+ });
+ })
+ .then(function() {
+ for (i in original) {
+ simplyRawApi[i] = original[i];
+ }
+ })
+ .catch(function() {
+ for (i in original) {
+ simplyRawApi[i] = original[i];
+ }
+ });
+}
\ No newline at end of file
diff --git a/www/api/data/components/component-remote/commands/syncRemoteComponent.js b/www/api/data/components/component-remote/commands/syncRemoteComponent.js
new file mode 100644
index 0000000..2709058
--- /dev/null
+++ b/www/api/data/components/component-remote/commands/syncRemoteComponent.js
@@ -0,0 +1,3 @@
+function(el) {
+ return simplyApp.actions.syncRemoteComponent(editor.pageData.component.remote);
+}
\ No newline at end of file
diff --git a/www/api/data/components/component-remote/componentTemplates/componentRemote.html b/www/api/data/components/component-remote/componentTemplates/componentRemote.html
new file mode 100644
index 0000000..903bc39
--- /dev/null
+++ b/www/api/data/components/component-remote/componentTemplates/componentRemote.html
@@ -0,0 +1,14 @@
+
+
+ Remote API URL
+
+
+
+
+
+
\ No newline at end of file
diff --git a/www/api/data/components/component-remote/meta.json b/www/api/data/components/component-remote/meta.json
new file mode 100644
index 0000000..6840e1a
--- /dev/null
+++ b/www/api/data/components/component-remote/meta.json
@@ -0,0 +1 @@
+{"id":"component-remote","description":"","remoteURL":"","remote":{"url":"","type":"base-component","component":""}}
\ No newline at end of file
diff --git a/www/api/data/generated.html b/www/api/data/generated.html
index 793fe33..982d80a 100644
--- a/www/api/data/generated.html
+++ b/www/api/data/generated.html
@@ -1256,6 +1256,42 @@
return 'name';
}
},
+ "syncRemoteComponent" : function(remote) {
+ let original = {
+ "url" : simplyRawApi.url,
+ "headers" : simplyRawApi.headers
+ };
+ simplyRawApi.url = remote.url;
+ simplyRawApi.headers = {
+ "accept" : "application/json"
+ };
+ let fetchFunctions = {
+ "base-component" : simplyDataApi.getBaseComponent,
+ "component" : simplyDataApi.getComponent,
+ "page" : simplyDataApi.getPage,
+ "page-frame" : simplyDataApi.getPageFrame
+ };
+
+ fetchFunctions[remote.type](remote.component)
+ .then(function(parts) {
+ parts.forEach(function(part) {
+ if (part.id == "meta") {
+ return;
+ }
+ editor.pageData.component.parts[part.id] = JSON.parse(part.contents);
+ });
+ })
+ .then(function() {
+ for (i in original) {
+ simplyRawApi[i] = original[i];
+ }
+ })
+ .catch(function() {
+ for (i in original) {
+ simplyRawApi[i] = original[i];
+ }
+ });
+ },
"browse" : function(path) {
return simplyDataApi.browse(path)
.catch(function(error) {
@@ -1691,6 +1727,9 @@
"addRawApiMethod" : function(el) {
editor.pageData.component.parts.rawApi.push({});
},
+ "syncRemoteComponent" : function(el) {
+ return simplyApp.actions.syncRemoteComponent(editor.pageData.component.remote);
+ },
"addRoute" : function(el) {
editor.pageData.component.parts.routes.push({});
},
@@ -2959,6 +2998,22 @@
+
+
+
+ Remote API URL
+
+
+
+
+
+
+
@@ -3153,6 +3208,7 @@
Edit base component:
+
@@ -3201,6 +3257,7 @@
Edit component:
+
@@ -3252,6 +3309,7 @@
Edit page:
+
@@ -3272,6 +3330,7 @@
Edit page frame
+
diff --git a/www/api/data/pages/base-component/pageTemplates/Edit base component.html b/www/api/data/pages/base-component/pageTemplates/Edit base component.html
index e201d7b..70884ae 100644
--- a/www/api/data/pages/base-component/pageTemplates/Edit base component.html
+++ b/www/api/data/pages/base-component/pageTemplates/Edit base component.html
@@ -6,6 +6,7 @@