Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Cwdoe 992 cite push fixes #88

Merged
merged 14 commits into from
Jul 31, 2023
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blueprint-ui",
"version": "0.3.7-rc2",
"version": "0.3.7-rc4",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
[topbarColor]="topbarColor"
[topbarTextColor]="topbarTextColor"
[imageFilePath]="topbarImage"
(urlNavigate)="goToUrl($event)"
></app-topbar>

<mat-sidenav-container class="tall" autosize>
Expand All @@ -26,15 +27,15 @@
<button
aria-label="Exit Administration"
mat-icon-button
[routerLink]="['/']"
(click)="goToUrl('/')"
style="outline: none"
>
<mat-icon
class="mdi-24px"
fontIcon="mdi-close-circle-outline"
></mat-icon>
</button>
<a class="nolink" [routerLink]="['/']">
<a class="nolink" (click)="goToUrl('/')">
<div class="cssLayoutRowCenterCenter">
<h2 class="icon-text">Administration</h2>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ export class AdminContainerComponent implements OnDestroy, OnInit {
});
}

goToUrl(url): void {
this.router.navigate([url], {
queryParamsHandling: 'merge',
});
}

getSelectedClass(section: string) {
if (section === this.displayedSection) {
return 'selected-item';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
class="mat-elevation-z2 mat-header-row"
>
<div class="mat-header-cell user-cell" mat-sort-header="name"><span style="margin-left: 80px;">User</span></div>
<div class="mat-header-cell permission-cell">Permissions</div>
<div class="mat-header-cell permission-cell" *ngFor="let permission of permissionList" mat-sort-header="{{ permission.id }}">{{ permission.key }}</div>
</section>

<mat-expansion-panel
Expand All @@ -127,14 +127,14 @@
</button>
{{ user.name }}
</span>
<span class="mat-cell permission-cell">
<span class="mat-cell permission-cell" *ngFor="let permission of permissionList">
<div class="cssLayoutRowStartCenter">
<div class="permission-item" *ngFor="let permission of permissionList">
<div class="permission-item">
<mat-checkbox
[checked]="hasPermission(permission.id, user)"
(change)="toggleUserPermission(user, permission.id)"
style="margin-right: 20px;"
>{{ permission.key }}</mat-checkbox
></mat-checkbox
>
</div>
</div>
Expand Down
17 changes: 7 additions & 10 deletions src/app/components/admin/admin-users/admin-users.component.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2022 Carnegie Mellon University. All Rights Reserved.
// Released under a MIT (SEI)-style license. See LICENSE.md in the
// Released under a MIT (SEI)-style license. See LICENSE.md in the
// project root for license information.

.mat-table {
Expand Down Expand Up @@ -39,7 +39,12 @@
}

.permission-cell {
flex: 70;
flex: 10;
align-self: center;
}

.permission-item {
margin-left: 5px;
}

.button-end {
Expand Down Expand Up @@ -68,14 +73,6 @@
width: 100px;
}

.pad-top {
margin-top: 12px;
}

.permission-item {
margin-right: 10px;
}

.new-user-spacing {
margin-left: 40px;
}
15 changes: 13 additions & 2 deletions src/app/components/admin/admin-users/admin-users.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class AdminUsersComponent implements OnDestroy {
pageEvent: PageEvent;
pageIndex = 0;
pageSize = 20;
sort: Sort = { active: 'shortName', direction: 'asc' };
sort: Sort = { active: 'name', direction: 'asc' };
addingNewUser = false;
newUser: User = { id: '', name: '' };
isLoading = false;
Expand Down Expand Up @@ -110,7 +110,18 @@ export class AdminUsersComponent implements OnDestroy {

sortUsers(a: User, b: User): number {
const dir = this.sort.direction === 'desc' ? -1 : 1;
return a.name.toLowerCase() < b.name.toLowerCase() ? -dir : dir;
if (!this.sort.direction || this.sort.active === 'name') {
this.sort = { active: 'name', direction: 'asc' };
return a.name.toLowerCase() < b.name.toLowerCase() ? -dir : dir;
} else {
const aValue = this.hasPermission(this.sort.active, a).toString();
const bValue = this.hasPermission(this.sort.active, b).toString();
if (aValue === bValue) {
return a.name.toLowerCase() < b.name.toLowerCase() ? -dir : dir;
} else {
return aValue < bValue ? dir : -dir;
}
}
}

paginatorEvent(page: PageEvent) {
Expand Down
43 changes: 28 additions & 15 deletions src/app/components/data-field-list/data-field-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { Component, Input, OnDestroy, ViewChild } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';
import { Subject, Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { delay, takeUntil } from 'rxjs/operators';
import {
DataField,
DataFieldType,
Expand Down Expand Up @@ -44,7 +44,7 @@ export class DataFieldListComponent implements OnDestroy {
editingId = '';
dataOptionList: DataOption[] = [];
dataFieldTypes = DataFieldType.keys;

private waitCount = 0;
private unsubscribe$ = new Subject();
// context menu
@ViewChild(MatMenuTrigger, { static: true }) contextMenu: MatMenuTrigger;
Expand Down Expand Up @@ -115,19 +115,8 @@ export class DataFieldListComponent implements OnDestroy {
dialogRef.componentInstance.editComplete.subscribe((result) => {
if (result.saveChanges && result.dataField) {
const dataFieldId = this.saveDataField(result.dataField);
result.addedDataFieldOptions.forEach(dfo => {
dfo.dataFieldId = dataFieldId;
console.log('add ' + dfo.optionName);
this.dataOptionDataService.add(dfo);
});
result.changedDataFieldOptions.forEach(dfo => {
console.log('update ' + dfo.optionName);
this.dataOptionDataService.updateDataOption(dfo);
});
result.deletedDataFieldOptions.forEach(dfo => {
console.log('delete ' + dfo.optionName);
this.dataOptionDataService.delete(dfo.id);
});
this.waitCount = 0;
this.saveDataOptions(dataFieldId, result.addedDataFieldOptions, result.changedDataFieldOptions, result.deletedDataFieldOptions);
}
dialogRef.close();
});
Expand All @@ -143,6 +132,30 @@ export class DataFieldListComponent implements OnDestroy {
return dataField.id;
}

saveDataOptions(dataFieldId: string, addOptionList: DataOption[], changeOptionList: DataOption[], deleteOptionList: DataOption[]) {
if (this.waitCount >= 50) {
console.log('Error saving the DataOptions! DataField never showed up in the DataField list.');
}
if (this.dataFieldList.some(df => df.id === dataFieldId)) {
addOptionList.forEach(dfo => {
dfo.dataFieldId = dataFieldId;
this.dataOptionDataService.add(dfo);
});
changeOptionList.forEach(dfo => {
this.dataOptionDataService.updateDataOption(dfo);
});
deleteOptionList.forEach(dfo => {
this.dataOptionDataService.delete(dfo.id);
});
} else {
this.waitCount++;
setTimeout(() => {
this.saveDataOptions(dataFieldId, addOptionList, changeOptionList, deleteOptionList);
}, 300);

}
}

deleteDataField(dataField: DataField): void {
if (this.isAddingDataField || (this.editingId && this.editingId !== dataField.id)) {
return;
Expand Down
1 change: 1 addition & 0 deletions src/app/components/home-app/home-app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
[topbarColor]="topbarColor"
[topbarTextColor]="topbarTextColor"
[imageFilePath]="topbarImage"
(urlNavigate)="topBarNavigate($event)"
></app-topbar>

<div *ngIf="apiIsSick" autosize>
Expand Down
14 changes: 13 additions & 1 deletion src/app/components/home-app/home-app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,19 @@ export class HomeAppComponent implements OnDestroy, OnInit {
}

goToUrl(url): void {
this.router.navigate([url]);
this.router.navigate([url], {
queryParamsHandling: 'merge',
});
}

topBarNavigate(url): void {
if (url === '/') {
this.router.navigate([url]);
} else {
this.router.navigate([url], {
queryParamsHandling: 'merge',
});
}
}

ngOnDestroy() {
Expand Down
7 changes: 4 additions & 3 deletions src/app/components/msel-info/msel-info.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,15 @@
title="Push to Gallery"
class="thin-button"
*ngIf="!msel.galleryCollectionId"
[disabled]="galleryToDo()"
[disabled]="!(isContentDeveloper || msel.hasRole(loggedInUserId, null).owner) || galleryToDo() || isChanged"
><span *ngIf="isBusy">Pushing to Gallery ...</span><span *ngIf="!isBusy">Push to Gallery</span></button>
<span *ngIf="!msel.galleryCollectionId && galleryToDo()" class="gallery-warning">** Unassigned Gallery Article Parameters in Data Fields</span>
<button
(click)="pullFromGallery()"
title="Remove from Gallery"
class="thin-button"
*ngIf="msel.galleryCollectionId"
[disabled]="!(isContentDeveloper || msel.hasRole(loggedInUserId, null).owner)"
>Remove from Gallery</button>
</div>
</div>
Expand Down Expand Up @@ -177,7 +178,7 @@
<mat-select
[(ngModel)]="msel.citeScoringModelId"
(cut)="isChanged = true"
(change)="isChanged = true"
(selectionChange)="isChanged = true"
(paste)="isChanged = true"
(keypress)="isChanged = true"
>
Expand Down Expand Up @@ -206,7 +207,7 @@
title="Push to CITE"
class="thin-button"
*ngIf="!msel.citeEvaluationId"
[disabled]="!(isContentDeveloper || msel.hasRole(loggedInUserId, null).owner) || !msel.citeScoringModelId || isBusy"
[disabled]="!(isContentDeveloper || msel.hasRole(loggedInUserId, null).owner) || !msel.citeScoringModelId || isBusy || isChanged"
><span *ngIf="isBusy">Pushing to CITE ...</span><span *ngIf="!isBusy">Push to CITE</span></button>
<button
(click)="pullFromCite()"
Expand Down
1 change: 0 additions & 1 deletion src/app/components/msel-list/msel-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ export class MselListComponent implements OnDestroy, OnInit {
}

goToUrl(url): void {
this.uiDataService.setMselTab('');
this.router.navigate([url]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/components/msel-roles/msel-roles.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class MselRolesComponent implements OnDestroy {
expandedSectionIds: string[] = [];
sortedScenarioEvents: ScenarioEvent[];
sortedDataFields: DataField[];
mselRoles: MselRole[] = [MselRole.Editor, MselRole.Approver, MselRole.MoveEditor, MselRole.Owner, MselRole.Viewer];
mselRoles: MselRole[] = [MselRole.Editor, MselRole.Approver, MselRole.MoveEditor, MselRole.Owner, MselRole.Facilitator, MselRole.Viewer];
isEditEnabled = false;
userList: User[] = [];
mselTeamList: MselTeam[] = [];
Expand Down Expand Up @@ -90,7 +90,7 @@ export class MselRolesComponent implements OnDestroy {
});
if (this.mselTeamList.length > 0) {
this.mselTeamList = this.mselTeamList.sort((a, b) =>
this.getTeam(a.teamId).shortName?.toLowerCase() > this.getTeam(b.teamId).shortName?.toLowerCase() ? 1 : -1);
a.team.shortName?.toLowerCase() > b.team.shortName?.toLowerCase() ? 1 : -1);
}
});
// subscribe to UserMselRoles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<div class="container">
<div class="tableFixHead" *ngIf="msel">
<table>
<thead>
<thead matSort
(matSortChange)="sortChanged($event)">
<tr>
<th class="background">
<div class="row-start-buttons">
Expand All @@ -19,10 +20,18 @@
>
<mat-icon class="mdi-24px self-center" fontIcon="mdi-plus-circle-outline"></mat-icon>
</button>
<mat-form-field style="width: 100px;">
<input
matInput
[(ngModel)]="filterString"
(keyup)="keyUp.next($event)"
placeholder="Search"
/>
</mat-form-field>
</div>
</th>
<ng-container *ngFor="let df of sortedDataFields">
<th class="background">
<th mat-sort-header="{{ df.name }}" class="background">
<div [style]="getStyle(df)">{{ df.name }}</div>
</th>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ th, td {
display: flex;
}

.order-header {
align-self: center;
margin-left: 75px;
}

.row-index {
width: 20px;
text-align: right;
Expand Down
Loading
Loading