Skip to content

Commit

Permalink
feat(arcgis-rest-developer-credentials): Initial package release
Browse files Browse the repository at this point in the history
* feat(arcgis-rest-developer-credentials): complete apikey add task

* fix(arcgis-rest-developer-credentials): add privilege validation check and implement oauth in demo

* fix(arcgis-rest-developer-credentials): online/Enterprise url; simplify createApiKey() interface

* feat(arcgis-rest-developer-credentials): get and update api key

* fix(arcgis-rest-developer-credentials): export some interfaces in index.ts

* feat(arcgis-rest-developer-credentials): get/update api key and their demos

* chore: changes from review

* chore: changes from review

* chore: basic test setup

* chore: add files

* chore: add test files

* fix(arcgis-rest-developer-credentials): perfect apikey management implementation after code review

* feat(arcgis-rest-developer-credentials): complete apikey implementation and test

* fix(arcgis-rest-developer-credentials): revert create ts

* fix: refactor to remove deep copy

* chore: finish fixing tests

* fix(arcgis-rest-developer-credentials): final improvement and add documentation

* fix(arcgis-rest-developer-credentials): reflect PR change request

* fix(arcgis-rest-developer-credentials): typo

* fix(arcgis-rest-developer-credentials): add demo README

* fix(arcgis-rest-developer-credentials): resolve PR issue

* feat(arcgis-rest-developer-credentials): oAuth app suite

* fix(arcgis-rest-developer-credentials): typo

* fix(arcgis-rest-developer-credentials): remove unnecessary question mark

* fix(arcgis-rest-developer-credentials): solve PR issue

---------

Co-authored-by: yid13368 <ytong@esri.com>
Co-authored-by: Patrick Arlt <patrick.arlt@gmail.com>
  • Loading branch information
3 people authored Jul 28, 2023
1 parent 98ae8ef commit 68e1249
Show file tree
Hide file tree
Showing 45 changed files with 6,069 additions and 126 deletions.
2 changes: 2 additions & 0 deletions demos/dev-credentials-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/app.js
/oAuthApp.js
34 changes: 34 additions & 0 deletions demos/dev-credentials-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Client Web Demo for Developer Credential Package

This page will show API key and OAuth 2.0 app CRUD demo with help of `arcgis-rest-developer-credentials` package. First
step requires a user to log in
via [Authenticate with an ArcGIS identity](https://developers.arcgis.com/arcgis-rest-js/authentication/tutorials/authenticate-with-an-arcgis-identity-rest-js-browser/).
Then you can use the form to create an API key or switch to the OAuth 2.0 form to create an OAuth 2.0 app.
Once you've created an API key or OAuth 2.0 app, you can click on the item in the table below the form to edit it.

## Running this demo

1. Run `npm run build` in the repository's root directory.
2. Go into `demos/dev-credentials-client` and run `npm start` to spin up the development server.
3. Visit [http://localhost:8080](http://localhost:8080).

## Additional tools used

<table>
<tr>
<th>Description</th>
<th>Tool</th>
</tr>
<tr>
<td>Enhanced Multi-Select</td>
<td><a href="https://select2.org/">Select2</a></td>
</tr>
<tr>
<td>Table</td>
<td><a href="https://datatables.net/">jQuery Data Table</a></td>
</tr>
<tr>
<td>Others</td>
<td>jQuery 3, Bootstrap 5</td>
</tr>
</table>
95 changes: 95 additions & 0 deletions demos/dev-credentials-client/apikeyManagement.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>dev-credentials client</title>
<!-- bootstrap-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz"
crossorigin="anonymous"></script>
<!-- jQuery-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<!-- select2-->
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<!-- datatable-->
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet"/>
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
</head>
<body>
<div id="content" class="container" style="display: none">
<button id="signOut" type="button" class="btn btn-primary mt-3">sign out</button>
<a href="oAuthAppManagement.html" class="btn btn-primary mt-3">
To OAuth2.0
</a>
<form id="form" novalidate>
<div class="card mt-4">
<h5 class="card-header">Create/Edit Key</h5>
<div class="card-body">
<h5 id="pageTitle" class="card-title"></h5>
<div class="mb-3">
<label for="privileges" class="form-label">Privileges</label>
<select class="form-select" id="privileges" multiple="multiple"></select>
</div>
<div class="mb-3">
<label for="httpreferrer" class="form-label">Http Referrers</label>
<select class="form-select" id="httpreferrer" multiple="multiple"></select>
</div>
<div class="row mb-3" id="titleAndDesc">
<div class="col-md-6">
<label for="title" class="form-label">Title</label>
<input type="text" class="form-control" id="title" required>
<div class="invalid-feedback">
Please provide a non-empty title.
</div>
</div>
<div class="col-md-6">
<label for="desc" class="form-label">Description</label>
<input type="text" class="form-control" id="desc">
</div>
</div>
<button id="createKey" type="submit" class="btn btn-primary">Create</button>
<button id="deleteButton" type="button" class="btn btn-danger" style="display: none">Delete</button>
</div>
</div>
</form>

<div class="card mt-4">
<h5 class="card-header" id="selectedKey">Selected: </h5>
<div class="card-body" style="overflow-x:auto;">
<table id="datatable" class="display" style="width:100%">
<thead>
<tr>
<th>Item Id</th>
<th>Title</th>
</tr>
</thead>
</table>
</div>
</div>

<div class="card mt-4">
<h5 class="card-header">Details</h5>
<div class="card-body">
<p class="card-text"></p>
</div>
</div>
</div>

<script type="importmap">
{
"imports": {
"@esri/arcgis-rest-request": "/@esri/arcgis-rest-request/dist/bundled/request.esm.js",
"@esri/arcgis-rest-portal": "/@esri/arcgis-rest-portal/dist/bundled/portal.esm.js",
"@esri/arcgis-rest-developer-credentials": "/@esri/arcgis-rest-developer-credentials/dist/bundled/developer-credentials.esm.js"
}
}


</script>
<script src="app.js" type="module"></script>
</body>
</html>
Loading

0 comments on commit 68e1249

Please sign in to comment.