<commit_before>angular.module('ontrack.extension.oidc', [
    'ot.service.core',
    'ot.service.form'
])
    .config(function ($stateProvider) {
        $stateProvider.state('oidc-settings', {
            url: '/extension/oidc/oidc-settings',
            templateUrl: 'extension/oidc/oidc-settings.tpl.html',
            controller: 'OidcSettingsCtrl'
        });
    })
    .controller('OidcSettingsCtrl', function ($scope, $http, ot, otFormService, otAlertService) {
        const view = ot.view();
        view.title = "OIDC Providers";
        view.breadcrumbs = ot.homeBreadcrumbs();
        view.commands = [
            ot.viewCloseCommand('/home')
        ];

        let viewInitialized = false;

        $scope.loadingProviders = false;

        const loadProviders = () => {
            $scope.loadingProviders = true;
            ot.pageCall($http.get("extension/oidc/providers")).then((resources) => {
                $scope.resources = resources;
                if (!viewInitialized) {
                    viewInitialized = true;
                    view.commands.push({
                        condition: function () {
                            return $scope.resources._create;
                        },
                        id: 'createProvider',
                        name: "Create providre",
                        cls: 'ot-command-new',
                        action: $scope.createProvider
                    });
                }
            }).finally(() => {
                $scope.loadingProviders = false;
            });
        };

        loadProviders();

        $scope.createProvider = () => {
            otFormService.create($scope.resources._create, "Create provider").then(loadProviders);
        };

        $scope.deleteProvider = (provider) => {
              otAlertService.confirm({
                  title: "OIDC provider deletion",
                  message: `Do you want to delete the ${provider.name} provider? It won't be available for authentication any longer.`
              }).then(() => ot.pageCall($http.delete(provider._delete))).then(loadProviders);
        };
    })
;<commit_msg>#756 Deletion of a provider<commit_after>angular.module('ontrack.extension.oidc', [
    'ot.service.core',
    'ot.service.form'
])
    .config(function ($stateProvider) {
        $stateProvider.state('oidc-settings', {
            url: '/extension/oidc/oidc-settings',
            templateUrl: 'extension/oidc/oidc-settings.tpl.html',
            controller: 'OidcSettingsCtrl'
        });
    })
    .controller('OidcSettingsCtrl', function ($scope, $http, ot, otFormService, otAlertService) {
        const view = ot.view();
        view.title = "OIDC Providers";
        view.breadcrumbs = ot.homeBreadcrumbs();
        view.commands = [
            ot.viewCloseCommand('/home')
        ];

        let viewInitialized = false;

        $scope.loadingProviders = false;

        const loadProviders = () => {
            $scope.loadingProviders = true;
            ot.pageCall($http.get("extension/oidc/providers")).then((resources) => {
                $scope.resources = resources;
                if (!viewInitialized) {
                    viewInitialized = true;
                    view.commands.push({
                        condition: function () {
                            return $scope.resources._create;
                        },
                        id: 'createProvider',
                        name: "Create provider",
                        cls: 'ot-command-new',
                        action: $scope.createProvider
                    });
                }
            }).finally(() => {
                $scope.loadingProviders = false;
            });
        };

        loadProviders();

        $scope.createProvider = () => {
            otFormService.create($scope.resources._create, "Create provider").then(loadProviders);
        };

        $scope.deleteProvider = (provider) => {
              otAlertService.confirm({
                  title: "OIDC provider deletion",
                  message: `Do you want to delete the ${provider.name} provider? It won't be available for authentication any longer.`
              }).then(() => ot.pageCall($http.delete(provider._delete))).then(loadProviders);
        };
    })
;
{'fraction_non_alphanumeric': 0.12848513011152415, 'fraction_numerical': 0.0006970260223048327, 'mean_word_length': 1.607510599636584, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5014086', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1073, 'n_words': 190}