etincidunt 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. package/.prettierignore +2 -0
  2. package/.travis.yml +29 -0
  3. package/.vscode/launch.json +24 -0
  4. package/.vscode/settings.json +3 -0
  5. package/demos/ago-node-cli/README.md +29 -0
  6. package/demos/ago-node-cli/ago.js +32 -0
  7. package/demos/ago-node-cli/index.js +11 -0
  8. package/demos/ago-node-cli/lib/item-export-command.js +48 -0
  9. package/demos/ago-node-cli/lib/item-search-command.js +35 -0
  10. package/demos/ago-node-cli/package-lock.json +172 -0
  11. package/demos/ago-node-cli/package.json +30 -0
  12. package/demos/attachments/README.md +5 -0
  13. package/demos/attachments/index.html +164 -0
  14. package/demos/attachments/package-lock.json +182 -0
  15. package/demos/attachments/package.json +18 -0
  16. package/demos/batch-geocoder-node/NYC_Restaurant_Inspection_Results.csv +100 -0
  17. package/demos/batch-geocoder-node/README.md +14 -0
  18. package/demos/batch-geocoder-node/batch-geocode.js +112 -0
  19. package/demos/batch-geocoder-node/config-template.js +18 -0
  20. package/demos/batch-geocoder-node/package-lock.json +109 -0
  21. package/demos/batch-geocoder-node/package.json +37 -0
  22. package/demos/express/README.md +10 -0
  23. package/demos/express/config.json.template +3 -0
  24. package/demos/express/package-lock.json +388 -0
  25. package/demos/express/package.json +18 -0
  26. package/demos/express/server.js +28 -0
  27. package/demos/feature-service-browser/README.md +6 -0
  28. package/demos/feature-service-browser/index.html +122 -0
  29. package/demos/feature-service-browser/package-lock.json +182 -0
  30. package/demos/feature-service-browser/package.json +18 -0
  31. package/demos/geocoder-browser/README.md +10 -0
  32. package/demos/geocoder-browser/config.js.template +1 -0
  33. package/demos/geocoder-browser/index.html +131 -0
  34. package/demos/geocoder-browser/package-lock.json +163 -0
  35. package/demos/geocoder-browser/package.json +19 -0
  36. package/demos/geocoder-browser/post-sign-in.html +25 -0
  37. package/demos/jsapi-integration/README.md +8 -0
  38. package/demos/jsapi-integration/config.js +6 -0
  39. package/demos/jsapi-integration/index.html +79 -0
  40. package/demos/jsapi-integration/package-lock.json +184 -0
  41. package/demos/jsapi-integration/package.json +19 -0
  42. package/demos/oauth2-browser/README.md +12 -0
  43. package/demos/oauth2-browser/authenticate.html +32 -0
  44. package/demos/oauth2-browser/config.js.template +6 -0
  45. package/demos/oauth2-browser/index.html +202 -0
  46. package/demos/oauth2-browser/logo.svg +4 -0
  47. package/demos/oauth2-browser/package-lock.json +163 -0
  48. package/demos/oauth2-browser/package.json +18 -0
  49. package/demos/oauth2-browser/style.css +36 -0
  50. package/demos/vue/.babelrc +6 -0
  51. package/demos/vue/.env.example +8 -0
  52. package/demos/vue/README.md +17 -0
  53. package/demos/vue/index.html +21 -0
  54. package/demos/vue/package-lock.json +7236 -0
  55. package/demos/vue/package.json +39 -0
  56. package/demos/vue/src/assets/logo.svg +29 -0
  57. package/demos/vue/src/components/App.vue +302 -0
  58. package/demos/vue/src/components/Authenticate.vue +68 -0
  59. package/demos/vue/src/components/Loader.vue +216 -0
  60. package/demos/vue/src/main.js +75 -0
  61. package/demos/vue/webpack.config.js +84 -0
  62. package/docs/FAQ.md +28 -0
  63. package/docs/HISTORY.md +62 -0
  64. package/docs/acetate.config.js +214 -0
  65. package/docs/build-typedoc.js +301 -0
  66. package/docs/src/_layout.html +82 -0
  67. package/docs/src/api/_declaration.html +496 -0
  68. package/docs/src/api/_layout.html +127 -0
  69. package/docs/src/api/_package.html +13 -0
  70. package/docs/src/api/index.html +23 -0
  71. package/docs/src/guides/_layout.html +24 -0
  72. package/docs/src/guides/amd-requirejs-dojo.md +40 -0
  73. package/docs/src/guides/babel-and-rollup.md +30 -0
  74. package/docs/src/guides/babel-and-webpack.md +30 -0
  75. package/docs/src/guides/browser-authentication.md +9 -0
  76. package/docs/src/guides/browserify.md +9 -0
  77. package/docs/src/guides/cli-authentication.md +9 -0
  78. package/docs/src/guides/client-server-authentication.md +9 -0
  79. package/docs/src/guides/from-a-cdn.md +36 -0
  80. package/docs/src/guides/index.md +52 -0
  81. package/docs/src/guides/node.md +30 -0
  82. package/docs/src/guides/package-overview.md +8 -0
  83. package/docs/src/guides/server-authentication.md +9 -0
  84. package/docs/src/guides/typescript-and-webpack.md +9 -0
  85. package/docs/src/img/icons.png +0 -0
  86. package/docs/src/img/icons@2x.png +0 -0
  87. package/docs/src/index.html +12 -0
  88. package/docs/src/js/api-search.js +113 -0
  89. package/docs/src/js/index.js +1 -0
  90. package/docs/src/js/nav-toggle.js +41 -0
  91. package/docs/src/sass/_highlight.scss +96 -0
  92. package/docs/src/sass/_icons.scss +157 -0
  93. package/docs/src/sass/style.scss +169 -0
  94. package/jasmine.json +7 -0
  95. package/karma.conf.js +100 -0
  96. package/lerna.json +8 -0
  97. package/notes/README.md +88 -0
  98. package/package.json +91 -0
  99. package/packages/arcgis-rest-auth/README.md +64 -0
  100. package/packages/arcgis-rest-auth/package-lock.json +11 -0
  101. package/packages/arcgis-rest-auth/package.json +51 -0
  102. package/packages/arcgis-rest-auth/src/ApplicationSession.ts +91 -0
  103. package/packages/arcgis-rest-auth/src/UserSession.ts +829 -0
  104. package/packages/arcgis-rest-auth/src/authenticated-request-options.ts +21 -0
  105. package/packages/arcgis-rest-auth/src/fetch-token.ts +55 -0
  106. package/packages/arcgis-rest-auth/src/generate-token.ts +36 -0
  107. package/packages/arcgis-rest-auth/src/index.ts +5 -0
  108. package/packages/arcgis-rest-auth/test/ApplicationSession.test.ts +121 -0
  109. package/packages/arcgis-rest-auth/test/UserSession.test.ts +883 -0
  110. package/packages/arcgis-rest-auth/test/fetchToken.test.ts +76 -0
  111. package/packages/arcgis-rest-auth/test/generateToken.test.ts +36 -0
  112. package/packages/arcgis-rest-auth/test/utils.ts +11 -0
  113. package/packages/arcgis-rest-auth/tsconfig.json +6 -0
  114. package/packages/arcgis-rest-common-types/README.md +61 -0
  115. package/packages/arcgis-rest-common-types/package.json +38 -0
  116. package/packages/arcgis-rest-common-types/src/group.ts +51 -0
  117. package/packages/arcgis-rest-common-types/src/index.ts +467 -0
  118. package/packages/arcgis-rest-common-types/src/item.ts +45 -0
  119. package/packages/arcgis-rest-common-types/src/webmap.ts +1225 -0
  120. package/packages/arcgis-rest-common-types/tsconfig.json +11 -0
  121. package/packages/arcgis-rest-feature-service/README.md +70 -0
  122. package/packages/arcgis-rest-feature-service/package-lock.json +11 -0
  123. package/packages/arcgis-rest-feature-service/package.json +50 -0
  124. package/packages/arcgis-rest-feature-service/src/add.ts +82 -0
  125. package/packages/arcgis-rest-feature-service/src/addAttachment.ts +65 -0
  126. package/packages/arcgis-rest-feature-service/src/delete.ts +85 -0
  127. package/packages/arcgis-rest-feature-service/src/deleteAttachments.ts +68 -0
  128. package/packages/arcgis-rest-feature-service/src/getAttachments.ts +64 -0
  129. package/packages/arcgis-rest-feature-service/src/helpers.ts +77 -0
  130. package/packages/arcgis-rest-feature-service/src/index.ts +8 -0
  131. package/packages/arcgis-rest-feature-service/src/query.ts +174 -0
  132. package/packages/arcgis-rest-feature-service/src/update.ts +81 -0
  133. package/packages/arcgis-rest-feature-service/src/updateAttachment.ts +74 -0
  134. package/packages/arcgis-rest-feature-service/test/attachments.test.ts +179 -0
  135. package/packages/arcgis-rest-feature-service/test/features.test.ts +172 -0
  136. package/packages/arcgis-rest-feature-service/test/mocks/feature.ts +220 -0
  137. package/packages/arcgis-rest-feature-service/test/mocks/foo.txt +1 -0
  138. package/packages/arcgis-rest-feature-service/tsconfig.json +6 -0
  139. package/packages/arcgis-rest-geocoder/README.md +73 -0
  140. package/packages/arcgis-rest-geocoder/package-lock.json +11 -0
  141. package/packages/arcgis-rest-geocoder/package.json +52 -0
  142. package/packages/arcgis-rest-geocoder/src/bulk.ts +102 -0
  143. package/packages/arcgis-rest-geocoder/src/geocode.ts +117 -0
  144. package/packages/arcgis-rest-geocoder/src/helpers.ts +81 -0
  145. package/packages/arcgis-rest-geocoder/src/index.ts +4 -0
  146. package/packages/arcgis-rest-geocoder/src/reverse.ts +84 -0
  147. package/packages/arcgis-rest-geocoder/src/suggest.ts +72 -0
  148. package/packages/arcgis-rest-geocoder/test/geocoder.test.ts +510 -0
  149. package/packages/arcgis-rest-geocoder/test/mocks/responses.ts +588 -0
  150. package/packages/arcgis-rest-geocoder/tsconfig.json +6 -0
  151. package/packages/arcgis-rest-groups/README.md +64 -0
  152. package/packages/arcgis-rest-groups/package-lock.json +11 -0
  153. package/packages/arcgis-rest-groups/package.json +52 -0
  154. package/packages/arcgis-rest-groups/src/groups.ts +272 -0
  155. package/packages/arcgis-rest-groups/src/index.ts +1 -0
  156. package/packages/arcgis-rest-groups/test/groups.test.ts +280 -0
  157. package/packages/arcgis-rest-groups/test/mocks/responses.ts +137 -0
  158. package/packages/arcgis-rest-groups/tsconfig.json +6 -0
  159. package/packages/arcgis-rest-items/README.md +66 -0
  160. package/packages/arcgis-rest-items/package-lock.json +11 -0
  161. package/packages/arcgis-rest-items/package.json +52 -0
  162. package/packages/arcgis-rest-items/src/index.ts +1 -0
  163. package/packages/arcgis-rest-items/src/items.ts +498 -0
  164. package/packages/arcgis-rest-items/test/items.test.ts +1153 -0
  165. package/packages/arcgis-rest-items/test/mocks/foo.zip +0 -0
  166. package/packages/arcgis-rest-items/test/mocks/item.ts +30 -0
  167. package/packages/arcgis-rest-items/test/mocks/resources.ts +28 -0
  168. package/packages/arcgis-rest-items/test/mocks/search.ts +60 -0
  169. package/packages/arcgis-rest-items/tsconfig.json +6 -0
  170. package/packages/arcgis-rest-request/README.md +65 -0
  171. package/packages/arcgis-rest-request/package-lock.json +11 -0
  172. package/packages/arcgis-rest-request/package.json +42 -0
  173. package/packages/arcgis-rest-request/src/index.ts +10 -0
  174. package/packages/arcgis-rest-request/src/request.ts +259 -0
  175. package/packages/arcgis-rest-request/src/utils/ArcGISAuthError.ts +67 -0
  176. package/packages/arcgis-rest-request/src/utils/ArcGISRequestError.ts +73 -0
  177. package/packages/arcgis-rest-request/src/utils/ErrorTypes.ts +29 -0
  178. package/packages/arcgis-rest-request/src/utils/check-for-errors.ts +65 -0
  179. package/packages/arcgis-rest-request/src/utils/encode-form-data.ts +29 -0
  180. package/packages/arcgis-rest-request/src/utils/encode-query-string.ts +23 -0
  181. package/packages/arcgis-rest-request/src/utils/get-portal-url.ts +25 -0
  182. package/packages/arcgis-rest-request/src/utils/get-portal.ts +45 -0
  183. package/packages/arcgis-rest-request/src/utils/process-params.ts +99 -0
  184. package/packages/arcgis-rest-request/test/mocks/errors.ts +59 -0
  185. package/packages/arcgis-rest-request/test/mocks/geojson-feature-collection.ts +10 -0
  186. package/packages/arcgis-rest-request/test/mocks/portal.ts +109 -0
  187. package/packages/arcgis-rest-request/test/mocks/sharing-rest-info.ts +38 -0
  188. package/packages/arcgis-rest-request/test/mocks/webmap.ts +38 -0
  189. package/packages/arcgis-rest-request/test/request.test.ts +296 -0
  190. package/packages/arcgis-rest-request/test/utils/ArcGISAuthError.test.ts +167 -0
  191. package/packages/arcgis-rest-request/test/utils/ArcGISRequestError.test.ts +40 -0
  192. package/packages/arcgis-rest-request/test/utils/check-for-errors.test.ts +101 -0
  193. package/packages/arcgis-rest-request/test/utils/encode-form-data.test.ts +112 -0
  194. package/packages/arcgis-rest-request/test/utils/get-portal-url.test.ts +34 -0
  195. package/packages/arcgis-rest-request/test/utils/portal.test.ts +94 -0
  196. package/packages/arcgis-rest-request/test/utils/process-params.test.ts +190 -0
  197. package/packages/arcgis-rest-request/tsconfig.json +6 -0
  198. package/packages/arcgis-rest-sharing/README.md +67 -0
  199. package/packages/arcgis-rest-sharing/package-lock.json +11 -0
  200. package/packages/arcgis-rest-sharing/package.json +55 -0
  201. package/packages/arcgis-rest-sharing/src/access.ts +91 -0
  202. package/packages/arcgis-rest-sharing/src/group-sharing.ts +212 -0
  203. package/packages/arcgis-rest-sharing/src/helpers.ts +92 -0
  204. package/packages/arcgis-rest-sharing/src/index.ts +2 -0
  205. package/packages/arcgis-rest-sharing/test/access.test.ts +153 -0
  206. package/packages/arcgis-rest-sharing/test/group-sharing.test.ts +436 -0
  207. package/packages/arcgis-rest-sharing/test/mocks/sharing.ts +15 -0
  208. package/packages/arcgis-rest-sharing/tsconfig.json +6 -0
  209. package/packages/arcgis-rest-users/README.md +71 -0
  210. package/packages/arcgis-rest-users/package-lock.json +11 -0
  211. package/packages/arcgis-rest-users/package.json +51 -0
  212. package/packages/arcgis-rest-users/src/index.ts +1 -0
  213. package/packages/arcgis-rest-users/src/users.ts +70 -0
  214. package/packages/arcgis-rest-users/test/mocks/responses.ts +170 -0
  215. package/packages/arcgis-rest-users/test/users.test.ts +97 -0
  216. package/packages/arcgis-rest-users/tsconfig.json +6 -0
  217. package/support/FormData.d.ts +1 -0
  218. package/support/changelog.js +388 -0
  219. package/support/commit-template.txt +19 -0
  220. package/support/deploy-doc-site.js +16 -0
  221. package/support/publish.sh +40 -0
  222. package/support/test-helpers.js +8 -0
  223. package/tsconfig.json +69 -0
  224. package/tslint.json +14 -0
  225. package/umd-base-profile.js +82 -0
  226. package/umd-production-profile.js +13 -0
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@esri/arcgis-rest-demo-vue-with-popup",
3
+ "description": "VueJS demo of @esri/arcgis-rest-* packages.",
4
+ "version": "1.6.0",
5
+ "author": "",
6
+ "license": "Apache-2.0",
7
+ "private": true,
8
+ "scripts": {
9
+ "start": "npm run dev",
10
+ "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
11
+ "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
12
+ },
13
+ "dependencies": {
14
+ "@esri/arcgis-rest-auth": "^1.6.0",
15
+ "@esri/arcgis-rest-request": "^1.6.0",
16
+ "vue": "^2.5.11",
17
+ "vue-router": "^3.0.1"
18
+ },
19
+ "devDependencies": {
20
+ "babel-core": "^6.26.0",
21
+ "babel-loader": "^7.1.2",
22
+ "babel-preset-env": "^1.6.0",
23
+ "babel-preset-stage-3": "^6.24.1",
24
+ "cross-env": "^5.0.5",
25
+ "css-loader": "^0.28.7",
26
+ "dotenv-webpack": "^1.5.5",
27
+ "file-loader": "^1.1.10",
28
+ "html-webpack-plugin": "^2.30.1",
29
+ "vue-loader": "^13.0.5",
30
+ "vue-template-compiler": "^2.4.4",
31
+ "webpack": "^3.6.0",
32
+ "webpack-dev-server": "^3.1.3"
33
+ },
34
+ "browserslist": [
35
+ "> 1%",
36
+ "last 2 versions",
37
+ "not ie <= 8"
38
+ ]
39
+ }
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:cc="http://creativecommons.org/ns#"
5
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
+ xmlns:svg="http://www.w3.org/2000/svg"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 400 400"
9
+ height="400"
10
+ width="400"
11
+ xml:space="preserve"
12
+ id="svg2"
13
+ version="1.1"><metadata
14
+ id="metadata8"><rdf:RDF><cc:Work
15
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
16
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
17
+ id="defs6" /><g
18
+ transform="matrix(1.3333333,0,0,-1.3333333,0,400)"
19
+ id="g10"><g
20
+ transform="translate(178.0626,235.0086)"
21
+ id="g12"><path
22
+ id="path14"
23
+ style="fill:#4dba87;fill-opacity:1;fill-rule:nonzero;stroke:none"
24
+ d="M 0,0 -22.669,-39.264 -45.338,0 h -75.491 L -22.669,-170.017 75.491,0 Z" /></g><g
25
+ transform="translate(178.0626,235.0086)"
26
+ id="g16"><path
27
+ id="path18"
28
+ style="fill:#435466;fill-opacity:1;fill-rule:nonzero;stroke:none"
29
+ d="M 0,0 -22.669,-39.264 -45.338,0 H -81.565 L -22.669,-102.01 36.227,0 Z" /></g></g></svg>
@@ -0,0 +1,302 @@
1
+ <template>
2
+ <div id="app-wrapper">
3
+ <div class="jumbotron">
4
+ <div class="container">
5
+ <div id="page-header" class="row">
6
+ <div id="logo-container" class="col-sm-3">
7
+ <img id="logo" src="../assets/logo.svg">
8
+ </div>
9
+ <div class="col-sm-9">
10
+ <h2>
11
+ ArcGIS Rest JS Vue Demo
12
+ </h2>
13
+ <p>
14
+ A simple vue application utilizing the arcgis-rest-js library.
15
+ </p>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ <div class="container">
21
+ <div class="row">
22
+ <div class="col-xs-12">
23
+ <!-- Hook the has-error class to the boolean clientIdError. -->
24
+ <div :class="{ 'has-error': clientIdError }" class="form-group">
25
+ <label class="control-label">ClientID</label>
26
+ <!-- Hook this input up to the clientId property. -->
27
+ <input
28
+ v-model="clientId"
29
+ type="text"
30
+ class="form-control"
31
+ placeholder="ClientID"
32
+ >
33
+ </div>
34
+ <p class="help-block">
35
+ You can generate your own clientid by creating an application on the
36
+ <a target='_blank' href='https://developers.arcgis.com/documentation/core-concepts/security-and-authentication/browser-based-user-logins/'>
37
+ ArcGIS for Developers
38
+ </a>
39
+ website. Be sure to add
40
+ <code>
41
+ {{ redirect_uri }}
42
+ </code>
43
+ as a redirect uri for your application.
44
+ </p>
45
+ </div>
46
+ </div>
47
+ <div class="row">
48
+ <div class="col-xs-6">
49
+ <!-- On click, this button will call the signInWithPopup function. -->
50
+ <button class="btn btn-primary btn-block" @click="signInWithPopup">Sign In (with popup)</button>
51
+ </div>
52
+ <div class="col-xs-6">
53
+ <!-- On click, this button will call the signInWithoutPopup function. -->
54
+ <button class="btn btn-primary btn-block" @click="signInWithInlineRedirect">Sign In (inline redirect)</button>
55
+ </div>
56
+ </div>
57
+ <!-- If there is a current session, render this bit. -->
58
+ <div v-if="session" class="row">
59
+ <div class="col-xs-12 text-center">
60
+ <p class="bg-success info-panel">
61
+ <!-- Display the current user's username. -->
62
+ Logged in as {{ session.username }}.
63
+ </p>
64
+ </div>
65
+ </div>
66
+ <!-- If there is not a current session, render this instead. -->
67
+ <div v-else class="row">
68
+ <div class="col-xs-12 text-center">
69
+ <p class="bg-info info-panel">
70
+ Log in using one of the methods above to load rest of the page.
71
+ </p>
72
+ </div>
73
+ </div>
74
+ <div class="row">
75
+ <div class="col-xs-6 col-xs-offset-3 text-center">
76
+ <button class="btn btn-block btn-warning" @click="signout">Sign Out</button>
77
+ </div>
78
+ </div>
79
+ <div class="panel panel-default">
80
+ <div class="panel-heading">
81
+ <div class="row" style="margin-bottom: 0px">
82
+ <div class="col-xs-4">
83
+ <!-- This button will call the search function. It's disabled if there is no current session. -->
84
+ <button @click="search" :disabled="!session" class="btn btn-success btn-block">
85
+ <span class="glyphicon glyphicon-search"></span>
86
+ Search Your Content
87
+ </button>
88
+ </div>
89
+ <div class="col-xs-8">
90
+ <div class="input-group">
91
+ <div class="input-group-addon">
92
+ <span class="glyphicon glyphicon-filter"></span>
93
+ </div>
94
+ <!-- Hook up this input the the filter string property. It's disabled if there is no current session. -->
95
+ <input
96
+ v-model="filterString"
97
+ :disabled="!session"
98
+ type="text"
99
+ class="form-control"
100
+ placeholder="Filter"
101
+ >
102
+ </div>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ <!-- Render this only if their is a current search pending. -->
107
+ <div v-if="searching" class="panel-body loading-table">
108
+ <loader
109
+ size='25'
110
+ label='Fetching Data...'
111
+ labelPosition='bottom'
112
+ ></loader>
113
+ </div>
114
+ <!-- Render if there are search results. -->
115
+ <table v-if="searchResults" class="table table-hover">
116
+ <thead>
117
+ <tr>
118
+ <th>Title:</th>
119
+ <th>ID:</th>
120
+ </tr>
121
+ </thead>
122
+ <!-- If there are any search results, render them. -->
123
+ <tbody v-if="searchResults.length > 0">
124
+ <!-- Iterate over the search results and render a table row for each. -->
125
+ <tr
126
+ v-for="(item, index) in searchResults"
127
+ :key="index"
128
+ >
129
+ <td>
130
+ {{ item.title }}
131
+ </td>
132
+ <td>
133
+ {{ item.id }}
134
+ </td>
135
+ </tr>
136
+ </tbody>
137
+ <!-- If no results were found, render this information. -->
138
+ <tbody v-else>
139
+ <tr class="danger">
140
+ <td>
141
+ No results found.
142
+ </td>
143
+ <td></td>
144
+ </tr>
145
+ </tbody>
146
+ </table>
147
+ </div>
148
+ </div>
149
+ </div>
150
+ </template>
151
+
152
+ <script>
153
+ // Import the arcgis-rest-auth bit.
154
+ import { UserSession } from '@esri/arcgis-rest-auth';
155
+ // Import the arcgis-rest-request bit.
156
+ import { request } from '@esri/arcgis-rest-request';
157
+ // Import the main Vue instance. Will be used for event dispatching.
158
+ import Main from '../main';
159
+ // Import a simple loading indicator.
160
+ import Loader from './Loader';
161
+
162
+ export default {
163
+ name: 'App',
164
+ components: { Loader },
165
+ // The session object is a prop supplied by the main Vue instance.
166
+ props: ['session'],
167
+ data() {
168
+ return {
169
+ // Store these values on this instance.
170
+ clientId: process.env.CLIENTID || null,
171
+ clientIdError: false,
172
+ filterString: null,
173
+ searching: null,
174
+ searchResults: null,
175
+ };
176
+ },
177
+ computed: {
178
+ // Simple computed property to access the current applications path to
179
+ // set it as the redirect_uri.
180
+ redirect_uri() {
181
+ return `${window.location.origin}${window.location.pathname}`;
182
+ }
183
+ },
184
+ created() {
185
+ // Upon creation, check to see if the session prop exists. If it does,
186
+ // pre-populate the client id value.
187
+ if (this.session) {
188
+ this.clientId = this.session.clientId;
189
+ }
190
+ },
191
+ mounted() {},
192
+ watch: {
193
+ // Set a watcher on the client id to validate it when it changes.
194
+ clientId() {
195
+ if (this.clientId === '') this.clientIdError = true;
196
+ else this.clientIdError = false;
197
+ },
198
+ },
199
+ methods: {
200
+ // Function to validate that the client id exists.
201
+ requireClientId() {
202
+ if (this.clientIdError || !this.clientId) {
203
+ this.clientIdError = true;
204
+ return false;
205
+ }
206
+ return true;
207
+ },
208
+ // The signup with a popup workflow. When popup is true, the beginOAuth2 function
209
+ // returns a promise.
210
+ signInWithPopup() {
211
+ if (this.requireClientId()) {
212
+ UserSession.beginOAuth2({
213
+ clientId: this.clientId,
214
+ // Passing the clientid here is only a requirement of this demo where we allow
215
+ // dynamic clientids via input. Typically you would have this hard-coded on
216
+ // the authorization callback.
217
+ redirectUri: `${this.redirect_uri}#/authenticate?clientID=${this.clientId}`,
218
+ popup: true,
219
+ }).then((session) => {
220
+ // Upon successful login, emit a login event on the main Vue instance. This
221
+ // triggers an update on the main Vue instance's session property which is
222
+ // passed to this component via props.
223
+ Main.$emit('login', session);
224
+ }).catch(error => {
225
+ console.error(error);
226
+ });
227
+ }
228
+ },
229
+ // The signup with an inline redirect workflow. In this case the user is just redirected to
230
+ // the authorization page.
231
+ signInWithInlineRedirect() {
232
+ if (this.requireClientId()) {
233
+ UserSession.beginOAuth2({
234
+ clientId: this.clientId,
235
+ redirectUri: `${this.redirect_uri}#/authenticate?clientID=${this.clientId}`,
236
+ popup: false,
237
+ });
238
+ }
239
+ },
240
+ // Function to log the use out of the current session.
241
+ signout() {
242
+ Main.$emit('logout');
243
+ },
244
+ // Function to call to search for a user's content.
245
+ search() {
246
+ // Update the properties for a new search.
247
+ this.searchResults = null;
248
+ this.searching = true;
249
+ // Timeout is for effect.
250
+ setTimeout(this.requestData, 300);
251
+ },
252
+ // Request data from AGOL.
253
+ requestData() {
254
+ // Construct a search query for only items the user owns. Add a filter if it exists.
255
+ const query = `owner: ${this.session.username}${this.filterString ? ` AND ${this.filterString}`:''}`
256
+ // Construct the url for the endpoint with the session's portal and the constructed
257
+ // query.
258
+ const searchUrl = `${this.session.portal}/search?q=${query}`;
259
+ // Make the request. Tack on the current authentication session.
260
+ request(searchUrl, { authentication: this.session })
261
+ .then((response) => {
262
+ this.searching = false;
263
+ this.searchResults = response.results;
264
+ }).catch(error => {
265
+ this.searching = false;
266
+ console.error(error);
267
+ });
268
+ },
269
+ },
270
+ };
271
+ </script>
272
+
273
+ <style>
274
+ .jumbotron {
275
+ padding-top: 0px;
276
+ padding-bottom: 0px;
277
+ }
278
+
279
+ #logo-container {
280
+ display: flex;
281
+ justify-content: center;
282
+ align-content: center;
283
+ }
284
+
285
+ #logo {
286
+ width: 150px;
287
+ height: 150px;
288
+ }
289
+
290
+ .info-panel{
291
+ padding: 15px;
292
+ }
293
+
294
+ .loading-table {
295
+ width: 100%;
296
+ height: 150px;
297
+ display: flex;
298
+ align-content: center;
299
+ justify-content: center;
300
+ }
301
+
302
+ </style>
@@ -0,0 +1,68 @@
1
+ <template>
2
+ <div id="authenticate-wrapper">
3
+ <!-- Just a simple loading indicator -->
4
+ <loader
5
+ size='25'
6
+ label='Authenticating...'
7
+ labelPosition='bottom'
8
+ ></loader>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ // Import the arcgis-rest-auth bit.
14
+ import { UserSession } from '@esri/arcgis-rest-auth';
15
+ // Import the main Vue instance. Will be used for event dispatching.
16
+ import Main from '../main';
17
+ // Import a simple loading indicator.
18
+ import Loader from './Loader';
19
+
20
+ export default {
21
+ name: 'Authenticate',
22
+ components: { Loader },
23
+ props: [],
24
+ data() {
25
+ return {};
26
+ },
27
+ computed: {
28
+ // Simple computed property to make it easier to access the client id
29
+ // in the url. In a production app the clientid should be hardcoded.
30
+ clientId () {
31
+ return this.$route.query.clientID;
32
+ },
33
+ },
34
+ created() {},
35
+ mounted() {
36
+ // When this component is rendered, set a timeout to process the authentication.
37
+ // The timing is just for effect to show it's working.
38
+ setTimeout(this.processAuthentication, 500);
39
+ },
40
+ methods: {
41
+ processAuthentication() {
42
+ // Complete the OAuth2 process. If in a popup, the window will close before
43
+ // this finishes and will be handled by the beginOAuth2 function. If not in
44
+ // a popup, it will proceed to the next couple lines.
45
+ const session = UserSession.completeOAuth2({
46
+ // Required as it is a piece of the key in the popup method. If not using
47
+ // a popup, this shouldn't be required.
48
+ clientId: this.clientId,
49
+ });
50
+ // If this component isn't in a popup, it will emit an event on the main Vue
51
+ // instance that a successful login occurred with the session object attached.
52
+ Main.$emit('login', session);
53
+ // The app is the rerouted to the main application.
54
+ this.$router.replace('/');
55
+ },
56
+ },
57
+ };
58
+ </script>
59
+
60
+ <style>
61
+ #authenticate-wrapper {
62
+ width: 100%;
63
+ height: 100%;
64
+ display: flex;
65
+ align-content: center;
66
+ justify-content: center;
67
+ }
68
+ </style>
@@ -0,0 +1,216 @@
1
+ <template>
2
+ <div ref='loader-wrapper' id='loader-wrapper'>
3
+ <div v-if="label" ref="label">
4
+ {{ label }}
5
+ </div>
6
+ <div ref="spinner" class="sk-fading-circle">
7
+ <div class="sk-circle1 sk-circle"></div>
8
+ <div class="sk-circle2 sk-circle"></div>
9
+ <div class="sk-circle3 sk-circle"></div>
10
+ <div class="sk-circle4 sk-circle"></div>
11
+ <div class="sk-circle5 sk-circle"></div>
12
+ <div class="sk-circle6 sk-circle"></div>
13
+ <div class="sk-circle7 sk-circle"></div>
14
+ <div class="sk-circle8 sk-circle"></div>
15
+ <div class="sk-circle9 sk-circle"></div>
16
+ <div class="sk-circle10 sk-circle"></div>
17
+ <div class="sk-circle11 sk-circle"></div>
18
+ <div class="sk-circle12 sk-circle"></div>
19
+ </div>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ name: 'Loader',
26
+ components: {},
27
+ props: ['size', 'label', 'labelPosition'],
28
+ data() {
29
+ return {};
30
+ },
31
+ watch: {
32
+ size() {
33
+ this.setSize();
34
+ },
35
+ labelPosition() {
36
+ this.setLabelPosition();
37
+ },
38
+ },
39
+ created() {},
40
+ mounted() {
41
+ this.setSize();
42
+ this.setLabelPosition();
43
+ },
44
+ methods: {
45
+ setSize() {
46
+ const marginPercentage = 0.2;
47
+ this.$refs.spinner.style.width = `${this.size || 40}px`;
48
+ this.$refs.spinner.style.height = `${this.size || 40}px`;
49
+ this.$refs.spinner.style.margin =
50
+ `${this.size * marginPercentage || 40 * marginPercentage}px`;
51
+ },
52
+ setLabelPosition() {
53
+ switch (this.labelPosition) {
54
+ case 'top':
55
+ this.$refs['loader-wrapper'].style['flex-direction'] = 'column';
56
+ break;
57
+ case 'bottom':
58
+ this.$refs['loader-wrapper'].style['flex-direction'] = 'column-reverse';
59
+ break;
60
+ case 'left':
61
+ this.$refs['loader-wrapper'].style['flex-direction'] = 'row';
62
+ break;
63
+ case 'right':
64
+ this.$refs['loader-wrapper'].style['flex-direction'] = 'row-reverse';
65
+ break;
66
+ default:
67
+ this.$refs['loader-wrapper'].style['flex-direction'] = 'column-reverse';
68
+ break;
69
+ }
70
+ },
71
+ },
72
+ };
73
+ </script>
74
+
75
+ <style>
76
+ #loader-wrapper {
77
+ display: inline-flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+ }
81
+
82
+ .sk-fading-circle {
83
+ width: 100%;
84
+ height: 100%;
85
+ position: relative;
86
+ }
87
+
88
+ .sk-fading-circle .sk-circle {
89
+ width: 100%;
90
+ height: 100%;
91
+ position: absolute;
92
+ left: 0;
93
+ top: 0;
94
+ }
95
+
96
+ .sk-fading-circle .sk-circle:before {
97
+ content: '';
98
+ display: block;
99
+ margin: 0 auto;
100
+ width: 15%;
101
+ height: 15%;
102
+ background-color: #333;
103
+ border-radius: 100%;
104
+ -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
105
+ animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
106
+ }
107
+ .sk-fading-circle .sk-circle2 {
108
+ -webkit-transform: rotate(30deg);
109
+ -ms-transform: rotate(30deg);
110
+ transform: rotate(30deg);
111
+ }
112
+ .sk-fading-circle .sk-circle3 {
113
+ -webkit-transform: rotate(60deg);
114
+ -ms-transform: rotate(60deg);
115
+ transform: rotate(60deg);
116
+ }
117
+ .sk-fading-circle .sk-circle4 {
118
+ -webkit-transform: rotate(90deg);
119
+ -ms-transform: rotate(90deg);
120
+ transform: rotate(90deg);
121
+ }
122
+ .sk-fading-circle .sk-circle5 {
123
+ -webkit-transform: rotate(120deg);
124
+ -ms-transform: rotate(120deg);
125
+ transform: rotate(120deg);
126
+ }
127
+ .sk-fading-circle .sk-circle6 {
128
+ -webkit-transform: rotate(150deg);
129
+ -ms-transform: rotate(150deg);
130
+ transform: rotate(150deg);
131
+ }
132
+ .sk-fading-circle .sk-circle7 {
133
+ -webkit-transform: rotate(180deg);
134
+ -ms-transform: rotate(180deg);
135
+ transform: rotate(180deg);
136
+ }
137
+ .sk-fading-circle .sk-circle8 {
138
+ -webkit-transform: rotate(210deg);
139
+ -ms-transform: rotate(210deg);
140
+ transform: rotate(210deg);
141
+ }
142
+ .sk-fading-circle .sk-circle9 {
143
+ -webkit-transform: rotate(240deg);
144
+ -ms-transform: rotate(240deg);
145
+ transform: rotate(240deg);
146
+ }
147
+ .sk-fading-circle .sk-circle10 {
148
+ -webkit-transform: rotate(270deg);
149
+ -ms-transform: rotate(270deg);
150
+ transform: rotate(270deg);
151
+ }
152
+ .sk-fading-circle .sk-circle11 {
153
+ -webkit-transform: rotate(300deg);
154
+ -ms-transform: rotate(300deg);
155
+ transform: rotate(300deg);
156
+ }
157
+ .sk-fading-circle .sk-circle12 {
158
+ -webkit-transform: rotate(330deg);
159
+ -ms-transform: rotate(330deg);
160
+ transform: rotate(330deg);
161
+ }
162
+ .sk-fading-circle .sk-circle2:before {
163
+ -webkit-animation-delay: -1.1s;
164
+ animation-delay: -1.1s;
165
+ }
166
+ .sk-fading-circle .sk-circle3:before {
167
+ -webkit-animation-delay: -1s;
168
+ animation-delay: -1s;
169
+ }
170
+ .sk-fading-circle .sk-circle4:before {
171
+ -webkit-animation-delay: -0.9s;
172
+ animation-delay: -0.9s;
173
+ }
174
+ .sk-fading-circle .sk-circle5:before {
175
+ -webkit-animation-delay: -0.8s;
176
+ animation-delay: -0.8s;
177
+ }
178
+ .sk-fading-circle .sk-circle6:before {
179
+ -webkit-animation-delay: -0.7s;
180
+ animation-delay: -0.7s;
181
+ }
182
+ .sk-fading-circle .sk-circle7:before {
183
+ -webkit-animation-delay: -0.6s;
184
+ animation-delay: -0.6s;
185
+ }
186
+ .sk-fading-circle .sk-circle8:before {
187
+ -webkit-animation-delay: -0.5s;
188
+ animation-delay: -0.5s;
189
+ }
190
+ .sk-fading-circle .sk-circle9:before {
191
+ -webkit-animation-delay: -0.4s;
192
+ animation-delay: -0.4s;
193
+ }
194
+ .sk-fading-circle .sk-circle10:before {
195
+ -webkit-animation-delay: -0.3s;
196
+ animation-delay: -0.3s;
197
+ }
198
+ .sk-fading-circle .sk-circle11:before {
199
+ -webkit-animation-delay: -0.2s;
200
+ animation-delay: -0.2s;
201
+ }
202
+ .sk-fading-circle .sk-circle12:before {
203
+ -webkit-animation-delay: -0.1s;
204
+ animation-delay: -0.1s;
205
+ }
206
+
207
+ @-webkit-keyframes sk-circleFadeDelay {
208
+ 0%, 39%, 100% { opacity: 0; }
209
+ 40% { opacity: 1; }
210
+ }
211
+
212
+ @keyframes sk-circleFadeDelay {
213
+ 0%, 39%, 100% { opacity: 0; }
214
+ 40% { opacity: 1; }
215
+ }
216
+ </style>