shamrickus commented on code in PR #7434:
URL: https://github.com/apache/trafficcontrol/pull/7434#discussion_r1165827998
##########
experimental/traffic-portal/src/app/shared/navigation/navigation.service.ts:
##########
@@ -167,6 +167,16 @@ export class NavigationService {
}
],
name: "Other"
+ }, {
Review Comment:
This is duplicating the `Configuration` entry, probably slipped through
during a merge as it got moved up.
##########
experimental/traffic-portal/src/app/api/testing/profile.service.ts:
##########
@@ -173,4 +173,36 @@ export class ProfileService {
})
);
}
+
+ /**
+ * Creates a new profile.
+ *
+ * @param profile The profile to create.
+ * @returns The created profile.
+ */
+ public async createProfile(profile: RequestProfile):
Promise<ResponseProfile> {
+ const t = {
+ ...profile,
+ cdnName: "test",
Review Comment:
nit: This can be null and since we don't actually know what `cdnName` is
associated with `cdn` I'd say it's fine to just leave this null (assuming that
doesn't break tests).
##########
experimental/traffic-portal/src/app/core/profiles/profile-table/profile-table.component.html:
##########
@@ -0,0 +1,27 @@
+<!--
+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 Profiles" autofocus inputmode="search" role="search" accesskey="/"
placeholder="Fuzzy Search" [formControl]="fuzzControl" (input)="updateURL()" />
+ </div>
+ <tp-generic-table
+ [data]="profiles | async"
Review Comment:
This is missing the dropdown from TPv1 that has `Import Profile` and
`Compare Profile`. Currently tpv2 doesn't really have a method for adding that
drop down but you can add more buttons through `[tableTitleButtons]`.
Compare Profiles should be disabled (needs parameters to be implemented),
you'll probably have to modify the generic-table code slightly to allow for
disabling of these buttons.
##########
experimental/traffic-portal/src/app/core/profiles/profile-table/profile-table.component.ts:
##########
@@ -0,0 +1,148 @@
+/*
+* 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, OnInit } from "@angular/core";
+import { UntypedFormControl } from "@angular/forms";
+import { MatDialog } from "@angular/material/dialog";
+import { ActivatedRoute, Params } from "@angular/router";
+import { BehaviorSubject } from "rxjs";
+import { ResponseProfile } from "trafficops-types";
+
+import { ProfileService } from "src/app/api";
+import { CurrentUserService } from
"src/app/shared/current-user/current-user.service";
+import { DecisionDialogComponent } from
"src/app/shared/dialogs/decision-dialog/decision-dialog.component";
+import { ContextMenuActionEvent, ContextMenuItem } from
"src/app/shared/generic-table/generic-table.component";
+import { NavigationService } from
"src/app/shared/navigation/navigation.service";
+
+/**
+ * ProfileTableComponent is the controller for the profiles page - which
+ * principally contains a table.
+ */
+@Component({
+ selector: "tp-profile-table",
+ styleUrls: ["./profile-table.component.scss"],
+ templateUrl: "./profile-table.component.html"
+})
+export class ProfileTableComponent implements OnInit {
+ /** All the physical locations which should appear in the table. */
+ public profiles: Promise<Array<ResponseProfile>>;
+
+ /** Definitions of the table's columns according to the ag-grid API */
+ public columnDefs = [{
+ field: "cdnName",
+ headerName: "CDN"
+ }, {
+ field: "description",
+ headerName: "Description",
+ }, {
+ field: "id",
+ headerName: "ID",
+ hide: true
+ }, {
+ field: "lastUpdated",
+ headerName: "Last Updated",
+ hide: true
+ }, {
+ field: "name",
+ headerName: "Name"
+ }, {
+ field: "routingDisabled",
+ headerName: "Routing Disabled"
+ }, {
+ field: "type",
+ headerName: "Type"
+ }];
+
+ /** Definitions for the context menu items (which act on augmented
cache-group data). */
+ public contextMenuItems: Array<ContextMenuItem<ResponseProfile>> = [
Review Comment:
This is missing a few options:
* Edit (which should be disabled for now as the detail view doesn't exist
yet)
* Mange Parameters (again should be disabled as parameters aren't present)
* Open In New tab (should be disabled)
* Export (which has a TO API endpoint)
* Clone Profile (which has a TO API endpoint that does the heavy lifting)
##########
experimental/traffic-portal/src/app/core/profiles/profile-table/profile-table.component.ts:
##########
@@ -0,0 +1,148 @@
+/*
+* 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, OnInit } from "@angular/core";
+import { UntypedFormControl } from "@angular/forms";
+import { MatDialog } from "@angular/material/dialog";
+import { ActivatedRoute, Params } from "@angular/router";
+import { BehaviorSubject } from "rxjs";
+import { ResponseProfile } from "trafficops-types";
+
+import { ProfileService } from "src/app/api";
+import { CurrentUserService } from
"src/app/shared/current-user/current-user.service";
+import { DecisionDialogComponent } from
"src/app/shared/dialogs/decision-dialog/decision-dialog.component";
+import { ContextMenuActionEvent, ContextMenuItem } from
"src/app/shared/generic-table/generic-table.component";
+import { NavigationService } from
"src/app/shared/navigation/navigation.service";
+
+/**
+ * ProfileTableComponent is the controller for the profiles page - which
+ * principally contains a table.
+ */
+@Component({
+ selector: "tp-profile-table",
+ styleUrls: ["./profile-table.component.scss"],
+ templateUrl: "./profile-table.component.html"
+})
+export class ProfileTableComponent implements OnInit {
+ /** All the physical locations which should appear in the table. */
+ public profiles: Promise<Array<ResponseProfile>>;
+
+ /** Definitions of the table's columns according to the ag-grid API */
+ public columnDefs = [{
+ field: "cdnName",
+ headerName: "CDN"
+ }, {
+ field: "description",
+ headerName: "Description",
+ }, {
+ field: "id",
+ headerName: "ID",
+ hide: true
+ }, {
+ field: "lastUpdated",
+ headerName: "Last Updated",
+ hide: true
+ }, {
+ field: "name",
+ headerName: "Name"
+ }, {
+ field: "routingDisabled",
+ headerName: "Routing Disabled"
+ }, {
+ field: "type",
+ headerName: "Type"
+ }];
+
+ /** Definitions for the context menu items (which act on augmented
cache-group data). */
+ public contextMenuItems: Array<ContextMenuItem<ResponseProfile>> = [
+ {
+ action: "delete",
+ multiRow: false,
+ name: "Delete"
+ },
+ {
+ href: "/core/servers",
+ name: "View Servers",
+ queryParams: (profile: ResponseProfile): Params =>
({profileName: profile.name})
+ }
+ ];
+
+ /** 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: UntypedFormControl = new UntypedFormControl("");
Review Comment:
This should be a `FormControl<string>` with `nonNullable` set to true (you
can see an example on the coordinates-table), these were converted to
`UntypedFormControl`s during an angular upgrade and we should ideally be
changing these to the typed version when we can.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]