-
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,465 additions
and
0 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,14 @@ | ||
'use strict'; | ||
|
||
var angular = require('angular'); | ||
|
||
angular.module('fusioApp.account', ['ngRoute']) | ||
|
||
.config(['$routeProvider', function($routeProvider) { | ||
$routeProvider.when('/account/change_password', { | ||
templateUrl: 'app/controller/account/change_password.html', | ||
controller: 'ChangePasswordCtrl' | ||
}); | ||
}]) | ||
|
||
.controller('ChangePasswordCtrl', require('./change_password')); |
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,72 @@ | ||
'use strict'; | ||
|
||
module.exports = function($scope, $http, $uibModalInstance, formBuilder, fusio) { | ||
|
||
$scope.action = { | ||
name: "", | ||
class: "", | ||
config: {} | ||
}; | ||
$scope.elements = []; | ||
$scope.config = {}; | ||
$scope.actions = []; | ||
|
||
$scope.create = function(action) { | ||
var data = angular.copy(action); | ||
|
||
if (angular.isObject($scope.config)) { | ||
data.config = formBuilder.postProcessModel($scope.config, $scope.elements); | ||
} | ||
|
||
$http.post(fusio.baseUrl + 'backend/action', data) | ||
.then(function(response) { | ||
var data = response.data; | ||
$scope.response = data; | ||
if (data.success === true) { | ||
$uibModalInstance.close(data); | ||
} | ||
}) | ||
.catch(function(response) { | ||
$scope.response = response.data; | ||
}); | ||
}; | ||
|
||
$http.get(fusio.baseUrl + 'backend/action/list') | ||
.then(function(response) { | ||
var data = response.data; | ||
$scope.actions = data.actions; | ||
|
||
if (data.actions[0]) { | ||
$scope.action.class = data.actions[0].class; | ||
$scope.loadConfig(); | ||
} | ||
}); | ||
|
||
$scope.close = function() { | ||
$uibModalInstance.dismiss('cancel'); | ||
}; | ||
|
||
$scope.closeResponse = function() { | ||
$scope.response = null; | ||
}; | ||
|
||
$scope.loadConfig = function() { | ||
if ($scope.action.class) { | ||
$http.get(fusio.baseUrl + 'backend/action/form?class=' + encodeURIComponent($scope.action.class)) | ||
.then(function(response) { | ||
var data = response.data; | ||
var containerEl = angular.element(document.querySelector('#config-form')); | ||
containerEl.children().remove(); | ||
|
||
$scope.elements = data.element; | ||
$scope.config = formBuilder.preProcessModel($scope.action.config, $scope.elements); | ||
var linkFn = formBuilder.buildHtml($scope.elements, 'config'); | ||
if (angular.isFunction(linkFn)) { | ||
var el = linkFn($scope); | ||
containerEl.append(el); | ||
} | ||
}); | ||
} | ||
}; | ||
|
||
}; |
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,29 @@ | ||
'use strict'; | ||
|
||
module.exports = function($scope, $http, $uibModalInstance, action, fusio) { | ||
|
||
$scope.action = action; | ||
|
||
$scope.delete = function(action) { | ||
$http.delete(fusio.baseUrl + 'backend/action/' + action.id) | ||
.then(function(response) { | ||
var data = response.data; | ||
$scope.response = data; | ||
if (data.success === true) { | ||
$uibModalInstance.close(data); | ||
} | ||
}) | ||
.catch(function(response) { | ||
$scope.response = response.data; | ||
}); | ||
}; | ||
|
||
$scope.close = function() { | ||
$uibModalInstance.dismiss('cancel'); | ||
}; | ||
|
||
$scope.closeResponse = function() { | ||
$scope.response = null; | ||
}; | ||
|
||
}; |
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,58 @@ | ||
'use strict'; | ||
|
||
module.exports = function($scope, $http, $uibModalInstance, action, fusio) { | ||
|
||
$scope.action = action; | ||
$scope.methods = ['GET', 'POST', 'PUT', 'DELETE']; | ||
$scope.request = { | ||
method: 'GET', | ||
uriFragments: '', | ||
parameters: '', | ||
body: '{}' | ||
}; | ||
$scope.response = null; | ||
|
||
$scope.requestOpen = false; | ||
$scope.responseOpen = true; | ||
|
||
$scope.execute = function(action, request) { | ||
var body = JSON.parse(request.body); | ||
if (!angular.isObject(body)) { | ||
body = {}; | ||
} | ||
var data = { | ||
method: request.method, | ||
uriFragments: request.uriFragments, | ||
parameters: request.parameters, | ||
body: body | ||
}; | ||
|
||
$http.post(fusio.baseUrl + 'backend/action/execute/' + action.id, data) | ||
.then(function(response) { | ||
var data = response.data; | ||
// in case we have no body property we have probably a general error | ||
// message in this case we simply show the complete response as body | ||
var resp = {}; | ||
if (!data.body) { | ||
resp.statusCode = 500; | ||
resp.headers = {}; | ||
resp.body = data; | ||
} else { | ||
resp = data; | ||
} | ||
|
||
$scope.response = { | ||
statusCode: resp.statusCode, | ||
headers: resp.headers, | ||
body: JSON.stringify(resp.body, null, 4) | ||
}; | ||
}); | ||
}; | ||
|
||
$scope.close = function() { | ||
$uibModalInstance.dismiss('cancel'); | ||
}; | ||
|
||
$scope.execute(action, $scope.request); | ||
|
||
}; |
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,20 @@ | ||
'use strict'; | ||
|
||
var angular = require('angular'); | ||
|
||
angular.module('fusioApp.action', ['ngRoute', 'ui.ace']) | ||
|
||
.config(['$routeProvider', function($routeProvider) { | ||
$routeProvider.when('/action', { | ||
templateUrl: 'app/controller/action/index.html', | ||
controller: 'ActionCtrl' | ||
}); | ||
}]) | ||
|
||
.controller('ActionCtrl', require('./action')) | ||
.controller('ActionCreateCtrl', require('./create')) | ||
.controller('ActionUpdateCtrl', require('./update')) | ||
.controller('ActionDeleteCtrl', require('./delete')) | ||
.controller('ActionExecuteCtrl', require('./execute')) | ||
|
||
; |
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,91 @@ | ||
'use strict'; | ||
|
||
module.exports = function($scope, $http, $uibModalInstance, $uibModal, action, formBuilder, $timeout, fusio) { | ||
|
||
$scope.action = action; | ||
$scope.elements = []; | ||
$scope.config = {}; | ||
$scope.actions = []; | ||
|
||
$scope.update = function(action) { | ||
var data = angular.copy(action); | ||
|
||
if (angular.isObject($scope.config)) { | ||
data.config = formBuilder.postProcessModel($scope.config, $scope.elements); | ||
} | ||
|
||
$http.put(fusio.baseUrl + 'backend/action/' + action.id, data) | ||
.then(function(response) { | ||
var data = response.data; | ||
$scope.response = data; | ||
if (data.success === true) { | ||
$uibModalInstance.close(data); | ||
} | ||
}) | ||
.catch(function(response) { | ||
$scope.response = response.data; | ||
}); | ||
}; | ||
|
||
$scope.close = function() { | ||
$uibModalInstance.dismiss('cancel'); | ||
}; | ||
|
||
$scope.closeResponse = function() { | ||
$scope.response = null; | ||
}; | ||
|
||
$scope.loadConfig = function() { | ||
if ($scope.action.class) { | ||
$http.get(fusio.baseUrl + 'backend/action/form?class=' + encodeURIComponent($scope.action.class)) | ||
.then(function(response) { | ||
var data = response.data; | ||
var containerEl = angular.element(document.querySelector('#config-form')); | ||
containerEl.children().remove(); | ||
|
||
$scope.elements = data.element; | ||
$scope.config = formBuilder.preProcessModel($scope.action.config, $scope.elements); | ||
var linkFn = formBuilder.buildHtml($scope.elements, 'config'); | ||
if (angular.isFunction(linkFn)) { | ||
var el = linkFn($scope); | ||
containerEl.append(el); | ||
} | ||
}); | ||
} | ||
}; | ||
|
||
$scope.execute = function(action) { | ||
$http.put(fusio.baseUrl + 'backend/action/' + action.id, action) | ||
.then(function(response) { | ||
var data = response.data; | ||
$scope.response = data; | ||
if (data.success === true) { | ||
var modalInstance = $uibModal.open({ | ||
size: 'lg', | ||
backdrop: 'static', | ||
templateUrl: 'app/controller/action/execute.html', | ||
controller: 'ActionExecuteCtrl', | ||
resolve: { | ||
action: function() { | ||
return action; | ||
} | ||
} | ||
}); | ||
|
||
modalInstance.result.then(function(response) { | ||
}, function() { | ||
}); | ||
} | ||
}) | ||
.catch(function(response) { | ||
$scope.response = response.data; | ||
}); | ||
}; | ||
|
||
$http.get(fusio.baseUrl + 'backend/action/' + action.id) | ||
.then(function(response) { | ||
$scope.action = response.data; | ||
$scope.loadConfig(); | ||
}); | ||
|
||
} |
Oops, something went wrong.