This is an automated email from the ASF dual-hosted git repository.
iuliana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git
The following commit(s) were added to refs/heads/master by this push:
new 582323f fix isYamlMode bug and placeholder for auto-detecting yaml
state
new 2da093e Merge pull request #187 from ahgittin/yaml-modes
582323f is described below
commit 582323f7ed5187115ffe9ed10838d1ca3e5ea539
Author: Alex Heneveld <[email protected]>
AuthorDate: Wed Feb 3 12:58:00 2021 +0000
fix isYamlMode bug and placeholder for auto-detecting yaml state
---
ui-modules/blueprint-composer/app/index.js | 7 ++++---
.../blueprint-composer/app/views/main/main.controller.js | 7 +++++--
.../blueprint-composer/app/views/main/yaml/yaml.state.js | 14 +++++++++++++-
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/ui-modules/blueprint-composer/app/index.js
b/ui-modules/blueprint-composer/app/index.js
index 1482fab..5afb6b8 100755
--- a/ui-modules/blueprint-composer/app/index.js
+++ b/ui-modules/blueprint-composer/app/index.js
@@ -58,7 +58,7 @@ import paletteDragAndDropService from
"./components/providers/palette-dragndrop.
import actionService from "./components/providers/action-service.provider";
import tabService from "./components/providers/tab-service.provider";
import {mainState} from "./views/main/main.controller";
-import {yamlState} from "./views/main/yaml/yaml.state";
+import {yamlAutodetectState, yamlCampState, yamlState} from
"./views/main/yaml/yaml.state";
import {graphicalState} from "./views/main/graphical/graphical.state";
import {graphicalEditState} from "./views/main/graphical/edit/edit.controller";
import {graphicalEditAddState} from "./views/main/graphical/edit/add/add";
@@ -98,7 +98,8 @@ function applicationConfig($urlRouterProvider,
$stateProvider, $logProvider, $co
.otherwise(graphicalState.url);
$stateProvider
.state(mainState)
- .state(yamlState)
+ .state(yamlAutodetectState)
+ .state(yamlCampState)
.state(graphicalState)
.state(graphicalEditAddState)
.state(graphicalEditState)
@@ -163,7 +164,7 @@ function paletteConfig(paletteServiceProvider) {
function errorHandler($rootScope, $state, brSnackbar) {
$rootScope.$on('$stateChangeError', (event, toState, toParams, fromState,
fromParams, error) => {
brSnackbar.create(error.detail);
- if (toState === yamlState) {
+ if (toState && toState.name &&
toState.name.startsWith(yamlAutodetectState.name)) {
$state.go(toState);
} else {
$state.go(graphicalState);
diff --git a/ui-modules/blueprint-composer/app/views/main/main.controller.js
b/ui-modules/blueprint-composer/app/views/main/main.controller.js
index 517b081..7e08c30 100644
--- a/ui-modules/blueprint-composer/app/views/main/main.controller.js
+++ b/ui-modules/blueprint-composer/app/views/main/main.controller.js
@@ -20,7 +20,7 @@ import {HIDE_INTERSTITIAL_SPINNER_EVENT} from
'brooklyn-ui-utils/interstitial-sp
import template from './main.template.html';
import {EntityFamily} from '../../components/util/model/entity.model';
import {graphicalState} from './graphical/graphical.state';
-import {yamlState} from './yaml/yaml.state';
+import {yamlAutodetectState} from './yaml/yaml.state';
import {graphicalEditEntityState} from
'./graphical/edit/entity/edit.entity.controller';
import {graphicalEditPolicyState} from
'./graphical/edit/policy/edit.policy.controller';
import {graphicalEditEnricherState} from
'./graphical/edit/enricher/edit.enricher.controller';
@@ -97,7 +97,7 @@ export function MainController($scope, $element, $log,
$state, $stateParams, brB
$scope.$on('blueprint.reset', () => {
vm.saveToCatalogConfig = {};
blueprintService.reset();
- $state.go($state.includes(yamlState) ? yamlState : graphicalState, {},
{inherit: false, reload: true});
+ $state.go(vm.isYamlMode() ? $state : graphicalState, {}, {inherit:
false, reload: true});
});
$scope.$on('blueprint.deploy', () => {
vm.deployApplication();
@@ -135,6 +135,9 @@ export function MainController($scope, $element, $log,
$state, $stateParams, brB
vm.isTabActive = stateKey => {
return $state.is(stateKey);
}
+ vm.isYamlMode = () => {
+ return $state.includes(yamlAutodetectState.name);
+ }
if (yaml) {
if (vm.isYamlMode()) {
diff --git a/ui-modules/blueprint-composer/app/views/main/yaml/yaml.state.js
b/ui-modules/blueprint-composer/app/views/main/yaml/yaml.state.js
index f9390ae..d1b3a25 100644
--- a/ui-modules/blueprint-composer/app/views/main/yaml/yaml.state.js
+++ b/ui-modules/blueprint-composer/app/views/main/yaml/yaml.state.js
@@ -19,7 +19,9 @@
import CodeMirror from 'codemirror';
import {YAMLException} from 'js-yaml';
-export const yamlState = {
+
+export const yamlAutodetectState = {
+ // TODO make this do auto-detect
name: 'main.yaml',
url: 'yaml',
template: '<br-yaml-editor value="vm.yaml"
type="blueprint"></br-yaml-editor>',
@@ -28,6 +30,16 @@ export const yamlState = {
data: {
label: 'YAML Editor'
}
+}
+export const yamlCampState = {
+ name: 'main.yaml.camp',
+ url: 'camp',
+ template: '<br-yaml-editor value="vm.yaml"
type="blueprint"></br-yaml-editor>',
+ controller: ['$scope', '$rootScope', '$timeout', 'blueprintService',
'brSnackbar', yamlStateController],
+ controllerAs: 'vm',
+ data: {
+ label: 'YAML Editor'
+ }
};
function yamlStateController($scope, $rootScope, $timeout, blueprintService,
brSnackbar) {