Skip to content

Commit

Permalink
514 Contributor Page (#515)
Browse files Browse the repository at this point in the history
* filter "more" routes from "explore" section

* update utils

* init contributors page

* contributor page

* fix popover style

* update popover content

* update changelog
  • Loading branch information
clemiller authored Nov 2, 2023
1 parent 0fc32e6 commit decd959
Show file tree
Hide file tree
Showing 43 changed files with 227 additions and 36 deletions.
17 changes: 17 additions & 0 deletions app/src/app/app-routing-stix.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { CampaignListComponent } from './views/stix/campaign/campaign-list/campa
import { AssetListComponent } from './views/stix/asset/asset-list/asset-list.component';
import { NotesPageComponent } from './views/notes-page/notes-page.component';
import { StixPageComponent } from './views/stix/stix-page/stix-page.component';
import { ContributorsPageComponent } from './views/contributors-page/contributors-page.component';

import { RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
Expand Down Expand Up @@ -282,6 +283,22 @@ stixRoutes.push({
},
component: ReferenceManagerComponent
}]
}, {
path: 'contributors',
canActivateChild: [AuthorizationGuard],
data: {
breadcrumb: 'contributors',
more: true
},
children: [{
path: '',
data: {
breadcrumb: 'list',
title: 'Contributors',
roles: viewRoles
},
component: ContributorsPageComponent
}]
}, {
path: 'notes',
canActivateChild: [AuthorizationGuard],
Expand Down
6 changes: 3 additions & 3 deletions app/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { AfterViewInit, Component, ElementRef, ViewChild, ViewEncapsulation } from '@angular/core';
import { MatDrawerContainer } from '@angular/material/sidenav';
import { OverlayContainer } from '@angular/cdk/overlay';
import { getCookie, hasCookie, setCookie } from './util/cookies';
import { getCookie, hasCookie, setCookie } from './utils/cookies';
import { SidebarService } from './services/sidebar/sidebar.service';
import { NGXLogger } from 'ngx-logger';
import { initLogger } from './util/logger';
import { initLogger } from './utils/logger';
import { AuthenticationService } from './services/connectors/authentication/authentication.service';
import { NavigationEnd, Router } from '@angular/router';
import { EditorService } from './services/editor/editor.service';
import { Theme } from './globals';
import { Theme } from './utils/globals';
import { AppConfigService } from './services/config/app-config.service';

@Component({
Expand Down
5 changes: 4 additions & 1 deletion app/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ import { TeamsListPageComponent } from './views/admin-page/teams/teams-list-page
import { TeamsViewPageComponent } from './views/admin-page/teams/teams-view-page/teams-view-page.component';
import { CreateNewDialogComponent } from './components/create-new-dialog/create-new-dialog.component';

import { ContributorsPageComponent } from './views/contributors-page/contributors-page.component';

import { AppConfigService } from './services/config/app-config.service';

export function initConfig(appConfigService: AppConfigService) {
Expand Down Expand Up @@ -348,7 +350,8 @@ export function initConfig(appConfigService: AppConfigService) {
SubtypeViewComponent,
SubtypeEditComponent,
SubtypeDialogComponent,
BreadcrumbComponent
BreadcrumbComponent,
ContributorsPageComponent
],
imports: [
MaterialFileInputModule,
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/authn/team.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { RestApiConnectorService } from '../../services/connectors/rest-api/rest-api-connector.service';
import { logger } from '../../util/logger';
import { logger } from '../../utils/logger';
import { Serializable, ValidationData } from '../serializable';

export class Team extends Serializable {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/authn/user-account.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { RestApiConnectorService } from '../../services/connectors/rest-api/rest-api-connector.service';
import { logger } from '../../util/logger';
import { logger } from '../../utils/logger';
import { Serializable, ValidationData } from '../serializable';
import { Role } from './role';
import { Status } from './status';
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/collection-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable, of } from 'rxjs';
import { RestApiConnectorService } from '../services/connectors/rest-api/rest-api-connector.service';
import { Serializable, ValidationData } from './serializable';
import { VersionNumber } from './version-number';
import { logger } from "../util/logger";
import { logger } from "../utils/logger";

// https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/develop/docs/collections.md#collection-version-properties
export class CollectionVersion extends Serializable {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/external-references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { map } from "rxjs/operators";
import { RestApiConnectorService } from "../services/connectors/rest-api/rest-api-connector.service";
import { Serializable, ValidationData } from "./serializable";
import { StixObject } from "./stix/stix-object";
import { logger } from "../util/logger";
import { logger } from "../utils/logger";
import { RelatedAsset } from "./stix/asset";

export class ExternalReferences extends Serializable {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/asset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StixObject } from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";
import { Observable } from "rxjs";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/campaign.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StixObject } from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";
import { Observable } from "rxjs";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable, of } from 'rxjs';
import { RestApiConnectorService } from 'src/app/services/connectors/rest-api/rest-api-connector.service';
import { ValidationData } from '../serializable';
import { Asset, Campaign, DataComponent, DataSource, Group, MarkingDefinition, Matrix, Mitigation, Relationship, Software, StixObject, Tactic, Technique } from '../stix';
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

/**
* auto-generated changelog/report about an import
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/data-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable } from "rxjs";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
import { StixObject } from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";
import { DataSource } from "./data-source";

export class DataComponent extends StixObject {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/data-source.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StixObject } from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { Observable } from "rxjs";
import { ValidationData } from "../serializable";
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { StixObject } from "./stix-object";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { Observable } from "rxjs";
import { ValidationData } from "../serializable";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

export class Group extends StixObject {
public name: string = "";
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable, of } from "rxjs";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
import { StixObject } from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

export class Identity extends StixObject {
public name: string; // identity name
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/marking-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StixObject } from "./stix-object";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { Observable, of } from "rxjs";
import { ValidationData } from "../serializable";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

export class MarkingDefinition extends StixObject {
public name: string = "";
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable, of } from "rxjs";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
import { StixObject } from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";
import { Tactic } from "./tactic";

export class Matrix extends StixObject {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/mitigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable } from "rxjs";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
import {StixObject} from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

export class Mitigation extends StixObject {
public name: string = "";
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable } from "rxjs";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
import { StixObject } from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

export class Note extends StixObject {
public title: string = "";
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/relationship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { map, switchMap } from "rxjs/operators";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
import { StixObject } from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

export class Relationship extends StixObject {

Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/software.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable } from "rxjs";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
import { StixObject } from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

type type_software = "malware" | "tool"
export class Software extends StixObject {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/stix-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Serializable, ValidationData } from '../serializable';
import { Paginated, RestApiConnectorService } from 'src/app/services/connectors/rest-api/rest-api-connector.service';
import { forkJoin, Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

export type workflowStates = "work-in-progress" | "awaiting-review" | "reviewed" | "";
let stixTypeToAttackType = {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/tactic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable, of } from "rxjs";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
import {StixObject} from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";
import { Technique } from "./technique";

export class Tactic extends StixObject {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/stix/technique.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { map, switchMap } from "rxjs/operators";
import { RestApiConnectorService } from "src/app/services/connectors/rest-api/rest-api-connector.service";
import { ValidationData } from "../serializable";
import { StixObject } from "./stix-object";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

export class Technique extends StixObject {
public name: string = "";
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/classes/version-number.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ValidatorFn, AbstractControl } from '@angular/forms';
import { logger } from "../util/logger";
import { logger } from "../utils/logger";

export class VersionNumber {
private _version = [];
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/components/footer/footer.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import * as globals from "../../globals";
import * as globals from "../../utils/globals";

@Component({
selector: 'app-footer',
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/components/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { stixRoutes } from "../../app-routing-stix.module";
import { AuthenticationService } from 'src/app/services/connectors/authentication/authentication.service';
import { Subscription } from "rxjs";
import { Role } from 'src/app/classes/authn/role';
import * as globals from "../../globals";
import * as globals from "../../utils/globals";

@Component({
selector: 'app-header',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { MatDialog } from '@angular/material/dialog';
import { AddDialogComponent } from 'src/app/components/add-dialog/add-dialog.component';
import { StixObject } from 'src/app/classes/stix/stix-object';
import { SelectionModel } from '@angular/cdk/collections';
import { logger } from "../../../../util/logger";
import { logger } from "../../../../utils/logger";
@Component({
selector: 'app-ordered-list-edit',
templateUrl: './ordered-list-edit.component.html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { SidebarService } from 'src/app/services/sidebar/sidebar.service';
import { MatSelect } from '@angular/material/select';
import { AddDialogComponent } from '../../add-dialog/add-dialog.component';
import { Collection } from 'src/app/classes/stix/collection';
import { logger } from 'src/app/util/logger';
import { logger } from 'src/app/utils/logger';

@Component({
selector: 'app-stix-list',
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/services/connectors/api-connector.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MatSnackBar } from "@angular/material/snack-bar";
import { Observable, of, throwError } from "rxjs";
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

export abstract class ApiConnector {
private theSnackbar: MatSnackBar; //note: constructor in super must import snackbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { Tactic } from 'src/app/classes/stix/tactic';
import { Technique } from 'src/app/classes/stix/technique';
import { environment } from "../../../../environments/environment";
import { ApiConnector } from '../api-connector';
import { logger } from "../../../util/logger";
import { logger } from "../../../utils/logger";
import { DataSource } from 'src/app/classes/stix/data-source';
import { DataComponent } from 'src/app/classes/stix/data-component';
import { UserAccount } from 'src/app/classes/authn/user-account';
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/services/title/title.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
import { filter, map, mergeMap } from 'rxjs/operators';
import { logger } from "../../util/logger";
import { logger } from "../../utils/logger";

@Injectable({
providedIn: 'root'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<div class="contributors-page view-page list-page grid">
<div class="list-page-header">
<h1 class="with-help-icon">
Contributors
<popover-content #objectDescription placement="bottom">
<span>Individuals or organizations that have contributed information regarding the existence of a technique, details on how to detect and/or mitigate use of a technique, or threat intelligence on adversary use.</span>
</popover-content>
<mat-icon class="help-icon" [popover]="objectDescription" aria-label="help">help_outline</mat-icon>
</h1>
</div>
<div *ngIf="!loading else loadingTemplate" class="row">
<ng-container *ngFor="let column of columns">
<div class="col">
<ul>
<li *ngFor="let contributor of column">
<a class="link" (click)="openDialog(contributor)">{{contributor}}</a>
</li>
</ul>
</div>
</ng-container>
</div>
</div>

<ng-template #contributorsDialog let-data>
<div class="contributors-dialog">
<h2>{{data.contributor}}</h2>
<mat-dialog-content>
<h3 class="section-header">Contributions</h3>
<div>
<app-stix-list (onRowAction)="dialogRef.close()" [config]="{
stixObjects: data.objects,
clickBehavior: 'linkToObjectPage',
showControls: false
}"></app-stix-list>
</div>
</mat-dialog-content>
<mat-dialog-actions align="center">
<button mat-button mat-dialog-close>
close
</button>
</mat-dialog-actions>
</div>
</ng-template>

<ng-template #loadingTemplate>
<app-loading-overlay></app-loading-overlay>
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@import "../../../style/globals";

.contributors-page {
width: 68em !important;
.link {
cursor: pointer;
}
}

.contributors-dialog {
text-align: center;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ContributorsPageComponent } from './contributors-page.component';

describe('ContributorsPageComponent', () => {
let component: ContributorsPageComponent;
let fixture: ComponentFixture<ContributorsPageComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ContributorsPageComponent],
}).compileComponents();

fixture = TestBed.createComponent(ContributorsPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit decd959

Please sign in to comment.