Added Bit Calculation Page
This commit is contained in:
@@ -4,6 +4,7 @@ import { ShiftUpdateComponent } from './components/pages/shift-update/shift-upda
|
||||
import { NoMansLandComponent } from './components/pages/no-mans-land/no-mans-land.component';
|
||||
import { ToolListComponent } from './components/pages/tool-list/tool-list.component';
|
||||
import { LoginComponent } from './components/pages/login/login.component';
|
||||
import { BitComponent } from './components/pages/bit/bit.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
{path: "", component: NoMansLandComponent},
|
||||
@@ -11,5 +12,6 @@ export const routes: Routes = [
|
||||
{path: "update", component: ShiftUpdateComponent},
|
||||
{path: "creds", component: ToolListComponent },
|
||||
{path: "login", component: LoginComponent },
|
||||
{path: 'bits', component: BitComponent},
|
||||
{path: "**", component: NoMansLandComponent},
|
||||
];
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<<<<<<< HEAD
|
||||
<tr *ngFor="let backup of backupVolumes">
|
||||
<td><a target="_blank" [href]=backup.projectURL>{{backup.projectName}}</a></td>
|
||||
<td><a target="_blank" [href]=backup.volumeURL>{{backup.volumeName}}</a></td>
|
||||
<td class="copyName" #copy (click)="copyName(copy)">{{backup.volumeName}}-{{currentDate | date: 'dd-MM-YYYY'}}-Cloud</td>
|
||||
</tr>
|
||||
=======
|
||||
<ng-container *ngFor="let backup of backupVolumes">
|
||||
<tr *ngIf="backup.backupDay.includes(today)">
|
||||
<td><a target="_blank" [href]=backup.projectURL>{{backup.projectName}}</a></td>
|
||||
@@ -33,7 +31,6 @@
|
||||
<td class="copyName" #copy (click)="copyName(copy)">{{backup.volumeName}}-{{currentDate | date: 'dd-MM-YYYY'}}-Cloud</td>
|
||||
</tr>
|
||||
</ng-container>
|
||||
>>>>>>> 01af0bf3951d914c030f1d261a3f1a53c28f6d10
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
16
src/app/components/pages/bit/bit.component.html
Normal file
16
src/app/components/pages/bit/bit.component.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<div class="container">
|
||||
<div class="units">
|
||||
<div class="unit" (click)="onUnitClick('bit')">Bits</div>
|
||||
<div class="unit" (click)="onUnitClick('bytes')">Bytes</div>
|
||||
<div class="unit" (click)="onUnitClick('mb')">MegaBytes</div>
|
||||
<div class="unit" (click)="onUnitClick('gb')">GigaBytes</div>
|
||||
<div class="unit" (click)="onUnitClick('pb')">PetaBytes</div>
|
||||
</div>
|
||||
<div class="input">
|
||||
<label for="cal-value">Enter Value: </label>
|
||||
<input type="text" id="cal-value" class=form-control name="calc-value" [(ngModel)]="value"><span> GB</span>
|
||||
</div>
|
||||
<div class="output">
|
||||
<p>{{ value * factor }} {{selectedUnit}}</p>
|
||||
</div>
|
||||
</div>
|
||||
29
src/app/components/pages/bit/bit.component.scss
Normal file
29
src/app/components/pages/bit/bit.component.scss
Normal file
@@ -0,0 +1,29 @@
|
||||
.container {
|
||||
margin: 2rem;
|
||||
|
||||
.units{
|
||||
display: flex;
|
||||
padding-bottom: 2rem;
|
||||
.unit{
|
||||
padding: 1rem;
|
||||
cursor: pointer;
|
||||
&:hover{
|
||||
background-color: lightcoral;
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label {
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
input{
|
||||
border: none;
|
||||
border-bottom: 2px solid black;
|
||||
border-radius: 5px;
|
||||
padding-left: 1rem;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
23
src/app/components/pages/bit/bit.component.spec.ts
Normal file
23
src/app/components/pages/bit/bit.component.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BitComponent } from './bit.component';
|
||||
|
||||
describe('BitComponent', () => {
|
||||
let component: BitComponent;
|
||||
let fixture: ComponentFixture<BitComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [BitComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(BitComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
45
src/app/components/pages/bit/bit.component.ts
Normal file
45
src/app/components/pages/bit/bit.component.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bit',
|
||||
standalone: true,
|
||||
imports: [CommonModule,FormsModule],
|
||||
templateUrl: './bit.component.html',
|
||||
styleUrl: './bit.component.scss'
|
||||
})
|
||||
export class BitComponent implements OnInit {
|
||||
value: number = 0;
|
||||
selectedUnit: string = "";
|
||||
factor: number = 0;
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
onUnitClick(unit: string){
|
||||
this.selectedUnit = unit;
|
||||
switch (unit) {
|
||||
case 'bit':
|
||||
this.factor = 1024 ** 2 * 8 ;
|
||||
break;
|
||||
case 'bytes':
|
||||
this.factor = 1024 ** 2 ;
|
||||
break;
|
||||
case 'mb':
|
||||
this.factor = 1024 ** 1 ;
|
||||
break;
|
||||
case 'gb':
|
||||
this.factor = 1 ;
|
||||
break;
|
||||
case 'pb':
|
||||
this.factor = 1/1024 ;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,9 +3,5 @@ export class Backup{
|
||||
projectURL!: string;
|
||||
volumeName!: string;
|
||||
volumeURL!: string;
|
||||
<<<<<<< HEAD
|
||||
day!: string;
|
||||
=======
|
||||
backupDay!: string[];
|
||||
>>>>>>> 01af0bf3951d914c030f1d261a3f1a53c28f6d10
|
||||
}
|
||||
Reference in New Issue
Block a user