Commit 89709ac1 authored by Muhammad Saroosh Asif's avatar Muhammad Saroosh Asif
Browse files

Revised

parent 939936d9
......@@ -14,4 +14,5 @@ last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line.
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
......@@ -9,9 +9,12 @@
# dependencies
/node_modules
# also for the server
/server-ws-20-21/node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
......@@ -43,3 +46,6 @@ testem.log
# System Files
.DS_Store
Thumbs.db
# Wiki?
# mit-ws-20-21.wiki
# MITIOSAPP
# MIT-IO-APP
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.12.
## PROJECT NAME
International Office App
## Development server
## MEMBERS
* Sabih Waseem Khan (12102800)
* Muhammad Danyal Butt (00772823)
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
## MYGIT REPOSITORY
https://mygit.th-deg.de/sw15800/mit-io-app
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": "8e778469-a346-4862-819d-b26cbe58dffb"
},
"version": 1,
"newProjectRoot": "projects",
"projects": {
"MIT-IOSAPP": {
"mit-ws": {
"projectType": "application",
"schematics": {
"@schematics/angular:application": {
"strict": true
}
},
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
......@@ -17,70 +16,69 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/MIT-IOSAPP",
"outputPath": "dist/mit-ws",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/custom-theme.scss",
"src/styles.css"
"src/styles.css",
"src/custom-theme.scss"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
"maximumWarning": "6kb",
"maximumError": "10kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
]
}
},
"defaultConfiguration": "production"
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "mit-ws:build",
"proxyConfig": "src/proxy.conf.json"
},
"configurations": {
"production": {
"browserTarget": "MIT-IOSAPP:build:production"
},
"development": {
"browserTarget": "MIT-IOSAPP:build:development"
"browserTarget": "mit-ws:build:production"
}
},
"defaultConfiguration": "development"
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "MIT-IOSAPP:build"
"browserTarget": "mit-ws:build"
}
},
"test": {
......@@ -95,13 +93,39 @@
"src/assets"
],
"styles": [
"src/styles.css"
"src/styles.css",
"src/custom-theme.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "mit-ws:serve"
},
"configurations": {
"production": {
"devServerTarget": "mit-ws:serve:production"
}
}
}
}
}
},
"defaultProject": "MIT-IOSAPP"
}
"defaultProject": "mit-ws"
}
\ No newline at end of file
[1121/112113.467:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
[1121/163321.128:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: StacktraceOption.PRETTY
}
}));
}
};
\ No newline at end of file
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('mit-ws app is running!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo(): Promise<unknown> {
return browser.get(browser.baseUrl) as Promise<unknown>;
}
getTitleText(): Promise<string> {
return element(by.css('app-root .content span')).getText() as Promise<string>;
}
}
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es2018",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
......@@ -9,28 +9,16 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/MIT-IOSAPP'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/mit-ws'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
......
This diff is collapsed.
{
"name": "mit-iosapp",
"name": "mit-ws",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"compodoc": "npx compodoc -p tsconfig.app.json src",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~12.2.0",
"@angular/cdk": "^12.2.13",
"@angular/common": "~12.2.0",
"@angular/compiler": "~12.2.0",
"@angular/core": "~12.2.0",
"@angular/forms": "~12.2.0",
"@angular/material": "^12.2.13",
"@angular/platform-browser": "~12.2.0",
"@angular/platform-browser-dynamic": "~12.2.0",
"@angular/router": "~12.2.0",
"rxjs": "~6.6.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
"@angular/animations": "~10.0.5",
"@angular/cdk": "^10.2.7",
"@angular/common": "~10.0.5",
"@angular/compiler": "~10.0.5",
"@angular/core": "~10.0.5",
"@angular/flex-layout": "^11.0.0-beta.33",
"@angular/forms": "~10.0.5",
"@angular/material": "^10.2.7",
"@angular/platform-browser": "~10.0.5",
"@angular/platform-browser-dynamic": "~10.0.5",
"@angular/router": "~10.0.5",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"ngx-socket-io": "^3.2.0",
"ngx-translate-cache": "^9.0.2",
"rxjs": "~6.5.5",
"socket.io-client": "^3.0.4",
"tslib": "^2.0.0",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.12",
"@angular/cli": "~12.2.12",
"@angular/compiler-cli": "~12.2.0",
"@types/jasmine": "~3.8.0",
"@angular-devkit/build-angular": "^0.1100.7",
"@angular/cli": "~10.0.4",
"@angular/compiler-cli": "~10.0.5",
"@compodoc/compodoc": "^1.1.11",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"jasmine-core": "~3.8.0",
"karma": "~6.3.0",
"@types/socket.io-client": "^1.4.34",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.3.5"
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.9.5"
}
}
<div style="text-align:center">
<h1>
Welcome User with E-Mail {{userName}}!
</h1>
<p>
<button mat-button color="warn" (click)="logout()">
Logout
</button>
</p>
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AdminComponent } from './admin.component';
import { RouterTestingModule } from '@angular/router/testing';
import { JwtService } from '../jwt.service';
describe('AdminComponent', () => {
let component: AdminComponent;
let fixture: ComponentFixture<AdminComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [AdminComponent],
imports: [RouterTestingModule],
providers: [JwtService]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AdminComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should set an Item', () => {
localStorage.setItem('access_token', 'u;p'); // u;p
expect(localStorage.getItem('access_token')).toBeDefined(); // u;p .toBe('u;p')
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { JwtService } from '../jwt.service';
@Component({
selector: 'app-admin',
templateUrl: './admin.component.html',
styleUrls: ['./admin.component.css']
})
export class AdminComponent implements OnInit {
constructor(private jwtService: JwtService, private router: Router) { }
ngOnInit(): void {
this.userName = localStorage.getItem('access_token').split(";")[0];
}
userName = "";
logout() {
this.jwtService.logout();
this.router.navigateByUrl('/login');
}
}
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: '', loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule)
},
{
path: 'page', loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule)
},
{
path: 'user', loadChildren: () => import('./user/user.module').then(m => m.UserModule)
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
.mainheader {
margin-bottom: 10%;
}
.firstnav {
background-color: #f8f9fa !important;
z-index: 1 !important;
position: fixed;
}
.secondnav {
background-color: #333333c7 !important;
height: 95px !important;
margin-top: 1%;
z-index: 1 !important;
position: fixed;
}
.spacer {
flex: 1 1 auto;
}
.firstnavbtn {
font-size: 17.3333px !important;
color: black !important;
}
.secondnavbtn {
border: unset !important;
background: unset !important;
font-family: sans-serif !important;
color: white !important;
font-weight: bold !important;
}
.btndiv {
margin-top: 2em !important;
}
.mat-icon-button {
width: auto;
padding: 10px;
}
.mat-icon {
font-size: 2em !important;
}
\ No newline at end of file
<!-- first header -->
<div class="mainheader">
<mat-toolbar class="firstnav">
<button mat-icon-button class="firstnavbtn">
PRESS
</button>
<button mat-icon-button class="firstnavbtn">
ALUMNI
</button>
<button mat-icon-button class=" firstnavbtn">
INTERNATIONAL
</button>
<button mat-icon-button class=" firstnavbtn">
BLOG
</button>
<span class="spacer"></span>
<app-select-language></app-select-language>