You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/07/15 20:14:38 UTC
[GitHub] [trafficcontrol] shamrickus opened a new pull request #6031: TP convert ag-grid tables to component
shamrickus opened a new pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031
<!--
************ STOP!! ************
If this Pull Request is intended to fix a security vulnerability, DO NOT submit it! Instead, contact
the Apache Software Foundation Security Team at security@trafficcontrol.apache.org and follow the
guidelines at https://www.apache.org/security/ regarding vulnerability disclosure.
-->
## What does this PR (Pull Request) do?
<!-- Explain the changes you made here. If this fixes an Issue, identify it by
replacing the text in the checkbox item with the Issue number e.g.
- [x] This PR fixes #9001 OR is not related to any Issue
^ This will automatically close Issue number 9001 when the Pull Request is
merged (The '#' is important).
Be sure you check the box properly, see the "The following criteria are ALL
met by this PR" section for details.
-->
- [x] This PR is not related to any Issue <!-- You can check for an issue here: https://github.com/apache/trafficcontrol/issues -->
It converts several ag-grid tables to the `common-grid-component`
## Which Traffic Control components are affected by this PR?
<!-- Please delete all components from this list that are NOT affected by this
Pull Request. Also, feel free to add the name of a tool or script that is
affected but not on the list.
Additionally, if this Pull Request does NOT affect documentation, please
explain why documentation is not required. -->
- Traffic Portal
## What is the best way to verify this PR?
Ensure the new pages still work, subtle functionality might be different since different versions of the ag-grid code exist.
The following pages have been changed:
- Jobs (Invalidation Requests)
- DS Jobs
- Servers
- Status >Servers
- Type >Servers
- CDN >Servers
- Cache Group >Servers
- Phys Loc >Servers
- Topology >Servers
- DS >Servers
- Notifications (on a CDN)
- Change logs
<!-- Please include here ALL the steps necessary to test your Pull Request. If
it includes tests (and most should), outline here the steps needed to run the
tests. If not, lay out the manual testing procedure and please explain why
tests are unnecessary for this Pull Request. -->
<!-- If this PR fixes a bug, please list here all of the affected versions - to
the best of your knowledge. It's also pretty helpful to include a commit hash
of where 'master' is at the time this PR is opened (if it affects master),
because what 'master' means will change over time. For example, if this PR
fixes a bug that's present in master (at commit hash '1df853c8'), in v4.0.0,
and in the current 4.0.1 Release candidate (e.g. RC1), then this list would
look like:
- master (1df853c8)
- 4.0.0
- 4.0.1 (RC1)
If you don't know what other versions might have this bug, AND don't know how
to find the commit hash of 'master', then feel free to leave this section
blank (or, preferably, delete it entirely).
-->
## The following criteria are ALL met by this PR
<!-- Check the boxes to signify that the associated statement is true. To
"check a box", replace the space inside of the square brackets with an 'x'.
e.g.
- [ x] <- Wrong
- [x ] <- Wrong
- [] <- Wrong
- [*] <- Wrong
- [x] <- Correct!
-->
- [x] This PR includes tests OR I have explained why tests are unnecessary
- [x] This PR includes documentation OR I have explained why documentation is unnecessary
- [x] This PR includes an update to CHANGELOG.md OR such an update is not necessary
- [x] This PR includes any and all required license headers
- [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://www.apache.org/security/) for details)
## Additional Information
The only remaining unconverted tables are deliveryservice and it's derivatives.
<!-- If you would like to include any additional information on the PR for
potential reviewers please put it here.
Some examples of this would be:
- Before and after screenshots/gifs of the Traffic Portal if it is affected
- Links to other dependent Pull Requests
- References to relevant context (e.g. new/updates to dependent libraries,
mailing list records, blueprints)
Feel free to leave this section blank (or, preferably, delete it entirely).
-->
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
-->
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] shamrickus commented on pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
shamrickus commented on pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#issuecomment-884984005
All bread crumbs that had a custom href were broken, fixed now.
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] shamrickus commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
shamrickus commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r673200971
##########
File path: traffic_portal/app/src/common/modules/table/agGrid/CommonGridController.js
##########
@@ -217,6 +230,9 @@ let CommonGridController = function ($scope, $document, $state, userModel, dateU
$scope.$apply();
},
onRowClicked: function(params) {
+ if (params.event.target.classList.contains('link')) {
+ return;
+ }
Review comment:
Probably, I just copied it from the servers page
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 merged pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
ocket8888 merged pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r673389300
##########
File path: traffic_portal/app/src/common/modules/table/deliveryServiceServers/TableDeliveryServiceServersController.js
##########
@@ -33,6 +34,56 @@ var TableDeliveryServiceServersController = function(deliveryService, servers, f
$scope.deliveryService = deliveryService;
+ this.$onInit = function() {
+ $scope.contextMenuOptions.push({
+ type: 0
+ });
+ $scope.contextMenuOptions.push({
+ type: 1,
+ shown: function(row) {
+ return !row.topology;
+ },
+ onClick: function(row) {
+ $scope.confirmRemoveServer(row);
+ },
+ isDisabled: function(row) {
+ return !$scope.isEdge(row) && !$scope.isOrigin(row);
+ },
+ getText: function(row) {
+ return "Remove " + row.type + "Server";
+ }
+ });
+ $scope.contextMenuOptions.push({
+ type: 1,
+ shown: function(row) {
+ return row.topology;
+ },
+ onClick: function(row) {
+ $scope.confirmRemoveServer(row);
+ },
+ isDisabled: function(row) {
+ return !$scope.isOrigin(row);
+ },
+ getText: function(row) {
+ return "Remove " + row.type + "Server";
+ }
+ });
+
+ $scope.dropDownOptions.push({
+ type: 0
+ });
+ $scope.dropDownOptions.push({
+ type: 1,
+ name: "selectServersMenuItem",
Review comment:
inconsistent indentation here
##########
File path: traffic_portal/app/src/common/modules/table/deliveryServiceServers/TableDeliveryServiceServersController.js
##########
@@ -93,7 +140,34 @@ var TableDeliveryServiceServersController = function(deliveryService, servers, f
});
};
+ /** @type CGC.TitleButton */
+ $scope.titleButton = {
+ onClick: function() {
+ locationUtils.navigateToPath("topologies/edit?name=" + $scope.deliveryService.topology);
+ },
+ getText: function() {
Review comment:
Inconsistent indentation here
##########
File path: traffic_portal/app/src/common/modules/table/deliveryServiceServers/TableDeliveryServiceServersController.js
##########
@@ -93,7 +140,34 @@ var TableDeliveryServiceServersController = function(deliveryService, servers, f
});
};
+ /** @type CGC.TitleButton */
+ $scope.titleButton = {
+ onClick: function() {
+ locationUtils.navigateToPath("topologies/edit?name=" + $scope.deliveryService.topology);
+ },
+ getText: function() {
+ return "[ " + $scope.deliveryService.topology + " topology ]";
+ }
+ };
+
+ /** @type CGC.TitleBreadCrumbs */
+ $scope.breadCrumbs = [{
+ href: "#!/delivery-services",
+ text: "Delivery Services"
+ },
+ {
+ getHref: function() {
+ return "#!/delivery-services/" + $scope.deliveryService.id + "?type=" + $scope.deliveryService.type;
Review comment:
Same as above RE: encode type names
##########
File path: traffic_portal/app/src/common/modules/table/deliveryServiceJobs/TableDeliveryServiceJobsController.js
##########
@@ -24,6 +25,23 @@ var TableDeliveryServiceJobsController = function(deliveryService, jobs, $contro
$scope.deliveryService = deliveryService;
+ /** @type CGC.TitleBreadCrumbs */
+ $scope.breadCrumbs = [{
+ href: "#!/delivery-services",
+ text: "Delivery Services"
+ },
+ {
+ getText: function () {
+ return $scope.deliveryService.xmlId;
+ },
+ getHref: function () {
+ return "#!/delivery-services/" + $scope.deliveryService.id + "?type=" + $scope.deliveryService.type;
Review comment:
A Type's name is not constrained to any reasonable pattern or character set - this should be encoding that as a URI component.
##########
File path: traffic_portal/app/src/common/modules/table/jobs/TableJobsController.js
##########
@@ -78,25 +66,30 @@ var TableJobsController = function(tableName, jobs, $document, $scope, $state, $
// going to derive the expires date from start + TTL (hours). Format: TTL:24h
let ttl = parseInt(x.parameters.slice('TTL:'.length, x.parameters.length-1), 10);
x.expires = new Date(x.startTime.getTime() + ttl*3600*1000);
+ return x;
});
- $scope.quickSearch = '';
-
- $scope.pageSize = 100;
+ /** @type CGC.DropDownOption[] */
+ $scope.dropDownOptions = [{
+ name: "createJobMenuItem",
+ onClick: function (){
+ $scope.createJob();
+ },
+ text: "Create Invalidation Request",
+ type: 1
+ }];
+
+ /** @type CGC.ContextMenuOption[] */
+ $scope.contextMenuOptions = [{
+ onClick: function (job, $event) {
+ $scope.confirmRemoveJob(jobs, $event);
Review comment:
I think this is supposed to be passing the `job` argument received by this handler, not the entire list of jobs. Given the definition below, it looks like this will always remove the first job in the list returned by the API, regardless of the one on which the context menu was opened.
##########
File path: traffic_portal/test/integration/PageObjects/ServersPage.po.ts
##########
@@ -141,8 +141,7 @@ export class ServersPage extends BasePage {
let name = nameServer+this.randomize;
await this.txtQuickSearch.clear();
await this.txtQuickSearch.sendKeys(name);
- await browser.actions().mouseMove(element(by.xpath("//span[text()='"+name+"']"))).perform();
- await browser.actions().doubleClick(element(by.xpath("//span[text()='"+name+"']"))).perform();
+ await browser.actions().click(element(by.xpath("//span[text()='"+name+"']"))).perform();
Review comment:
We shouldn't be using XPath, CSS is much more familiar and easier to understand. The equivalent selector in this case would be `by.cssContainingText("span", name)`, which is much simpler.
##########
File path: traffic_portal/app/src/common/modules/table/jobs/TableJobsController.js
##########
@@ -51,16 +43,12 @@ var TableJobsController = function(tableName, jobs, $document, $scope, $state, $
field: "startTime",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatter,
- valueFormatter: dateCellFormatter
},
{
headerName: "Expires (UTC)",
field: "expires",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatter,
- valueFormatter: dateCellFormatter
Review comment:
same as above RE: UTC in the column name
##########
File path: traffic_portal/app/src/common/modules/table/servers/TableServersController.js
##########
@@ -262,204 +220,171 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
field: "statusLastUpdated",
hide: true,
filter: "agDateColumnFilter",
- valueFormatter: dateCellFormatter
+ relative: true
}
];
/** All of the statuses (populated on init). */
let statuses = [];
- /** All of the servers - lastUpdated fields converted to actual Dates, ip fields populated from interfaces */
- $scope.servers = servers.map(
- function(x) {
- x.lastUpdated = x.lastUpdated ? new Date(x.lastUpdated.replace("+00", "Z")) : x.lastUpdated;
- x.statusLastUpdated = x.statusLastUpdated ? new Date(x.statusLastUpdated): x.statusLastUpdated;
- Object.assign(x, serverUtils.toLegacyIPInfo(x.interfaces));
- });
-
- /** The base URL to use for constructing links to server charts. */
- $scope.chartsBase = propertiesModel.properties.servers.charts.baseUrl;
-
- /** The currently selected server - at the moment only used by the context menu */
- $scope.server = {
- hostName: "",
- domainName: "",
- id: -1
- };
-
- $scope.quickSearch = '';
-
- $scope.pageSize = 100;
-
- $scope.mouseDownSelectionText = "";
-
- /** Options, configuration, data and callbacks for the ag-grid table. */
- $scope.gridOptions = {
- components: {
- httpsCellRenderer: HTTPSCellRenderer,
- sshCellRenderer: SSHCellRenderer,
- updateCellRenderer: UpdateCellRenderer
- },
- columnDefs: columns,
- enableCellTextSelection:true,
- suppressMenuHide: true,
- multiSortKey: 'ctrl',
- alwaysShowVerticalScroll: true,
- defaultColDef: {
- filter: true,
- sortable: true,
- resizable: true,
- tooltipValueGetter: function(param) {
- return param.value;
- }
+ /** @type CGC.DropDownOption[] */
+ $scope.dropDownOptions = [{
+ name: "createServerMenuItem",
+ href: "#!/servers/new",
+ text: "Create New Server",
+ type: 2
+ }, {
+ type: 0
+ }, {
+ onClick: function (entry) {
+ $scope.confirmCDNQueueServerUpdates(entry);
+ },
+ text: "Queue Server Updates",
+ type: 1
+ }, {
+ onClick: function (entry) {
+ $scope.confirmCDNClearServerUpdates(entry);
+ },
+ text: "Clear Server Updates",
+ type: 1
+ }];
+
+ /** @type CGC.ContextMenuOption[] */
+ $scope.contextMenuOptions = [
+ {
+ type: 2,
+ getHref: function(entry) {
+ return "#!/servers/" + entry.id;
+ },
+ getText: function (entry) {
+ return "Open " + entry.hostName + " in New Tab";
+ },
+ newTab: true
},
- rowData: servers,
- pagination: true,
- paginationPageSize: $scope.pageSize,
- rowBuffer: 0,
- tooltipShowDelay: 500,
- allowContextMenuWithControlKey: true,
- preventDefaultOnContextMenu: true,
- colResizeDefault: "shift",
- onColumnVisible: function(params) {
- if (params.visible){
- return;
- }
- const filterModel = $scope.gridOptions.api.getFilterModel();
- for (let column of params.columns) {
- if (column.filterActive) {
- if (column.colId in filterModel) {
- delete filterModel[column.colId];
- $scope.gridOptions.api.setFilterModel(filterModel);
- }
- }
- }
+ {
+ type: 2,
+ getHref: function (entry) {
+ return "http://" + entry.hostName + "." + entry.domainName;
+ },
+ text: "Navigate To Server FQDN"
},
- onCellContextMenu: function(params) {
- $scope.showMenu = true;
- $scope.menuStyle.left = String(params.event.clientX) + "px";
- $scope.menuStyle.top = String(params.event.clientY) + "px";
- $scope.menuStyle.bottom = "unset";
- $scope.menuStyle.right = "unset";
- $scope.$apply();
- const boundingRect = document.getElementById("context-menu").getBoundingClientRect();
-
- if (boundingRect.bottom > window.innerHeight){
- $scope.menuStyle.bottom = String(window.innerHeight - params.event.clientY) + "px";
- $scope.menuStyle.top = "unset";
- }
- if (boundingRect.right > window.innerWidth) {
- $scope.menuStyle.right = String(window.innerWidth - params.event.clientX) + "px";
- $scope.menuStyle.left = "unset";
- }
- $scope.server = params.data;
- $scope.$apply();
+ {
+ type: 0
},
- onCellMouseDown: function() {
- $scope.mouseDownSelectionText = window.getSelection().toString();
+ {
+ type: 2,
+ getHref: function (entry) {
+ return "#!/servers/" + entry.id;
+ },
+ text: "Edit"
},
- onRowClicked: function(params) {
- if (params.event.target.classList.contains('link')) {
- // no need to navigate to server detail page
- return;
- }
- const selection = window.getSelection().toString();
- if(selection === "" || selection === $scope.mouseDownSelectionText) {
- locationUtils.navigateToPath('/servers/' + params.data.id);
- // Event is outside the digest cycle, so we need to trigger one.
- $scope.$apply();
- }
- $scope.mouseDownSelectionText = "";
- },
- onColumnResized: function(params) {
- localStorage.setItem(tableName + "_table_columns", JSON.stringify($scope.gridOptions.columnApi.getColumnState()));
- },
- onFirstDataRendered: function(event) {
- try {
- const filterState = JSON.parse(localStorage.getItem(tableName + "_table_filters")) || {};
- // apply any filter provided to the controller
- Object.assign(filterState, filter);
- $scope.gridOptions.api.setFilterModel(filterState);
- } catch (e) {
- console.error("Failure to load stored filter state:", e);
+ {
+ type: 1,
+ onClick: function (entry) {
+ $scope.confirmDelete(entry, null);
+ },
+ text: "Delete"
+ },
+ {
+ type: 0
+ },
+ {
+ type: 1,
+ text: "Update Status",
+ onClick: function (entry) {
+ $scope.confirmStatusUpdate(entry, null);
}
-
- $scope.gridOptions.api.addEventListener("filterChanged", function() {
- localStorage.setItem(tableName + "_table_filters", JSON.stringify($scope.gridOptions.api.getFilterModel()));
- });
- },
- onGridReady: function() {
- try { // need to create the show/hide column checkboxes and bind to the current visibility
- const colstates = JSON.parse(localStorage.getItem(tableName + "_table_columns"));
- if (colstates) {
- if (!$scope.gridOptions.columnApi.setColumnState(colstates)) {
- console.error("Failed to load stored column state: one or more columns not found");
- }
- } else {
- $scope.gridOptions.api.sizeColumnsToFit();
- }
- } catch (e) {
- console.error("Failure to retrieve required column info from localStorage (key=" + tableName + "_table_columns):", e);
+ },
+ {
+ type: 1,
+ isDisabled: function(entry){
+ return !$scope.isCache(entry) || entry.updPending;
+ },
+ onClick: function (entry){
+ $scope.queueServerUpdates(entry, null);
+ },
+ text: "Queue Server Updates",
+ },
+ {
+ type: 1,
+ isDisabled: function(entry){
+ return !$scope.isCache(entry) || !entry.updPending;
+ },
+ onClick: function (entry){
Review comment:
inconsistent indentation here
##########
File path: traffic_portal/app/src/common/modules/table/changeLogs/TableChangeLogsController.js
##########
@@ -16,43 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
+/** @typedef { import('../agGrid/CommonGridController').CGC } CGC */
var TableChangeLogsController = function(tableName, changeLogs, $scope, $state, $uibModal, dateUtils, propertiesModel, messageModel) {
+ /** @type CGC.TitleButton */
+ $scope.titleButton = {
+ onClick: function() {
+ $scope.changeDays();
+ },
+ getText: function() {
+ return "[ last " + $scope.days + " day" + ($scope.days > 1 ? "s" : "") + " ]";
+ }
+ };
- /**
- * Gets value to display a default tooltip.
- */
- function defaultTooltip(params) {
- return params.value;
- }
-
- /**
- * Formats the contents of a 'lastUpdated' column cell as "relative to now".
- */
- function dateCellFormatterRelative(params) {
- return params.value ? dateUtils.getRelativeTime(params.value) : params.value;
- }
-
- function dateCellFormatter(params) {
- return params.value.toUTCString();
- }
-
- let columns = [
+ /** @type CGC.ColumnDefinition */
+ $scope.columns = [
{
headerName: "Occurred",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatterRelative,
- valueFormatter: dateCellFormatterRelative
+ relative: true,
},
{
headerName: "Created (UTC)",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatter,
- valueFormatter: dateCellFormatter
Review comment:
If these are no longer formatting using `Date.prototype.toString` then they're in the format defined by ECMA-262 which includes timezone information. So a column name including "(UTC)" is not only unnecessary, but at also potentially inaccurate (though in practice I believe the API always returns UTC date/times).
##########
File path: traffic_portal/app/src/common/modules/table/jobs/table.jobs.tpl.html
##########
@@ -6,7 +6,7 @@
to you 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
-
+drowDenO
Review comment:
drowDenO?
##########
File path: traffic_portal/app/src/common/modules/table/servers/TableServersController.js
##########
@@ -262,204 +220,171 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
field: "statusLastUpdated",
hide: true,
filter: "agDateColumnFilter",
- valueFormatter: dateCellFormatter
+ relative: true
}
];
/** All of the statuses (populated on init). */
let statuses = [];
- /** All of the servers - lastUpdated fields converted to actual Dates, ip fields populated from interfaces */
- $scope.servers = servers.map(
- function(x) {
- x.lastUpdated = x.lastUpdated ? new Date(x.lastUpdated.replace("+00", "Z")) : x.lastUpdated;
- x.statusLastUpdated = x.statusLastUpdated ? new Date(x.statusLastUpdated): x.statusLastUpdated;
- Object.assign(x, serverUtils.toLegacyIPInfo(x.interfaces));
- });
-
- /** The base URL to use for constructing links to server charts. */
- $scope.chartsBase = propertiesModel.properties.servers.charts.baseUrl;
-
- /** The currently selected server - at the moment only used by the context menu */
- $scope.server = {
- hostName: "",
- domainName: "",
- id: -1
- };
-
- $scope.quickSearch = '';
-
- $scope.pageSize = 100;
-
- $scope.mouseDownSelectionText = "";
-
- /** Options, configuration, data and callbacks for the ag-grid table. */
- $scope.gridOptions = {
- components: {
- httpsCellRenderer: HTTPSCellRenderer,
- sshCellRenderer: SSHCellRenderer,
- updateCellRenderer: UpdateCellRenderer
- },
- columnDefs: columns,
- enableCellTextSelection:true,
- suppressMenuHide: true,
- multiSortKey: 'ctrl',
- alwaysShowVerticalScroll: true,
- defaultColDef: {
- filter: true,
- sortable: true,
- resizable: true,
- tooltipValueGetter: function(param) {
- return param.value;
- }
+ /** @type CGC.DropDownOption[] */
+ $scope.dropDownOptions = [{
+ name: "createServerMenuItem",
+ href: "#!/servers/new",
+ text: "Create New Server",
+ type: 2
+ }, {
+ type: 0
+ }, {
+ onClick: function (entry) {
+ $scope.confirmCDNQueueServerUpdates(entry);
+ },
+ text: "Queue Server Updates",
+ type: 1
+ }, {
+ onClick: function (entry) {
+ $scope.confirmCDNClearServerUpdates(entry);
+ },
+ text: "Clear Server Updates",
+ type: 1
+ }];
+
+ /** @type CGC.ContextMenuOption[] */
+ $scope.contextMenuOptions = [
+ {
+ type: 2,
+ getHref: function(entry) {
+ return "#!/servers/" + entry.id;
+ },
+ getText: function (entry) {
+ return "Open " + entry.hostName + " in New Tab";
+ },
+ newTab: true
},
- rowData: servers,
- pagination: true,
- paginationPageSize: $scope.pageSize,
- rowBuffer: 0,
- tooltipShowDelay: 500,
- allowContextMenuWithControlKey: true,
- preventDefaultOnContextMenu: true,
- colResizeDefault: "shift",
- onColumnVisible: function(params) {
- if (params.visible){
- return;
- }
- const filterModel = $scope.gridOptions.api.getFilterModel();
- for (let column of params.columns) {
- if (column.filterActive) {
- if (column.colId in filterModel) {
- delete filterModel[column.colId];
- $scope.gridOptions.api.setFilterModel(filterModel);
- }
- }
- }
+ {
+ type: 2,
+ getHref: function (entry) {
+ return "http://" + entry.hostName + "." + entry.domainName;
+ },
+ text: "Navigate To Server FQDN"
},
- onCellContextMenu: function(params) {
- $scope.showMenu = true;
- $scope.menuStyle.left = String(params.event.clientX) + "px";
- $scope.menuStyle.top = String(params.event.clientY) + "px";
- $scope.menuStyle.bottom = "unset";
- $scope.menuStyle.right = "unset";
- $scope.$apply();
- const boundingRect = document.getElementById("context-menu").getBoundingClientRect();
-
- if (boundingRect.bottom > window.innerHeight){
- $scope.menuStyle.bottom = String(window.innerHeight - params.event.clientY) + "px";
- $scope.menuStyle.top = "unset";
- }
- if (boundingRect.right > window.innerWidth) {
- $scope.menuStyle.right = String(window.innerWidth - params.event.clientX) + "px";
- $scope.menuStyle.left = "unset";
- }
- $scope.server = params.data;
- $scope.$apply();
+ {
+ type: 0
},
- onCellMouseDown: function() {
- $scope.mouseDownSelectionText = window.getSelection().toString();
+ {
+ type: 2,
+ getHref: function (entry) {
+ return "#!/servers/" + entry.id;
+ },
+ text: "Edit"
},
- onRowClicked: function(params) {
- if (params.event.target.classList.contains('link')) {
- // no need to navigate to server detail page
- return;
- }
- const selection = window.getSelection().toString();
- if(selection === "" || selection === $scope.mouseDownSelectionText) {
- locationUtils.navigateToPath('/servers/' + params.data.id);
- // Event is outside the digest cycle, so we need to trigger one.
- $scope.$apply();
- }
- $scope.mouseDownSelectionText = "";
- },
- onColumnResized: function(params) {
- localStorage.setItem(tableName + "_table_columns", JSON.stringify($scope.gridOptions.columnApi.getColumnState()));
- },
- onFirstDataRendered: function(event) {
- try {
- const filterState = JSON.parse(localStorage.getItem(tableName + "_table_filters")) || {};
- // apply any filter provided to the controller
- Object.assign(filterState, filter);
- $scope.gridOptions.api.setFilterModel(filterState);
- } catch (e) {
- console.error("Failure to load stored filter state:", e);
+ {
+ type: 1,
+ onClick: function (entry) {
+ $scope.confirmDelete(entry, null);
+ },
+ text: "Delete"
Review comment:
inconsistent indentation here
##########
File path: traffic_portal/app/src/common/modules/table/notifications/TableNotificationsController.js
##########
@@ -16,28 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
+/** @typedef { import('../agGrid/CommonGridController').CGC } CGC */
var TableNotificationsController = function(tableName, notifications, filter, $scope, $state, $uibModal, $document, dateUtils, cdnService) {
-
- /**
- * Gets value to display a default tooltip.
- */
- function defaultTooltip(params) {
- return params.value;
- }
-
- function dateCellFormatter(params) {
- return params.value.toUTCString();
- }
-
- let columns = [
+ /** @type CGC.ColumnDefinition */
+ $scope.columns = [
{
headerName: "Created (UTC)",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatter,
- valueFormatter: dateCellFormatter
Review comment:
same as above RE: UTC in the column name
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] shamrickus commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
shamrickus commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r673416939
##########
File path: traffic_portal/app/src/common/modules/table/jobs/TableJobsController.js
##########
@@ -78,25 +66,30 @@ var TableJobsController = function(tableName, jobs, $document, $scope, $state, $
// going to derive the expires date from start + TTL (hours). Format: TTL:24h
let ttl = parseInt(x.parameters.slice('TTL:'.length, x.parameters.length-1), 10);
x.expires = new Date(x.startTime.getTime() + ttl*3600*1000);
+ return x;
});
- $scope.quickSearch = '';
-
- $scope.pageSize = 100;
+ /** @type CGC.DropDownOption[] */
+ $scope.dropDownOptions = [{
+ name: "createJobMenuItem",
+ onClick: function (){
+ $scope.createJob();
+ },
+ text: "Create Invalidation Request",
+ type: 1
+ }];
+
+ /** @type CGC.ContextMenuOption[] */
+ $scope.contextMenuOptions = [{
+ onClick: function (job, $event) {
+ $scope.confirmRemoveJob(jobs, $event);
Review comment:
You are correct.
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r673396451
##########
File path: traffic_portal/app/src/common/modules/table/changeLogs/TableChangeLogsController.js
##########
@@ -16,43 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
+/** @typedef { import('../agGrid/CommonGridController').CGC } CGC */
var TableChangeLogsController = function(tableName, changeLogs, $scope, $state, $uibModal, dateUtils, propertiesModel, messageModel) {
+ /** @type CGC.TitleButton */
+ $scope.titleButton = {
+ onClick: function() {
+ $scope.changeDays();
+ },
+ getText: function() {
+ return "[ last " + $scope.days + " day" + ($scope.days > 1 ? "s" : "") + " ]";
+ }
+ };
- /**
- * Gets value to display a default tooltip.
- */
- function defaultTooltip(params) {
- return params.value;
- }
-
- /**
- * Formats the contents of a 'lastUpdated' column cell as "relative to now".
- */
- function dateCellFormatterRelative(params) {
- return params.value ? dateUtils.getRelativeTime(params.value) : params.value;
- }
-
- function dateCellFormatter(params) {
- return params.value.toUTCString();
- }
-
- let columns = [
+ /** @type CGC.ColumnDefinition */
+ $scope.columns = [
{
headerName: "Occurred",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatterRelative,
- valueFormatter: dateCellFormatterRelative
+ relative: true,
},
{
headerName: "Created (UTC)",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatter,
- valueFormatter: dateCellFormatter
Review comment:
If these are now formatting using `Date.prototype.toString` then they're in the format defined by ECMA-262 which includes timezone information. So a column name including "(UTC)" is not only unnecessary, but at also potentially inaccurate (though in practice I believe the API always returns UTC date/times).
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r672724241
##########
File path: traffic_portal/app/src/common/modules/table/cdnNotifications/TableCDNNotificationsController.js
##########
@@ -16,12 +16,42 @@
* specific language governing permissions and limitations
* under the License.
*/
+/** @typedef { import('../agGrid/CommonGridController').CGC } CGC */
var TableCDNNotificationsController = function(cdn, notifications, filter, $controller, $scope) {
// extends the TableNotificationsController to inherit common methods
angular.extend(this, $controller('TableNotificationsController', { tableName: 'cdnNotifications', notifications: notifications, filter: filter, $scope: $scope }));
+ /** @type CGC.TitleBreadCrumbs[] */
+ $scope.breadCrumbs = [{
+ href: "#!/cdns",
+ text: "CDNs"
+ },
+ {
+ getText: function() {
+ return $scope.cdn.name;
+ },
+ getHref: function() {
+ return "#!/cdns/" + $scope.cdn.id;
+ }
+ },
+ {
+ text: "Notifications"
+ }];
+
+ this.$onInit = function() {
+ let i;
+ for(i = 0; i < $scope.dropDownOptions.length; ++i) {
Review comment:
does webpack not let you do `for (let i=0; i < thing; ++i;){...}`? Or better yet, `for (const ddo of $scope.dropDownOptions) {...}`?
##########
File path: traffic_portal/app/src/common/modules/table/agGrid/grid.tpl.html
##########
@@ -18,14 +18,22 @@
-->
<div class="x_title">
- <ol class="breadcrumb pull-left">
- <li class="active" ng-if="$ctrl.title">
- {{ $ctrl.title }}
- <button ng-if="$ctrl.titleButton !== undefined" type="button" class="btn btn-link"
- ng-click="$ctrl.titleButton.onClick()">{{ $ctrl.titleButton.getText() }}</button>
- </li>
+ <div class="pull-left">
+ <ol class="breadcrumb pull-left" ng-if="$ctrl.breadCrumbs !== undefined">
+ <li ng-repeat="bc in $ctrl.breadCrumbs track by $index" ng-class="{'active': ($index+1 === $ctrl.breadCrumbs.length)}">
+ <a ng-if="$ctrl.bcHasHref(bc)" href="{{ $ctrl.bcGetHref(bc) }}">{{ $ctrl.bcGetText(bc) }}</a>
Review comment:
interpolated content in link targets should use `ng-href` to guarantee binding
##########
File path: traffic_portal/app/src/common/modules/table/agGrid/CommonGridController.js
##########
@@ -217,6 +230,9 @@ let CommonGridController = function ($scope, $document, $state, userModel, dateU
$scope.$apply();
},
onRowClicked: function(params) {
+ if (params.event.target.classList.contains('link')) {
+ return;
+ }
Review comment:
shouldn't this just check `params.event.target instanceof HTMLAnchorElement` ? Classes can be improperly applied or overloaded for styling reasons, seems more reliable to just directly check if the target is actually a link.
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r673455993
##########
File path: traffic_portal/app/src/common/modules/table/changeLogs/TableChangeLogsController.js
##########
@@ -16,43 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
+/** @typedef { import('../agGrid/CommonGridController').CGC } CGC */
var TableChangeLogsController = function(tableName, changeLogs, $scope, $state, $uibModal, dateUtils, propertiesModel, messageModel) {
+ /** @type CGC.TitleButton */
+ $scope.titleButton = {
+ onClick: function() {
+ $scope.changeDays();
+ },
+ getText: function() {
+ return "[ last " + $scope.days + " day" + ($scope.days > 1 ? "s" : "") + " ]";
+ }
+ };
- /**
- * Gets value to display a default tooltip.
- */
- function defaultTooltip(params) {
- return params.value;
- }
-
- /**
- * Formats the contents of a 'lastUpdated' column cell as "relative to now".
- */
- function dateCellFormatterRelative(params) {
- return params.value ? dateUtils.getRelativeTime(params.value) : params.value;
- }
-
- function dateCellFormatter(params) {
- return params.value.toUTCString();
- }
-
- let columns = [
+ /** @type CGC.ColumnDefinition */
+ $scope.columns = [
{
headerName: "Occurred",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatterRelative,
- valueFormatter: dateCellFormatterRelative
+ relative: true,
},
{
headerName: "Created (UTC)",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatter,
- valueFormatter: dateCellFormatter
Review comment:
Where is it doing that? ~~I only see moment being called for the relative~~ nvm, it looks like any column definition that uses the agDateColumnFilter is getting its tooltipValueGetter and valueFormatter set to the same UTC thing as before. It's not using moment, but it's not as much of a problem as I thought. Although, the UTC cell formatter is also outputting timezone information, so "UTC" is still unnecessary. But not possibly incorrect.
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r672724241
##########
File path: traffic_portal/app/src/common/modules/table/cdnNotifications/TableCDNNotificationsController.js
##########
@@ -16,12 +16,42 @@
* specific language governing permissions and limitations
* under the License.
*/
+/** @typedef { import('../agGrid/CommonGridController').CGC } CGC */
var TableCDNNotificationsController = function(cdn, notifications, filter, $controller, $scope) {
// extends the TableNotificationsController to inherit common methods
angular.extend(this, $controller('TableNotificationsController', { tableName: 'cdnNotifications', notifications: notifications, filter: filter, $scope: $scope }));
+ /** @type CGC.TitleBreadCrumbs[] */
+ $scope.breadCrumbs = [{
+ href: "#!/cdns",
+ text: "CDNs"
+ },
+ {
+ getText: function() {
+ return $scope.cdn.name;
+ },
+ getHref: function() {
+ return "#!/cdns/" + $scope.cdn.id;
+ }
+ },
+ {
+ text: "Notifications"
+ }];
+
+ this.$onInit = function() {
+ let i;
+ for(i = 0; i < $scope.dropDownOptions.length; ++i) {
Review comment:
does webpack not let you do `for (let i=0; i < thing; ++i;){...}`? Or better yet, `for (const ddo of $scope.dropDownOptions) {...}`?
##########
File path: traffic_portal/app/src/common/modules/table/agGrid/grid.tpl.html
##########
@@ -18,14 +18,22 @@
-->
<div class="x_title">
- <ol class="breadcrumb pull-left">
- <li class="active" ng-if="$ctrl.title">
- {{ $ctrl.title }}
- <button ng-if="$ctrl.titleButton !== undefined" type="button" class="btn btn-link"
- ng-click="$ctrl.titleButton.onClick()">{{ $ctrl.titleButton.getText() }}</button>
- </li>
+ <div class="pull-left">
+ <ol class="breadcrumb pull-left" ng-if="$ctrl.breadCrumbs !== undefined">
+ <li ng-repeat="bc in $ctrl.breadCrumbs track by $index" ng-class="{'active': ($index+1 === $ctrl.breadCrumbs.length)}">
+ <a ng-if="$ctrl.bcHasHref(bc)" href="{{ $ctrl.bcGetHref(bc) }}">{{ $ctrl.bcGetText(bc) }}</a>
Review comment:
interpolated content in link targets should use `ng-href` to guarantee binding
##########
File path: traffic_portal/app/src/common/modules/table/agGrid/CommonGridController.js
##########
@@ -217,6 +230,9 @@ let CommonGridController = function ($scope, $document, $state, userModel, dateU
$scope.$apply();
},
onRowClicked: function(params) {
+ if (params.event.target.classList.contains('link')) {
+ return;
+ }
Review comment:
shouldn't this just check `params.event.target instanceof HTMLAnchorElement` ? Classes can be improperly applied or overloaded for styling reasons, seems more reliable to just directly check if the target is actually a link.
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r673402776
##########
File path: traffic_portal/test/integration/PageObjects/ServersPage.po.ts
##########
@@ -141,8 +141,7 @@ export class ServersPage extends BasePage {
let name = nameServer+this.randomize;
await this.txtQuickSearch.clear();
await this.txtQuickSearch.sendKeys(name);
- await browser.actions().mouseMove(element(by.xpath("//span[text()='"+name+"']"))).perform();
- await browser.actions().doubleClick(element(by.xpath("//span[text()='"+name+"']"))).perform();
+ await browser.actions().click(element(by.xpath("//span[text()='"+name+"']"))).perform();
Review comment:
We shouldn't be using XPath, CSS is much more familiar and easier to understand. The equivalent selector in this case would be `by.cssContainingText("span", name)`, which is much simpler. As a bonus, that'll also work properly in the event that `name` contains single quotes, whereas this one doesn't (although that doesn't seem likely to occur).
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] shamrickus commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
shamrickus commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r674203235
##########
File path: traffic_portal/app/src/common/modules/table/changeLogs/TableChangeLogsController.js
##########
@@ -16,43 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
+/** @typedef { import('../agGrid/CommonGridController').CGC } CGC */
var TableChangeLogsController = function(tableName, changeLogs, $scope, $state, $uibModal, dateUtils, propertiesModel, messageModel) {
+ /** @type CGC.TitleButton */
+ $scope.titleButton = {
+ onClick: function() {
+ $scope.changeDays();
+ },
+ getText: function() {
+ return "[ last " + $scope.days + " day" + ($scope.days > 1 ? "s" : "") + " ]";
+ }
+ };
- /**
- * Gets value to display a default tooltip.
- */
- function defaultTooltip(params) {
- return params.value;
- }
-
- /**
- * Formats the contents of a 'lastUpdated' column cell as "relative to now".
- */
- function dateCellFormatterRelative(params) {
- return params.value ? dateUtils.getRelativeTime(params.value) : params.value;
- }
-
- function dateCellFormatter(params) {
- return params.value.toUTCString();
- }
-
- let columns = [
+ /** @type CGC.ColumnDefinition */
+ $scope.columns = [
{
headerName: "Occurred",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatterRelative,
- valueFormatter: dateCellFormatterRelative
+ relative: true,
},
{
headerName: "Created (UTC)",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatter,
- valueFormatter: dateCellFormatter
Review comment:
I was looking at a thing specifically for jobs. The functionality is the same as it was before, so if it was working before it should be fine now.
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r674271502
##########
File path: traffic_portal/app/src/common/modules/table/deliveryServiceJobs/TableDeliveryServiceJobsController.js
##########
@@ -35,7 +35,7 @@ var TableDeliveryServiceJobsController = function(deliveryService, jobs, $contro
return $scope.deliveryService.xmlId;
},
getHref: function () {
- return "#!/delivery-services/" + $scope.deliveryService.id + "?type=" + $scope.deliveryService.type;
+ return encodeURI("#!/delivery-services/" + $scope.deliveryService.id + "?type=" + $scope.deliveryService.type);
Review comment:
That won't work, `encodeURI` expects a full URI as input, and because we are putting query string parameters in x-www-form-urlencoded format inside a document fragment, it assumes nothing needs to be escaped and leaves the input unchanged:

Using `encodeURIComponent` expects the entirety of its input to be a single component of a URI, so it will encode too much:

You need to use `encodeURIComponent` only on the part that needs to be encoded as a single URI component, like:
```javascript
"#!/delivery-services/" + $scope.deliveryService.id + "?type=" + encodeURIComponent($scope.deliveryService.type);
```
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] shamrickus commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
shamrickus commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r674272010
##########
File path: traffic_portal/app/src/common/modules/table/deliveryServiceJobs/TableDeliveryServiceJobsController.js
##########
@@ -35,7 +35,7 @@ var TableDeliveryServiceJobsController = function(deliveryService, jobs, $contro
return $scope.deliveryService.xmlId;
},
getHref: function () {
- return "#!/delivery-services/" + $scope.deliveryService.id + "?type=" + $scope.deliveryService.type;
+ return encodeURI("#!/delivery-services/" + $scope.deliveryService.id + "?type=" + $scope.deliveryService.type);
Review comment:
Already changed
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r672724241
##########
File path: traffic_portal/app/src/common/modules/table/cdnNotifications/TableCDNNotificationsController.js
##########
@@ -16,12 +16,42 @@
* specific language governing permissions and limitations
* under the License.
*/
+/** @typedef { import('../agGrid/CommonGridController').CGC } CGC */
var TableCDNNotificationsController = function(cdn, notifications, filter, $controller, $scope) {
// extends the TableNotificationsController to inherit common methods
angular.extend(this, $controller('TableNotificationsController', { tableName: 'cdnNotifications', notifications: notifications, filter: filter, $scope: $scope }));
+ /** @type CGC.TitleBreadCrumbs[] */
+ $scope.breadCrumbs = [{
+ href: "#!/cdns",
+ text: "CDNs"
+ },
+ {
+ getText: function() {
+ return $scope.cdn.name;
+ },
+ getHref: function() {
+ return "#!/cdns/" + $scope.cdn.id;
+ }
+ },
+ {
+ text: "Notifications"
+ }];
+
+ this.$onInit = function() {
+ let i;
+ for(i = 0; i < $scope.dropDownOptions.length; ++i) {
Review comment:
does webpack not let you do `for (let i=0; i < thing; ++i;){...}`? Or better yet, `for (const ddo of $scope.dropDownOptions) {...}`?
##########
File path: traffic_portal/app/src/common/modules/table/agGrid/grid.tpl.html
##########
@@ -18,14 +18,22 @@
-->
<div class="x_title">
- <ol class="breadcrumb pull-left">
- <li class="active" ng-if="$ctrl.title">
- {{ $ctrl.title }}
- <button ng-if="$ctrl.titleButton !== undefined" type="button" class="btn btn-link"
- ng-click="$ctrl.titleButton.onClick()">{{ $ctrl.titleButton.getText() }}</button>
- </li>
+ <div class="pull-left">
+ <ol class="breadcrumb pull-left" ng-if="$ctrl.breadCrumbs !== undefined">
+ <li ng-repeat="bc in $ctrl.breadCrumbs track by $index" ng-class="{'active': ($index+1 === $ctrl.breadCrumbs.length)}">
+ <a ng-if="$ctrl.bcHasHref(bc)" href="{{ $ctrl.bcGetHref(bc) }}">{{ $ctrl.bcGetText(bc) }}</a>
Review comment:
interpolated content in link targets should use `ng-href` to guarantee binding
##########
File path: traffic_portal/app/src/common/modules/table/agGrid/CommonGridController.js
##########
@@ -217,6 +230,9 @@ let CommonGridController = function ($scope, $document, $state, userModel, dateU
$scope.$apply();
},
onRowClicked: function(params) {
+ if (params.event.target.classList.contains('link')) {
+ return;
+ }
Review comment:
shouldn't this just check `params.event.target instanceof HTMLAnchorElement` ? Classes can be improperly applied or overloaded for styling reasons, seems more reliable to just directly check if the target is actually a link.
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] shamrickus commented on a change in pull request #6031: TP convert ag-grid tables to component
Posted by GitBox <gi...@apache.org>.
shamrickus commented on a change in pull request #6031:
URL: https://github.com/apache/trafficcontrol/pull/6031#discussion_r673414251
##########
File path: traffic_portal/app/src/common/modules/table/changeLogs/TableChangeLogsController.js
##########
@@ -16,43 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
+/** @typedef { import('../agGrid/CommonGridController').CGC } CGC */
var TableChangeLogsController = function(tableName, changeLogs, $scope, $state, $uibModal, dateUtils, propertiesModel, messageModel) {
+ /** @type CGC.TitleButton */
+ $scope.titleButton = {
+ onClick: function() {
+ $scope.changeDays();
+ },
+ getText: function() {
+ return "[ last " + $scope.days + " day" + ($scope.days > 1 ? "s" : "") + " ]";
+ }
+ };
- /**
- * Gets value to display a default tooltip.
- */
- function defaultTooltip(params) {
- return params.value;
- }
-
- /**
- * Formats the contents of a 'lastUpdated' column cell as "relative to now".
- */
- function dateCellFormatterRelative(params) {
- return params.value ? dateUtils.getRelativeTime(params.value) : params.value;
- }
-
- function dateCellFormatter(params) {
- return params.value.toUTCString();
- }
-
- let columns = [
+ /** @type CGC.ColumnDefinition */
+ $scope.columns = [
{
headerName: "Occurred",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatterRelative,
- valueFormatter: dateCellFormatterRelative
+ relative: true,
},
{
headerName: "Created (UTC)",
field: "lastUpdated",
hide: false,
filter: "agDateColumnFilter",
- tooltipValueGetter: dateCellFormatter,
- valueFormatter: dateCellFormatter
Review comment:
It uses `moment.js`
--
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: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org