Commit cd8cb6a7 authored by Meet Narendra's avatar Meet Narendra 💬

Frontend ese1

parent 39bcf6d8
......@@ -23,6 +23,10 @@ import { JiraComponent } from './jira/jira.component';
import { ConfluenceComponent } from './confluence/confluence.component';
import { ProjectComponent } from './project/project.component';
import { MatTab, MatTabsModule } from '@angular/material/tabs';
import { MatStepperModule } from '@angular/material/stepper';
import { MatListModule } from '@angular/material/list';
@NgModule({
declarations: [
AppComponent,
......@@ -49,7 +53,9 @@ import { MatTab, MatTabsModule } from '@angular/material/tabs';
MatSidenavModule,
MatGridListModule,
MatCardModule,
MatTabsModule
MatTabsModule,
MatStepperModule,
MatListModule
],
providers: [CookieService],
bootstrap: [AppComponent]
......
import { Component, OnInit } from '@angular/core';
import {Observable, Observer} from 'rxjs';
import { FetcherService } from '../fetcher.service';
@Component({
selector: 'app-confluence',
......@@ -6,10 +8,11 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./confluence.component.css']
})
export class ConfluenceComponent implements OnInit {
constructor() { }
projectId = NaN;
constructor(private fetcherService: FetcherService) { }
ngOnInit(): void {
this.projectId = this.fetcherService.getCurrentProjectId();
}
}
import { TestBed } from '@angular/core/testing';
import { FetcherService } from './fetcher.service';
describe('FetcherService', () => {
let service: FetcherService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(FetcherService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class FetcherService {
currentProjectId = NaN;
getCurrentProjectId() {
return this.currentProjectId;
}
setCurrentProjectId(id: number) {
this.currentProjectId = id;
}
constructor() { }
}
import { Component, OnInit } from '@angular/core';
import {Observable, Observer} from 'rxjs';
import { FetcherService } from '../fetcher.service';
export interface entry{
id: number;
name: string;
commitMessage: string;
commitDate: string;
type: string;
url: string;
}
@Component({
selector: 'app-github',
......@@ -6,10 +18,28 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./github.component.css']
})
export class GithubComponent implements OnInit {
constructor() { }
projectId = NaN;
constructor(private fetcherService: FetcherService) {
}
fetchData(id: number) {
//return dummy data of type entry
return [
{id: 1, name: "test", commitMessage: "test", commitDate: "test", type: "folder", url: "test"},
{id: 2, name: "test", commitMessage: "test", commitDate: "test", type: "folder", url: "test"},
{id: 3, name: "test", commitMessage: "test", commitDate: "test", type: "folder", url: "test"},
{id: 4, name: "test", commitMessage: "test", commitDate: "test", type: "folder", url: "test"},
{id: 5, name: "test", commitMessage: "test", commitDate: "test", type: "folder", url: "test"},
{id: 1, name: "test", commitMessage: "test", commitDate: "test", type: "file", url: "test"},
{id: 2, name: "test", commitMessage: "test", commitDate: "test", type: "file", url: "test"},
{id: 3, name: "test", commitMessage: "test", commitDate: "test", type: "file", url: "test"},
{id: 4, name: "test", commitMessage: "test", commitDate: "test", type: "file", url: "test"},
{id: 5, name: "test", commitMessage: "test", commitDate: "test", type: "file", url: "test"},
]
}
ngOnInit(): void {
this.projectId = this.fetcherService.getCurrentProjectId();
console.log(this.projectId);
}
}
\ No newline at end of file
......@@ -31,7 +31,7 @@
<button mat-icon-button class="example-icon" (click)="drawer.toggle()" aria-label="">
<mat-icon>menu</mat-icon>
</button>
<span>Projects</span>
<span>Home</span>
<span class="example-spacer"></span>
</div>
<div class="flex-item">
......
import { Component, OnInit } from '@angular/core';
import {Observable, Observer} from 'rxjs';
import { FetcherService } from '../fetcher.service';
@Component({
selector: 'app-jira',
......@@ -6,10 +8,11 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./jira.component.css']
})
export class JiraComponent implements OnInit {
constructor() { }
projectId = NaN;
constructor(private fetcherService: FetcherService) { }
ngOnInit(): void {
this.projectId = this.fetcherService.getCurrentProjectId();
}
}
......@@ -3,7 +3,7 @@
}
.example-header-image {
background-image: url('https://material.angular.io/assets/img/examples/shiba1.jpg');
background-image: url('https://cdn.pixabay.com/photo/2017/01/10/03/54/avatar-1968236_960_720.png');
background-size: cover;
}
#nav{
......@@ -34,3 +34,14 @@
height: 85%;
background-color: snow;
}
#profile-comp{
display: flex;
justify-content: space-around;
}
.example-input-wrapper {
margin-bottom: 16px;
}
label {
margin-right: 4px;
}
\ No newline at end of file
......@@ -30,7 +30,7 @@
<button mat-icon-button class="example-icon" (click)="drawer.toggle()" aria-label="">
<mat-icon>menu</mat-icon>
</button>
<span>Projects</span>
<span>Profile</span>
<span class="example-spacer"></span>
</div>
<div class="flex-item">
......@@ -43,24 +43,56 @@
</div>
</mat-toolbar>
</p>
<div>
<mat-card class="example-card">
<div id="profile-comp" class="flex-container row">
<mat-card class="example-card flex-item">
<mat-card-header>
<div mat-card-avatar class="example-header-image"></div>
<mat-card-title>Shiba Inu</mat-card-title>
<mat-card-subtitle>Dog Breed</mat-card-subtitle>
<mat-card-title>First Name Last Name</mat-card-title>
<mat-card-subtitle>Employee Designation</mat-card-subtitle>
</mat-card-header>
<img mat-card-image src="https://material.angular.io/assets/img/examples/shiba2.jpg" alt="Photo of a Shiba Inu">
<mat-card-content>
<p>
The Shiba Inu is the smallest of the six original and distinct spitz breeds of dog from Japan.
A small, agile dog that copes very well with mountainous terrain, the Shiba Inu was originally
bred for hunting.
Some catchy bio.
</p>
</mat-card-content>
<mat-card-actions>
<button mat-button>Edit Profile</button>
</mat-card-actions>
</mat-card>
<mat-vertical-stepper [linear]="false" #stepper >
<mat-step [stepControl]="firstFormGroup">
<form [formGroup]="firstFormGroup">
<ng-template matStepLabel>Fill out your name</ng-template>
<mat-form-field>
<input matInput placeholder="Last name, First name" formControlName="firstCtrl" required>
</mat-form-field>
<div>
<button mat-button matStepperNext>Next</button>
</div>
</form>
</mat-step>
<mat-step [stepControl]="secondFormGroup">
<form [formGroup]="secondFormGroup">
<ng-template matStepLabel>Fill out your address</ng-template>
<mat-form-field>
<input matInput placeholder="Address" formControlName="secondCtrl" required>
</mat-form-field>
<div>
<button mat-button matStepperPrevious>Back</button>
<button mat-button matStepperNext>Next</button>
</div>
</form>
</mat-step>
<mat-step>
<ng-template matStepLabel>Done</ng-template>
You are now done.
<div>
<button mat-button matStepperPrevious>Back</button>
<button mat-button (click)="stepper.reset()">Reset</button>
</div>
</mat-step>
</mat-vertical-stepper>
</div>
</mat-drawer-container>
import { Component, OnInit } from '@angular/core';
import { CookieService } from 'ngx-cookie-service';
import {FormBuilder, FormGroup} from '@angular/forms';
@Component({
selector: 'app-profile',
......@@ -7,8 +8,12 @@ import { CookieService } from 'ngx-cookie-service';
styleUrls: ['./profile.component.css']
})
export class ProfileComponent implements OnInit {
constructor(private cookieService: CookieService) { }
firstFormGroup: FormGroup;
secondFormGroup: FormGroup;
constructor(private cookieService: CookieService,private _formBuilder: FormBuilder) {
this.firstFormGroup = this._formBuilder.group({firstCtrl: ['']});
this.secondFormGroup = this._formBuilder.group({secondCtrl: ['']});
}
ngOnInit(): void {
}
......
......@@ -46,10 +46,13 @@
Loading tabs...
</ng-container>
<mat-tab-group mat-align-tabs="center">
<mat-tab *ngFor="let tab of asyncTabs | async">
<mat-tab-group mat-align-tabs="center" selectedIndex="1" (selectedTabChange)="changeTab($event)">
<mat-tab *ngFor="let tab of asyncTabs | async" >
<ng-template mat-tab-label>{{tab.label}}</ng-template>
{{tab.content}}
<app-github *ngIf="tabInd===1" routerLink="['']" [state]="{id:id,name:name}"></app-github>
<app-jira *ngIf="tabInd===3"></app-jira>
<app-confluence *ngIf="tabInd===2"></app-confluence>
<app-slack *ngIf="tabInd===4"></app-slack>
</mat-tab>
</mat-tab-group>
</p>
......
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import {Observable, Observer} from 'rxjs';
import { GithubComponent } from '../github/github.component';
import { JiraComponent } from '../jira/jira.component';
import { SlackComponent } from '../slack/slack.component';
import { ConfluenceComponent } from '../confluence/confluence.component';
import { FetcherService } from '../fetcher.service';
export interface ExampleTab {
label: string;
content: string;
......@@ -14,8 +19,9 @@ export interface ExampleTab {
export class ProjectComponent implements OnInit {
id: number;
name: string;
tabInd = 1;
asyncTabs: Observable<ExampleTab[]>;
constructor() {
constructor(private fetcherService: FetcherService) {
console.log(window.history.state);
this.id = window.history.state.id;
this.name = window.history.state.name;
......@@ -30,7 +36,11 @@ export class ProjectComponent implements OnInit {
}, 1000);
});
}
changeTab(event: any) {
this.tabInd = event.index+1;
}
ngOnInit(): void {
this.fetcherService.setCurrentProjectId(this.id);
}
}
import { Component, OnInit } from '@angular/core';
import {Observable, Observer} from 'rxjs';
import { FetcherService } from '../fetcher.service';
@Component({
selector: 'app-slack',
......@@ -6,10 +8,11 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./slack.component.css']
})
export class SlackComponent implements OnInit {
constructor() { }
projectId = NaN;
constructor(private fetcherService: FetcherService) { }
ngOnInit(): void {
this.projectId = this.fetcherService.getCurrentProjectId();
}
}
......@@ -4,6 +4,7 @@ from .models import *
from .serializers import *
from rest_framework import viewsets,views
from rest_framework.response import Response
#from sitcomm.conf import *
class UserViewSet(viewsets.ModelViewSet):
queryset = Users.objects.all()
......@@ -50,3 +51,15 @@ class registerViewSet(views.APIView):
return Response({'uid':user.uid,'status':True})
except:
return Response({'status':False})
class getReposViewSet(views.APIView):
def get(self,request):
uid = request.GET.get('uid')
try:
user = Users.objects.get(uid=uid)
if user is None:
return Response({'status':False})
repos = Projects.objects.filter(uid=user)
return Response({'repos':repos,'status':True})
except:
return Response({'status':False})
\ No newline at end of file
#CONSTANTS FILE
GITHUB_TOKEN = "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"
GITHUB_GET_REPOS_URL = f'curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer {GITHUB_TOKEN}" \
https://api.github.com/users/USERID/repos'
GITHUB_GET_REPO_URL = f'curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer {GITHUB_TOKEN}" \
https://api.github.com/repos/USERID/REPONAME'
GITHUB_GET_REPO_FILES_URL = f'curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer {GITHUB_TOKEN}" \
https://api.github.com/repos/USERID/REPONAME/contents/'
GITHUB_GET_REPO_FILE_URL = f'curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer {GITHUB_TOKEN}" \
https://api.github.com/repos/USERID/REPONAME/contents/FILENAME'
\ No newline at end of file
from django.db import models
from home.models import *
# Create your models here.
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
django = "*"
[dev-packages]
[requires]
python_version = "3.10"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment