-
Notifications
You must be signed in to change notification settings - Fork 13
feat(account): add menu for managing API credentials #191
Conversation
Users can now manage their API credentials: - list applications - show permissions - revoke credentials
feat(account): add menu for managing API credentials
997ad85
to
d78db32
Compare
d78db32
to
aa6a0c8
Compare
|
||
<div data-wizard-step> | ||
|
||
<p data-ng-bind-html="tr('user_credentials_delete_modal_step1_question', [$ctrl.credential.name])"></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tr? Should be $translate now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I need to rebase on develop
branch.
@@ -0,0 +1,10 @@ | |||
angular | |||
.module("UserAccount") | |||
.config(["$stateProvider", function ($stateProvider) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to inject $stateProvider before the function, grunt ng-annotate task do it for you :)
@@ -0,0 +1,40 @@ | |||
angular.module("UserAccount.services") | |||
.service("UseraccountCredentialsService", class UseraccountCredentialsService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be in ovh-api-services :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! I'll have to merge and release this pull request first.
} | ||
|
||
getCredentials () { | ||
return this.OvhHttp.get("/me/api/credential", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should use a variable for the pattern: "/me/api/credential" and use it across your methods :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OvhApiMe
will be used.
</oui-column> | ||
<oui-column data-title=":: i18n.user_credentials_desc"> | ||
<span data-ng-if="$row.description.length > 20" | ||
data-ng-bind="($row.description | limitTo:'15') + '…'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
this.Alerter = Alerter; | ||
this.UseraccountCredentialsService = UseraccountCredentialsService; | ||
|
||
this.$scope.$on("useraccount.credentials.refresh", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to $onInit
?
return this.UseraccountCredentialsService.getCredentials() | ||
.then((credentialsIds) => { | ||
this.credentialsIds = credentialsIds; | ||
return credentialsIds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed ? You already have this.credentialsIds
at this point
} | ||
|
||
transformItem (credential) { | ||
return this.UseraccountCredentialsService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return this.UseraccountCredentialsService
.getCredential(credential.id)
.then((credentialInfo) => this.UseraccountCredentialsService
.getApplication(credentialInfo.credentialId)
.then((applicationInfo) => _.assign(credentialInfo, applicationInfo)));
to
return this.UseraccountCredentialsService
.getCredential(credential.id)
.then((credentialInfo) => this.UseraccountCredentialsService.getApplication(credentialInfo.credentialId))
.then((applicationInfo) => _.assign(credentialInfo, applicationInfo));
<td> | ||
<span class="label" | ||
data-ng-class="{ | ||
'label-danger': rule.method === 'DELETE', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is DELETE
considered a "danger" ? I understand it's only a matter of color but it's a bit weird, was this CX validated ?
@@ -0,0 +1,33 @@ | |||
"use strict"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this if you use a class
this.$scope = $scope; | ||
this.UseraccountCredentialsService = UseraccountCredentialsService; | ||
this.Alerter = Alerter; | ||
this.credential = $scope.currentActionData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move this to $onInit
.controller("UserAccount.controllers.credentials.read", class UserAccountCredentialsReadController { | ||
constructor ($scope) { | ||
this.$scope = $scope; | ||
this.credential = $scope.currentActionData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move this to $onInit
I close this PR due to inactivity. I plan to re-open it in a near future. |
ref:
needed: