[CORD-772] Example UI Extension update for platform install
Change-Id: I673869b28401d9c5321320ed2b69a282578d0e9f
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..de807ff
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,3 @@
+node_modules
+typings
+npm-debug.log
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b947077
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+node_modules/
+dist/
diff --git a/Dockerfile b/Dockerfile
old mode 100755
new mode 100644
index 36cfca2..b8a636c
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,21 +1,10 @@
-# To build use: docker build -t xosproject/xos-sample-gui-extension .
-# To run use: docker run -p 4001:4000 -d xosproject/xos-sample-gui-extension
-
-FROM nginx
+FROM xosproject/xos-gui-extension-builder
# Set environment vars
ENV CODE_SOURCE .
ENV CODE_DEST /var/www
ENV VHOST /var/www/dist
-# Install nodeJs
-RUN apt-get update
-RUN apt-get install curl git bzip2 -y
-RUN curl -sL https://deb.nodesource.com/setup_4.x > install_node.sh
-RUN chmod a+x install_node.sh
-RUN ./install_node.sh
-RUN apt-get install -y nodejs
-
# Add the app deps
COPY ${CODE_SOURCE}/package.json ${CODE_DEST}/package.json
COPY ${CODE_SOURCE}/typings.json ${CODE_DEST}/typings.json
@@ -25,11 +14,7 @@
RUN npm install
RUN npm run typings
-# Create folder for logs
-RUN mkdir -p /var/log/nginx/log
-
# Build the app
-EXPOSE 4000
COPY ${CODE_SOURCE}/conf ${CODE_DEST}/conf
COPY ${CODE_SOURCE}/gulp_tasks ${CODE_DEST}/gulp_tasks
COPY ${CODE_SOURCE}/src ${CODE_DEST}/src
@@ -37,7 +22,3 @@
COPY ${CODE_SOURCE}/tsconfig.json ${CODE_DEST}/tsconfig.json
COPY ${CODE_SOURCE}/tslint.json ${CODE_DEST}/tslint.json
RUN npm run build
-
-# Override nginx configutaion
-COPY ${CODE_SOURCE}/nginx.conf ${CODE_DEST}/nginx.conf
-RUN mv ${CODE_SOURCE}/nginx.conf /etc/nginx/conf.d/default.conf
diff --git a/Makefile b/Makefile
deleted file mode 100644
index d90c9a4..0000000
--- a/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-CONTAINER_NAME = xos-sample-gui-extension
-CONTAINER_IMAGE_NAME = xosproject/$(CONTAINER_NAME)
-REDIS_HOST = xos.dev
-
-run_container: build_container
- docker run -p 4001:4000 --name $(CONTAINER_NAME) -d $(CONTAINER_IMAGE_NAME)
-
-build_container:
- docker build -t $(CONTAINER_IMAGE_NAME) .
-
-onboard:
- redis-cli -h $(REDIS_HOST) PUBLISH XOSComponent ''
-
-#onboard:
-# redis-cli -h $(REDIS_HOST) PUBLISH Onboard '{"app": "$(CONTAINER_NAME)", "files": ["http://xos.dev:4001/spa/vendor.js", "http://xos.dev:4001/spa/app.js"]}'
-rm:
- docker stop $(CONTAINER_NAME)
- docker rm $(CONTAINER_NAME)
-
-rmi:
- docker rmi $(CONTAINER_IMAGE_NAME)
-
-enter:
- docker exec -it $(CONTAINER_NAME) bash
diff --git a/README.md b/README.md
index 2f21a2b..6bcfa0f 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,20 @@
# xos-sample-gui-extension
-## Demo
-
-To run this demo we suggest to setup `xos` using the `Vagrant` VM provided in the `fronted` configuration, but it is enabled for all the configuration.
-
-### Setup the extension container
-
-From any `service-profile` folder execute: `make xos_gui_sample_extension_c`
-
-> This command will build the container image (It is automatically triggered by the next command).
-
-### Onboard the GUI extension
-
-From any `service-profile` folder execute: `make ui-sample-extension`
-
## TODO:
-- [ ] Provide a dev environment
\ No newline at end of file
+- [ ] Provide a dev environment
+
+## Platform install integration
+
+Having a profile deployed is required. To add extensions listed in your `profile-manifest` as:
+
+```
+enabled_gui_extensions:
+ - name: sample
+ path: orchestration/xos-sample-gui-extension
+```
+
+_NOTE: the `name` field must match the subdirectory specified in `conf/app/gulp.conf.js` (eg: `dist/extensions/sample`)_
+
+Execute: `ansible-playbook -i inventory/mock-rcord deploy-xos-gui-extensions-playbook.yml`
+_NOTE: remember to replate `inventory/**` with the actual `cord_profile` you are using_
\ No newline at end of file
diff --git a/conf/gulp.conf.js b/conf/gulp.conf.js
index 730290d..a8d0964 100755
--- a/conf/gulp.conf.js
+++ b/conf/gulp.conf.js
@@ -18,7 +18,7 @@
*/
exports.paths = {
src: 'src',
- dist: 'dist',
+ dist: 'dist/extensions/sample', // NOTE that 'sample' have to match the extension name provided in platform install
appConfig: 'conf/app',
tmp: '.tmp',
e2e: 'e2e',
diff --git a/gulp_tasks/misc.js b/gulp_tasks/misc.js
index d766d14..d1e70ec 100755
--- a/gulp_tasks/misc.js
+++ b/gulp_tasks/misc.js
@@ -12,7 +12,7 @@
gulp.task('other', other);
function clean() {
- return del([conf.paths.dist, conf.paths.tmp]);
+ return del([`${conf.paths.dist}/*`, conf.paths.tmp]);
}
function other() {
diff --git a/src/index.ts b/src/index.ts
index a8791d7..417424f 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -20,12 +20,12 @@
.run(function(
$log: ng.ILogService,
$state: ng.ui.IStateService,
- NavigationService: any,
+ XosNavigationService: any,
XosComponentInjector: any,
XosKeyboardShortcut: any) {
$log.info('[xos-sample-gui-extension] App is running');
- NavigationService.add({
+ XosNavigationService.add({
label: 'Example Extension',
state: 'xos.xos-sample-gui-extension.example-route',
});
diff --git a/xos-sample-gui-extension.yaml b/xos-sample-gui-extension.yaml
new file mode 100644
index 0000000..2dcb037
--- /dev/null
+++ b/xos-sample-gui-extension.yaml
@@ -0,0 +1,15 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Persiste xos-sample-gui-extension
+
+imports:
+ - custom_types/xos.yaml
+
+topology_template:
+ node_templates:
+
+ # UI Extension
+ xos-sample-gui-extension:
+ type: tosca.nodes.XOSGuiExtension
+ properties:
+ files: /spa/extensions/xos-sample-gui-extension/vendor.js, /spa/extensions/xos-sample-gui-extension/app.js