Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor Code] Remove unused services and imports #3547

Merged
merged 3 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend_v2/src/app/components/about/about.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, Inject } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { GlobalService } from '../../services/global.service';

/**
Expand Down
6 changes: 2 additions & 4 deletions frontend_v2/src/app/components/auth/auth.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { GlobalService } from '../../services/global.service';
import { AuthService } from '../../services/auth.service';

Expand All @@ -22,13 +22,11 @@ export class AuthComponent implements OnInit {
/**
* Constructor.
* @param router Router Injection.
* @param route ActivatedRoute Injection.
* @param globalService GlobalService Injection.
* @param authService AuthServiceInjection
*/
constructor(
private router: Router,
private route: ActivatedRoute,
private globalService: GlobalService,
public authService: AuthService
) {}
Expand Down
16 changes: 8 additions & 8 deletions frontend_v2/src/app/components/auth/login/login.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
id="name"
class="dark-autofill"
name="name"
(focusin)="isnameFocused = true"
(focusout)="isnameFocused = authService.getUser['name'] !== ''"
(focusin)="isNameFocused = true"
(focusout)="isNameFocused = authService.getUser['name'] !== ''"
[(ngModel)]="authService.getUser['name']"
(change)="isnameFocused = authService.getUser['name'] !== ''"
(change)="isNameFocused = authService.getUser['name'] !== ''"
#name="ngModel"
minLength="3"
required
/>
<span class="form-icon form-icon-dark"><i class="fa fa-user"></i></span>
<label for="name" [class.active]="isnameFocused">Username*</label>
<label for="name" [class.active]="isNameFocused">Username*</label>
<div class="wrn-msg text-highlight" *ngIf="name.invalid && (name.dirty || name.touched || loginForm.submitted)">
<p *ngIf="name.errors.minlength">Username is too short.</p>
<p *ngIf="name.errors.required">Username is required.</p>
Expand All @@ -50,9 +50,9 @@
(paste)="authService.getUser['password'] = ''"
class="dark-autofill"
name="password"
(focusin)="ispasswordFocused = true"
(focusout)="ispasswordFocused = authService.getUser['password'] !== ''"
(change)="ispasswordFocused = authService.getUser['password'] !== ''"
(focusin)="isPasswordFocused = true"
(focusout)="isPasswordFocused = authService.getUser['password'] !== ''"
(change)="isPasswordFocused = authService.getUser['password'] !== ''"
[(ngModel)]="authService.getUser['password']"
#password="ngModel"
autocomplete="new-password"
Expand All @@ -63,7 +63,7 @@
<i *ngIf="!authService.canShowPassword" class="fa fa-eye pointer"></i>
<i *ngIf="authService.canShowPassword" class="fa fa-eye-slash pointer"></i>
</span>
<label for="password" [class.active]="ispasswordFocused">Password (min 8 characters) *</label>
<label for="password" [class.active]="isPasswordFocused">Password (min 8 characters) *</label>
<div
class="wrn-msg text-highlight"
*ngIf="password.invalid && (password.dirty || password.touched || loginForm.submitted)"
Expand Down
29 changes: 7 additions & 22 deletions frontend_v2/src/app/components/auth/login/login.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { Component, OnInit, Inject } from '@angular/core';
import { ViewChildren, QueryList, AfterViewInit } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { InputComponent } from '../../../components/utility/input/input.component';
import { WindowService } from '../../../services/window.service';
import { Component, OnInit } from '@angular/core';
import { ApiService } from '../../../services/api.service';
import { AuthService } from '../../../services/auth.service';
import { GlobalService } from '../../../services/global.service';
import { EndpointsService } from '../../../services/endpoints.service';
import { Router, ActivatedRoute } from '@angular/router';
import { Router } from '@angular/router';

/**
* Component Class
Expand All @@ -17,9 +13,9 @@ import { Router, ActivatedRoute } from '@angular/router';
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss'],
})
export class LoginComponent implements OnInit, AfterViewInit {
isnameFocused = false;
ispasswordFocused = false;
export class LoginComponent implements OnInit {
isNameFocused = false;
isPasswordFocused = false;

/**
* Route path for challenge list
Expand Down Expand Up @@ -48,22 +44,16 @@ export class LoginComponent implements OnInit, AfterViewInit {

/**
* Constructor.
* @param document window document injection
* @param windowService
* @param globalService GlobalService Injection.
* @param apiService ApiService Injection
* @param authService AuthService Injection
* @param router Router Injection.
* @param route ActivatedRoute Injection.
* @param globalService GlobalService Injection.
* @param endpointsService
* @param endpointsService EndPointsService Injection.
*/
constructor(
@Inject(DOCUMENT) private document: Document,
private windowService: WindowService,
private globalService: GlobalService,
private apiService: ApiService,
public authService: AuthService,
private route: ActivatedRoute,
private router: Router,
private endpointsService: EndpointsService
) {}
Expand All @@ -78,11 +68,6 @@ export class LoginComponent implements OnInit, AfterViewInit {
this.authService.resetForm();
}

/**
* After view is initialized.
*/
ngAfterViewInit() {}

/**
* Constructor.
* @param self Router Injection.
Expand Down
14 changes: 3 additions & 11 deletions frontend_v2/src/app/components/auth/signup/signup.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Component, OnInit, Inject } from '@angular/core';
import { AfterViewInit } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { WindowService } from '../../../services/window.service';
import { ApiService } from '../../../services/api.service';
import { EndpointsService } from '../../../services/endpoints.service';
import { GlobalService } from '../../../services/global.service';
import { Router, ActivatedRoute } from '@angular/router';
import { Router } from '@angular/router';
import { AuthService } from '../../../services/auth.service';

/**
Expand Down Expand Up @@ -37,22 +35,16 @@ export class SignupComponent implements OnInit, AfterViewInit {

/**
* Constructor.
* @param document window document Injection.
* @param windowService ActivatedRoute Injection.
* @param globalService GlobalService Injection.
* @param apiService ApiService Injection.
* @param authService
* @param authService AuthService Injection.
* @param endpointsService EndPointsService Injection.
* @param router Router Injection.
* @param route ActivatedRoute Injection.
* @param endpointsService
*/
constructor(
@Inject(DOCUMENT) private document: Document,
private windowService: WindowService,
private globalService: GlobalService,
private apiService: ApiService,
public authService: AuthService,
private route: ActivatedRoute,
private endpointsService: EndpointsService,
private router: Router
) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import { AuthService } from '../../../services/auth.service';
import { ApiService } from '../../../services/api.service';
import { GlobalService } from '../../../services/global.service';

/**
Expand Down Expand Up @@ -32,14 +31,10 @@ export class VerifyEmailComponent implements OnInit {
* Constructor.
* @param authService AuthService Injection.
* @param globalService GlobalService Injection.
* @param apiService Router Injection.
* @param route ActivatedRoute Injection.
* @param router GlobalService Injection.
*/
constructor(
private router: Router,
private route: ActivatedRoute,
private apiService: ApiService,
private globalService: GlobalService,
private authService: AuthService
) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Component, OnInit, ViewChildren, QueryList, Inject } from '@angular/core';
import { Component, OnInit, Inject } from '@angular/core';
import { AuthService } from '../../services/auth.service';
import { ApiService } from '../../services/api.service';
import { GlobalService } from '../../services/global.service';
import { ChallengeService } from '../../services/challenge.service';
import { Router, ActivatedRoute } from '@angular/router';
import { Router } from '@angular/router';
import { DOCUMENT } from '@angular/common';

/**
Expand Down Expand Up @@ -60,22 +59,18 @@ export class ChallengeCreateComponent implements OnInit {

/**
* Constructor.
* @param route ActivatedRoute Injection.
* @param router Router Injection.
* @param authService AuthService Injection.
* @param router Router Injection.
* @param challengeService ChallengeService Injection.
* @param document
* @param globalService GlobalService Injection.
* @param apiService ApiService Injection.
* @param challengeService ChallengeService Injection.
*/
constructor(
public authService: AuthService,
private router: Router,
private route: ActivatedRoute,
private challengeService: ChallengeService,
@Inject(DOCUMENT) private document,
private globalService: GlobalService,
private apiService: ApiService
private globalService: GlobalService
) {}

/**
Expand Down
20 changes: 3 additions & 17 deletions frontend_v2/src/app/components/challenge/challenge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import { Component, Inject, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Meta } from '@angular/platform-browser';
import { DOCUMENT } from '@angular/common';
import { NGXLogger } from 'ngx-logger';

// import services
import { AuthService } from '../../services/auth.service';
import { ApiService } from '../../services/api.service';
import { GlobalService } from '../../services/global.service';
import { ChallengeService } from '../../services/challenge.service';
import { EndpointsService } from '../../services/endpoints.service';

/**
* Component Class
Expand Down Expand Up @@ -70,33 +67,22 @@ export class ChallengeComponent implements OnInit {
*/
isLoggedIn: any = false;

/**
* To call the API inside modal for editing the challenge details
*/
apiCall: any;

/**
* Constructor.
* @param router Router Injection.
* @param route ActivatedRoute Injection.
* @param router GlobalService Injection.
* @param authService AuthService Injection.
* @param globalService GlobalService Injection.
* @param apiService Router Injection.
* @param endpointsService EndpointsService Injection.
* @param challengeService ChallengeService Injection.
* @param DOCUMENT Document Injection
* @param authService AuthService Injection.
*/
constructor(
@Inject(DOCUMENT) document: any,
private router: Router,
private route: ActivatedRoute,
private apiService: ApiService,
private globalService: GlobalService,
private challengeService: ChallengeService,
public authService: AuthService,
private endpointsService: EndpointsService,
private meta: Meta,
private logger: NGXLogger
private meta: Meta
) {}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Router } from '@angular/router';

import { AuthService } from '../../../services/auth.service';
import { ApiService } from '../../../services/api.service';
Expand Down Expand Up @@ -46,7 +46,6 @@ export class ChallengediscussComponent implements OnInit {
constructor(
private authService: AuthService,
private router: Router,
private route: ActivatedRoute,
private challengeService: ChallengeService,
private globalService: GlobalService,
private apiService: ApiService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { Component, OnInit, Inject } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { NGXLogger } from 'ngx-logger';

// import service
import { ChallengeService } from '../../../services/challenge.service';
import { ApiService } from '../../../services/api.service';
import { EndpointsService } from '../../../services/endpoints.service';
import { GlobalService } from '../../../services/global.service';

/**
* Component Class
Expand Down Expand Up @@ -37,12 +33,6 @@ export class ChallengeevaluationComponent implements OnInit {
*/
tncElement: any;

/**
* To call the API inside modal for editing the challenge evaluation
* details, evaluation script and terms and conditions
*/
apiCall: any;

/**
* Constructor.
* @param document window document Injection.
Expand All @@ -51,10 +41,6 @@ export class ChallengeevaluationComponent implements OnInit {
constructor(
private challengeService: ChallengeService,
@Inject(DOCUMENT) private document: Document,
private endpointsService: EndpointsService,
private apiService: ApiService,
private globalService: GlobalService,
private logger: NGXLogger
) {}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component, OnInit, QueryList, ViewChildren, AfterViewInit, OnDestroy } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Router, ActivatedRoute } from '@angular/router';
import { MatSliderChange } from '@angular/material';
import { NGXLogger } from 'ngx-logger';

// import component
Expand Down Expand Up @@ -211,12 +210,13 @@ export class ChallengeleaderboardComponent implements OnInit, AfterViewInit, OnD

/**
* Constructor.
* @param route ActivatedRoute Injection.
* @param router GlobalService Injection.
* @param authService AuthService Injection.
* @param globalService GlobalService Injection.
* @param apiService Router Injection.
* @param router Router Injection.
* @param route ActivatedRoute Injection.
* @param challengeService ChallengeService Injection.
* @param globalService GlobalService Injection.
* @param apiService ApiService Injection.
* @param endpointsService EndPointsService Injection.
*/
constructor(
private authService: AuthService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { Component, OnInit, Inject } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { NGXLogger } from 'ngx-logger';

// import service
import { GlobalService } from '../../../services/global.service';
import { ChallengeService } from '../../../services/challenge.service';
import { EndpointsService } from '../../../services/endpoints.service';

/**
* Component Class
Expand All @@ -28,15 +24,10 @@ export class ChallengeoverviewComponent implements OnInit {

/**
* Constructor.
* @param document Window document Injection.
* @param challengeService ChallengeService Injection.
*/
constructor(
private challengeService: ChallengeService,
@Inject(DOCUMENT) private document: Document,
private globalService: GlobalService,
private endpointsService: EndpointsService,
private logger: NGXLogger
private challengeService: ChallengeService
) {}

/**
Expand Down
Loading