Is there any way to embed the GitHub Issue Tracker in a webpage? - github

I'd like to put it in the Progress section of my project's webpage. I tried using an iframe, and I tried using $.load(), but neither of these work.
Any ideas?

If you don't need all the feature from the native GitHub issues page, you could consider listing those issue to generate your own include/presentation.
See "possible to embed Github list of issues (with specific tag) on website?"
Kasper Souren proposes below in the comments the following fiddle:
var urlToGetAllOpenBugs = "https://api.github.com/repos/jquery/jquery/issues?state=open&labels=bug";
$(document).ready(function () {
$.getJSON(urlToGetAllOpenBugs, function (allIssues) {
$("div").append("found " + allIssues.length + " issues</br>");
$.each(allIssues, function (i, issue) {
$("div")
.append("<b>" + issue.number + " - " + issue.title + "</b></br>")
.append("created at: " + issue.created_at + "</br>")
.append(issue.body + "</br></br></br>");
});
});
});

Look at https://github.com/serverless/scope which is based on serverless configuration, uses Amazon DynamoDB framework and github webhook service to fetch issue stats (open, close, comment, labels, milestones, etc.) and pull requests. It's well documented and allows several configurations, including embedding to one's website. I have just tried it and works well so far!

Related

GitHub: How to get `utteranc.es` to work for website discussion

My website https://friendly.github.io/HistDataVis/ wants to use the seemingly light weight and useful discussion feature offered by the https://github.com/utterance app.
I believe I have installed it correctly in my repo, https://github.com/friendly/HistDataVis, but it does not appear on the site when built.
I'm stumped on how to determine what the problem is, or how to correct it. Can anyone help?
For reference, here is my setup:
The website is built in R Studio, using distill in rmarkdown.
I created utterances.html with the standard JS code recommended.
<script>
document.addEventListener("DOMContentLoaded", function () {
if (!/posts/.test(location.pathname)) {
return;
}
var script = document.createElement("script");
script.src = "https://utteranc.es/client.js";
script.setAttribute("repo", "friendly/HistDataVis");
script.setAttribute("issue-term", "og:title");
script.setAttribute("crossorigin", "anonymous");
script.setAttribute("label", "comments ??");
/* wait for article to load, append script to article element */
var observer = new MutationObserver(function (mutations, observer) {
var article = document.querySelector("d-article");
if (article) {
observer.disconnect();
/* HACK: article scroll */
article.setAttribute("style", "overflow-y: hidden");
article.appendChild(script);
}
});
observer.observe(document.body, { childList: true });
});
</script>
In one Rmd file, I use in_header to insert this into the generated HTML file:
---
title: "Discussion"
date: "`r Sys.Date()`"
output:
distill::distill_article:
toc: true
includes:
in_header: utterances.html
---
Also used this in my _site.yml file to apply to all Rmd files on the site.
On my GitHub account, I installed utterances under GitHub apps, and gave it repository access to the repo for this site.
Edit2
Following the solution suggested by #laymonage, I fixed the script. I now get the Comments section on my web page, but get an error, "utterances not installed" when I try to use it. Yet, utterances is installed, as I just checked.
This part of your code:
if (!/posts/.test(location.pathname)) {
return;
}
Prevents the rest of the script to load because it's always true.
The condition checks whether the value of location.pathname passes the regular expression test string posts and negates it (!). That means the condition is true if the location.pathname (the path name of the current URL, e.g. /HistDataVis/ for https://friendly.github.io/HistDataVis/) does not contain posts anywhere in the string. None of the pages on your website has posts in the pathname, so the script will end there.
It should work if you change /posts/ to /HistDataVis or just remove the if block altogether.
Alternatively, you can also try giscus, a similar project that uses GitHub Discussions instead of Issues. Someone already made a guide on how to use it with Distill. Disclaimer: I'm the developer of giscus.

How to clear state in botkit 4 conversation

We have built a bot using botkit v4 and we are using it with Facebook messenger.
We want to clear the state on a specific facebook_postback.
I tried the following but nothing is working.
bot.controller.storage.delete(message.user)
I did not find any proper references in the documents as well. any help will be appreciated.
Ref: https://learn.microsoft.com/en-us/javascript/api/botbuilder-core/storage?view=botbuilder-ts-latest#delete-string---
Storage.delete method takes a list of identifiers, so correct syntax is
bot.controller.storage.delete([itemId]);
Also you need to discover correct format for itemId,
I have an example from websocket controller and it looks like this:
websocket/conversations/USERID-USERID/
The final syntax would look like this:
const itemId = 'facebook/conversations/' + message.user + '-' + message.user + '/';
await bot.controller.storage.delete([itemId]);

Is there any way to replace some part of code in Github repository dynamically?

I have a simple code on my Github repository that I want to make it changeable on the fly!
for example it's my code:
var name = "Reza";
alert("Hello " + name + "!");
my code is javascript and it will show an alert to the user Like "Hello Reza!" here.
I want to give some access to everyone to be able to change my code parameters before doing clone.
for example in my current code, I need to do something like this:
var name = {{your_name}};
alert("Hello " + name + "!");
And other users, should pass their name when they are sending their request to clone my project; then they will get cloned code customized by their name.
I want to know is there any way to do this using Github repository?

Siebel Open UI - How to make a query over Business Component from Javascript

I'm struggling to a Siebel Open UI requirement which ask for running a query over the current Business Component upon a double click on a record.
I tried the following in PR js associated to my custom applet:
var pm = this.GetPM();
var recordSet = pm.Get("GetRecordSet");
for (record in recordSet) {
var row = $("#" + this.GetPM().Get("GetPlaceholder"))
.find("tr[id=" + (Number(record) + 1) + "]")
.dblclick({ctx:pm}, function(event) {
var bc = event.data.ctx.Get("GetBusComp");
bc.InvokeMethod("ClearToQuery");
bc.SetSearchSpec("Id","1-81OR");
bc.InvokeMethod("ExecuteQuery");
});
}
the "bc" variable seems to be corrected instantiated, but when I look in the method exposed (console web browser) I don't see any of interest for making a query apart from InvokeMethod("ExecuteQuery") which is not working (it does nothing when I look at the logs).
Do you know how can I make such query from PR or PM?
Vincenzo
There are limitations in earlier versions of OpenUi but after 15, it has exposure to many BC methods.
Try this:
http://www.askmesiebel.com/2014/04/siebel-open-ui-invoke-business-service-from-pm-file/
Finally i got it, Query itselft is not possible on browser side. Only way is to call a Business Service which performs the query (at that time, bs is executed on the servver side)

Error in loading file with same name

I am using below script for uploading a file in alfresco but it refuses to create stating conflict.
"<?xml version='1.0' encoding='utf-8'?>\n" +
"<entry xmlns='http://www.w3.org/2005/Atom' xmlns:app=\"http://www.w3.org/2007/app\" xmlns:cmisra=\"http://docs.oasis-open.org/ns/cmis/restatom/200908/\" xmlns:cmis=\"http://docs.oasis-open.org/ns/cmis/core/200908/\" xmlns:alf=\"http://www.alfresco.org\">\n" +
"<title>" + fileName + "</title>\n" +
"<summary>" + fileDescrption + "</summary>\n" +
"<author>" + author + "</author>\n" +
"<content type='" + mimeType.toString() + "'>" + encoder.encode(bytes) + "</content>\n" +
"<cmisra:object>\n"+
"<cmis:properties>\n" +
"<cmis:propertyId propertyDefinitionId=\"cmis:objectTypeId\">\n"+
"<cmis:value>D:hs:doc</cmis:value>\n"+
"</cmis:propertyId>\n" +
"<cmis:propertyId propertyDefinitionId=\"cmis:versionable\">\n"+
"<cmis:value>TRUE</cmis:value>\n"+
"</cmis:propertyId>\n" +
"</cmis:properties>\n" +
"</cmisra:object>\n" +
"</entry>\n";
how can i enable versioning using cmis rest .
I agree with Gagravarr that you will save yourself a lot of time and frustration by using one of the libraries available at http://chemistry.apache.org or some other source.
However, the answer to your question is that it sounds like you are trying to create a new object with the same name in the same folder as an existing object. Alfresco does not allow this, hence the error.
Instead, what you need to do is update the existing object. You are using the AtomPub Binding so if what you want to do is update the content stream, you can do a PUT on the content stream's URL.
If instead you are trying to update the properties, you can do a PUT on the object's URL.
This will change the object without creating a new version. If you instead want to create a new version, you need to check out the object (POST the object to the checked out collection) which will return the Private Working Copy (PWC). You can then set the content stream and update the properties on the PWC as noted above, then you can do a checkin. This will create a new version.
Note that if Alfresco hands you a change token you need to hand it back when performing these kinds of updates or you will get an update conflict exception.
If you need specifics on how to do any of this, read the spec. If you want a friendly API to do this rather than dealing with low-level AtomPub XML, PUTs, POSTs, and DELETEs, then grab a CMIS library.