From 155fa7bb24ddfe89a34b25581e5e74a9d1ed2e16 Mon Sep 17 00:00:00 2001 From: Cindy Qi Li Date: Tue, 17 Jan 2017 10:58:29 -0500 Subject: [PATCH 1/2] GPII-2228: Added an example to demonstrate GPII customizations. --- examples/gpii-driver/README.md | 7 +++++++ examples/gpii-driver/app.js | 30 ++++++++++++++++++++++++++++++ examples/gpii-driver/app.json | 15 +++++++++++++++ examples/gpii-driver/driver.js | 26 ++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 examples/gpii-driver/README.md create mode 100644 examples/gpii-driver/app.js create mode 100644 examples/gpii-driver/app.json create mode 100644 examples/gpii-driver/driver.js diff --git a/examples/gpii-driver/README.md b/examples/gpii-driver/README.md new file mode 100644 index 000000000..7deeb05a8 --- /dev/null +++ b/examples/gpii-driver/README.md @@ -0,0 +1,7 @@ +This directory contains an example that provides customisations to the GPII by means of the "driver" pattern. + +This example demonstrates how to inject a component named `gpii.app` as a subcomponent of the GPII flow manager. To start the customized GPII, simply type: + + node deiver.js + +from this directory. The logging information output by `gpii.app` will appear on the GPII console. diff --git a/examples/gpii-driver/app.js b/examples/gpii-driver/app.js new file mode 100644 index 000000000..38f51228e --- /dev/null +++ b/examples/gpii-driver/app.js @@ -0,0 +1,30 @@ +/* + * Copyright 2017 OCAD University + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ + +"use strict"; + +var fluid = require("infusion"); + +fluid.defaults("gpii.app", { + gradeNames: ["fluid.component"], + components: { + appImpl: { + type: "fluid.component", + options: { + listeners: { + "onCreate.log": { + listener: "console.log", + args: ["!!! The app component has been created!"] + } + } + } + } + } +}); diff --git a/examples/gpii-driver/app.json b/examples/gpii-driver/app.json new file mode 100644 index 000000000..9fd65d790 --- /dev/null +++ b/examples/gpii-driver/app.json @@ -0,0 +1,15 @@ +{ + "type": "gpii.appDemo", + "options": { + "gradeNames": ["fluid.component"], + "distributeOptions": { + "distributeApp": { + "record": "gpii.app", + "target": "{that flowManager}.options.gradeNames" + } + } + }, + "mergeConfigs": [ + "../../gpii/configs/gpii.config.cloudBased.development.all.local.json" + ] +} diff --git a/examples/gpii-driver/driver.js b/examples/gpii-driver/driver.js new file mode 100644 index 000000000..b4f1fa15c --- /dev/null +++ b/examples/gpii-driver/driver.js @@ -0,0 +1,26 @@ +/*! + * Driver file to demonstrate GPII customisations + * + * Copyright 2012 OCAD University + * Copyright 2017 OCAD University + * + * Licensed under the New BSD license. You may not use this file except in + * compliance with this License. + * + * You may obtain a copy of the License at + * https://github.com/GPII/universal/blob/master/LICENSE.txt + */ + +"use strict"; + +var fluid = require("infusion"), + kettle = fluid.registerNamespace("kettle"); + +require("kettle"); +require("../../index.js"); +require("./app.js"); + +kettle.config.loadConfig({ + configName: kettle.config.getConfigName("app"), + configPath: __dirname +}); From 2a97ff752e7b2ccb0db967a4543024f4d7cfc695 Mon Sep 17 00:00:00 2001 From: Cindy Qi Li Date: Thu, 19 Jan 2017 11:16:24 -0500 Subject: [PATCH 2/2] GPII-2228: Fixed a typo. --- examples/gpii-driver/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gpii-driver/README.md b/examples/gpii-driver/README.md index 7deeb05a8..bdac05593 100644 --- a/examples/gpii-driver/README.md +++ b/examples/gpii-driver/README.md @@ -2,6 +2,6 @@ This directory contains an example that provides customisations to the GPII by m This example demonstrates how to inject a component named `gpii.app` as a subcomponent of the GPII flow manager. To start the customized GPII, simply type: - node deiver.js + node driver.js from this directory. The logging information output by `gpii.app` will appear on the GPII console.