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

Frontend ese1

parent 39bcf6d8
...@@ -23,6 +23,10 @@ import { JiraComponent } from './jira/jira.component'; ...@@ -23,6 +23,10 @@ import { JiraComponent } from './jira/jira.component';
import { ConfluenceComponent } from './confluence/confluence.component'; import { ConfluenceComponent } from './confluence/confluence.component';
import { ProjectComponent } from './project/project.component'; import { ProjectComponent } from './project/project.component';
import { MatTab, MatTabsModule } from '@angular/material/tabs'; import { MatTab, MatTabsModule } from '@angular/material/tabs';
import { MatStepperModule } from '@angular/material/stepper';
import { MatListModule } from '@angular/material/list';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
...@@ -49,7 +53,9 @@ import { MatTab, MatTabsModule } from '@angular/material/tabs'; ...@@ -49,7 +53,9 @@ import { MatTab, MatTabsModule } from '@angular/material/tabs';
MatSidenavModule, MatSidenavModule,
MatGridListModule, MatGridListModule,
MatCardModule, MatCardModule,
MatTabsModule MatTabsModule,
MatStepperModule,
MatListModule
], ],
providers: [CookieService], providers: [CookieService],
bootstrap: [AppComponent] bootstrap: [AppComponent]
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {Observable, Observer} from 'rxjs';
import { FetcherService } from '../fetcher.service';
@Component({ @Component({
selector: 'app-confluence', selector: 'app-confluence',
...@@ -6,10 +8,11 @@ import { Component, OnInit } from '@angular/core'; ...@@ -6,10 +8,11 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./confluence.component.css'] styleUrls: ['./confluence.component.css']
}) })
export class ConfluenceComponent implements OnInit { export class ConfluenceComponent implements OnInit {
projectId = NaN;
constructor() { } constructor(private fetcherService: FetcherService) { }
ngOnInit(): void { 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 { 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({ @Component({
selector: 'app-github', selector: 'app-github',
...@@ -6,10 +18,28 @@ import { Component, OnInit } from '@angular/core'; ...@@ -6,10 +18,28 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./github.component.css'] styleUrls: ['./github.component.css']
}) })
export class GithubComponent implements OnInit { export class GithubComponent implements OnInit {
projectId = NaN;
constructor() { } 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 { ngOnInit(): void {
this.projectId = this.fetcherService.getCurrentProjectId();
console.log(this.projectId);
} }
} }
\ No newline at end of file
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<button mat-icon-button class="example-icon" (click)="drawer.toggle()" aria-label=""> <button mat-icon-button class="example-icon" (click)="drawer.toggle()" aria-label="">
<mat-icon>menu</mat-icon> <mat-icon>menu</mat-icon>
</button> </button>
<span>Projects</span> <span>Home</span>
<span class="example-spacer"></span> <span class="example-spacer"></span>
</div> </div>
<div class="flex-item"> <div class="flex-item">
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {Observable, Observer} from 'rxjs';
import { FetcherService } from '../fetcher.service';
@Component({ @Component({
selector: 'app-jira', selector: 'app-jira',
...@@ -6,10 +8,11 @@ import { Component, OnInit } from '@angular/core'; ...@@ -6,10 +8,11 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./jira.component.css'] styleUrls: ['./jira.component.css']
}) })
export class JiraComponent implements OnInit { export class JiraComponent implements OnInit {
projectId = NaN;
constructor() { } constructor(private fetcherService: FetcherService) { }
ngOnInit(): void { ngOnInit(): void {
this.projectId = this.fetcherService.getCurrentProjectId();
} }
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
} }
.example-header-image { .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; background-size: cover;
} }
#nav{ #nav{
...@@ -33,4 +33,15 @@ ...@@ -33,4 +33,15 @@
width: 85%; width: 85%;
height: 85%; height: 85%;
background-color: snow; 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 @@ ...@@ -30,7 +30,7 @@
<button mat-icon-button class="example-icon" (click)="drawer.toggle()" aria-label=""> <button mat-icon-button class="example-icon" (click)="drawer.toggle()" aria-label="">
<mat-icon>menu</mat-icon> <mat-icon>menu</mat-icon>
</button> </button>
<span>Projects</span> <span>Profile</span>
<span class="example-spacer"></span> <span class="example-spacer"></span>
</div> </div>
<div class="flex-item"> <div class="flex-item">
...@@ -43,24 +43,56 @@ ...@@ -43,24 +43,56 @@
</div> </div>
</mat-toolbar> </mat-toolbar>
</p> </p>
<div> <div id="profile-comp" class="flex-container row">
<mat-card class="example-card"> <mat-card class="example-card flex-item">
<mat-card-header> <mat-card-header>
<div mat-card-avatar class="example-header-image"></div> <div mat-card-avatar class="example-header-image"></div>
<mat-card-title>Shiba Inu</mat-card-title> <mat-card-title>First Name Last Name</mat-card-title>
<mat-card-subtitle>Dog Breed</mat-card-subtitle> <mat-card-subtitle>Employee Designation</mat-card-subtitle>
</mat-card-header> </mat-card-header>
<img mat-card-image src="https://material.angular.io/assets/img/examples/shiba2.jpg" alt="Photo of a Shiba Inu"> <img mat-card-image src="https://material.angular.io/assets/img/examples/shiba2.jpg" alt="Photo of a Shiba Inu">
<mat-card-content> <mat-card-content>
<p> <p>
The Shiba Inu is the smallest of the six original and distinct spitz breeds of dog from Japan. Some catchy bio.
A small, agile dog that copes very well with mountainous terrain, the Shiba Inu was originally
bred for hunting.
</p> </p>
</mat-card-content> </mat-card-content>
<mat-card-actions> <mat-card-actions>
<button mat-button>Edit Profile</button> <button mat-button>Edit Profile</button>
</mat-card-actions> </mat-card-actions>
</mat-card> </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> </div>
</mat-drawer-container> </mat-drawer-container>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { CookieService } from 'ngx-cookie-service'; import { CookieService } from 'ngx-cookie-service';
import {FormBuilder, FormGroup} from '@angular/forms';
@Component({ @Component({
selector: 'app-profile', selector: 'app-profile',
...@@ -7,8 +8,12 @@ import { CookieService } from 'ngx-cookie-service'; ...@@ -7,8 +8,12 @@ import { CookieService } from 'ngx-cookie-service';
styleUrls: ['./profile.component.css'] styleUrls: ['./profile.component.css']
}) })
export class ProfileComponent implements OnInit { export class ProfileComponent implements OnInit {
firstFormGroup: FormGroup;
constructor(private cookieService: CookieService) { } secondFormGroup: FormGroup;
constructor(private cookieService: CookieService,private _formBuilder: FormBuilder) {
this.firstFormGroup = this._formBuilder.group({firstCtrl: ['']});
this.secondFormGroup = this._formBuilder.group({secondCtrl: ['']});
}
ngOnInit(): void { ngOnInit(): void {
} }
......
...@@ -46,10 +46,13 @@ ...@@ -46,10 +46,13 @@
Loading tabs... Loading tabs...
</ng-container> </ng-container>
<mat-tab-group mat-align-tabs="center"> <mat-tab-group mat-align-tabs="center" selectedIndex="1" (selectedTabChange)="changeTab($event)">
<mat-tab *ngFor="let tab of asyncTabs | async"> <mat-tab *ngFor="let tab of asyncTabs | async" >
<ng-template mat-tab-label>{{tab.label}}</ng-template> <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>
</mat-tab-group> </mat-tab-group>
</p> </p>
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import {Observable, Observer} from 'rxjs'; 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 { export interface ExampleTab {
label: string; label: string;
content: string; content: string;
...@@ -14,8 +19,9 @@ export interface ExampleTab { ...@@ -14,8 +19,9 @@ export interface ExampleTab {
export class ProjectComponent implements OnInit { export class ProjectComponent implements OnInit {
id: number; id: number;
name: string; name: string;
tabInd = 1;
asyncTabs: Observable<ExampleTab[]>; asyncTabs: Observable<ExampleTab[]>;
constructor() { constructor(private fetcherService: FetcherService) {
console.log(window.history.state); console.log(window.history.state);
this.id = window.history.state.id; this.id = window.history.state.id;
this.name = window.history.state.name; this.name = window.history.state.name;
...@@ -30,7 +36,11 @@ export class ProjectComponent implements OnInit { ...@@ -30,7 +36,11 @@ export class ProjectComponent implements OnInit {
}, 1000); }, 1000);
}); });
} }
changeTab(event: any) {
this.tabInd = event.index+1;
}
ngOnInit(): void { ngOnInit(): void {
this.fetcherService.setCurrentProjectId(this.id);
} }
} }
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {Observable, Observer} from 'rxjs';
import { FetcherService } from '../fetcher.service';
@Component({ @Component({
selector: 'app-slack', selector: 'app-slack',
...@@ -6,10 +8,11 @@ import { Component, OnInit } from '@angular/core'; ...@@ -6,10 +8,11 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./slack.component.css'] styleUrls: ['./slack.component.css']
}) })
export class SlackComponent implements OnInit { export class SlackComponent implements OnInit {
projectId = NaN;
constructor() { } constructor(private fetcherService: FetcherService) { }
ngOnInit(): void { ngOnInit(): void {
this.projectId = this.fetcherService.getCurrentProjectId();
} }
} }
...@@ -4,6 +4,7 @@ from .models import * ...@@ -4,6 +4,7 @@ from .models import *
from .serializers import * from .serializers import *
from rest_framework import viewsets,views from rest_framework import viewsets,views
from rest_framework.response import Response from rest_framework.response import Response
#from sitcomm.conf import *
class UserViewSet(viewsets.ModelViewSet): class UserViewSet(viewsets.ModelViewSet):
queryset = Users.objects.all() queryset = Users.objects.all()
...@@ -48,5 +49,17 @@ class registerViewSet(views.APIView): ...@@ -48,5 +49,17 @@ class registerViewSet(views.APIView):
try: try:
user = Users.objects.create(email=email,password=password,role=role,active=True) user = Users.objects.create(email=email,password=password,role=role,active=True)
return Response({'uid':user.uid,'status':True}) 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: except:
return Response({'status':False}) 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 django.db import models
from home.models import *
# Create your models here. # 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