Skip to content
Permalink
Browse files

Merge pull request #1969 from privacyidea/1871/versioning-ng-components

Versioning for AngularJS components
  • Loading branch information
cornelinux committed Dec 19, 2019
2 parents 39849a0 + 54192f1 commit 13a94db2a37a51536a5d0b70322301c07050d5df
@@ -31,6 +31,7 @@ myApp = angular.module("privacyideaApp",
'privacyideaApp.recoveryStates',
'privacyideaApp.loginStates',
'privacyideaApp.componentStates',
'privacyideaApp.versioning',
'isteven-multi-select', 'angularFileUpload',
'inform', 'gettext', 'cfp.hotkeys']);
myApp.config(function ($urlRouterProvider) {
@@ -23,9 +23,9 @@
*
*/

angular.module('privacyideaApp.auditStates', ['ui.router']).config(
['$stateProvider',
function ($stateProvider) {
angular.module('privacyideaApp.auditStates', ['ui.router', 'privacyideaApp.versioning']).config(
['$stateProvider', 'versioningSuffixProviderProvider',
function ($stateProvider, versioningSuffixProviderProvider) {
// get the instance, the pathname part
var instance = window.location.pathname;
if (instance === "/") {
@@ -35,12 +35,12 @@ angular.module('privacyideaApp.auditStates', ['ui.router']).config(
$stateProvider
.state('audit', {
url: "/audit",
templateUrl: auditpath + "audit.html",
templateUrl: auditpath + "audit.html" + versioningSuffixProviderProvider.$get().$get(),
controller: "auditController"
})
.state('audit.log', {
url: "/log?serial&user",
templateUrl: auditpath + "audit.log.html",
templateUrl: auditpath + "audit.log.html" + versioningSuffixProviderProvider.$get().$get(),
controller: "auditController"
});
}]);
@@ -20,9 +20,9 @@
*
*/

angular.module('privacyideaApp.componentStates', ['ui.router']).config(
['$stateProvider',
function ($stateProvider) {
angular.module('privacyideaApp.componentStates', ['ui.router', 'privacyideaApp.versioning']).config(
['$stateProvider', 'versioningSuffixProviderProvider',
function ($stateProvider, versioningSuffixProviderProvider) {
// get the instance, the pathname part
var instance = window.location.pathname;
if (instance === "/") {
@@ -32,17 +32,17 @@ angular.module('privacyideaApp.componentStates', ['ui.router']).config(
$stateProvider
.state('component', {
url: "/component",
templateUrl: auditpath + "component.html",
templateUrl: auditpath + "component.html" + versioningSuffixProviderProvider.$get().$get(),
controller: "componentController"
})
.state('component.clienttype', {
url: "/clienttype",
templateUrl: auditpath + "component.clienttype.html",
templateUrl: auditpath + "component.clienttype.html" + versioningSuffixProviderProvider.$get().$get(),
controller: "componentController"
})
.state('component.subscriptions', {
url: "/subscriptions",
templateUrl: auditpath + "component.subscriptions.html",
templateUrl: auditpath + "component.subscriptions.html" + versioningSuffixProviderProvider.$get().$get(),
controller: "componentController"
})
;

Large diffs are not rendered by default.

@@ -18,7 +18,7 @@
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
myApp.directive('tokenDataEdit', function(AuthFactory, instanceUrl) {
myApp.directive('tokenDataEdit', function(AuthFactory, instanceUrl, versioningSuffixProvider) {
return {
scope: {
text: '@',
@@ -34,7 +34,9 @@ myApp.directive('tokenDataEdit', function(AuthFactory, instanceUrl) {
callback: '&',
callbackCancel: '&'
},
templateUrl: instanceUrl + "/static/components/directives/views/directive.tokendata.html",
templateUrl: instanceUrl
+ "/static/components/directives/views/directive.tokendata.html"
+ versioningSuffixProvider.$get(),
link: function(scope, element, attr, ctrl) {
scope.loggedInUser = AuthFactory.getUser();
//debug: console.log("tokenDataEdit");
@@ -43,12 +45,14 @@ myApp.directive('tokenDataEdit', function(AuthFactory, instanceUrl) {
};
});

myApp.directive("piFilter", function (instanceUrl) {
myApp.directive("piFilter", function (instanceUrl, versioningSuffixProvider) {
return {
require: 'ngModel',
restrict: 'E',
scope: {},
templateUrl: instanceUrl + "/static/components/directives/views/directive.filter.table.html",
templateUrl: instanceUrl
+ "/static/components/directives/views/directive.filter.table.html"
+ versioningSuffixProvider.$get(),
link: function (scope, element, attr, ctrl) {
scope.updateFilter = function() {
ctrl.$setViewValue(scope.filterValue);
@@ -103,7 +107,7 @@ myApp.directive("piSortBy", function(){
});


myApp.directive('assignUser', function($http, $rootScope, userUrl, AuthFactory, instanceUrl) {
myApp.directive('assignUser', function($http, $rootScope, userUrl, AuthFactory, instanceUrl, versioningSuffixProvider) {
/*
This directive is used to select a user from a realm
@@ -114,7 +118,9 @@ myApp.directive('assignUser', function($http, $rootScope, userUrl, AuthFactory,
newUserObject: '=',
realms: '='
},
templateUrl: instanceUrl + "/static/components/directives/views/directive.assignuser.html",
templateUrl: instanceUrl
+ "/static/components/directives/views/directive.assignuser.html"
+ versioningSuffixProvider.$get(),
link: function (scope, element, attr) {
//debug: console.log("Entering assignUser directive");
//debug: console.log(scope.realms);
@@ -162,7 +168,7 @@ myApp.directive('assignUser', function($http, $rootScope, userUrl, AuthFactory,
});

myApp.directive('assignToken', function($http, $rootScope, tokenUrl,
AuthFactory, instanceUrl) {
AuthFactory, instanceUrl, versioningSuffixProvider) {
/*
This directive is used to select a serial number and assign it
to the user.
@@ -173,7 +179,9 @@ myApp.directive('assignToken', function($http, $rootScope, tokenUrl,
scope: {
newTokenObject: '='
},
templateUrl: instanceUrl + "/static/components/directives/views/directive.assigntoken.html",
templateUrl: instanceUrl
+ "/static/components/directives/views/directive.assigntoken.html"
+ versioningSuffixProvider.$get(),
link: function (scope, element, attr) {
// Toggle enable/disable loadSerials call
scope.toggleLoadSerials = function($toggle) {
@@ -214,7 +222,7 @@ myApp.directive('assignToken', function($http, $rootScope, tokenUrl,


myApp.directive('attachToken', function($http, tokenUrl,
AuthFactory, instanceUrl) {
AuthFactory, instanceUrl, versioningSuffixProvider) {
/*
This directive is used to select a serial number and attach it to a machine
@@ -224,7 +232,9 @@ myApp.directive('attachToken', function($http, tokenUrl,
scope: {
newTokenObject: '='
},
templateUrl: instanceUrl + "/static/components/directives/views/directive.attachtoken.html",
templateUrl: instanceUrl
+ "/static/components/directives/views/directive.attachtoken.html"
+ versioningSuffixProvider.$get(),
link: function (scope, element, attr) {
scope.loadSerials = function($viewValue) {
var auth_token = AuthFactory.getAuthToken();
@@ -245,15 +255,17 @@ myApp.directive('attachToken', function($http, tokenUrl,


myApp.directive('attachMachine', function($http, machineUrl,
AuthFactory, instanceUrl) {
AuthFactory, instanceUrl, versioningSuffixProvider) {
/*
This directive is used to select a machine.
*/
return {
scope: {
newMachine: '='
},
templateUrl: instanceUrl + "/static/components/directives/views/directive.attachmachine.html",
templateUrl: instanceUrl
+ "/static/components/directives/views/directive.attachmachine.html"
+ versioningSuffixProvider.$get(),
link: function (scope, element, attr) {
scope.loadMachines = function($viewValue) {
var auth_token = AuthFactory.getAuthToken();
@@ -321,10 +333,12 @@ myApp.directive('statusClass', function() {
});

// See http://blog.techdev.de/an-angularjs-directive-to-download-pdf-files/
myApp.directive('csvDownload', function(AuthFactory, $http, instanceUrl) {
myApp.directive('csvDownload', function(AuthFactory, $http, instanceUrl, versioningSuffixProvider) {
return {
restrict: 'E',
templateUrl: instanceUrl + "/static/components/directives/views/directive.csvdownload.html",
templateUrl: instanceUrl
+ "/static/components/directives/views/directive.csvdownload.html"
+ versioningSuffixProvider.$get(),
scope: true,
link: function (scope, element, attr) {
var anchor = element.children()[0];
@@ -417,7 +431,7 @@ myApp.directive('autofocus', ['$timeout',
}
]);

myApp.directive("piPolicyConditions", function (instanceUrl) {
myApp.directive("piPolicyConditions", function (instanceUrl, versioningSuffixProvider) {
/* This directive is used to set the conditions of a policy.
It supports adding, removing and editing conditions. */
return {
@@ -429,7 +443,9 @@ myApp.directive("piPolicyConditions", function (instanceUrl) {
// We only need a one-directional binding, because we will never change the definitions
conditionDefs: "=defs"
},
templateUrl: instanceUrl + "/static/components/directives/views/directive.policyconditions.html",
templateUrl: instanceUrl
+ "/static/components/directives/views/directive.policyconditions.html"
+ versioningSuffixProvider.$get(),
link: function (scope, element, attr, ctrl) {
// The index of the condition that is currently being edited,
// or -1 if no condition is currently being edited
@@ -19,9 +19,9 @@
*
*/

angular.module('privacyideaApp.loginStates', ['ui.router']).config(
['$stateProvider',
function ($stateProvider) {
angular.module('privacyideaApp.loginStates', ['ui.router', 'privacyideaApp.versioning']).config(
['$stateProvider', 'versioningSuffixProviderProvider',
function ($stateProvider, versioningSuffixProviderProvider) {
// get the instance, the pathname part
var instance = window.location.pathname;
if (instance === "/") {
@@ -31,22 +31,22 @@ angular.module('privacyideaApp.loginStates', ['ui.router']).config(
$stateProvider
.state('offline', {
url: "/offline",
templateUrl: loginpath + "offline.html"
templateUrl: loginpath + "offline.html" + versioningSuffixProviderProvider.$get().$get()
}).state('login', {
url: "/login",
templateUrl: loginpath + "login.html"
templateUrl: loginpath + "login.html" + versioningSuffixProviderProvider.$get().$get()
}).state('initial_login', {
// This is the state, when no login path is specified
url: "",
templateUrl: loginpath + "login.html"
templateUrl: loginpath + "login.html" + versioningSuffixProviderProvider.$get().$get()
}).state('response', {
// This is the state, when the login is performed via
// challenge response.
url: "/response",
templateUrl: loginpath + "enter-response.html"
templateUrl: loginpath + "enter-response.html" + versioningSuffixProviderProvider.$get().$get()
}).state('pinchange', {
url: "/pinchange",
templateUrl: loginpath + "pinchange.html",
templateUrl: loginpath + "pinchange.html" + versioningSuffixProviderProvider.$get().$get(),
controller: "pinChangeController"
});
}]);
@@ -20,9 +20,9 @@
*
*/

angular.module('privacyideaApp.machineStates', ['ui.router']).config(
['$stateProvider',
function ($stateProvider) {
angular.module('privacyideaApp.machineStates', ['ui.router', 'privacyideaApp.versioning']).config(
['$stateProvider', 'versioningSuffixProviderProvider',
function ($stateProvider, versioningSuffixProviderProvider) {
// get the instance, the pathname part
var instance = window.location.pathname;
if (instance === "/") {
@@ -32,15 +32,15 @@ angular.module('privacyideaApp.machineStates', ['ui.router']).config(
$stateProvider
.state('machine', {
url: "/machine",
templateUrl: machinepath + "machine.html"
templateUrl: machinepath + "machine.html" + versioningSuffixProviderProvider.$get().$get()
})
.state('machine.list', {
url: "/list?resolver",
templateUrl: machinepath + "machine.list.html"
templateUrl: machinepath + "machine.list.html" + versioningSuffixProviderProvider.$get().$get()
})
.state('machine.details', {
url: "/details/{machineid:.*}/{machineresolver:.*}",
templateUrl: machinepath + "machine.details.html",
templateUrl: machinepath + "machine.details.html" + versioningSuffixProviderProvider.$get().$get(),
controller: ['$scope', '$stateParams',
function ($scope, $stateParams) {
$scope.machineid = $stateParams.machineid;
@@ -19,9 +19,9 @@
*
*/

angular.module('privacyideaApp.recoveryStates', ['ui.router']).config(
['$stateProvider',
function ($stateProvider) {
angular.module('privacyideaApp.recoveryStates', ['ui.router', 'privacyideaApp.versioning']).config(
['$stateProvider', 'versioningSuffixProviderProvider',
function ($stateProvider, versioningSuffixProviderProvider) {
// get the instance, the pathname part
var instance = window.location.pathname;
if (instance === "/") {
@@ -31,12 +31,12 @@ angular.module('privacyideaApp.recoveryStates', ['ui.router']).config(
$stateProvider
.state('recovery', {
url: "/recovery",
templateUrl: recoverypath + "recovery.html",
templateUrl: recoverypath + "recovery.html" + versioningSuffixProviderProvider.$get().$get(),
controller: "recoveryController"
})
.state('reset', {
url: "/reset/{user:.*}/{recoverycode:.*}",
templateUrl: recoverypath + "recovery.reset.html",
templateUrl: recoverypath + "recovery.reset.html" + versioningSuffixProviderProvider.$get().$get(),
controller: "recoveryController"
});
}]);
@@ -19,9 +19,9 @@
*
*/

angular.module('privacyideaApp.registerStates', ['ui.router']).config(
['$stateProvider',
function ($stateProvider) {
angular.module('privacyideaApp.registerStates', ['ui.router', 'privacyideaApp.versioning']).config(
['$stateProvider', 'versioningSuffixProviderProvider',
function ($stateProvider, versioningSuffixProviderProvider) {
// get the instance, the pathname part
var instance = window.location.pathname;
if (instance === "/") {
@@ -31,7 +31,7 @@ angular.module('privacyideaApp.registerStates', ['ui.router']).config(
$stateProvider
.state('register', {
url: "/register",
templateUrl: registerpath + "register.html",
templateUrl: registerpath + "register.html" + versioningSuffixProviderProvider.$get().$get(),
controller: "registerController"
});
}]);

0 comments on commit 13a94db

Please sign in to comment.
You can’t perform that action at this time.