diff --git a/Api/Models/poamMilestone.model.js b/Api/Models/poamMilestone.model.js index cae32297..d9233c7e 100644 --- a/Api/Models/poamMilestone.model.js +++ b/Api/Models/poamMilestone.model.js @@ -10,11 +10,6 @@ module.exports = (sequelize, DataTypes) => { type: DataTypes.INTEGER, allowNull: false }, - milestoneTitle: { - type: DataTypes.STRING(255), - allowNull: true, - defaultValue: '' - }, milestoneDate: { type: DataTypes.DATEONLY, allowNull: true, @@ -24,6 +19,11 @@ module.exports = (sequelize, DataTypes) => { allowNull: true, defaultValue: '' }, + milestoneStatus: { + type: DataTypes.STRING(10), + allowNull: true, + defaultValue: 'Pending' + }, }, { freezeTableName: true, timestamps: false, diff --git a/Api/Services/mysql/poamMilestoneService.js b/Api/Services/mysql/poamMilestoneService.js index f1a3ebf6..b7550fe6 100644 --- a/Api/Services/mysql/poamMilestoneService.js +++ b/Api/Services/mysql/poamMilestoneService.js @@ -67,20 +67,20 @@ exports.postPoamMilestone = async function postPoamMilestone(req, res, next) { }); } - if (!req.body.milestoneTitle) req.body.milestoneTitle = null; if (!req.body.milestoneDate) req.body.milestoneDate = null; if (!req.body.milestoneComments) req.body.milestoneComments = null; + if (!req.body.milestoneStatus) req.body.milestoneStatus = null; let connection; try { connection = await dbUtils.pool.getConnection(); - let sql_query = `INSERT INTO poamtracking.poamMilestones (poamId, milestoneTitle, milestoneDate, milestoneComments) values (?, ?, ?, ?)`; + let sql_query = `INSERT INTO poamtracking.poamMilestones (poamId, milestoneDate, milestoneComments, milestoneStatus) values (?, ?, ?, ?)`; await connection.query(sql_query, [ req.params.poamId, - req.body.milestoneTitle, req.body.milestoneDate, req.body.milestoneComments, + req.body.milestoneStatus, ]); let sql = @@ -134,19 +134,19 @@ exports.putPoamMilestone = async function putPoamMilestone(req, res, next) { }); } - if (!req.body.milestoneTitle) req.body.milestoneTitle = null; if (!req.body.milestoneDate) req.body.milestoneDate = null; if (!req.body.milestoneComments) req.body.milestoneComments = null; + if (!req.body.milestoneStatus) req.body.milestoneStatus = null; let connection; try { connection = await dbUtils.pool.getConnection(); - let sql_query = `UPDATE poamtracking.poammilestones SET milestoneTitle= ?, milestoneDate = ?, milestoneComments = ? WHERE poamId = ? AND milestoneId = ?`; + let sql_query = `UPDATE poamtracking.poammilestones SET milestoneDate = ?, milestoneComments = ?, milestoneStatus = ? WHERE poamId = ? AND milestoneId = ?`; await connection.query(sql_query, [ - req.body.milestoneTitle, req.body.milestoneDate, req.body.milestoneComments, + req.body.milestoneStatus, req.params.poamId, req.params.milestoneId, ]); @@ -192,7 +192,7 @@ exports.deletePoamMilestone = async function deletePoamMilestone( return next({ status: 422, errors: { - milestoneTitle: "is required", + milestoneId: "is required", }, }); } diff --git a/Api/Services/mysql/usersService.js b/Api/Services/mysql/usersService.js index d5b2b8c1..b5af3185 100644 --- a/Api/Services/mysql/usersService.js +++ b/Api/Services/mysql/usersService.js @@ -400,6 +400,9 @@ module.exports.generateJWT = async function (previousPayload, jwtSignOptions, us } else if (this.lastCollectionAccessedId) { payload.lastCollectionAccessedId = this.lastCollectionAccessedId; } + else if (user.accountStataus === 'Pending') { + console.log("User account is pending, not setting payload..."); + } else { // console.log("No lastCollectionAccessedId, not setting payload.lastCollectionAccessedId at all...") writeLog.writeLog(4, "usersService", 'info', req.userObject.username, req.userObject.displayName, { event: 'No lastCollectionAccessedId, not setting payload.lastCollectionAccessedId at all...' }) diff --git a/Api/specification/poam-manager.yaml b/Api/specification/poam-manager.yaml index 76a94566..e6e81ad8 100644 --- a/Api/specification/poam-manager.yaml +++ b/Api/specification/poam-manager.yaml @@ -2995,35 +2995,35 @@ components: type: integer poamId: type: integer - milestoneTitle: - type: string milestoneDate: type: string format: date milestoneComments: type: string + milestoneStatus: + type: string PoamMilestoneRequest: type: object properties: poamId: type: integer - milestoneTitle: - type: string milestoneDate: type: string milestoneComments: type: string + milestoneStatus: + type: string PoamMilestoneUpdateRequest: type: object properties: - milestoneTitle: - type: string milestoneDate: type: string milestoneComments: type: string + milestoneStatus: + type: string description: Schema for updating a milestone. All fields are optional, allowing partial updates. register: diff --git a/Database/POAM_Tracking_Tool_Data_Model.sql b/Database/POAM_Tracking_Tool_Data_Model.sql index 3d6514a8..80827f05 100644 --- a/Database/POAM_Tracking_Tool_Data_Model.sql +++ b/Database/POAM_Tracking_Tool_Data_Model.sql @@ -18,8 +18,8 @@ CREATE TABLE `poamtracking`.`user` ( `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `lastAccess` datetime DEFAULT NULL, `lastCollectionAccessedId` int NOT NULL DEFAULT '0', - `accountStatus` varchar(45) NOT NULL DEFAULT 'Pending', - `fullName` varchar(225) DEFAULT NULL, + `accountStatus` varchar(25) NOT NULL DEFAULT 'Pending', + `fullName` varchar(100) DEFAULT NULL, `defaultTheme` varchar(20) DEFAULT 'dark', `isAdmin` int NOT NULL DEFAULT '0', PRIMARY KEY (`userId`), @@ -32,8 +32,8 @@ CREATE TABLE `poamtracking`.`asset` ( `assetName` VARCHAR(255) NOT NULL, `fullyQualifiedDomainName` VARCHAR(255) DEFAULT NULL, `collectionId` INT NOT NULL, - `description` VARCHAR(75) DEFAULT NULL, - `ipAddress` VARCHAR(20) DEFAULT NULL, + `description` VARCHAR(255) DEFAULT NULL, + `ipAddress` VARCHAR(50) DEFAULT NULL, `macAddress` VARCHAR(50) DEFAULT NULL, `nonComputing` TINYINT(1) DEFAULT '0', `metadata` JSON, @@ -50,7 +50,7 @@ CREATE TABLE `poamtracking`.`asset` ( CREATE TABLE `poamtracking`.`poamassets` ( `poamId` int NOT NULL, - `assetId` varchar(50) NOT NULL, + `assetId` int NOT NULL, PRIMARY KEY (`poamId`,`assetId`), KEY `poamAssetsAssetId` (`assetId`) /*!80000 INVISIBLE */, KEY `poamAssetPoamId` (`poamId`) @@ -72,8 +72,8 @@ CREATE TABLE `poamtracking`.`assetlabels` ( CREATE TABLE `poamtracking`.`label` ( `labelId` int NOT NULL AUTO_INCREMENT, - `description` varchar(75) DEFAULT NULL, - `labelName` varchar(30) NOT NULL, + `description` varchar(255) DEFAULT NULL, + `labelName` varchar(50) NOT NULL, `poamCount` int NOT NULL DEFAULT '0', PRIMARY KEY (`labelId`), UNIQUE KEY `labelName_UNIQUE` (`labelName`) @@ -103,9 +103,9 @@ CREATE TABLE `poamtracking`.`poamapprovers` ( CREATE TABLE `poamtracking`.`poammilestones` ( `milestoneId` INT NOT NULL AUTO_INCREMENT, `poamId` int NOT NULL, - `milestoneTitle` varchar(255) DEFAULT NULL, `milestoneDate` date DEFAULT NULL, - `milestoneComments` varchar(2000) DEFAULT NULL, + `milestoneComments` varchar(2000) DEFAULT '', + `milestoneStatus` varchar(10) DEFAULT 'Pending', PRIMARY KEY (`milestoneId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; @@ -136,7 +136,7 @@ CREATE TABLE `poamtracking`.`poam` ( `iavmNumber` varchar(25) DEFAULT '', `aaPackage` varchar(50) DEFAULT '', `vulnerabilityId` varchar(255) DEFAULT '', - `description` varchar(255) DEFAULT '', + `description` varchar(2000) DEFAULT '', `rawSeverity` varchar(25) DEFAULT '', `adjSeverity` varchar(25) DEFAULT '', `scheduledCompletionDate` date DEFAULT '1900-01-01', diff --git a/Front End/poam-app/src/app/Shared/components/confirmation-dialog/confirmation-dialog.component.ts b/Front End/poam-app/src/app/Shared/components/confirmation-dialog/confirmation-dialog.component.ts index cf95bdc4..33af6012 100644 --- a/Front End/poam-app/src/app/Shared/components/confirmation-dialog/confirmation-dialog.component.ts +++ b/Front End/poam-app/src/app/Shared/components/confirmation-dialog/confirmation-dialog.component.ts @@ -15,11 +15,11 @@ import { NbDialogRef } from '@nebular/theme'; selector: 'confirmation-dialog', styleUrls: ['./confirmation-dialog.component.scss'], template: ` - - + +

{{ options.header }}

- +

{{ options.body }}

diff --git a/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-datepicker.component.ts b/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-datepicker.component.ts index 126233d5..0c116612 100644 --- a/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-datepicker.component.ts +++ b/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-datepicker.component.ts @@ -1,3 +1,13 @@ +/* +!####################################################################### +! C-PATTM SOFTWARE +! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file +! crane_C_PAT.1_license.txt, which is part of this software package. BY +! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND +! CONDITIONS OF THE LICENSE. +!######################################################################## +*/ + import { Component, OnInit } from '@angular/core'; import { DefaultEditor } from 'angular2-smart-table'; import { parseISO } from 'date-fns'; @@ -27,12 +37,7 @@ export class SmartTableDatepickerComponent extends DefaultEditor implements OnIn onChange(event: any) { const date: Date = event instanceof Date ? event : new Date(event); - const formattedDate = this.formatDate(date); - this.cell.setValue(formattedDate); + this.cell.setValue(date.toString()); this.date = date; } - - private formatDate(date: Date): string { - return date.toISOString().substring(0, 10); - } -} \ No newline at end of file +} diff --git a/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-input.component.ts b/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-input.component.ts index cc35af20..04bbe185 100644 --- a/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-input.component.ts +++ b/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-input.component.ts @@ -1,3 +1,13 @@ +/* +!####################################################################### +! C-PATTM SOFTWARE +! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file +! crane_C_PAT.1_license.txt, which is part of this software package. BY +! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND +! CONDITIONS OF THE LICENSE. +!######################################################################## +*/ + import { Component, OnInit } from '@angular/core'; import { DefaultEditor } from 'angular2-smart-table'; @@ -21,4 +31,4 @@ export class SmartTableInputComponent extends DefaultEditor implements OnInit { onChange(event: any) { this.cell.setValue(event); } -} \ No newline at end of file +} diff --git a/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-inputDisabled.component.ts b/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-inputDisabled.component.ts index 69fb9da7..896e2dd1 100644 --- a/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-inputDisabled.component.ts +++ b/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-inputDisabled.component.ts @@ -1,3 +1,13 @@ +/* +!####################################################################### +! C-PATTM SOFTWARE +! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file +! crane_C_PAT.1_license.txt, which is part of this software package. BY +! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND +! CONDITIONS OF THE LICENSE. +!######################################################################## +*/ + import { Component, OnInit } from '@angular/core'; import { DefaultEditor } from 'angular2-smart-table'; @@ -21,4 +31,4 @@ export class SmartTableInputDisabledComponent extends DefaultEditor implements O onChange(event: any) { this.cell.setValue(event); } -} \ No newline at end of file +} diff --git a/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-select.component.ts b/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-select.component.ts index 5b0a00ae..6abd65d8 100644 --- a/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-select.component.ts +++ b/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-select.component.ts @@ -1,3 +1,13 @@ +/* +!####################################################################### +! C-PATTM SOFTWARE +! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file +! crane_C_PAT.1_license.txt, which is part of this software package. BY +! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND +! CONDITIONS OF THE LICENSE. +!######################################################################## +*/ + import { Component, OnInit } from '@angular/core'; import { DefaultEditor, ListEditorSettings } from 'angular2-smart-table'; diff --git a/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-textarea.component.ts b/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-textarea.component.ts index 5c248545..e0a40dbe 100644 --- a/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-textarea.component.ts +++ b/Front End/poam-app/src/app/Shared/components/smart-table/smart-table-textarea.component.ts @@ -1,10 +1,20 @@ +/* +!####################################################################### +! C-PATTM SOFTWARE +! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file +! crane_C_PAT.1_license.txt, which is part of this software package. BY +! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND +! CONDITIONS OF THE LICENSE. +!######################################################################## +*/ + import { Component, OnInit } from '@angular/core'; import { DefaultEditor } from 'angular2-smart-table'; @Component({ selector: 'smart-table-textarea', template: ` - + `, }) export class SmartTableTextareaComponent extends DefaultEditor implements OnInit { @@ -21,4 +31,4 @@ export class SmartTableTextareaComponent extends DefaultEditor implements OnInit onChange(event: any) { this.cell.setValue(event); } -} \ No newline at end of file +} diff --git a/Front End/poam-app/src/app/add-days.pipe.ts b/Front End/poam-app/src/app/add-days.pipe.ts deleted file mode 100644 index 3df748f2..00000000 --- a/Front End/poam-app/src/app/add-days.pipe.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -@Pipe({ - name: 'addDays' -}) -export class AddDaysPipe implements PipeTransform { - transform(value: string, days: number): string | null { - - if (!value) return ''; - const date = new Date(value); - date.setDate(date.getDate() + days); - const newDate = date.toISOString().split('T')[0]; - return date.toISOString(); - } -} diff --git a/Front End/poam-app/src/app/app-routing.module.ts b/Front End/poam-app/src/app/app-routing.module.ts index 0053c3b5..0a0d1ee6 100644 --- a/Front End/poam-app/src/app/app-routing.module.ts +++ b/Front End/poam-app/src/app/app-routing.module.ts @@ -15,14 +15,10 @@ import { PoamApproveComponent } from './pages/poam-processing/poam-approve/poam- import { PoamExtendComponent } from './pages/poam-processing/poam-extend/poam-extend.component'; import { AuthGuard } from './auth.guard' import { AppComponent } from './app.component'; -import { LoginComponent } from './pages/login/login.component'; -import { LoginCallbackComponent } from './pages/login/loginCallback.component'; const routes: Routes = [ { path: '', canActivate: [AuthGuard], component: AppComponent }, - { path: 'login', component: LoginComponent }, - { path: 'callback', component: LoginCallbackComponent }, { path: 'consent', loadChildren: () => import('./pages/dod-consent/dod-consent.module').then(m => m.DoDConsentModule) }, { path: 'approve', loadChildren: () => import('./pages/poam-processing/poam-approve/poam-approve.module').then(m => m.PoamApproveModule) }, { path: 'extend', loadChildren: () => import('./pages/poam-processing/poam-extend/poam-extend.module').then(m => m.PoamExtendModule) }, diff --git a/Front End/poam-app/src/app/app.component.ts b/Front End/poam-app/src/app/app.component.ts index 1bfe500a..cdf4def9 100644 --- a/Front End/poam-app/src/app/app.component.ts +++ b/Front End/poam-app/src/app/app.component.ts @@ -146,10 +146,8 @@ export class AppComponent implements OnInit, OnDestroy { this.userService.postUser(newUser).subscribe(result => { console.log("User name: " + newUser.userName + " has been added, account status is PENDING"); this.user = newUser; - // Further processing if needed after user creation }); } else { - // Handle other kinds of errors console.error('An error occurred:', error.message); } } diff --git a/Front End/poam-app/src/app/app.module.ts b/Front End/poam-app/src/app/app.module.ts index 0481e2cc..a0b0d499 100644 --- a/Front End/poam-app/src/app/app.module.ts +++ b/Front End/poam-app/src/app/app.module.ts @@ -19,7 +19,6 @@ import { PoamDetailsComponent } from './pages/poam-processing/poam-details/poam- import { CoreModule } from '../app/@core/core.module'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NbActionsModule, NbAutocompleteModule, NbCardModule, NbDialogModule, NbMenuModule, NbSidebarModule, NbLayoutModule, NbAlertModule, NbSelectModule, NbIconModule, NbSpinnerModule, NbThemeModule, NbStepperModule, NbCheckboxModule, NbButtonModule, NbInputModule, NbAccordionModule, NbDatepickerModule} from '@nebular/theme'; -import { LoginComponent } from './pages/login/login.component'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { HttpClientModule } from '@angular/common/http'; import { NbAuthModule, NbOAuth2AuthStrategy, NbOAuth2ResponseType, NbOAuth2GrantType, NbAuthOAuth2Token, } from '@nebular/auth'; @@ -57,7 +56,6 @@ function initializeKeycloak(keycloak: KeycloakService) { @NgModule({ declarations: [ AppComponent, - LoginComponent, PoamDetailsComponent, ], providers: [AuthGuard, diff --git a/Front End/poam-app/src/app/auth/auth-options.ts b/Front End/poam-app/src/app/auth/auth-options.ts index f16e0e98..a53acc3b 100644 --- a/Front End/poam-app/src/app/auth/auth-options.ts +++ b/Front End/poam-app/src/app/auth/auth-options.ts @@ -10,11 +10,10 @@ import { PASSWORD_AUTH_OPTIONS } from "./password-strategy-options"; import { NbAuthOptions, NbPasswordAuthStrategy, defaultAuthOptions } from "@nebular/auth"; -import { deepExtend } from "@nebular/auth/helpers"; export const AUTH_OPTIONS: NbAuthOptions = { strategies: [ - NbPasswordAuthStrategy.setup(PASSWORD_AUTH_OPTIONS) // try just entering [Strategy, options] + NbPasswordAuthStrategy.setup(PASSWORD_AUTH_OPTIONS) ], forms: { login: { diff --git a/Front End/poam-app/src/app/auth/auth.module.ts b/Front End/poam-app/src/app/auth/auth.module.ts index 387fba36..ae58e142 100644 --- a/Front End/poam-app/src/app/auth/auth.module.ts +++ b/Front End/poam-app/src/app/auth/auth.module.ts @@ -23,13 +23,9 @@ import { } from "@nebular/theme"; import { AuthRoutingModule } from "./auth.routing"; import { NbAuthModule } from "@nebular/auth"; -import { RegisterComponent } from "./register/register.component"; -import { LoginComponent } from './login/login.component'; -import { ResetPasswordComponent } from './reset-password/reset-password.component'; import { Angular2SmartTableModule } from 'angular2-smart-table'; @NgModule({ - declarations: [RegisterComponent, LoginComponent, ResetPasswordComponent], imports: [ CommonModule, diff --git a/Front End/poam-app/src/app/auth/auth.routing.ts b/Front End/poam-app/src/app/auth/auth.routing.ts index f1b1f72f..103b06d0 100644 --- a/Front End/poam-app/src/app/auth/auth.routing.ts +++ b/Front End/poam-app/src/app/auth/auth.routing.ts @@ -11,31 +11,12 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { NbAuthComponent, NbLogoutComponent, NbRequestPasswordComponent, NbResetPasswordComponent } from '@nebular/auth'; -import { RegisterComponent } from './register/register.component'; -import { LoginComponent } from './login/login.component'; -import { ResetPasswordComponent } from './reset-password/reset-password.component'; const routes: Routes = [ { path: '', component: NbAuthComponent, children: [ - // { - // path: 'login', - // component: LoginComponent, - // }, - // { - // path: 'login/:token', - // component: LoginComponent, - // }, - { - path: 'register', - component: RegisterComponent - }, - { - path: 'register/:token', - component: RegisterComponent - }, { path: 'logout', component: NbLogoutComponent, @@ -43,10 +24,6 @@ const routes: Routes = [ { path: 'request-password', component: NbRequestPasswordComponent, - }, - { - path: 'reset-password/:token', - component: ResetPasswordComponent, } ] } diff --git a/Front End/poam-app/src/app/auth/login/login.component.scss b/Front End/poam-app/src/app/auth/login/login.component.scss deleted file mode 100644 index 0a255944..00000000 --- a/Front End/poam-app/src/app/auth/login/login.component.scss +++ /dev/null @@ -1,14 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ - -// The nb-card-header within the NbAuthComponent displays the back() arrow, the following two lines prevent the header from being displayed -// removing the back arrow. -// /deep/ .nb-theme-dark nb-card-header { display: none !important; } -// /deep/ .nb-theme-corporate nb-card-header { display: none !important; } diff --git a/Front End/poam-app/src/app/auth/login/login.component.ts b/Front End/poam-app/src/app/auth/login/login.component.ts index 9735cb41..ed45b107 100644 --- a/Front End/poam-app/src/app/auth/login/login.component.ts +++ b/Front End/poam-app/src/app/auth/login/login.component.ts @@ -10,7 +10,7 @@ import { Component, OnInit, ChangeDetectorRef, Inject } from '@angular/core'; import { NbLoginComponent, NbAuthService, NB_AUTH_OPTIONS, NbAuthResult } from '@nebular/auth'; -import { Router, ActivatedRoute, Data } from '@angular/router'; +import { Router, ActivatedRoute } from '@angular/router'; import { _fixedSizeVirtualScrollStrategyFactory } from '@angular/cdk/scrolling'; import { environment } from 'src/environments/environment'; import { LoginService } from './login.service'; @@ -18,7 +18,6 @@ import { LoginService } from './login.service'; @Component({ selector: 'ngx-login', templateUrl: './login.component.html', - styleUrls: ['./login.component.scss'] }) export class LoginComponent extends NbLoginComponent implements OnInit { @@ -41,8 +40,6 @@ export class LoginComponent extends NbLoginComponent implements OnInit { console.log(this.errors) } ngOnInit() { - - //this.login(); } override login(): void { @@ -69,7 +66,6 @@ export class LoginComponent extends NbLoginComponent implements OnInit { if (result.isSuccess()) { - //console.log("authenticated result: ", result); this.payload = result.getToken().getPayload(); const redirect = result.getRedirect(); diff --git a/Front End/poam-app/src/app/auth/login/login.service.ts b/Front End/poam-app/src/app/auth/login/login.service.ts index 78abb175..3445db72 100644 --- a/Front End/poam-app/src/app/auth/login/login.service.ts +++ b/Front End/poam-app/src/app/auth/login/login.service.ts @@ -9,10 +9,8 @@ */ import { Injectable } from '@angular/core'; -import { HttpClient, HttpParams, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; -//import 'rxjs/Rx'; -import { Observable, throwError } from 'rxjs'; -import { catchError } from 'rxjs/operators'; +import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; +import { throwError } from 'rxjs'; import { environment } from '../../../environments/environment'; @Injectable({ @@ -30,36 +28,11 @@ export class LoginService { private handleError(error: HttpErrorResponse) { if (error.error instanceof ErrorEvent) { - // A client-side or network error occurred. Handle it accordingly. console.error('An error occurred:', error.error.message); } else { - // The backend returned an unsuccessful response code. - // The response body may contain clues as to what went wrong, console.error(`Backend returned code ${error.status}, ` + `body was: ${error.error}`); } - // return an observable with a user-facing error message return throwError('Something bad happened; please try again later.'); } - getUserById() { - // console.log("Login Service Call attempted: geUserByIdTest()..."); - return this.http.get(`${this.uri}/User/1`); - } - - // authUser(body: any): Observable { - // console.log("Login Service Call attempted: authUser()..."); - // //verifyInvitation(body): Observable { - // //console.log("Attempting call verifyInvitation..."); - // //return this.http.post(`${this.uri}/user/authUser`, body); - // return this.http.post(`${this.uri}/auth/login`, body); - // } - - // authUserTest(body: any): Observable { - // console.log("Login Service Call attempted: authUser()..."); - // //verifyInvitation(body): Observable { - // //console.log("Attempting call verifyInvitation..."); - // //return this.http.post(`${this.uri}/user/authUser`, body); - // //this.service.authenticate(this.strategy, authUser) - // return this.http.post(`${this.uri}/auth/login`, body); - // } } diff --git a/Front End/poam-app/src/app/auth/register/register.component.html b/Front End/poam-app/src/app/auth/register/register.component.html deleted file mode 100644 index 75f0f1d2..00000000 --- a/Front End/poam-app/src/app/auth/register/register.component.html +++ /dev/null @@ -1,163 +0,0 @@ - - -

Register

- - -

Oh snap!

-
    -
  • {{ error }}
  • -
-
- - -

Hooray!

-
    -
  • {{ message }}
  • -
-
- -
- -
- - - -
- -
- - -
- -
- - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - -
- -
- - Agree to Terms & Condiions - -
- - -
- - - -
- Already have an account? Log in -
diff --git a/Front End/poam-app/src/app/auth/register/register.component.scss b/Front End/poam-app/src/app/auth/register/register.component.scss deleted file mode 100644 index 799ed759..00000000 --- a/Front End/poam-app/src/app/auth/register/register.component.scss +++ /dev/null @@ -1,9 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ diff --git a/Front End/poam-app/src/app/auth/register/register.component.ts b/Front End/poam-app/src/app/auth/register/register.component.ts deleted file mode 100644 index 9a907049..00000000 --- a/Front End/poam-app/src/app/auth/register/register.component.ts +++ /dev/null @@ -1,212 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ - -import { Component, OnInit, Inject, ChangeDetectorRef } from "@angular/core"; -import { NbRegisterComponent, NbAuthService, NB_AUTH_OPTIONS, NbAuthResult } from "@nebular/auth"; -import { Router, ActivatedRoute } from '@angular/router'; -import { UsersService } from '../../pages/user-processing/users.service'; -import { CollectionsService } from '../../pages/collection-processing/collections.service'; -import { forkJoin } from "rxjs"; -import { Cell, ListEditorSettings, Settings } from "angular2-smart-table"; - -@Component({ - selector: "ngx-register", - templateUrl: "./register.component.html", - styleUrls: ["./register.component.scss"] -}) -export class RegisterComponent extends NbRegisterComponent implements OnInit { - - permissionToken: null | undefined; - permissions: any = {}; - CurrentState: string = ''; - override showMessages: any = {}; - override submitted = false; - username: string = ''; - override errors: string[] = []; - override messages: string[] = []; - override user: any = {}; - - payload: any = {}; - collectionList: any; - collectionPermissions: any[] = []; - data: any = []; - - collectionPermissionsSettings: Settings = { - add: { - addButtonContent: '', //'', - createButtonContent: '', - cancelButtonContent: '', //', - confirmCreate: true, - }, - edit: { - editButtonContent: '', - saveButtonContent: '', - cancelButtonContent: '', //', - confirmSave: true - }, - delete: { - deleteButtonContent: '', - confirmDelete: true, - }, - actions: { - add: true, - edit: true, - delete: true, - position: 'right', - }, - columns: { - collectionId: { - title: '*Collection', - type: 'html', - valuePrepareFunction: (cellValue: any, cell: Cell) => { - var collection = this.collectionList.find((tl: any) => tl.collectionId === +cellValue); - return (collection) ? collection.collectionName : cellValue; - }, - editor: { - type: 'list', - config: { - list: [], - }, - }, - } - }, - hideSubHeader: false, - }; - - constructor(service: NbAuthService, - @Inject(NB_AUTH_OPTIONS) options = {}, - cd: ChangeDetectorRef, - router: Router, - private route: ActivatedRoute, - private collectionService: CollectionsService, - private userService: UsersService, - ) { - - super(service, options, cd, router); - } - - ngOnInit() { - - this.collectionPermissions = []; - forkJoin( - this.collectionService.getCollections("Registrant"), - ) - .subscribe(([collections]: any) => { - - this.collectionList = collections.collections; - - this.setCollectionName(); - }); - - - } - - setCollectionName() { - let settings = this.collectionPermissionsSettings; - // Use index signature syntax to access 'collectionId' - let collectionIdSettings = settings.columns['collectionId']; - // Check if 'editor' and 'config' are defined and if 'config' is of type 'ListEditorSettings' - if (collectionIdSettings.editor && collectionIdSettings.editor.type === 'list') { - let editorConfig = collectionIdSettings.editor.config as ListEditorSettings; - editorConfig.list = []; - this.collectionPermissionsSettings = Object.assign({}, settings); - editorConfig.list = this.collectionList.map((collection: any) => { - console.log("collection: ", collection); - return { - title: collection.collectionName, - value: collection.collectionId - }; - }); - this.collectionPermissionsSettings = Object.assign({}, settings); - } - } - - confirmEdit(event: any) { - this.setCollectionName(); - event.confirm.resolve(); - } - - confirmCreate(event: any) { - this.setCollectionName(); - event.confirm.resolve(); - } - - confirmDelete(event: any) { - this.setCollectionName(); - event.confirm.resolve(); - } - - override register(): void { - - this.errors = this.messages = []; - this.submitted = true; - let requests: any[] = []; - if (this.collectionPermissions) { - this.collectionPermissions.forEach((request) => { - requests.push({ collectionId: +request.collectionId }) - }); - } - this.user.collectionAccessRequest = requests - console.log("register this.user: ", this.user) - - this.service.register(this.strategy, this.user).subscribe((result: NbAuthResult) => { - - this.submitted = false; - - if (result.isSuccess()) { - - this.messages = result.getMessages(); - - this.login(); - } else { - - this.errors = result.getErrors(); - console.log("register errors: ", this.errors); - this.showMessages.error = true; - } - }); - } - - login(): void { - - this.errors = []; - this.messages = []; - this.submitted = true; - this.strategy = "email"; - let authUser = { email: this.user.email, password: this.user.password } - - this.service.authenticate(this.strategy, authUser).subscribe((result: NbAuthResult) => { - - this.submitted = false; - - if (result.isSuccess()) { - - //console.log("authenticated result: ", result); - this.payload = result.getToken().getPayload(); - - const redirect = result.getRedirect(); - - if (redirect) { - - setTimeout(() => { - - return this.router.navigateByUrl(redirect); - }, this.redirectDelay); - } - - } else { - - this.errors = result.getErrors(); - console.log("authenticated not successful errors: ", this.errors); - } - - }); - } -} diff --git a/Front End/poam-app/src/app/auth/reset-password/reset-password.component.html b/Front End/poam-app/src/app/auth/reset-password/reset-password.component.html deleted file mode 100644 index 41c46bc6..00000000 --- a/Front End/poam-app/src/app/auth/reset-password/reset-password.component.html +++ /dev/null @@ -1,90 +0,0 @@ - -

Change password

-

Please set a new password

- - -

Oh snap!

-
    -
  • {{ error }}
  • -
-
- - -

Hooray!

-
    -
  • {{ message }}
  • -
-
- -
- -
- - -
- -
- - - -
- -
- - - -
- - -
- - diff --git a/Front End/poam-app/src/app/auth/reset-password/reset-password.component.scss b/Front End/poam-app/src/app/auth/reset-password/reset-password.component.scss deleted file mode 100644 index 9b2a9ed4..00000000 --- a/Front End/poam-app/src/app/auth/reset-password/reset-password.component.scss +++ /dev/null @@ -1,20 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ - -/** - * @license - * Copyright Akveo. All Rights Reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - */ - :host { - .form-group:last-of-type { - margin-bottom: 3rem; - } - } diff --git a/Front End/poam-app/src/app/auth/reset-password/reset-password.component.ts b/Front End/poam-app/src/app/auth/reset-password/reset-password.component.ts deleted file mode 100644 index ae990464..00000000 --- a/Front End/poam-app/src/app/auth/reset-password/reset-password.component.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ - -import { Component, OnInit, ChangeDetectorRef, Inject } from '@angular/core'; -import { AuthService } from '../auth.service'; -import { ResetPasswordService } from './reset-password.service'; -import { Router, ActivatedRoute } from '@angular/router'; -import { AUTH_OPTIONS } from '../auth-options'; -import { getDeepFromObject } from '../helpers'; -//import { UserService } from '../../@core/data/users.service'; - -@Component({ - selector: 'nb-reset-password-page', - styleUrls: ['./reset-password.component.scss'], - templateUrl: './reset-password.component.html', -}) -export class ResetPasswordComponent implements OnInit { - resetToken: null | undefined; - redirectDelay: number = 0; - showMessages: any = {}; - submitted = false; - confirmPassword = true; - currentPassword = ''; - newPassword = ''; - errors: string[] = []; - messages: string[] = []; - user: any = {}; - protected options = {}; - CurrentState: string = ''; - - constructor(protected authService: AuthService, - protected cd: ChangeDetectorRef, - protected router: Router, - private route: ActivatedRoute, - private resetPasswordService: ResetPasswordService, - //private userService: UserService, - ) { - - this.options = AUTH_OPTIONS; - this.route.params.subscribe(params => { - this.resetToken = params['token']; - //console.log("MyToken: " + this.resetToken); - this.VerifyToken(); - }); - } - - ngOnInit() { - - if (this.CurrentState != 'Verified') { - this.submitted = false; - this.errors.push("Your link has expired, request a new link via forgot password") - this.showMessages.error = true; - } - } - - VerifyToken() { - this.resetPasswordService.ValidPasswordToken({ resettoken: this.resetToken }).subscribe( - data => { - this.CurrentState = 'Verified'; - this.user = data.body.user; - this.currentPassword = ''; - this.newPassword = ''; - - if (data.body.confirmPassword != "true") { this.confirmPassword = false;} - this.showMessages.error = false; - - }, - err => { - this.CurrentState = 'NotVerified'; - this.errors = [ err.error.message ]; - this.showMessages.error = true; - } - ); - } - - resetPass(): void { - console.log("***verifyToken: " + this.CurrentState); - this.errors = this.messages = []; - this.showMessages.error = false; - - if (this.CurrentState != 'Verified') { - this.errors.push("Your link has expired, request a new link via forgot password") - this.showMessages.error = true; - return - } - - if (this.confirmPassword) { - this.resetPasswordService.verifyPassword({ userId: this.user._id, currentPassword: this.currentPassword}).subscribe( - data => { - console.log("Have data: " + JSON.stringify(data)); - - if (data.result) { - - this.setNewPassword(); - - } else { - this.errors.push("The current password entered does not match existing password"); - this.showMessages.error = true; - } - - }, - err => { - console.log("Have err: " + JSON.stringify(err)); - if (err.error.message) { - this.errors = err.error.message; - this.showMessages.error = true; - } - } - ); - } else { - this.setNewPassword(); - } - } - - setNewPassword() { - this.submitted = true; - this.resetPasswordService.newPassword({ resettoken: this.resetToken, newPassword: this.newPassword }).subscribe( - data => { - this.messages = data.message; - setTimeout(() => { - this.messages = []; - this.router.navigate(['login']); - }, 3000); - }, - err => { - if (err.error.message) { - this.errors = err.error.message; - this.showMessages.error = true; } - } - ); - } - - getConfigValue(key: string): any { - return getDeepFromObject(this.options, key, null); - } -} diff --git a/Front End/poam-app/src/app/auth/reset-password/reset-password.service.ts b/Front End/poam-app/src/app/auth/reset-password/reset-password.service.ts deleted file mode 100644 index 7c7c81cb..00000000 --- a/Front End/poam-app/src/app/auth/reset-password/reset-password.service.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ - -import { Injectable } from '@angular/core'; -import { HttpClient, HttpResponse, HttpErrorResponse } from '@angular/common/http'; -import { Observable, throwError } from 'rxjs'; - -import { environment } from '../../../environments/environment'; -import { catchError } from 'rxjs/operators'; - -@Injectable({ - providedIn: 'root' -}) -export class ResetPasswordService { - //private uri = environment.apiEndpoint; - private uri = environment.keycloakUrl; - - constructor(private http: HttpClient) { } - - generateResetToken(body: any): Observable { - console.log("Attempting call generateResetToken..."); - return this.http.post(`${this.uri}/generate_reset_token`, body); - } - - newPassword(body: { resettoken: null | undefined; newPassword: string; }): Observable { - console.log("Attempting call newPassword..."); - return this.http.post(`${this.uri}/new_password`, body); - } - - ValidPasswordToken(body: { resettoken: null | undefined; }): Observable { - console.log("Attempting call ValidPasswordToken..."); - return this.http.post(`${this.uri}/valid_password_token`, body); - } - - verifyPassword(body: { userId: any; currentPassword: string; }): Observable { - console.log("Attempting call verifyPassword..."); - return this.http.post(`${this.uri}/verify_password`, body); - } -} diff --git a/Front End/poam-app/src/app/file-upload.service.ts b/Front End/poam-app/src/app/file-upload.service.ts index 3d28641a..6db646a8 100644 --- a/Front End/poam-app/src/app/file-upload.service.ts +++ b/Front End/poam-app/src/app/file-upload.service.ts @@ -1,3 +1,13 @@ +/* +!####################################################################### +! C-PATTM SOFTWARE +! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file +! crane_C_PAT.1_license.txt, which is part of this software package. BY +! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND +! CONDITIONS OF THE LICENSE. +!######################################################################## +*/ + import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { environment } from '../environments/environment'; diff --git a/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.scss b/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.scss index 0aabd058..1669d608 100644 --- a/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.scss +++ b/Front End/poam-app/src/app/pages/asset-processing/asset-processing.component.scss @@ -1,4 +1,14 @@ -/* General Styles */ +/* +!####################################################################### +! C-PATTM SOFTWARE +! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file +! crane_C_PAT.1_license.txt, which is part of this software package. BY +! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND +! CONDITIONS OF THE LICENSE. +!######################################################################## +*/ + + .add-asset-button { margin-top: 20px; } @@ -15,7 +25,6 @@ width: 100%; } -/* Import Section Styles */ .import-section { display: flex; align-items: center; @@ -30,7 +39,6 @@ } } -/* Media Queries */ @media screen and (min-width: 400px) { .nb-column-name, .nb-column-size { width: 50%; diff --git a/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.scss b/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.scss index ef31b9b2..d1dc8daa 100644 --- a/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.scss +++ b/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.scss @@ -16,6 +16,12 @@ border-collapse: collapse; border: 1px solid nb-theme(border-basic-color-3); } + +::ng-deep angular2-smart-table-pager .angular2-smart-page-item .angular2-smart-page-link { + background-color: nb-theme(background-basic-color-2); + color: nb-theme(text-basic-color); + border: 1px solid nb-theme(border-basic-color-3); +} ::ng-deep angular2-smart-table table, ::ng-deep angular2-smart-table th, @@ -81,4 +87,4 @@ .buttons { padding-top: 1rem; - } \ No newline at end of file + } diff --git a/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.ts b/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.ts index d763454a..fcfa6193 100644 --- a/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.ts +++ b/Front End/poam-app/src/app/pages/asset-processing/asset/asset.component.ts @@ -70,15 +70,15 @@ export class AssetComponent implements OnInit { assetLabelsSettings: Settings = { add: { - addButtonContent: '', //'', + addButtonContent: '', createButtonContent: '', - cancelButtonContent: '', //', + cancelButtonContent: '', confirmCreate: true, }, edit: { editButtonContent: '', saveButtonContent: '', - cancelButtonContent: '', //', + cancelButtonContent: '', confirmSave: true }, delete: { @@ -93,7 +93,8 @@ export class AssetComponent implements OnInit { }, columns: { labelId: { - title: '*Label', + title: 'Label', + width: '100%', isFilterable: false, type: 'html', valuePrepareFunction: (labelId: any, row: any) => { diff --git a/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.scss b/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.scss index 0f859c5c..90f8486e 100644 --- a/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.scss +++ b/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.scss @@ -16,6 +16,12 @@ border-collapse: collapse; border: 1px solid nb-theme(border-basic-color-3); } + +::ng-deep angular2-smart-table-pager .angular2-smart-page-item .angular2-smart-page-link { + background-color: nb-theme(background-basic-color-2); + color: nb-theme(text-basic-color); + border: 1px solid nb-theme(border-basic-color-3); +} ::ng-deep angular2-smart-table table, ::ng-deep angular2-smart-table th, @@ -82,4 +88,3 @@ .buttons { padding-top: 1rem; } - \ No newline at end of file diff --git a/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.ts b/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.ts index 145b75de..c3352a47 100644 --- a/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.ts +++ b/Front End/poam-app/src/app/pages/collection-processing/collection/collection.component.ts @@ -46,15 +46,15 @@ export class CollectionComponent implements OnInit, OnChanges { collectionApproverSettings: Settings = { add: { - addButtonContent: '', //'', + addButtonContent: '', createButtonContent: '', - cancelButtonContent: '', //', + cancelButtonContent: '', confirmCreate: true, }, edit: { editButtonContent: '', saveButtonContent: '', - cancelButtonContent: '', //', + cancelButtonContent: '', confirmSave: true }, delete: { diff --git a/Front End/poam-app/src/app/pages/login/login.component.html b/Front End/poam-app/src/app/pages/login/login.component.html deleted file mode 100644 index 657e879d..00000000 --- a/Front End/poam-app/src/app/pages/login/login.component.html +++ /dev/null @@ -1,12 +0,0 @@ - - -

home works!

- diff --git a/Front End/poam-app/src/app/pages/login/login.component.scss b/Front End/poam-app/src/app/pages/login/login.component.scss deleted file mode 100644 index 799ed759..00000000 --- a/Front End/poam-app/src/app/pages/login/login.component.scss +++ /dev/null @@ -1,9 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ diff --git a/Front End/poam-app/src/app/pages/login/login.component.spec.ts b/Front End/poam-app/src/app/pages/login/login.component.spec.ts deleted file mode 100644 index 8eb42e74..00000000 --- a/Front End/poam-app/src/app/pages/login/login.component.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ - -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { LoginComponent } from './login.component'; - -describe('LoginComponent', () => { - let component: LoginComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ LoginComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(LoginComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/Front End/poam-app/src/app/pages/login/login.component.ts b/Front End/poam-app/src/app/pages/login/login.component.ts deleted file mode 100644 index a64cbc01..00000000 --- a/Front End/poam-app/src/app/pages/login/login.component.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ - -import { Component, OnInit } from '@angular/core'; -import { AuthService } from '../../auth'; -import { Subject, takeUntil } from 'rxjs'; - -@Component({ - templateUrl: './login.component.html', - styleUrls: ['./login.component.scss'] -}) -export class LoginComponent implements OnInit { - - constructor(private authService: AuthService,) { } - - ngOnInit(): void { - //this.testLogin() - } - - testLogin() { - /* this.authService.authenticate('redHat') - .pipe(takeUntil(this.destroy$)) - .subscribe((authResult: any) => { - console.log("Red Hat AuthResult: ", authResult) - }); - - */ - console.log("Auth Service Calling redHat") - this.authService - .authenticate('redHat') - .pipe(takeUntil(this.destroy$)) - .subscribe((authResult: any) => {console.log("Red Hat AuthResult: ", authResult)}); - - - } - private destroy$ = new Subject(); - - - ngOnDestroy() { - this.destroy$.next(); - this.destroy$.complete(); - } - -} diff --git a/Front End/poam-app/src/app/pages/login/login.service.ts b/Front End/poam-app/src/app/pages/login/login.service.ts deleted file mode 100644 index dafa8704..00000000 --- a/Front End/poam-app/src/app/pages/login/login.service.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ - -import { EventEmitter, Injectable } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; -import { throwError, Observable } from 'rxjs'; -import { catchError } from 'rxjs/operators'; -import { environment } from '../../../environments/environment'; - -@Injectable({ - providedIn: 'root' -}) -export class LoginService { - private uri = environment.apiEndpoint; - - httpOptions = { - headers: new HttpHeaders({ - //'Content-Type': 'application/json', - 'Content-Type': 'x-www-form-urlencoded', - 'Access-Control-Allow-Origin':'*' - }) - }; - - constructor(private http: HttpClient) { } - public onNewPoam: EventEmitter = new EventEmitter(); - - public newPoam(poam: any) { - // do something, then... - this.onNewPoam.emit({poam: poam}); - } - - private handleError(error: HttpErrorResponse) { - if (error.error instanceof ErrorEvent) { - // A client-side or network error occurred. Handle it accordingly. - console.error('An error occurred:', error.error.message); - } else { - // The backend returned an unsuccessful response code. - // The response body may contain clues as to what went wrong, - console.error(`Backend returned code ${error.status}, ` + `body was: ${error.error}`); - } - // return an observable with a user-facing error message - return throwError('Something bad happened; please try again later.'); - } - - getToken(authorization: any) { - console.log("LoginService Call attempted: getToken(authorization)...authorization: ", authorization); - //this.httpOptions.headers= this.httpOptions.headers.append('Access-Control-Allow-Origin', '*') - return this.http.post(environment.tokenReturnUrl, authorization, this.httpOptions); - //return 'Nothing'; - } - -} diff --git a/Front End/poam-app/src/app/pages/login/loginCallback.component.html b/Front End/poam-app/src/app/pages/login/loginCallback.component.html deleted file mode 100644 index adcdf002..00000000 --- a/Front End/poam-app/src/app/pages/login/loginCallback.component.html +++ /dev/null @@ -1,12 +0,0 @@ - - -

home CALLBACK Processing!

- diff --git a/Front End/poam-app/src/app/pages/login/loginCallback.component.ts b/Front End/poam-app/src/app/pages/login/loginCallback.component.ts deleted file mode 100644 index 27dbf399..00000000 --- a/Front End/poam-app/src/app/pages/login/loginCallback.component.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* -!####################################################################### -! C-PATTM SOFTWARE -! CRANE C-PATTM plan of action and milestones software. Use is governed by the Open Source Academic Research License Agreement contained in the file -! crane_C_PAT.1_license.txt, which is part of this software package. BY -! USING OR MODIFYING THIS SOFTWARE, YOU ARE AGREEING TO THE TERMS AND -! CONDITIONS OF THE LICENSE. -!######################################################################## -*/ - -import { Component, OnDestroy, OnInit } from '@angular/core'; -import { AuthService } from '../../auth'; -import { Router, ActivatedRoute } from '@angular/router'; -import { Subject, takeUntil } from 'rxjs'; -import { LoginService } from './login.service'; -import { NbPasswordAuthStrategy, NbAuthModule, NbAuthResult, NbAuthJWTToken, NbOAuth2AuthStrategy, NbOAuth2ResponseType, NbOAuth2GrantType, NbAuthOAuth2Token, NbAuthToken, } from '@nebular/auth'; -import { KeycloakService } from 'keycloak-angular' -import { KeycloakProfile, KeycloakRoles } from 'keycloak-js'; - -@Component({ - selector: 'nb-playground-oauth2-callback', - templateUrl: './loginCallback.component.html', -}) -export class LoginCallbackComponent implements OnDestroy { - - public isLoggedIn = false; - public userProfile: KeycloakProfile | null = null; - - private destroy$ = new Subject(); - - constructor(private AuthService: AuthService, - private router: Router, - private activateRoute: ActivatedRoute, - private login: LoginService, - private readonly keycloak: KeycloakService) { - - this.AuthService.authenticate('redHat') - .pipe(takeUntil(this.destroy$)) - .subscribe(async (authResult: NbAuthResult) => { - - console.log("authResult: ", authResult) - //let usrName = this.keycloak.getUsername(); - - this.userProfile = await this.keycloak.loadUserProfile(); - console.log("userProfile: ",this.userProfile) - - // if (authResult.isSuccess()) { - // this.AuthService.getToken().subscribe((tk: any) => { - // console.log("token: ", tk) - // }) -// let payload = token.getPayload(); - - // console.log("token: ", token) - // console.log("payload: ", payload) - //let t2: NbAuthJWTToken = payload.access_token.getToken() - - //console.log("payload: ", t2.getPayload()) - - - this.router.navigateByUrl('/'); - //this.router.navigateByUrl('/pages/dashboard'); - //} - }); - } - - public async ngOnInit() { - this.isLoggedIn = await this.keycloak.isLoggedIn(); - if (this.isLoggedIn) { - this.userProfile = await this.keycloak.loadUserProfile(); - console.log("userProfile: ",this.userProfile) - } - } - - ngOnDestroy(): void { - this.destroy$.next(); - this.destroy$.complete(); - } -} diff --git a/Front End/poam-app/src/app/pages/poam-processing/poam-approve/poam-approve.component.html b/Front End/poam-app/src/app/pages/poam-processing/poam-approve/poam-approve.component.html index 2c10c98d..a4e0c9d5 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poam-approve/poam-approve.component.html +++ b/Front End/poam-app/src/app/pages/poam-processing/poam-approve/poam-approve.component.html @@ -13,8 +13,7 @@ Approve POAM - +
diff --git a/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.html b/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.html index 0cdea6c6..3f175c11 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.html +++ b/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.html @@ -53,7 +53,7 @@
- +
@@ -209,7 +209,7 @@ + rows="16" maxlength="2000"> @@ -217,7 +217,7 @@ + rows="16" maxlength="2000"> @@ -236,7 +236,7 @@ + rows="16" maxlength="2000"> @@ -260,7 +260,7 @@ - + diff --git a/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.scss b/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.scss index 21427843..bad36ff8 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.scss +++ b/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.scss @@ -16,14 +16,20 @@ border-collapse: collapse; border: 1px solid nb-theme(border-basic-color-3); } - - ::ng-deep angular2-smart-table table, - ::ng-deep angular2-smart-table th, - ::ng-deep angular2-smart-table td { - border: 1px solid nb-theme(border-basic-color-3); - padding: 0.5rem; - text-align: left; - } + +::ng-deep angular2-smart-table-pager .angular2-smart-page-item .angular2-smart-page-link { + background-color: nb-theme(background-basic-color-2); + color: nb-theme(text-basic-color); + border: 1px solid nb-theme(border-basic-color-3); +} + +::ng-deep angular2-smart-table table, +::ng-deep angular2-smart-table th, +::ng-deep angular2-smart-table td { + border: 1px solid nb-theme(border-basic-color-3); + padding: 0.5rem; + text-align: left; +} ::ng-deep angular2-smart-table thead tr:nth-child(3) { background-color: nb-theme(background-basic-color-1); diff --git a/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.ts b/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.ts index 3acde4f9..6b5737cc 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.ts +++ b/Front End/poam-app/src/app/pages/poam-processing/poam-details/poam-details.component.ts @@ -25,10 +25,10 @@ import { UsersService } from '../../user-processing/users.service' import { Settings } from 'angular2-smart-table'; import { SharedService } from '../../../Shared/shared.service'; import { SmartTableDatepickerComponent } from 'src/app/Shared/components/smart-table/smart-table-datepicker.component'; -import { SmartTableInputComponent } from 'src/app/Shared/components/smart-table/smart-table-input.component'; import { SmartTableTextareaComponent } from 'src/app/Shared/components/smart-table/smart-table-textarea.component'; import { SmartTableInputDisabledComponent } from 'src/app/Shared/components/smart-table/smart-table-inputDisabled.component'; import { SmartTableSelectComponent } from 'src/app/Shared/components/smart-table/smart-table-select.component'; +import { addDays, format, isAfter, parseISO } from 'date-fns'; interface Permission { userId: number; @@ -82,7 +82,7 @@ export class PoamDetailsComponent implements OnInit { poamAssetsSettings: Settings = { add: { - addButtonContent: '', //'', + addButtonContent: '', createButtonContent: '', cancelButtonContent: '', //', confirmCreate: true, @@ -104,7 +104,8 @@ export class PoamDetailsComponent implements OnInit { }, columns: { assetId: { - title: '*Asset', + title: 'Asset', + width: '100%', isFilterable: false, type: 'html', valuePrepareFunction: (_cell: any, row: any) => { @@ -125,7 +126,7 @@ export class PoamDetailsComponent implements OnInit { poamApproverSettings: Settings = { add: { - addButtonContent: '', //'', + addButtonContent: '', createButtonContent: '', cancelButtonContent: '', //', confirmCreate: true, @@ -148,7 +149,8 @@ export class PoamDetailsComponent implements OnInit { }, columns: { userId: { - title: '*Approver', + title: 'Approver', + width: '20%', isFilterable: false, type: 'html', isEditable: false, @@ -175,6 +177,7 @@ export class PoamDetailsComponent implements OnInit { }, approved: { title: 'Approved', + width: '20%', isFilterable: false, type: 'html', isAddable: false, @@ -188,6 +191,7 @@ export class PoamDetailsComponent implements OnInit { }, approvedDate: { title: 'Approved Date', + width: '20%', isFilterable: false, type: 'html', isEditable: false, @@ -202,6 +206,7 @@ export class PoamDetailsComponent implements OnInit { }, comments: { title: 'Comments', + width: '40%', isFilterable: false, editor: { type: 'custom', @@ -219,7 +224,7 @@ export class PoamDetailsComponent implements OnInit { poamAssigneesSettings: Settings = { add: { - addButtonContent: '', //'', + addButtonContent: '', createButtonContent: '', cancelButtonContent: '', //', confirmCreate: true, @@ -242,6 +247,7 @@ export class PoamDetailsComponent implements OnInit { columns: { userId: { title: 'Members Assigned', + width: '100%', isFilterable: false, type: 'html', valuePrepareFunction: (_cell: any, row: any) => { @@ -292,12 +298,13 @@ export class PoamDetailsComponent implements OnInit { delete: true, }, columns: { - milestoneTitle: { - title: 'Milestone Title', + milestoneComments: { + title: 'Milestone Comments', + width: '60%', isFilterable: false, editor: { type: 'custom', - component: SmartTableInputComponent, + component: SmartTableTextareaComponent, }, isEditable: true, isAddable: true, @@ -307,6 +314,7 @@ export class PoamDetailsComponent implements OnInit { }, milestoneDate: { title: 'Milestone Date', + width: '20%', isFilterable: false, type: 'text', isEditable: true, @@ -319,17 +327,23 @@ export class PoamDetailsComponent implements OnInit { component: SmartTableDatepickerComponent, }, }, - milestoneComments: { - title: 'Milestone Comments', + milestoneStatus: { + title: 'Milestone Status', + width: '20%', isFilterable: false, + type: 'html', + valuePrepareFunction: (_cell: any, row: any) => { + return (row.value) ? row.value : 'Pending' + }, editor: { type: 'custom', - component: SmartTableTextareaComponent, - }, - isEditable: true, - isAddable: true, - valuePrepareFunction: (_cell: any, row: any) => { - return (row.value) ? row.value : ' ' + component: SmartTableSelectComponent, + config: { + list: [ + { value: 'Pending', title: 'Pending' }, + { value: 'Complete', title: 'Complete' } + ], + }, }, }, }, @@ -508,8 +522,8 @@ export class PoamDetailsComponent implements OnInit { ) .subscribe(([poam, collection, users, collectionAssets, assets, assignees, collectionApprovers, poamApprovers, poamMilestones]: any) => { this.poam = { ...poam }; - this.dates.scheduledCompletionDate = (this.poam.scheduledCompletionDate) ? this.poam.scheduledCompletionDate.substr(0, 10) : ''; - this.dates.submittedDate = (this.poam.submittedDate) ? this.poam.submittedDate.substr(0, 10) : ''; + this.dates.scheduledCompletionDate = (this.poam.scheduledCompletionDate) ? parseISO(this.poam.scheduledCompletionDate.substr(0, 10)) : ''; + this.dates.submittedDate = (this.poam.submittedDate) ? parseISO(this.poam.submittedDate.substr(0, 10)) : ''; this.collection = collection; this.collectionUsers = users.permissions; this.assets = collectionAssets; @@ -568,6 +582,7 @@ export class PoamDetailsComponent implements OnInit { { this.poamApproverSettings.columns['approved'] = { title: 'Approved', + width: '20%', isFilterable: false, isEditable: true, type: 'html', @@ -823,17 +838,93 @@ let approverSettings = this.poamApproverSettings; this.router.navigateByUrl("/poam-processing"); } + async confirmCreateMilestone(event: any) { + if (this.poam.poamId === "ADDPOAM") { + event.confirm.resolve(); + return; + } + + if (this.poam.status != "Draft") { + this.showConfirmation("You may only modify the milestone list if poam status is 'Draft'."); + event.confirm.reject(); + return; + } + + const scheduledCompletionDate = parseISO(this.poam.scheduledCompletionDate); + const milestoneDate = event.newData.milestoneDate; + + if (this.poam.extensionTimeAllowed === 0 || this.poam.extensionTimeAllowed == null) { + if (isAfter(milestoneDate, scheduledCompletionDate)) { + this.showConfirmation("The Milestone date provided exceeds the POAM scheduled completion date."); + event.confirm.reject(); + return; + } + } else { + const maxAllowedDate = addDays(scheduledCompletionDate, this.poam.extensionTimeAllowed); + + if (isAfter(milestoneDate, maxAllowedDate)) { + this.showConfirmation("The Milestone date provided exceeds the POAM scheduled completion date and the allowed extension time."); + event.confirm.reject(); + return; + } + } + + if (this.poam.poamId) { + let milestone: any = { + milestoneDate: format(event.newData.milestoneDate, "yyyy-MM-dd"), + milestoneComments: (event.newData.milestoneComments) ? event.newData.milestoneComments : ' ', + milestoneStatus: (event.newData.milestoneStatus) ? event.newData.milestoneStatus : 'Pending', + } + + await this.poamService.addPoamMilestone(this.poam.poamId, milestone).subscribe((res: any) => { + if (res.null) { + this.showConfirmation("Unable to insert row, potentially a duplicate."); + event.confirm.reject(); + return; + } else { + + event.confirm.resolve(); + this.poamMilestones.push(milestone); + this.poamMilestones = [...this.poamMilestones]; + } + }) + + } else { + this.showConfirmation("Failed to create POAM milestone entry. Invalid input."); + event.confirm.reject(); + } + } + confirmEditMilestone(event: any) { if (this.poam.poamId === "ADDPOAM" || this.poam.status !== "Draft") { this.showConfirmation("Milestones can only be modified if the POAM status is 'Draft'."); event.confirm.reject(); return; } - console.log("event.newData: ", event.newData); + + const scheduledCompletionDate = parseISO(this.poam.scheduledCompletionDate); + const milestoneDate = event.newData.milestoneDate; + + if (this.poam.extensionTimeAllowed === 0 || this.poam.extensionTimeAllowed == null) { + if (isAfter(milestoneDate, scheduledCompletionDate)) { + this.showConfirmation("The Milestone date provided exceeds the POAM scheduled completion date."); + event.confirm.reject(); + return; + } + } else { + const maxAllowedDate = addDays(scheduledCompletionDate, this.poam.extensionTimeAllowed); + + if (isAfter(milestoneDate, maxAllowedDate)) { + this.showConfirmation("The Milestone date provided exceeds the POAM scheduled completion date and the allowed extension time."); + event.confirm.reject(); + return; + } + } + const milestoneUpdate = { - ...(event.newData.milestoneTitle && { milestoneTitle: event.newData.milestoneTitle }), - ...(event.newData.milestoneDate && { milestoneDate: event.newData.milestoneDate }), - ...(event.newData.milestoneComments && { milestoneComments: event.newData.milestoneComments }), + ...(event.newData.milestoneDate && { milestoneDate: format(event.newData.milestoneDate, "yyyy-MM-dd") }), + ...(event.newData.milestoneComments && { milestoneComments: (event.newData.milestoneComments) ? event.newData.milestoneComments : ' ' }), + ...(event.newData.milestoneStatus && { milestoneStatus: (event.newData.milestoneStatus) ? event.newData.milestoneStatus : 'Pending' }), }; this.poamService.updatePoamMilestone(this.poam.poamId, event.data.milestoneId, milestoneUpdate).subscribe(() => { @@ -868,47 +959,6 @@ let approverSettings = this.poamApproverSettings; }) } - async confirmCreateMilestone(event: any) { - // console.log("poamDetails confirmCreateApprover data: ", event) - - if (this.poam.poamId === "ADDPOAM") { - event.confirm.resolve(); - return; - } - - if (this.poam.status != "Draft") { - this.showConfirmation("you may only modify the milestone list if poam status is 'Draft'."); - event.confirm.reject(); - return; - } - - if (this.poam.poamId) { - let milestone: any = { - milestoneTitle: event.newData.milestoneTitle, - milestoneDate: (event.newData.milestoneDate != 'Not Reviewed') ? this.datePipe.transform(new Date(), 'yyyy-MM-dd') : '', - milestoneComments: event.newData.milestoneComments - } - - await this.poamService.addPoamMilestone(this.poam.poamId, milestone).subscribe((res: any) => { - // console.log("poamDetail confirmCreatePoam res: ", res) - if (res.null) { - this.showConfirmation("Unable to insert row, potentially a duplicate."); - event.confirm.reject(); - return; - } else { - - event.confirm.resolve(); - this.poamMilestones.push(milestone); - this.poamMilestones = [...this.poamMilestones]; - } - }) - - } else { - this.showConfirmation("Failed to create POAM milestone entry. Invalid input."); - event.confirm.reject(); - } - } - confirmEditApprover(event: any) { // console.log("poamDetails confirmEditApprover event: ", event) if (this.poam.poamId === "ADDPOAM") { @@ -948,7 +998,6 @@ let approverSettings = this.poamApproverSettings; } async confirmDeleteApprover(event: any) { - // console.log("poamDetails confirmDeleteApprover event: ", event) if (this.poam.poamId === "ADDPOAM") { event.confirm.resolve(); return; @@ -961,18 +1010,15 @@ let approverSettings = this.poamApproverSettings; } this.poamService.deletePoamApprover(event.data.poamId, event.data.userId).subscribe((res: any) => { - // console.log("confirmDelete res to delete: ", res) const index = this.poamApprovers.findIndex(((e: any) => {e.poamId == event.data.poamId && e.userId == event.data.userId})); if (index > -1) { this.poamApprovers.splice(index, 1); } event.confirm.resolve(); - // console.log("poamApprovers after delete: ",this.poamApprovers) }) } async confirmCreateApprover(event: any) { - // console.log("poamDetails confirmCreateApprover data: ", event) if (this.poam.poamId === "ADDPOAM") { event.confirm.resolve(); @@ -988,8 +1034,6 @@ let approverSettings = this.poamApproverSettings; if (this.poam.poamId && event.newData.userId ) { - // console.log("poamDetails confirmCreate poam.colectionId: ",this.poam.collectionId,", userId: ", event.newData.userId); - // console.log("poamDetails confirmCreate collectionApprovers: ",this.collectionApprovers) let user = await this.collectionApprovers.collectionApprovers.find((tl: any) => tl.collectionId == this.poam.collectionId && tl.userId == event.newData.userId) let approver: any = { diff --git a/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.html b/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.html index b65322f9..2fa768de 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.html +++ b/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.html @@ -17,7 +17,7 @@
- + 0 Days 30 Days 60 Days @@ -31,7 +31,7 @@
@@ -70,4 +70,4 @@
- \ No newline at end of file + diff --git a/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.scss b/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.scss index 6925c417..1870d6f2 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.scss +++ b/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.scss @@ -17,6 +17,12 @@ border: 1px solid nb-theme(border-basic-color-3); } +::ng-deep angular2-smart-table-pager .angular2-smart-page-item .angular2-smart-page-link { + background-color: nb-theme(background-basic-color-2); + color: nb-theme(text-basic-color); + border: 1px solid nb-theme(border-basic-color-3); +} + ::ng-deep angular2-smart-table table, ::ng-deep angular2-smart-table th, ::ng-deep angular2-smart-table td { diff --git a/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.ts b/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.ts index 4acec2a3..fd9ab58e 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.ts +++ b/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.component.ts @@ -19,10 +19,11 @@ import { UsersService } from '../../user-processing/users.service'; import { DatePipe } from '@angular/common'; import { SmartTableTextareaComponent } from 'src/app/Shared/components/smart-table/smart-table-textarea.component'; import { SmartTableDatepickerComponent } from 'src/app/Shared/components/smart-table/smart-table-datepicker.component'; -import { SmartTableInputComponent } from 'src/app/Shared/components/smart-table/smart-table-input.component'; import { Settings } from 'angular2-smart-table'; import { Observable, forkJoin } from 'rxjs'; import { ConfirmationDialogComponent, ConfirmationDialogOptions } from 'src/app/Shared/components/confirmation-dialog/confirmation-dialog.component'; +import { SmartTableSelectComponent } from '../../../Shared/components/smart-table/smart-table-select.component'; +import { addDays, format, isAfter, parseISO } from 'date-fns'; @Component({ @@ -52,7 +53,8 @@ export class PoamExtendComponent implements OnInit { "Unanticipated Risks", ]; public extensionJustificationPlaceholder: string = "Select from the available options, modify a provided option, or provide a custom justification"; - + completionDate: any; + completionDateWithExtension: any; poamMilestoneSettings: Settings = { add: { addButtonContent: '', @@ -77,44 +79,52 @@ export class PoamExtendComponent implements OnInit { delete: true, }, columns: { - milestoneTitle: { - title: 'Milestone Title', + milestoneComments: { + title: 'Milestone Comments', + width: '60%', isFilterable: false, editor: { type: 'custom', - component: SmartTableInputComponent, + component: SmartTableTextareaComponent, }, isEditable: true, isAddable: true, valuePrepareFunction: (_cell: any, row: any) => { - return (row.value) ? row.value : ' ' + return (row.value); }, }, milestoneDate: { title: 'Milestone Date', + width: '20%', isFilterable: false, type: 'text', isEditable: true, isAddable: true, valuePrepareFunction: (_cell: any, row: any) => { - return (row.value) ? row.value.substr(0, 10) : ''; + return (row.value) ? row.value : ''; }, editor: { type: 'custom', component: SmartTableDatepickerComponent, }, }, - milestoneComments: { - title: 'Milestone Comments', + milestoneStatus: { + title: 'Milestone Status', + width: '20%', isFilterable: false, + type: 'html', + valuePrepareFunction: (_cell: any, row: any) => { + return (row.value) ? row.value : 'Pending' + }, editor: { type: 'custom', - component: SmartTableTextareaComponent, - }, - isEditable: true, - isAddable: true, - valuePrepareFunction: (_cell: any, row: any) => { - return (row.value) ? row.value : ' ' + component: SmartTableSelectComponent, + config: { + list: [ + { value: 'Pending', title: 'Pending' }, + { value: 'Complete', title: 'Complete' } + ], + }, }, }, }, @@ -165,6 +175,11 @@ export class PoamExtendComponent implements OnInit { scheduledCompletionDate: extensionData.scheduledCompletionDate }; this.extensionJustification = this.poam.extensionJustification; + this.completionDate = this.poam.scheduledCompletionDate.substr(0, 10).replaceAll('-', '/'); + this.completionDateWithExtension = format( + addDays(this.completionDate, this.poam.extensionTimeAllowed), + 'EEE MMM dd yyyy' + ); } else { this.poam = { extensionTimeAllowed: 0, @@ -172,6 +187,7 @@ export class PoamExtendComponent implements OnInit { scheduledCompletionDate: '' }; this.extensionJustification = ''; + this.completionDateWithExtension = this.poam.scheduledCompletionDate.substr(0, 10).replaceAll('-', '/'); } this.poamMilestones = milestones.poamMilestones; }, @@ -181,17 +197,97 @@ export class PoamExtendComponent implements OnInit { }); } - confirmEditMilestone(event: any) { - if (this.poam.poamId === "ADDPOAM" || this.poam.status !== "Draft") { - this.showConfirmation("Milestones can only be modified if the POAM status is 'Draft'."); + computeDeadlineWithExtension(event: any) { + + if (this.poam.extensionTimeAllowed === 0 || this.poam.extensionTimeAllowed == null) { + this.completionDate = this.poam.scheduledCompletionDate.substr(0, 10).replaceAll('-', '/'); + this.completionDateWithExtension = format(this.completionDate, 'EEE MMM dd yyyy'); + } + else { + this.completionDate = this.poam.scheduledCompletionDate.substr(0, 10).replaceAll('-', '/'); + this.completionDateWithExtension = format( + addDays(this.completionDate, this.poam.extensionTimeAllowed), + 'EEE MMM dd yyyy' + ); + } + } + + async confirmCreateMilestone(event: any) { + if (this.poamId === "ADDPOAM") { + this.showConfirmation("The POAM must be created or saved before creating extension milestones."); event.confirm.reject(); return; } - console.log("event.newData: ", event.newData); + + const scheduledCompletionDate = parseISO(this.poam.scheduledCompletionDate); + const milestoneDate = event.newData.milestoneDate; + + if (this.poam.extensionTimeAllowed === 0 || this.poam.extensionTimeAllowed == null) { + if (isAfter(milestoneDate, scheduledCompletionDate)) { + this.showConfirmation("The Milestone date can not exceed the POAM scheduled completion date."); + event.confirm.reject(); + return; + } + } else { + const maxAllowedDate = addDays(scheduledCompletionDate, this.poam.extensionTimeAllowed); + + if (isAfter(milestoneDate, maxAllowedDate)) { + this.showConfirmation("The Milestone date can not exceed the POAM scheduled completion date and the allowed extension time."); + event.confirm.reject(); + return; + } + } + + if (this.poam.poamId) { + let milestone: any = { + milestoneDate: format(event.newData.milestoneDate, "yyyy-MM-dd"), + milestoneComments: (event.newData.milestoneComments) ? event.newData.milestoneComments : ' ', + milestoneStatus: (event.newData.milestoneStatus) ? event.newData.milestoneStatus : 'Pending', + } + + await this.poamService.addPoamMilestone(this.poam.poamId, milestone).subscribe((res: any) => { + if (res.null) { + this.showConfirmation("Unable to insert row, potentially a duplicate."); + event.confirm.reject(); + return; + } else { + + event.confirm.resolve(); + this.poamMilestones.push(milestone); + this.poamMilestones = [...this.poamMilestones]; + } + }) + + } else { + this.showConfirmation("Failed to create POAM milestone entry. Invalid input."); + event.confirm.reject(); + } + } + + confirmEditMilestone(event: any) { + const scheduledCompletionDate = parseISO(this.poam.scheduledCompletionDate); + const milestoneDate = event.newData.milestoneDate; + + if (this.poam.extensionTimeAllowed === 0 || this.poam.extensionTimeAllowed == null) { + if (isAfter(milestoneDate, scheduledCompletionDate)) { + this.showConfirmation("The Milestone date can not exceed the POAM scheduled completion date."); + event.confirm.reject(); + return; + } + } else { + const maxAllowedDate = addDays(scheduledCompletionDate, this.poam.extensionTimeAllowed); + + if (isAfter(milestoneDate, maxAllowedDate)) { + this.showConfirmation("The Milestone date can not exceed the POAM scheduled completion date and the allowed extension time."); + event.confirm.reject(); + return; + } + } + const milestoneUpdate = { - ...(event.newData.milestoneTitle && { milestoneTitle: event.newData.milestoneTitle }), - ...(event.newData.milestoneDate && { milestoneDate: event.newData.milestoneDate }), - ...(event.newData.milestoneComments && { milestoneComments: event.newData.milestoneComments }), + ...(event.newData.milestoneDate && { milestoneDate: format(event.newData.milestoneDate, "yyyy-MM-dd") }), + ...(event.newData.milestoneComments && { milestoneComments: (event.newData.milestoneComments) ? event.newData.milestoneComments : ' ' }), + ...(event.newData.milestoneStatus && { milestoneStatus: (event.newData.milestoneStatus) ? event.newData.milestoneStatus : 'Pending' }), }; this.poamService.updatePoamMilestone(this.poam.poamId, event.data.milestoneId, milestoneUpdate).subscribe(() => { @@ -226,46 +322,6 @@ export class PoamExtendComponent implements OnInit { }) } - async confirmCreateMilestone(event: any) { - // console.log("poamDetails confirmCreateApprover data: ", event) - - if (this.poam.poamId === "ADDPOAM") { - event.confirm.resolve(); - return; - } - - if (this.poam.status != "Draft") { - this.showConfirmation("you may only modify the milestone list if poam status is 'Draft'."); - event.confirm.reject(); - return; - } - - if (this.poam.poamId) { - let milestone: any = { - milestoneTitle: event.newData.milestoneTitle, - milestoneDate: (event.newData.milestoneDate != 'Not Reviewed') ? this.datePipe.transform(new Date(), 'yyyy-MM-dd') : '', - milestoneComments: event.newData.milestoneComments - } - - await this.poamService.addPoamMilestone(this.poam.poamId, milestone).subscribe((res: any) => { - // console.log("poamDetail confirmCreatePoam res: ", res) - if (res.null) { - this.showConfirmation("Unable to insert row, potentially a duplicate."); - event.confirm.reject(); - return; - } else { - - event.confirm.resolve(); - this.poamMilestones.push(milestone); - this.poamMilestones = [...this.poamMilestones]; - } - }) - - } else { - this.showConfirmation("Failed to create POAM milestone entry. Invalid input."); - event.confirm.reject(); - } - } async showConfirmation(errMsg: string, header?: string, status?: string, isSuccessful: boolean = false) { let options = new ConfirmationDialogOptions({ header: header ? header : "Notification", diff --git a/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.module.ts b/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.module.ts index fc26bf4f..04cc47d0 100644 --- a/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.module.ts +++ b/Front End/poam-app/src/app/pages/poam-processing/poam-extend/poam-extend.module.ts @@ -15,11 +15,9 @@ import { PoamExtendRoutingModule } from './poam-extend.routing'; import { NbButtonModule, NbCardModule, NbInputModule, NbThemeModule, NbSelectModule, NbAutocompleteModule } from '@nebular/theme'; import { Angular2SmartTableModule } from 'angular2-smart-table'; import { FormsModule } from '@angular/forms'; -import { AddDaysPipe } from '../../../add-days.pipe'; @NgModule({ declarations: [ - AddDaysPipe, PoamExtendComponent, ], exports: [ diff --git a/Front End/poam-app/src/app/pages/user-processing/user/user.component.scss b/Front End/poam-app/src/app/pages/user-processing/user/user.component.scss index c2612635..f3207a9a 100644 --- a/Front End/poam-app/src/app/pages/user-processing/user/user.component.scss +++ b/Front End/poam-app/src/app/pages/user-processing/user/user.component.scss @@ -16,6 +16,12 @@ border: 1px solid nb-theme(border-basic-color-3); } +::ng-deep angular2-smart-table-pager .angular2-smart-page-item .angular2-smart-page-link { + background-color: nb-theme(background-basic-color-2); + color: nb-theme(text-basic-color); + border: 1px solid nb-theme(border-basic-color-3); +} + ::ng-deep angular2-smart-table table, ::ng-deep angular2-smart-table th, ::ng-deep angular2-smart-table td { diff --git a/Front End/poam-app/src/app/pages/user-processing/user/user.component.ts b/Front End/poam-app/src/app/pages/user-processing/user/user.component.ts index 5fbefbe8..97d2ed78 100644 --- a/Front End/poam-app/src/app/pages/user-processing/user/user.component.ts +++ b/Front End/poam-app/src/app/pages/user-processing/user/user.component.ts @@ -55,7 +55,7 @@ export class UserComponent implements OnInit { collectionPermissionsSettings: Settings = { add: { - addButtonContent: '', //'', + addButtonContent: '', createButtonContent: '', cancelButtonContent: '', //', confirmCreate: true, @@ -79,6 +79,7 @@ export class UserComponent implements OnInit { columns: { collectionId: { title: 'Collections', + width: '19%', isFilterable: false, type: 'html', valuePrepareFunction: (_cell: any, row: any) => { @@ -93,6 +94,7 @@ export class UserComponent implements OnInit { }, canOwn: { title: 'Can Own', + width: '19%', isFilterable: false, type: 'html', valuePrepareFunction: (_cell: any, row: any) => { @@ -111,6 +113,7 @@ export class UserComponent implements OnInit { }, canMaintain: { title: 'Can Maintain', + width: '19%', isFilterable: false, type: 'html', valuePrepareFunction: (_cell: any, row: any) => { @@ -129,6 +132,7 @@ export class UserComponent implements OnInit { }, canApprove: { title: 'Can Approve', + width: '19%', isFilterable: false, type: 'html', valuePrepareFunction: (_cell: any, row: any) => { @@ -147,6 +151,7 @@ export class UserComponent implements OnInit { }, canView: { title: 'Can View', + width: '19%', isFilterable: false, type: 'html', valuePrepareFunction: (_cell: any, row: any) => { @@ -184,9 +189,6 @@ export class UserComponent implements OnInit { currentUser => { this.user = currentUser; - if (this.user.isAdmin == 1) { - this.checked = true; - } this.loadCollections(); this.getData(); this.isLoading = false; @@ -207,6 +209,9 @@ export class UserComponent implements OnInit { this.user = userData; this.loadCollections(); this.isLoading = false; + if (this.user.isAdmin == 1) { + this.checked = true; + } }, error => { console.error('Error fetching user data', error);