-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allow parameters to be supplied when creating a service instance and binding to an application * Bug fix * Address PR feedback * Fix for failing unit test * e2e test fix * Address PR feedback * Fix bug when re-editing a parameter
- Loading branch information
1 parent
9d5683a
commit 957e6bd
Showing
17 changed files
with
360 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
// The filters | ||
angular.module('app.framework.filters') | ||
.filter('jsonString', jsonStringFilter); | ||
|
||
/** | ||
* @namespace app.framework.filters.jsonStringFilter | ||
* @memberof app.framework.filters | ||
* @name jsonStringFilter | ||
* @description An angular filter which will format the JSON object as a string OR show a supplied invalid message | ||
* @param {object} $filter - Angular $filter service | ||
* @returns {Function} The filter itself | ||
*/ | ||
function jsonStringFilter($filter) { | ||
var jsonStringFilter = function (obj, invalidMsg) { | ||
|
||
try { | ||
return angular.toJson(obj); | ||
} catch (e) { | ||
return $filter('translate')(invalidMsg) || ''; | ||
} | ||
}; | ||
|
||
// Ensure the filter is reapplied on change of language | ||
jsonStringFilter.$stateful = true; | ||
|
||
return jsonStringFilter; | ||
} | ||
|
||
})(); |
28 changes: 28 additions & 0 deletions
28
components/app-framework/src/utils/auto-focus/focus-when.directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
angular | ||
.module('app.framework.utils') | ||
.directive('focusWhen', focusWhen); | ||
|
||
/** | ||
* A simple attribute directive to set focus on an element when a value is set | ||
* @param {Object} $timeout - the Angular $timeout service | ||
* @returns {Object} the focus-when directive | ||
* */ | ||
function focusWhen($timeout) { | ||
return { | ||
restrict: 'A', | ||
link: function (scope, element, attrs) { | ||
scope.$watch(attrs.focusWhen, function (nv) { | ||
if (nv) { | ||
$timeout(function () { | ||
element[0].focus(); | ||
}, 0); | ||
} | ||
}); | ||
} | ||
}; | ||
} | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
components/app-framework/src/widgets/json-text-input/json-text-input.directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
angular | ||
.module('app.framework.widgets') | ||
.directive('jsonTextInput', jsonTextInput); | ||
|
||
/** | ||
* @name jsonTextInput | ||
* @description A directive that displays JSON. | ||
* @returns {object} The directive definition object | ||
*/ | ||
function jsonTextInput() { | ||
return { | ||
restrict: 'A', | ||
require: 'ngModel', | ||
scope: { | ||
ngModel: '=' | ||
}, | ||
link: function ($scope, elem, attr, ngModelCtrl) { | ||
ngModelCtrl.$parsers.push(function (viewValue) { | ||
try { | ||
return angular.fromJson(viewValue); | ||
} catch (e) { | ||
return undefined; | ||
} | ||
}); | ||
ngModelCtrl.$formatters.push(function (value) { | ||
return angular.toJson(value, 2); | ||
}); | ||
} | ||
}; | ||
} | ||
})(); |
16 changes: 16 additions & 0 deletions
16
components/app-framework/src/widgets/json-text-input/json-text-input.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.json-input-field { | ||
flex: 1 1 0; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
&.form-group { | ||
width: 100%; | ||
} | ||
|
||
textarea { | ||
outline: 0; | ||
border: 0; | ||
font-family: monospace; | ||
font-size: $font-size-monospace; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.