Skip to content

Instantly share code, notes, and snippets.

View aycabas's full-sized avatar
👻

Ayca Bas aycabas

👻
View GitHub Profile
@aycabas
aycabas / launch.json compounds
Created March 30, 2023 09:16
launch.json compounds
{
"name": "Debug in Outlook (Edge)",
"configurations": [
"Attach to Frontend in Outlook (Edge)"
],
"preLaunchTask": "Start Teams App Locally",
"presentation": {
"group": "all",
"order": 3
},
@aycabas
aycabas / launch.json configurations
Created March 30, 2023 09:13
launch.json configurations
{
"name": "Attach to Frontend in Outlook (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://outlook.office.com/host/${local:teamsAppId}?${account-hint}",
"presentation": {
"group": "all",
"hidden": true
},
"internalConsoleOptions": "neverOpen"
@aycabas
aycabas / Sample Dashboard
Created March 30, 2023 09:08
Sample Dashboard
import { Dashboard } from "../lib/Dashboard";
import { DevOps } from "../widgets/DevOpsWidget";
import { GithubIssues } from "../widgets/GitHubWidget";
import { oneColumn } from "../lib/Dashboard.styles";
export default class SampleDashboard extends Dashboard {
protected rowHeights(): string | undefined {
return "320px 400px";
}
protected columnWidths(): string | undefined {
@aycabas
aycabas / GitHub Widget
Created March 30, 2023 09:06
GitHub Widget
import "../styles/GitHub.css";
import { Button, Image, Text } from "@fluentui/react-components";
import { Open16Regular } from "@fluentui/react-icons";
import { githubIssuesModel } from "../../models/githubIssuesModel";
import { getIssues } from "../../services/githubService";
import { Widget } from "../lib/Widget";
import { headerStyles, widgetStyles } from "../lib/Widget.styles";
interface IIssueState {
issues?: githubIssuesModel[];
}
@aycabas
aycabas / an HTTP call to GitHub API
Created March 30, 2023 09:01
an HTTP call to GitHub API
import { githubIssuesModel } from "../models/githubIssuesModel";
import { Octokit } from "octokit";
export async function getIssues(): Promise<githubIssuesModel[]> {
const octokit = new Octokit({ //github personal access token auth: "GITHUB_PERSONAL_ACCESS_TOKEN" })
try {
const resp = await octokit.request('GET /repos/{owner}/{repo}/issues', {
//repository name and owner name
owner: "OWNER_NAME",
repo: "REPOSITORY_NAME"
})
@aycabas
aycabas / npm install octokit
Created March 30, 2023 08:57
npm install octokit
npm install octokit
@aycabas
aycabas / DevOps Widget
Created March 30, 2023 08:56
DevOps Widget
import { CircleSmall20Filled } from "@fluentui/react-icons";
import { DevOpsModel } from "../../models/devOpsModel";
import { DevOpsWorkItems } from "../../services/devopsService";
import { Widget } from "../lib/Widget";
import { headerStyles } from "../lib/Widget.styles";
interface IWorkItemState {
devOpsData?: DevOpsModel[];
}
export class DevOps extends Widget<IWorkItemState> {
@aycabas
aycabas / retrieve the response value from DevOps
Created March 30, 2023 06:58
retrieve the response value from DevOps
const devopsValue = req["value"];
for (const obj of devopsValue)
{
const tmp: DevOpsModel = {
id: obj["id"], url: obj["url"],
fields: {
title: obj["fields"]["System.Title"],
workItemType: obj["fields"]["System.WorkItemType"],
assigendTo: {
displayName: obj["fields"]["System.AssignedTo"]["displayName"],
@aycabas
aycabas / an HTTP call to DevOps API
Last active March 30, 2023 06:55
an HTTP call to DevOps API
import { DevOpsModel } from "../models/devOpsModel";
export async function DevOpsWorkItems(): Promise<DevOpsModel[]>
{
try
{
let devopsItems: DevOpsModel[] = [];
const req = await fetch( "https://dev.azure.com/ORGANIZATION_NAME/PROJECT_NAME/_apis/wit/workitems?ids=1,2,3,4,5&api-version=7.0",
{ method: "GET", headers: { "Content-Type": "application/json; charset=utf-8;", Authorization: "Basic " + btoa("Basic" + ":" + "DEVOPS_PERSONAL_ACCESS_TOKEN"), }, })
.then((response) => response.json()).then((req) => { return req; });
return;