in ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js [130:185]
function link($scope, $element) {
initOurConfig($scope);
$scope.activateModal = () => {
let entity = blueprintService.get();
let metadata = blueprintService.entityHasMetadata(entity) ? blueprintService.getEntityMetadata(entity) : new Map();
initOurConfig($scope);
if (!$scope.config.current.itemType) {
// This is the default item type
$scope.config.current.itemType = $scope.config.local.default.itemType || 'application';
}
// Set various properties from the blueprint entity data if not already set
if (!$scope.config.current.iconUrl && ($scope.config.initial.iconUrl || entity.hasIcon() || metadata.has('iconUrl'))) {
$scope.config.current.iconUrl = $scope.config.initial.iconUrl || entity.icon || metadata.get('iconUrl');
}
if (!$scope.isNewFromTemplate()) {
// (these should only be set if not making something new from a template, as the entity items will refer to the template)
(composerOverrides.updateBundleConfig || updateBundleConfig)(entity,metadata, $scope.config);
}
// Override this callback to update configuration data elsewhere
$scope.config = (composerOverrides.updateCatalogConfig || ((config, $element) => config))($scope.config, $element);
const { bundle, symbolicName } = ($scope.config.initial || {});
// Show advanced tab initially if bundle or symbolic name does not match the naming pattern.
$scope.showAdvanced = (bundle && symbolicName)
? !VALID_FIELD_PATTERN.test(bundle) || !VALID_FIELD_PATTERN.test(symbolicName)
: false;
let modalInstance = $uibModal.open({
templateUrl: TEMPLATE_MODAL_URL,
size: 'save',
controller: ['$scope', '$filter', 'blueprintService', 'paletteApi', 'brUtilsGeneral', CatalogItemModalController],
scope: $scope,
});
// Promise is resolved when the modal is closed. We expect the modal to pass back the action to perform thereafter
modalInstance.result.then(reason => {
switch (reason) {
case REASONS.new:
$rootScope.$broadcast('blueprint.reset');
break;
case REASONS.deploy:
$rootScope.$broadcast('blueprint.deploy');
break;
case REASONS.continue:
$rootScope.$broadcast('blueprint.continue');
break;
}
});
};
}