From ef652bad04c162bad5f4254fa3d2591a8ef7d5c3 2016-10-07 10:53:17 From: Marcin Lulek Date: 2016-10-07 10:53:17 Subject: [PATCH] components: user and alert channels components --- diff --git a/frontend/src/app.js b/frontend/src/app.js index 567f93f..4336a8e 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -48,6 +48,10 @@ angular.module('appenlight.components', [ 'appenlight.components.eventBrowserView', 'appenlight.components.userProfileView', 'appenlight.components.userIdentitiesView', + 'appenlight.components.userPasswordView', + 'appenlight.components.userAuthTokensView', + 'appenlight.components.userAlertChannelsListView', + 'appenlight.components.userAlertChannelsEmailNewView', 'appenlight.components.settingsView' ]); angular.module('appenlight.directives', [ diff --git a/frontend/src/components/views/settings-view/settings-view.js b/frontend/src/components/views/settings-view/settings-view.js index 6553b96..bc05978 100644 --- a/frontend/src/components/views/settings-view/settings-view.js +++ b/frontend/src/components/views/settings-view/settings-view.js @@ -23,8 +23,9 @@ angular.module('appenlight.components.settingsView', []) controller: SettingsViewController }); -SettingsViewController.$inject = []; +SettingsViewController.$inject = ['$state']; -function SettingsViewController() { +function SettingsViewController($state) { + this.$state = $state; console.info('SettingsViewController'); } diff --git a/frontend/src/templates/user/alert_channels_email.html b/frontend/src/components/views/user-alert-channel-email-new-view/user-alert-channel-email-new-view.html similarity index 84% rename from frontend/src/templates/user/alert_channels_email.html rename to frontend/src/components/views/user-alert-channel-email-new-view/user-alert-channel-email-new-view.html index 80bea6d..e0066af 100644 --- a/frontend/src/templates/user/alert_channels_email.html +++ b/frontend/src/components/views/user-alert-channel-email-new-view/user-alert-channel-email-new-view.html @@ -1,20 +1,20 @@ - + -
+

Adding email alert channel - after you authorize your email in the system we can send alerts directly to this mailbox.

-
+
- +
- +
diff --git a/frontend/src/controllers/user/alert_channel_email.js b/frontend/src/components/views/user-alert-channel-email-new-view/user-alert-channel-email-new-view.js similarity index 90% rename from frontend/src/controllers/user/alert_channel_email.js rename to frontend/src/components/views/user-alert-channel-email-new-view/user-alert-channel-email-new-view.js index 9e5bea7..c104c9b 100644 --- a/frontend/src/controllers/user/alert_channel_email.js +++ b/frontend/src/components/views/user-alert-channel-email-new-view/user-alert-channel-email-new-view.js @@ -17,8 +17,11 @@ // # services, and proprietary license terms, please see // # https://rhodecode.com/licenses/ -angular.module('appenlight.controllers') - .controller('AlertChannelsEmailController', AlertChannelsEmailController) +angular.module('appenlight.components.userAlertChannelsEmailNewView', []) + .component('userAlertChannelsEmailNewView', { + templateUrl: 'components/views/user-alert-channel-email-new-view/user-alert-channel-email-new-view.html', + controller: AlertChannelsEmailController + }); AlertChannelsEmailController.$inject = ['$state','userSelfPropertyResource']; diff --git a/frontend/src/templates/user/alert_channels_list.html b/frontend/src/components/views/user-alert-channels-list-view/user-alert-channels-list-view.html similarity index 73% rename from frontend/src/templates/user/alert_channels_list.html rename to frontend/src/components/views/user-alert-channels-list-view/user-alert-channels-list-view.html index 8598484..1495b2b 100644 --- a/frontend/src/templates/user/alert_channels_list.html +++ b/frontend/src/components/views/user-alert-channels-list-view/user-alert-channels-list-view.html @@ -1,19 +1,19 @@ - + -
+

Report alert rules

- Add top-level rule + Add top-level rule

- +
@@ -29,7 +29,7 @@
You can add more integrations that support different alert channels via application management panel.
- +
{{ channel.channel_visible_value }} + ng-click="$ctrl.updateChannel(channel,'send_alerts')" ng-class="{dim:!channel.send_alerts}" tooltip-append-to-body="true"> Alerts + ng-click="$ctrl.updateChannel(channel,'daily_digest')" ng-class="{dim:!channel.daily_digest}" tooltip-append-to-body="true"> Daily digests @@ -49,7 +49,7 @@ Remove diff --git a/frontend/src/controllers/user/alert_channels.js b/frontend/src/components/views/user-alert-channels-list-view/user-alert-channels-list-view.js similarity index 93% rename from frontend/src/controllers/user/alert_channels.js rename to frontend/src/components/views/user-alert-channels-list-view/user-alert-channels-list-view.js index 1507d97..65b7fe6 100644 --- a/frontend/src/controllers/user/alert_channels.js +++ b/frontend/src/components/views/user-alert-channels-list-view/user-alert-channels-list-view.js @@ -17,11 +17,15 @@ // # services, and proprietary license terms, please see // # https://rhodecode.com/licenses/ -angular.module('appenlight.controllers').controller('AlertChannelsController', AlertChannelsController); +angular.module('appenlight.components.userAlertChannelsListView', []) + .component('userAlertChannelsListView', { + templateUrl: 'components/views/user-alert-channels-list-view/user-alert-channels-list-view.html', + controller: userAlertChannelsListViewController + }); -AlertChannelsController.$inject = ['userSelfPropertyResource', 'applicationsNoIdResource']; +userAlertChannelsListViewController.$inject = ['userSelfPropertyResource', 'applicationsNoIdResource']; -function AlertChannelsController(userSelfPropertyResource, applicationsNoIdResource) { +function userAlertChannelsListViewController(userSelfPropertyResource, applicationsNoIdResource) { console.debug('AlertChannelsController'); var vm = this; vm.loading = {channels: true, applications: true, actions:true}; diff --git a/frontend/src/templates/user/auth_tokens.html b/frontend/src/components/views/user-auth-tokens-view/user-auth-tokens-view.html similarity index 81% rename from frontend/src/templates/user/auth_tokens.html rename to frontend/src/components/views/user-auth-tokens-view/user-auth-tokens-view.html index 977ff9c..0df03df 100644 --- a/frontend/src/templates/user/auth_tokens.html +++ b/frontend/src/components/views/user-auth-tokens-view/user-auth-tokens-view.html @@ -1,6 +1,6 @@ - + -
+
@@ -11,20 +11,20 @@
- - - + + +
- +
-
@@ -41,7 +41,7 @@
- +
@@ -71,7 +71,7 @@ diff --git a/frontend/src/controllers/user/auth_tokens.js b/frontend/src/components/views/user-auth-tokens-view/user-auth-tokens-view.js similarity index 80% rename from frontend/src/controllers/user/auth_tokens.js rename to frontend/src/components/views/user-auth-tokens-view/user-auth-tokens-view.js index 07c05ec..39085e6 100644 --- a/frontend/src/controllers/user/auth_tokens.js +++ b/frontend/src/components/views/user-auth-tokens-view/user-auth-tokens-view.js @@ -17,12 +17,16 @@ // # services, and proprietary license terms, please see // # https://rhodecode.com/licenses/ -angular.module('appenlight.controllers').controller('UserAuthTokensController', UserAuthTokensController); +angular.module('appenlight.components.userAuthTokensView', []) + .component('userAuthTokensView', { + templateUrl: 'components/views/user-auth-tokens-view/user-auth-tokens-view.html', + controller: userAuthTokensViewController + }); -UserAuthTokensController.$inject = ['$filter', 'userSelfPropertyResource', 'AeConfig']; +userAuthTokensViewController.$inject = ['userSelfPropertyResource', 'AeConfig']; -function UserAuthTokensController($filter, userSelfPropertyResource, AeConfig) { - console.debug('UserAuthTokensController'); +function userAuthTokensViewController(userSelfPropertyResource, AeConfig) { + console.debug('userAuthTokensViewController'); var vm = this; vm.loading = {tokens: true}; @@ -48,11 +52,13 @@ function UserAuthTokensController($filter, userSelfPropertyResource, AeConfig) { setServerValidation(vm.TokenForm, response.data); } }) - } + }; vm.removeToken = function (token) { - userSelfPropertyResource.delete({key: 'auth_tokens', - token:token.token}, + userSelfPropertyResource.delete({ + key: 'auth_tokens', + token: token.token + }, function () { var index = vm.tokens.indexOf(token); if (index !== -1) { diff --git a/frontend/src/templates/user/profile_password.html b/frontend/src/components/views/user-password-view/user-password-view.html similarity index 76% rename from frontend/src/templates/user/profile_password.html rename to frontend/src/components/views/user-password-view/user-password-view.html index be6c36d..39696c8 100644 --- a/frontend/src/templates/user/profile_password.html +++ b/frontend/src/components/views/user-password-view/user-password-view.html @@ -1,40 +1,40 @@ - + -
+
- +
- +
- +
- +
- +
- +
- +
diff --git a/frontend/src/controllers/user/password.js b/frontend/src/components/views/user-password-view/user-password-view.js similarity index 83% rename from frontend/src/controllers/user/password.js rename to frontend/src/components/views/user-password-view/user-password-view.js index ed58ea4..ed8f275 100644 --- a/frontend/src/controllers/user/password.js +++ b/frontend/src/components/views/user-password-view/user-password-view.js @@ -17,13 +17,16 @@ // # services, and proprietary license terms, please see // # https://rhodecode.com/licenses/ -angular.module('appenlight.controllers') - .controller('UserPasswordController', UserPasswordController) +angular.module('appenlight.components.userPasswordView', []) + .component('userPasswordView', { + templateUrl: 'components/views/user-password-view/user-password-view.html', + controller: UserPasswordViewController + }); -UserPasswordController.$inject = ['userSelfPropertyResource']; +UserPasswordViewController.$inject = ['userSelfPropertyResource']; -function UserPasswordController(userSelfPropertyResource) { - console.debug('UserPasswordController'); +function UserPasswordViewController(userSelfPropertyResource) { + console.debug('UserPasswordViewController'); var vm = this; vm.loading = {password: false}; vm.form = {}; @@ -37,7 +40,7 @@ function UserPasswordController(userSelfPropertyResource) { setServerValidation(vm.passwordForm); }, function (response) { if (response.status == 422) { - console.log('vm',vm); + console.log('vm', vm); setServerValidation(vm.passwordForm, response.data); console.log(response.data); } diff --git a/frontend/src/routes.js b/frontend/src/routes.js index 500b0fb..b9691ed 100644 --- a/frontend/src/routes.js +++ b/frontend/src/routes.js @@ -162,8 +162,7 @@ angular.module('appenlight').config(['$stateProvider', '$urlRouterProvider', fun $stateProvider.state('user.profile.password', { url: '/password', - templateUrl: 'templates/user/profile_password.html', - controller: 'UserPasswordController as password' + component: 'userPasswordView' }); $stateProvider.state('user.profile.identities', { @@ -173,26 +172,23 @@ angular.module('appenlight').config(['$stateProvider', '$urlRouterProvider', fun $stateProvider.state('user.profile.auth_tokens', { url: '/auth_tokens', - templateUrl: 'templates/user/auth_tokens.html', - controller: 'UserAuthTokensController as auth_tokens' + component: 'userAuthTokensView' }); $stateProvider.state('user.alert_channels', { abstract: true, url: '/alert_channels', - templateUrl: 'templates/user/alert_channels.html' + template: '' }); $stateProvider.state('user.alert_channels.list', { url: '/list', - templateUrl: 'templates/user/alert_channels_list.html', - controller: 'AlertChannelsController as channels' + component: 'userAlertChannelsListView' }); $stateProvider.state('user.alert_channels.email', { url: '/email', - templateUrl: 'templates/user/alert_channels_email.html', - controller: 'AlertChannelsEmailController as email' + component: 'userAlertChannelsEmailNewView' }); $stateProvider.state('applications', { diff --git a/frontend/src/templates/user/alert_channels.html b/frontend/src/templates/user/alert_channels.html deleted file mode 100644 index be33d1c..0000000 --- a/frontend/src/templates/user/alert_channels.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/src/templates/user/breadcrumbs.html b/frontend/src/templates/user/breadcrumbs.html index 33cd308..7ffc112 100644 --- a/frontend/src/templates/user/breadcrumbs.html +++ b/frontend/src/templates/user/breadcrumbs.html @@ -4,7 +4,6 @@
  • Password
  • Identities
  • -
    Your current tokens