You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by rs...@apache.org on 2023/05/11 05:36:26 UTC
[trafficcontrol] 03/05: Updated folder name
This is an automated email from the ASF dual-hosted git repository.
rshah pushed a commit to branch feature/tpv2-role-details
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit cacfc77372e52d859c921bc8fc11a5ebb49a4962
Author: Rima Shah <ri...@comcast.com>
AuthorDate: Wed May 3 22:34:58 2023 -0600
Updated folder name
---
.../users/roles/tables/roles-table.component.html | 28 ------
.../users/roles/tables/roles-table.component.scss | 13 ---
.../roles/tables/roles-table.component.spec.ts | 68 -------------
.../users/roles/tables/roles-table.component.ts | 111 ---------------------
4 files changed, 220 deletions(-)
diff --git a/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.html b/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.html
deleted file mode 100644
index 1ac559b6e1..0000000000
--- a/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<mat-card class="table-page-content">
- <div class="search-container">
- <input type="search" name="fuzzControl" aria-label="Fuzzy Search Roles" inputmode="search" role="search" accesskey="/" placeholder="Fuzzy Search" [formControl]="fuzzControl" (input)="updateURL()" />
- </div>
- <tp-generic-table
- [data]="roles | async"
- [cols]="columnDefs"
- [fuzzySearch]="fuzzySubject"
- context="roles"
- [contextMenuItems]="contextMenuItems"
- (contextMenuAction)="handleContextMenu($event)">
- </tp-generic-table>
-</mat-card>
-
-
-<a class="page-fab" mat-fab title="Create a new role" *ngIf="auth.hasPermission('ROLE:CREATE')" routerLink="new"><mat-icon>add</mat-icon></a>
diff --git a/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.scss b/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.scss
deleted file mode 100644
index ebe77042d3..0000000000
--- a/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.scss
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
diff --git a/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.spec.ts b/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.spec.ts
deleted file mode 100644
index f7df2655fc..0000000000
--- a/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.spec.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-import { ComponentFixture, fakeAsync, TestBed, tick } from "@angular/core/testing";
-import { MatDialogModule } from "@angular/material/dialog";
-import { RouterTestingModule } from "@angular/router/testing";
-
-import { APITestingModule } from "src/app/api/testing";
-import { RoleTableComponent } from "src/app/core/users/roles/table/roles-table.component";
-
-describe("RoleTableComponent", () => {
- let component: RoleTableComponent;
- let fixture: ComponentFixture<RoleTableComponent>;
-
- beforeEach(async () => {
- await TestBed.configureTestingModule({
- declarations: [ RoleTableComponent ],
- imports: [ APITestingModule, RouterTestingModule, MatDialogModule ]
- })
- .compileComponents();
-
- fixture = TestBed.createComponent(RoleTableComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it("should create", () => {
- expect(component).toBeTruthy();
- });
-
- it("updates the fuzzy search output", fakeAsync(() => {
- let called = false;
- const text = "testquest";
- const spy = jasmine.createSpy("subscriber", (txt: string): void =>{
- if (!called) {
- expect(txt).toBe("");
- called = true;
- } else {
- expect(txt).toBe(text);
- }
- });
- component.fuzzySubject.subscribe(spy);
- tick();
- expect(spy).toHaveBeenCalled();
- component.fuzzControl.setValue(text);
- component.updateURL();
- tick();
- expect(spy).toHaveBeenCalledTimes(2);
- }));
-
- it("handles contextmenu events", () => {
- expect(async () => component.handleContextMenu({
- action: component.contextMenuItems[0].name,
- data: {name: "test", description: "Can only read", lastUpdated: new Date()}
- })).not.toThrow();
- });
-});
diff --git a/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.ts b/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.ts
deleted file mode 100644
index 814e4863b9..0000000000
--- a/experimental/traffic-portal/src/app/core/users/roles/tables/roles-table.component.ts
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-import { Component, type OnInit } from "@angular/core";
-import { FormControl } from "@angular/forms";
-import { ActivatedRoute } from "@angular/router";
-import { BehaviorSubject } from "rxjs";
-import type { ResponseRole } from "trafficops-types";
-
-import { UserService } from "src/app/api";
-import { CurrentUserService } from "src/app/shared/current-user/current-user.service";
-import type { ContextMenuActionEvent, ContextMenuItem } from "src/app/shared/generic-table/generic-table.component";
-import { NavigationService } from "src/app/shared/navigation/navigation.service";
-/**
- * AsnsTableComponent is the controller for the "Asns" table.
- */
-@Component({
- selector: "tp-roles",
- styleUrls: ["./roles-table.component.scss"],
- templateUrl: "./roles-table.component.html"
-})
-export class RolesTableComponent implements OnInit {
- /** List of roles */
- public roles: Promise<Array<ResponseRole>>;
- constructor(private readonly route: ActivatedRoute, private readonly headerSvc: NavigationService,
- private readonly api: UserService, public readonly auth: CurrentUserService) {
- this.fuzzySubject = new BehaviorSubject<string>("");
- this.roles = this.api.getRoles();
- this.headerSvc.headerTitle.next("Roles");
- }
-
- /** Initializes table data, loading it from Traffic Ops. */
- public ngOnInit(): void {
- this.route.queryParamMap.subscribe(
- m => {
- const search = m.get("search");
- if (search) {
- this.fuzzControl.setValue(decodeURIComponent(search));
- this.updateURL();
- }
- },
- e => {
- console.error("Failed to get query parameters:", e);
- }
- );
- }
-
- /** Definitions of the table's columns according to the ag-grid API */
- public columnDefs = [
- {
- field: "name",
- headerName: "Name"
- },
- {
- field: "description",
- headerName: "Description",
- },
- {
- field: "lastUpdated",
- headerName: "Last Updated"
- }
- ];
-
- /** Definitions for the context menu items (which act on augmented asn data). */
- public contextMenuItems: Array<ContextMenuItem<ResponseRole>> = [
- {
- href: (selectedRow: ResponseRole): string => `${selectedRow.name}`,
- name: "View Role"
- },
- {
- href: (selectedRow: ResponseRole): string => `${selectedRow.name}`,
- name: "Open in New Tab",
- newTab: true
- },
- {
- href: (selectedRow: ResponseRole): string => `/core/users?role=${selectedRow.name}`,
- name: "View Users"
- },
- ];
-
- /** A subject that child components can subscribe to for access to the fuzzy search query text */
- public fuzzySubject: BehaviorSubject<string>;
-
- /** Form controller for the user search input. */
- public fuzzControl = new FormControl<string>("");
-
- /** Update the URL's 'search' query parameter for the user's search input. */
- public updateURL(): void {
- this.fuzzySubject.next(this.fuzzControl.value ?? "");
- }
-
- /**
- * Handles a context menu event.
- *
- * @param a The action selected from the context menu.
- */
- public handleContextMenu(a: ContextMenuActionEvent<Readonly<ResponseRole>>): void {
- console.log("action:", a);
- }
-}