replacing direct query of issues by swagger call, working

swagger_example
Fabien Benetou 2 years ago
parent 4f72cc08be
commit d793d0c847
  1. 24
      index.html

@ -22,6 +22,7 @@
<!-- still experimenting, see webdav.html --> <!-- still experimenting, see webdav.html -->
<script src='dependencies/webdav.js'></script> <script src='dependencies/webdav.js'></script>
<script src="https://unpkg.com/swagger-client"></script>
<!-- replacing with local copies as CDNs are like unpkg tend to be slow <!-- replacing with local copies as CDNs are like unpkg tend to be slow
<script type="module" src="https://unpkg.com/immers-client/dist/destination.bundle.js"></script> <script type="module" src="https://unpkg.com/immers-client/dist/destination.bundle.js"></script>
@ -2293,6 +2294,28 @@ function addDropZone(position="0 1.4 -0.6", callback=setFeedbackHUD, radius=0.11
return el return el
} }
AFRAME.registerComponent('issues-from-swagger', {
init:function(){
let generatorName = this.attrName
var specUrl = 'swagger.v1.json' // from 'https://git.benetou.fr/swagger.v1.json' but copied to bypass CORS
var swaggerClient = new SwaggerClient(specUrl)
.then(function (swaggerClient) {
myclient = swaggerClient
return swaggerClient.apis.issue.issueListIssues({owner: "utopiah", repo: "text-code-xr-engine"})
}, function (reason) {
console.error("failed to load the spec" + reason)
})
.then(function(issuesResult) {
console.log(issuesResult.obj)
res = issuesResult.obj
res.slice(0,maxItemsFromSources).map( (n,i) => addNewNote( n.title, "0 "+(1+i/10)+" -1.8", ".1 .1 .1", null, generatorName ) )
}, function (reason) {
console.error("failed on API call " + reason)
})
},
});
/* /*
generalize selector to pick last Nth rather than very last generalize selector to pick last Nth rather than very last
@ -2388,6 +2411,7 @@ consider pick then apply, i.e changeColorLastId() but for next Id
<!-- somehow disable hand interaction despite, according to the documentation, it should rely on world position <!-- somehow disable hand interaction despite, according to the documentation, it should rely on world position
<a-text target value="jxr qs #rig sa position 0 0 10" position="0 1.55 .5" rotation="0 180 0" scale="0.1 0.1 0.1"></a-text> <a-text target value="jxr qs #rig sa position 0 0 10" position="0 1.55 .5" rotation="0 180 0" scale="0.1 0.1 0.1"></a-text>
--> -->
<a-entity issues-from-swagger position="0 1.6 -1"></a>
<a-console position="0 1.5 -2" font-size="34" height=1 skip-intro=true></a-console> <a-console position="0 1.5 -2" font-size="34" height=1 skip-intro=true></a-console>
</a-scene> </a-scene>

Loading…
Cancel
Save