You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by tb...@apache.org on 2018/11/09 13:26:42 UTC
[1/4] brooklyn-ui git commit: Configure various catalog properties
based on current blueprint
Repository: brooklyn-ui
Updated Branches:
refs/heads/master e226b481d -> d403a918f
Configure various catalog properties based on current blueprint
Signed-off-by: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/474de9e2
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/474de9e2
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/474de9e2
Branch: refs/heads/master
Commit: 474de9e24478a971d2d6a757dd4fd54e8e63eb74
Parents: e226b48
Author: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Authored: Wed Oct 24 14:51:44 2018 +0100
Committer: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Committed: Fri Nov 9 09:51:01 2018 +0000
----------------------------------------------------------------------
.../catalog-saver/catalog-saver.directive.js | 47 +++++++++++++++++---
1 file changed, 41 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/474de9e2/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
index bdfaa67..5437065 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
+++ b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
@@ -60,12 +60,47 @@ export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, co
link: link
};
- function link($scope, $element) {
+ function link($scope, $element, $compile, controller) {
$scope.buttonText = $scope.config.label || ($scope.config.itemType ? `Update ${$scope.config.name || $scope.config.symbolicName}` : 'Add to catalog');
$scope.activateModal = () => {
- // Override callback to update catalog configuration data in other applications
- $scope.config = (composerOverrides.updateCatalogConfig || (($scope, $element) => $scope.config))($scope, $element);
+ function injectorGet(reference) { return $element.injector().get(reference); }
+ function blueprintService() { return injectorGet('blueprintService'); }
+
+ let entity = blueprintService().get();
+ let config = controller.saveToCatalogConfig;
+
+ // Reset the config values if this is not an update
+ if (!$scope.isUpdate) {
+ config = {
+ itemType: 'entity',
+ };
+ }
+
+ // Set various properties from the blueprint entity data
+ if (!config.version && entity.hasVersion()) {
+ config.version = entity.version;
+ }
+ if (!config.iconUrl && entity.hasIcon()) {
+ config.iconUrl = entity.icon;
+ }
+ if (!config.name && entity.hasName()) {
+ config.name = entity.name;
+ }
+ if (!config.symbolicName && entity.hasId()) {
+ config.symbolicName = entity.id;
+ }
+ if (!config.bundle) {
+ let bundle = config.symbolicName || config.name;
+ bundle = bundle.split(/[^-a-zA-Z0-9.,_]+/).join('-').toLowerCase();
+ config.bundle = bundle;
+ if (!config.symbolicName) {
+ config.symbolicName = bundle;
+ }
+ }
+
+ // Override this callback to update configuration data elsewhere
+ (composerOverrides.updateCatalogConfig || ((config, $element, controller) => { }))(config, $element, controller);
let modalInstance = $uibModal.open({
templateUrl: TEMPLATE_MODAL_URL,
@@ -82,6 +117,7 @@ export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, co
break;
case REASONS.deploy:
$rootScope.$broadcast('blueprint.deploy');
+ $scope.isUpdate = true;
break;
}
});
@@ -98,15 +134,14 @@ export function CatalogItemModalController($scope, blueprintService, paletteApi,
view: VIEWS.form,
saving: false,
force: false,
- isUpdate: Object.keys($scope.config).length > 0
};
$scope.getTitle = () => {
switch ($scope.state.view) {
case VIEWS.form:
- return $scope.state.isUpdate ? `Update ${$scope.config.name || $scope.config.symbolicName}` : 'Add to catalog';
+ return $scope.isUpdate ? `Update ${$scope.config.name || $scope.config.symbolicName}` : 'Add to catalog';
case VIEWS.saved:
- return `${$scope.config.name || $scope.config.symbolicName} ${$scope.state.isUpdate ? 'updated' : 'saved'}`;
+ return `${$scope.config.name || $scope.config.symbolicName} ${$scope.isUpdate ? 'updated' : 'saved'}`;
}
};
[4/4] brooklyn-ui git commit: This closes #106
Posted by tb...@apache.org.
This closes #106
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/d403a918
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/d403a918
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/d403a918
Branch: refs/heads/master
Commit: d403a918f56df4c224e816d79c374bb17c6d1f03
Parents: e226b48 d96318f
Author: Thomas Bouron <th...@cloudsoftcorp.com>
Authored: Fri Nov 9 13:26:35 2018 +0000
Committer: Thomas Bouron <th...@cloudsoftcorp.com>
Committed: Fri Nov 9 13:26:35 2018 +0000
----------------------------------------------------------------------
.../catalog-saver/catalog-saver.directive.js | 45 +++++++++--
.../catalog-saver.modal.template.html | 83 +++++++++++---------
2 files changed, 82 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
[2/4] brooklyn-ui git commit: Adds optional advanced section to
catalog save modal
Posted by tb...@apache.org.
Adds optional advanced section to catalog save modal
Signed-off-by: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/b6692321
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/b6692321
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/b6692321
Branch: refs/heads/master
Commit: b66923215180412954333957ddd20eb87c427117
Parents: 474de9e
Author: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Authored: Wed Nov 7 13:27:53 2018 +0000
Committer: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Committed: Fri Nov 9 10:23:43 2018 +0000
----------------------------------------------------------------------
.../catalog-saver/catalog-saver.directive.js | 30 +++----
.../catalog-saver.modal.template.html | 83 +++++++++++---------
2 files changed, 60 insertions(+), 53 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/b6692321/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
index 5437065..c1042a9 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
+++ b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
@@ -60,17 +60,19 @@ export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, co
link: link
};
- function link($scope, $element, $compile, controller) {
+ function link($scope, $element) {
$scope.buttonText = $scope.config.label || ($scope.config.itemType ? `Update ${$scope.config.name || $scope.config.symbolicName}` : 'Add to catalog');
$scope.activateModal = () => {
function injectorGet(reference) { return $element.injector().get(reference); }
- function blueprintService() { return injectorGet('blueprintService'); }
+ let blueprintService = injectorGet('blueprintService');
- let entity = blueprintService().get();
- let config = controller.saveToCatalogConfig;
+ let entity = blueprintService.get();
+ let metadata = blueprintService.entityHasMetadata(entity) ? blueprintService.getEntityMetadata(entity) : { };
+ let config = $scope.$parent.$parent.vm.saveToCatalogConfig;
// Reset the config values if this is not an update
+ $scope.isUpdate = Object.keys($scope.config).length > 1;
if (!$scope.isUpdate) {
config = {
itemType: 'entity',
@@ -78,29 +80,28 @@ export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, co
}
// Set various properties from the blueprint entity data
- if (!config.version && entity.hasVersion()) {
- config.version = entity.version;
+ if (!config.version && (entity.hasVersion() || metadata.has('version'))) {
+ config.version = entity.version || metadata.get('version');
}
- if (!config.iconUrl && entity.hasIcon()) {
- config.iconUrl = entity.icon;
+ if (!config.iconUrl && (entity.hasIcon() || metadata.has('iconUrl'))) {
+ config.iconUrl = entity.icon || metadata.get('iconUrl');
}
if (!config.name && entity.hasName()) {
config.name = entity.name;
}
- if (!config.symbolicName && entity.hasId()) {
- config.symbolicName = entity.id;
+ if (!config.symbolicName && (entity.hasId() || metadata.has('id'))) {
+ config.symbolicName = entity.id || metadata.get('id');
}
if (!config.bundle) {
- let bundle = config.symbolicName || config.name;
- bundle = bundle.split(/[^-a-zA-Z0-9.,_]+/).join('-').toLowerCase();
- config.bundle = bundle;
+ let bundle = config.symbolicName || config.name || 'untitled';
+ config.bundle = bundle.split(/[^-a-zA-Z0-9.,_]+/).join('-').toLowerCase();
if (!config.symbolicName) {
config.symbolicName = bundle;
}
}
// Override this callback to update configuration data elsewhere
- (composerOverrides.updateCatalogConfig || ((config, $element, controller) => { }))(config, $element, controller);
+ $scope.config = (composerOverrides.updateCatalogConfig || ((config, $element) => config))(config, $element);
let modalInstance = $uibModal.open({
templateUrl: TEMPLATE_MODAL_URL,
@@ -117,7 +118,6 @@ export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, co
break;
case REASONS.deploy:
$rootScope.$broadcast('blueprint.deploy');
- $scope.isUpdate = true;
break;
}
});
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/b6692321/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
index 39b203a..97a43ce 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
+++ b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
@@ -23,17 +23,17 @@
<div class="modal-body add-to-catalog-modal">
<form ng-show="state.view === VIEWS.form" name="form" novalidate>
- <div class="form-group" ng-class="{'has-error': form.bundle.$invalid}">
- <label class="control-label">Bundle ID</label>
- <div class="input-group">
- <span class="input-group-addon">catalog-bom-</span>
- <input ng-model="config.bundle" ng-disabled="state.saving" class="form-control" placeholder="E.g my-bundle" name="bundle" required ng-pattern="state.pattern" autofocus />
- </div>
- <p class="help-block" ng-show="form.bundle.$invalid">
- <span ng-if="form.bundle.$error.required">You must specify a bundle ID</span>
- <span ng-if="form.bundle.$error.pattern">The bundle ID can contains only letters, numbers as well a the following characters: <code>.</code>, <code>-</code> and <code>_</code></span>
- </p>
+
+ <div class="form-group">
+ <label class="control-label">Blueprint display name</label>
+ <input ng-model="config.name" ng-disabled="state.saving" class="form-control" name="name" type="text" />
</div>
+
+ <div class="form-group">
+ <label class="control-label">Blueprint description</label>
+ <textarea ng-model="config.description" ng-disabled="state.saving" class="form-control" name="description" rows="3"></textarea>
+ </div>
+
<div class="form-group" ng-class="{'has-error': form.version.$invalid}">
<label class="control-label">Version</label>
<div class="input-group">
@@ -51,35 +51,42 @@
<span ng-if="form.version.$error.exist">This version has already been used</span>
</p>
</div>
- <div class="form-group" ng-class="{'has-error': form.symbolicName.$invalid}">
- <label class="control-label">Blueprint symbolic name</label>
- <input ng-model="config.symbolicName" ng-disabled="state.saving" class="form-control" placeholder="E.g my-catalog-id" name="symbolicName" required ng-pattern="state.pattern" autofocus />
- <p class="help-block" ng-show="form.symbolicName.$invalid">
- <span ng-if="form.symbolicName.$error.required">You must specify a blueprint symbolic name</span>
- <span ng-if="form.symbolicName.$error.pattern">The blueprint symbolic name can contains only letters, numbers as well a the following characters: <code>.</code>, <code>-</code> and <code>_</code></span>
- </p>
- </div>
- <div class="form-group" ng-class="{'has-error': form.itemType.$invalid}">
- <label class="control-label">Blueprint type</label>
- <select class="form-control" name="itemType" ng-options="type.id as type.label for type in TYPES" ng-model="config.itemType" ng-disabled="state.saving" required >
- </select>
- <p class="help-block" ng-show="form.itemType.$invalid">
- <span ng-if="form.itemType.$error.required">You must specify a blueprint type</span>
- </p>
- </div>
- <div class="form-group">
- <label class="control-label">Blueprint display name</label>
- <input ng-model="config.name" ng-disabled="state.saving" class="form-control" name="name" type="text" />
- </div>
- <div class="form-group">
- <label class="control-label">Blueprint description</label>
- <textarea ng-model="config.description" ng-disabled="state.saving" class="form-control" name="description" rows="3"></textarea>
- </div>
- <div class="form-group">
- <label class="control-label">Blueprint icon url</label>
- <input ng-model="config.iconUrl" ng-disabled="state.saving" class="form-control" name="iconUrl" type="text" />
- </div>
+ <br-collapsible heading="Advanced">
+ <div class="form-group" ng-class="{'has-error': form.bundle.$invalid}">
+ <label class="control-label">Bundle ID</label>
+ <div class="input-group">
+ <span class="input-group-addon">catalog-bom-</span>
+ <input ng-model="config.bundle" ng-disabled="state.saving" class="form-control" placeholder="E.g my-bundle" name="bundle" required ng-pattern="state.pattern" autofocus />
+ </div>
+ <p class="help-block" ng-show="form.bundle.$invalid">
+ <span ng-if="form.bundle.$error.required">You must specify a bundle ID</span>
+ <span ng-if="form.bundle.$error.pattern">The bundle ID can contains only letters, numbers as well a the following characters: <code>.</code>, <code>-</code> and <code>_</code></span>
+ </p>
+ </div>
+
+ <div class="form-group" ng-class="{'has-error': form.symbolicName.$invalid}">
+ <label class="control-label">Blueprint symbolic name</label>
+ <input ng-model="config.symbolicName" ng-disabled="state.saving" class="form-control" placeholder="E.g my-catalog-id" name="symbolicName" required ng-pattern="state.pattern" autofocus />
+ <p class="help-block" ng-show="form.symbolicName.$invalid">
+ <span ng-if="form.symbolicName.$error.required">You must specify a blueprint symbolic name</span>
+ <span ng-if="form.symbolicName.$error.pattern">The blueprint symbolic name can contains only letters, numbers as well a the following characters: <code>.</code>, <code>-</code> and <code>_</code></span>
+ </p>
+ </div>
+
+ <div class="form-group" ng-class="{'has-error': form.itemType.$invalid}">
+ <label class="control-label">Blueprint type</label>
+ <select class="form-control" name="itemType" ng-options="type.id as type.label for type in TYPES" ng-model="config.itemType" ng-disabled="state.saving" required >
+ </select>
+ <p class="help-block" ng-show="form.itemType.$invalid">
+ <span ng-if="form.itemType.$error.required">You must specify a blueprint type</span>
+ </p>
+ </div>
+ <div class="form-group">
+ <label class="control-label">Blueprint icon url</label>
+ <input ng-model="config.iconUrl" ng-disabled="state.saving" class="form-control" name="iconUrl" type="text" />
+ </div>
+ </br-collapsible>
</form>
<div class="text-center" ng-show="state.view === VIEWS.saved">
[3/4] brooklyn-ui git commit: Update reference to dialog model and
blueprint service
Posted by tb...@apache.org.
Update reference to dialog model and blueprint service
Signed-off-by: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/d96318f9
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/d96318f9
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/d96318f9
Branch: refs/heads/master
Commit: d96318f923075850d951393728a9facc7ef24cd8
Parents: b669232
Author: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Authored: Fri Nov 9 11:48:04 2018 +0000
Committer: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Committed: Fri Nov 9 12:23:29 2018 +0000
----------------------------------------------------------------------
.../catalog-saver/catalog-saver.directive.js | 46 +++++++++-----------
1 file changed, 20 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/d96318f9/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
index c1042a9..be05fff 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
+++ b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
@@ -42,20 +42,20 @@ const TYPES = [
];
angular.module(MODULE_NAME, [angularAnimate, uibModal, brUtils])
- .directive('catalogSaver', ['$rootScope', '$uibModal', '$injector', 'composerOverrides', saveToCatalogModalDirective])
+ .directive('catalogSaver', ['$rootScope', '$uibModal', '$injector', 'composerOverrides', 'blueprintService', saveToCatalogModalDirective])
.directive('catalogVersion', ['$parse', catalogVersionDirective])
.run(['$templateCache', templateCache]);
export default MODULE_NAME;
-export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, composerOverrides) {
+export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, composerOverrides, blueprintService) {
return {
restrict: 'E',
templateUrl: function (tElement, tAttrs) {
return tAttrs.templateUrl || TEMPLATE_URL;
},
scope: {
- config: '='
+ config: '=',
},
link: link
};
@@ -64,44 +64,38 @@ export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, co
$scope.buttonText = $scope.config.label || ($scope.config.itemType ? `Update ${$scope.config.name || $scope.config.symbolicName}` : 'Add to catalog');
$scope.activateModal = () => {
- function injectorGet(reference) { return $element.injector().get(reference); }
- let blueprintService = injectorGet('blueprintService');
-
let entity = blueprintService.get();
- let metadata = blueprintService.entityHasMetadata(entity) ? blueprintService.getEntityMetadata(entity) : { };
- let config = $scope.$parent.$parent.vm.saveToCatalogConfig;
+ let metadata = blueprintService.entityHasMetadata(entity) ? blueprintService.getEntityMetadata(entity) : new Map();
// Reset the config values if this is not an update
- $scope.isUpdate = Object.keys($scope.config).length > 1;
+ $scope.isUpdate = Object.keys($scope.config).length > ($scope.config.label ? 1 : 0);
if (!$scope.isUpdate) {
- config = {
- itemType: 'entity',
- };
+ $scope.config.itemType = 'template';
}
// Set various properties from the blueprint entity data
- if (!config.version && (entity.hasVersion() || metadata.has('version'))) {
- config.version = entity.version || metadata.get('version');
+ if (!$scope.config.version && (entity.hasVersion() || metadata.has('version'))) {
+ $scope.config.version = entity.version || metadata.get('version');
}
- if (!config.iconUrl && (entity.hasIcon() || metadata.has('iconUrl'))) {
- config.iconUrl = entity.icon || metadata.get('iconUrl');
+ if (!$scope.config.iconUrl && (entity.hasIcon() || metadata.has('iconUrl'))) {
+ $scope.config.iconUrl = entity.icon || metadata.get('iconUrl');
}
- if (!config.name && entity.hasName()) {
- config.name = entity.name;
+ if (!$scope.config.name && entity.hasName()) {
+ $scope.config.name = entity.name;
}
- if (!config.symbolicName && (entity.hasId() || metadata.has('id'))) {
- config.symbolicName = entity.id || metadata.get('id');
+ if (!$scope.config.symbolicName && (entity.hasId() || metadata.has('id'))) {
+ $scope.config.symbolicName = entity.id || metadata.get('id');
}
- if (!config.bundle) {
- let bundle = config.symbolicName || config.name || 'untitled';
- config.bundle = bundle.split(/[^-a-zA-Z0-9.,_]+/).join('-').toLowerCase();
- if (!config.symbolicName) {
- config.symbolicName = bundle;
+ if (!$scope.config.bundle) {
+ let bundle = $scope.config.symbolicName || $scope.config.name || 'untitled';
+ $scope.config.bundle = bundle.split(/[^-a-zA-Z0-9._]+/).join('-').toLowerCase();
+ if (!$scope.config.symbolicName) {
+ $scope.config.symbolicName = $scope.config.bundle;
}
}
// Override this callback to update configuration data elsewhere
- $scope.config = (composerOverrides.updateCatalogConfig || ((config, $element) => config))(config, $element);
+ $scope.config = (composerOverrides.updateCatalogConfig || ((config, $element) => config))($scope.config, $element);
let modalInstance = $uibModal.open({
templateUrl: TEMPLATE_MODAL_URL,