Skip to content

Commit

Permalink
API Token: turn page into tab on account page #3086 #3025 #2841
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Apr 25, 2016
1 parent e195cbb commit 0e08dca
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 60 deletions.
4 changes: 2 additions & 2 deletions src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ contact.contact=Contact

account.info=Account Information
account.edit=Edit Account
apiTaken=API Token
account.apiToken=API Token
user.isShibUser=Account information cannot be edited when logged in through an institutional account.
user.helpShibUserMigrateOffShibBeforeLink=Leaving your institution? Please contact
user.helpShibUserMigrateOffShibAfterLink=for assistance.
Expand Down Expand Up @@ -209,7 +209,7 @@ shib.accountInformation=Account Information
shib.offerToCreateNewAccount=This information is provided by your institution and will be used to create your Dataverse account.
shib.passwordRejected=<strong>Validation Error</strong> - Your account can only be converted if you provide the correct password for your existing account.

#apitoken.xhtml
# tab on dataverseuser.xhtml
apitoken.title=API Token
apitoken.message=Here is your API Token. Check out our {0}API Guide{1} for more information.
apitoken.generateBtn=Generate Token
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/ApiTokenPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
import edu.harvard.iq.dataverse.authorization.AuthenticationServiceBean;
import edu.harvard.iq.dataverse.authorization.users.ApiToken;
import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser;
import static edu.harvard.iq.dataverse.util.JsfHelper.JH;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

/**
* @todo Rename this to ApiTokenFragment? The separate page is being taken out
* per https://github.com/IQSS/dataverse/issues/3086
*/
@ViewScoped
@Named("ApiTokenPage")
public class ApiTokenPage implements java.io.Serializable {
Expand Down
5 changes: 0 additions & 5 deletions src/main/webapp/WEB-INF/pretty-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,4 @@
<view-id value="/search/advanced.xhtml" />
</url-mapping>

<url-mapping id="apiToken">
<pattern value="/account/apitoken"/>
<view-id value="/apitoken.xhtml" />
</url-mapping>

</pretty-config>
45 changes: 0 additions & 45 deletions src/main/webapp/apitoken.xhtml

This file was deleted.

25 changes: 19 additions & 6 deletions src/main/webapp/dataverseuser.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<h:form id="dataverseUserForm">
<p:focus context="dataverseUserForm"/>
<div class="clearfix" jsf:rendered="#{empty DataverseUserPage.editMode}">
<div class="btn-group pull-right">
<div class="btn-group pull-right" jsf:rendered="#{!empty DataverseUserPage.builtinUser}">
<button type="button" id="editAccount" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<ui:fragment rendered="#{!empty DataverseUserPage.builtinUser}">
<span class="glyphicon glyphicon-pencil"/> #{bundle['account.edit']}
Expand All @@ -50,11 +50,6 @@
</p:commandLink>
</li>
</ui:fragment>
<li>
<h:outputLink value="/apitoken.xhtml">
<h:outputText value="#{bundle.apiTaken}" />
</h:outputLink>
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -332,6 +327,24 @@
</div>
</div>
</p:tab>
<p:tab id="apiTokenTab" title="API Token">
<p class="help-block">
<span class="glyphicon glyphicon-info-sign"/>&#160;
<h:outputFormat value="#{bundle['apitoken.message']}" escape="false">
<f:param value="&lt;a href=&#34;#{systemConfig.guidesBaseUrl}/#{systemConfig.version}/api&#34; target=&#34;_blank&#34;&gt;"/>
<f:param value="&lt;/a&gt;"/>
</h:outputFormat>
</p>
<div class="highlight">
<pre>
<code class="language-html" data-lang="html">${ApiTokenPage.apiToken}</code>
</pre>
</div>
<div>
<button class="btn btn-default" jsf:action="#{ApiTokenPage.generate()}">
#{ApiTokenPage.checkForApiToken() ? bundle['apitoken.regenerateBtn'] : bundle['apitoken.generateBtn']} </button>
</div>
</p:tab>
<ui:remove>
<p:tab id="groupsRoles" title="#{bundle['header.user.selectTab.groupsAndRoles']}">
<span class="glyphicon glyphicon-info-sign"></span> #{bundle['groupAndRoles.manageTips']}
Expand Down

0 comments on commit 0e08dca

Please sign in to comment.