This is an automated email from the ASF dual-hosted git repository.
ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new ad4b800 Feature/tp refetch (#6325)
ad4b800 is described below
commit ad4b800dc71c8c49fb0935efcc21c093758067f9
Author: Taylor Clayton Frey <[email protected]>
AuthorDate: Fri Nov 5 11:51:33 2021 -0600
Feature/tp refetch (#6325)
* Update TP to account for Refetch.
Modify display table and create page.
Update TP integration tests.
* Fix validation message for TP integration test.
Ensure ttl required form validation shows correctly.
* Changelog entry
* Update deliveryservice->jobs
* Pin specific version in package-lock.json
* Replace ng attributes. Remove parseInt call
Co-authored-by: Taylor Frey <[email protected]>
---
CHANGELOG.md | 1 +
cache-config/testing/ort-tests/tcdata/todb.go | 2 +-
traffic_ops/testing/api/v2/todb_test.go | 2 +-
traffic_ops/testing/api/v3/todb_test.go | 2 +-
traffic_ops/testing/api/v4/crconfig_test.go | 2 +-
traffic_ops/testing/api/v4/tc-fixtures.json | 2 +-
traffic_ops/testing/api/v4/todb_test.go | 2 +-
traffic_ops/testing/api/v4/topologies_test.go | 2 +-
traffic_portal/app/src/common/api/JobService.js | 6 +++---
.../form.deliveryServiceJob.tpl.html | 18 ++++++++++++------
.../new/FormNewDeliveryServiceJobController.js | 8 ++++++++
.../src/common/modules/form/job/form.job.tpl.html | 20 +++++++++++++-------
.../modules/form/job/new/FormNewJobController.js | 8 ++++++++
.../common/modules/table/jobs/TableJobsController.js | 13 ++++++++-----
traffic_portal/package-lock.json | 5 +++--
traffic_portal/test/integration/Data/jobs.ts | 5 +++--
.../test/integration/PageObjects/Jobs.po.ts | 9 ++++++---
17 files changed, 72 insertions(+), 35 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6034fa5..ae451a7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ The format is based on [Keep a
Changelog](http://keepachangelog.com/en/1.0.0/).
- SANs information to the SSL key endpoint and Traffic Portal page.
- Added definition for `heartbeat.polling.interval` for CDN Traffic Monitor
config in API documentation.
- New `pkg` script options, `-h`, `-s`, `-S`, and `-L`.
+- Added `Invalidation Type` (REFRESH or REFETCH) for invalidating content to
Traffic Portal.
### Fixed
- [#6197](https://github.com/apache/trafficcontrol/issues/6197) - TO
`/deliveryservices/:id/routing` makes requests to all TRs instead of by CDN.
diff --git a/cache-config/testing/ort-tests/tcdata/todb.go
b/cache-config/testing/ort-tests/tcdata/todb.go
index 2de9861..68eddb7 100644
--- a/cache-config/testing/ort-tests/tcdata/todb.go
+++ b/cache-config/testing/ort-tests/tcdata/todb.go
@@ -107,7 +107,7 @@ func SetupRoles(db *sql.DB) error {
sqlStmt := `
INSERT INTO role (name, description, priv_level) VALUES ('disallowed','Block
all access',0) ON CONFLICT DO NOTHING;
-INSERT INTO role (name, description, priv_level) VALUES ('read-only
user','Block all access', 10) ON CONFLICT DO NOTHING;
+INSERT INTO role (name, description, priv_level) VALUES ('read-only','Block
all access', 10) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('operations','Block
all access', 20) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('admin','super-user',
30) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('portal','Portal
User', 2) ON CONFLICT DO NOTHING;
diff --git a/traffic_ops/testing/api/v2/todb_test.go
b/traffic_ops/testing/api/v2/todb_test.go
index b5aa360..297fbd9 100644
--- a/traffic_ops/testing/api/v2/todb_test.go
+++ b/traffic_ops/testing/api/v2/todb_test.go
@@ -106,7 +106,7 @@ func SetupRoles(db *sql.DB) error {
sqlStmt := `
INSERT INTO role (name, description, priv_level) VALUES ('disallowed','Block
all access',0) ON CONFLICT DO NOTHING;
-INSERT INTO role (name, description, priv_level) VALUES ('read-only
user','Block all access', 10) ON CONFLICT DO NOTHING;
+INSERT INTO role (name, description, priv_level) VALUES ('read-only','Block
all access', 10) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('operations','Block
all access', 20) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('admin','super-user',
30) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('portal','Portal
User', 2) ON CONFLICT DO NOTHING;
diff --git a/traffic_ops/testing/api/v3/todb_test.go
b/traffic_ops/testing/api/v3/todb_test.go
index 088717f..601dceb 100644
--- a/traffic_ops/testing/api/v3/todb_test.go
+++ b/traffic_ops/testing/api/v3/todb_test.go
@@ -106,7 +106,7 @@ func SetupRoles(db *sql.DB) error {
sqlStmt := `
INSERT INTO role (name, description, priv_level) VALUES ('disallowed','Block
all access',0) ON CONFLICT DO NOTHING;
-INSERT INTO role (name, description, priv_level) VALUES ('read-only
user','Block all access', 10) ON CONFLICT DO NOTHING;
+INSERT INTO role (name, description, priv_level) VALUES ('read-only','Block
all access', 10) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('operations','Block
all access', 20) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('admin','super-user',
30) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('portal','Portal
User', 2) ON CONFLICT DO NOTHING;
diff --git a/traffic_ops/testing/api/v4/crconfig_test.go
b/traffic_ops/testing/api/v4/crconfig_test.go
index 495511e..aac5ab4 100644
--- a/traffic_ops/testing/api/v4/crconfig_test.go
+++ b/traffic_ops/testing/api/v4/crconfig_test.go
@@ -61,7 +61,7 @@ func SnapshotWithReadOnlyUser(t *testing.T) {
RegistrationSent: new(time.Time),
LocalPassword: util.StrPtr("test_pa$$word"),
ConfirmLocalPassword: util.StrPtr("test_pa$$word"),
- Role: "read-only user",
+ Role: "read-only",
}
user.Email = util.StrPtr("[email protected]")
user.TenantID = resp.Response[0].ID
diff --git a/traffic_ops/testing/api/v4/tc-fixtures.json
b/traffic_ops/testing/api/v4/tc-fixtures.json
index 23b150e..bc3b173 100644
--- a/traffic_ops/testing/api/v4/tc-fixtures.json
+++ b/traffic_ops/testing/api/v4/tc-fixtures.json
@@ -5547,7 +5547,7 @@
"phoneNumber": "",
"postalCode": "",
"publicSshKey": "",
- "role": "read-only user",
+ "role": "read-only",
"stateOrProvince": "",
"tenant": "tenant1",
"uid": 0,
diff --git a/traffic_ops/testing/api/v4/todb_test.go
b/traffic_ops/testing/api/v4/todb_test.go
index 83f34d4..60e833f 100644
--- a/traffic_ops/testing/api/v4/todb_test.go
+++ b/traffic_ops/testing/api/v4/todb_test.go
@@ -100,7 +100,7 @@ func SetupRoles(db *sql.DB) error {
sqlStmt := `
INSERT INTO role (name, description, priv_level) VALUES ('disallowed','Block
all access',0) ON CONFLICT DO NOTHING;
-INSERT INTO role (name, description, priv_level) VALUES ('read-only
user','Block all access', 10) ON CONFLICT DO NOTHING;
+INSERT INTO role (name, description, priv_level) VALUES ('read-only','Block
all access', 10) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('operations','Block
all access', 20) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('admin','super-user',
30) ON CONFLICT DO NOTHING;
INSERT INTO role (name, description, priv_level) VALUES ('portal','Portal
User', 2) ON CONFLICT DO NOTHING;
diff --git a/traffic_ops/testing/api/v4/topologies_test.go
b/traffic_ops/testing/api/v4/topologies_test.go
index 05db1cd..c9fa5a8 100644
--- a/traffic_ops/testing/api/v4/topologies_test.go
+++ b/traffic_ops/testing/api/v4/topologies_test.go
@@ -996,7 +996,7 @@ func CRUDTopologyReadOnlyUser(t *testing.T) {
RegistrationSent: new(time.Time),
LocalPassword: util.StrPtr("test_pa$$word"),
ConfirmLocalPassword: util.StrPtr("test_pa$$word"),
- Role: "read-only user",
+ Role: "read-only",
}
user.Email = util.StrPtr("[email protected]")
user.TenantID = resp.Response[0].ID
diff --git a/traffic_portal/app/src/common/api/JobService.js
b/traffic_portal/app/src/common/api/JobService.js
index 4db2d61..39155f9 100644
--- a/traffic_portal/app/src/common/api/JobService.js
+++ b/traffic_portal/app/src/common/api/JobService.js
@@ -20,7 +20,7 @@
var JobService = function($http, ENV) {
this.getJobs = function(queryParams) {
- return $http.get(ENV.api.stable + 'jobs', {params:
queryParams}).then(
+ return $http.get(ENV.api.unstable + 'jobs', {params:
queryParams}).then(
function(result) {
return result.data.response;
},
@@ -31,7 +31,7 @@ var JobService = function($http, ENV) {
};
this.createJob = function(job) {
- return $http.post(ENV.api.stable + 'jobs', job).then(
+ return $http.post(ENV.api.unstable + 'jobs', job).then(
function (result) {
return result;
},
@@ -42,7 +42,7 @@ var JobService = function($http, ENV) {
};
this.deleteJob = function(id) {
- return $http.delete(ENV.api.stable + 'jobs', {params: {id:
id}}).then(
+ return $http.delete(ENV.api.unstable + 'jobs', {params: {id:
id}}).then(
function(result) {
return result;
},
diff --git
a/traffic_portal/app/src/common/modules/form/deliveryServiceJob/form.deliveryServiceJob.tpl.html
b/traffic_portal/app/src/common/modules/form/deliveryServiceJob/form.deliveryServiceJob.tpl.html
index 92a4139..470a9c6 100644
---
a/traffic_portal/app/src/common/modules/form/deliveryServiceJob/form.deliveryServiceJob.tpl.html
+++
b/traffic_portal/app/src/common/modules/form/deliveryServiceJob/form.deliveryServiceJob.tpl.html
@@ -40,14 +40,20 @@ under the License.
<span ng-show="hasError(jobForm.regex)"
class="form-control-feedback"><i class="fa fa-times"></i></span>
</div>
</div>
- <div class="form-group" ng-class="{'has-error':
hasError(jobForm.ttl), 'has-feedback': hasError(jobForm.ttl)}">
+ <div class="form-group" ng-class="{'has-error':
hasError(jobForm.ttlhours), 'has-feedback': hasError(jobForm.ttlhours)}">
<label class="control-label col-md-2 col-sm-2 col-xs-12">TTL
(hours) *</label>
<div class="col-md-10 col-sm-10 col-xs-12">
- <input name="ttl" type="number" class="form-control"
placeholder="Number of hours until the invalidation request expires"
ng-model="job.ttl" ng-maxlength="3" ng-pattern="/^\d+$/" required autofocus>
- <small class="input-error"
ng-show="hasPropertyError(jobForm.ttl, 'required')">Required Whole
Number</small>
- <small class="input-error"
ng-show="hasPropertyError(jobForm.ttl, 'maxlength')">Too Long</small>
- <small class="input-error"
ng-show="hasPropertyError(jobForm.ttl, 'pattern')">Whole Number</small>
- <span ng-show="hasError(jobForm.ttl)"
class="form-control-feedback"><i class="fa fa-times"></i></span>
+ <input name="ttlhours" type="number" class="form-control"
placeholder="Number of hours until the invalidation request expires"
ng-model="job.ttlhours" min="1" max="999" required autofocus>
+ <small class="input-error"
ng-show="hasPropertyError(jobForm.ttlhours, 'required')">Required Whole
Number</small>
+ <span ng-show="hasError(jobForm.ttlhours)"
class="form-control-feedback"><i class="fa fa-times"></i></span>
+ </div>
+ </div>
+ <div class="form-group" ng-class="{'has-error':
hasError(jobForm.invalidationtype), 'has-feedback':
hasError(jobForm.invalidationtype)}">
+ <label class="control-label col-md-2 col-sm-2
col-xs-12">Invalidation Type *</label>
+ <div class="col-md-10 col-sm-10 col-xs-12">
+ <select name="invalidationtype" class="form-control"
ng-model="job.invalidationType" ng-options="invalidationtype as
invalidationtype for invalidationtype in invalidationtypes" required>
+ </select>
+ <small class="input-error"
ng-show="hasPropertyError(jobForm.invalidationtype,
'required')">Required</small>
</div>
</div>
<div class="modal-footer">
diff --git
a/traffic_portal/app/src/common/modules/form/deliveryServiceJob/new/FormNewDeliveryServiceJobController.js
b/traffic_portal/app/src/common/modules/form/deliveryServiceJob/new/FormNewDeliveryServiceJobController.js
index 7815b51..055955f 100644
---
a/traffic_portal/app/src/common/modules/form/deliveryServiceJob/new/FormNewDeliveryServiceJobController.js
+++
b/traffic_portal/app/src/common/modules/form/deliveryServiceJob/new/FormNewDeliveryServiceJobController.js
@@ -22,6 +22,14 @@ var FormNewDeliveryServiceJobController =
function(deliveryService, job, $scope,
// extends the FormDeliveryServiceJobController to inherit common
methods
angular.extend(this, $controller('FormDeliveryServiceJobController', {
deliveryService: deliveryService, job: job, $scope: $scope }));
+ // define invalidation types
+ $scope.invalidationtypes = [
+ 'REFRESH',
+ 'REFETCH'
+ ];
+ // set default invalidation type
+ $scope.job.invalidationType = $scope.invalidationtypes[0];
+
$scope.jobName = 'New';
$scope.settings = {
diff --git a/traffic_portal/app/src/common/modules/form/job/form.job.tpl.html
b/traffic_portal/app/src/common/modules/form/job/form.job.tpl.html
index 06dfc74..028cafd 100644
--- a/traffic_portal/app/src/common/modules/form/job/form.job.tpl.html
+++ b/traffic_portal/app/src/common/modules/form/job/form.job.tpl.html
@@ -31,7 +31,7 @@ under the License.
<div class="form-group" ng-class="{'has-error':
hasError(jobForm.deliveryservice), 'has-feedback':
hasError(jobForm.deliveryservice)}">
<label class="control-label col-md-2 col-sm-2
col-xs-12">Delivery Service *</label>
<div class="col-md-10 col-sm-10 col-xs-12">
- <select name="deliveryservice" class="form-control"
ng-model="job.deliveryService" ng-options="deliveryservice.id as
deliveryservice.xmlId for deliveryservice in deliveryservices" required>
+ <select name="deliveryservice" class="form-control"
ng-model="job.deliveryService" ng-options="deliveryservice.xmlId as
deliveryservice.xmlId for deliveryservice in deliveryservices" required>
<option value="">Select...</option>
</select>
<small class="input-error"
ng-show="hasPropertyError(jobForm.deliveryservice, 'required')">Required</small>
@@ -47,14 +47,20 @@ under the License.
<span ng-show="hasError(jobForm.regex)"
class="form-control-feedback"><i class="fa fa-times"></i></span>
</div>
</div>
- <div class="form-group" ng-class="{'has-error':
hasError(jobForm.ttl), 'has-feedback': hasError(jobForm.ttl)}">
+ <div class="form-group" ng-class="{'has-error':
hasError(jobForm.ttlhours), 'has-feedback': hasError(jobForm.ttlhours)}">
<label class="control-label col-md-2 col-sm-2 col-xs-12">TTL
(hours) *</label>
<div class="col-md-10 col-sm-10 col-xs-12">
- <input name="ttl" type="number" class="form-control"
placeholder="Number of hours until the invalidation request expires"
ng-model="job.ttl" ng-maxlength="3" ng-pattern="/^\d+$/" required autofocus>
- <small class="input-error"
ng-show="hasPropertyError(jobForm.ttl, 'required')">Required Whole
Number</small>
- <small class="input-error"
ng-show="hasPropertyError(jobForm.ttl, 'maxlength')">Too Long</small>
- <small class="input-error"
ng-show="hasPropertyError(jobForm.ttl, 'pattern')">Whole Number</small>
- <span ng-show="hasError(jobForm.ttl)"
class="form-control-feedback"><i class="fa fa-times"></i></span>
+ <input name="ttlhours" type="number" class="form-control"
placeholder="Number of hours until the invalidation request expires"
ng-model="job.ttlhours" min="1" max="999" required autofocus>
+ <small class="input-error"
ng-show="hasPropertyError(jobForm.ttlhours, 'required')">Required Whole
Number</small>
+ <span ng-show="hasError(jobForm.ttlhours)"
class="form-control-feedback"><i class="fa fa-times"></i></span>
+ </div>
+ </div>
+ <div class="form-group" ng-class="{'has-error':
hasError(jobForm.invalidationtype), 'has-feedback':
hasError(jobForm.invalidationtype)}">
+ <label class="control-label col-md-2 col-sm-2
col-xs-12">Invalidation Type *</label>
+ <div class="col-md-10 col-sm-10 col-xs-12">
+ <select name="invalidationtype" class="form-control"
ng-model="job.invalidationType" ng-options="invalidationtype as
invalidationtype for invalidationtype in invalidationtypes" required>
+ </select>
+ <small class="input-error"
ng-show="hasPropertyError(jobForm.invalidationtype,
'required')">Required</small>
</div>
</div>
<div class="modal-footer">
diff --git
a/traffic_portal/app/src/common/modules/form/job/new/FormNewJobController.js
b/traffic_portal/app/src/common/modules/form/job/new/FormNewJobController.js
index 6b20964..b162159 100644
--- a/traffic_portal/app/src/common/modules/form/job/new/FormNewJobController.js
+++ b/traffic_portal/app/src/common/modules/form/job/new/FormNewJobController.js
@@ -22,6 +22,14 @@ var FormNewJobController = function(job, $scope,
$controller, jobService, messag
// extends the FormJobController to inherit common methods
angular.extend(this, $controller('FormJobController', { job: job,
$scope: $scope }));
+ // define invalidation types
+ $scope.invalidationtypes = [
+ 'REFRESH',
+ 'REFETCH'
+ ];
+ // set default invalidation type
+ $scope.job.invalidationType = $scope.invalidationtypes[0];
+
$scope.jobName = 'New';
$scope.settings = {
diff --git
a/traffic_portal/app/src/common/modules/table/jobs/TableJobsController.js
b/traffic_portal/app/src/common/modules/table/jobs/TableJobsController.js
index 999d2e5..2ba1bf6 100644
--- a/traffic_portal/app/src/common/modules/table/jobs/TableJobsController.js
+++ b/traffic_portal/app/src/common/modules/table/jobs/TableJobsController.js
@@ -34,8 +34,8 @@ var TableJobsController = function(tableName, jobs,
$document, $scope, $state, $
hide: false
},
{
- headerName: "Parameters",
- field: "parameters",
+ headerName: "TTL (Hours)",
+ field: "ttlHours",
hide: false
},
{
@@ -54,6 +54,11 @@ var TableJobsController = function(tableName, jobs,
$document, $scope, $state, $
headerName: "Created By",
field: "createdBy",
hide: false
+ },
+ {
+ headerName: "Invalidation Type",
+ field: "invalidationType",
+ hide: false
}
];
@@ -63,9 +68,7 @@ var TableJobsController = function(tableName, jobs,
$document, $scope, $state, $
// need to convert this to a date object for ag-grid
filter to work properly
x.startTime = new Date(x.startTime.replace("+00", "Z"));
- // 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);
+ x.expires = new Date(x.startTime.getTime() +
x.ttlHours*3600*1000);
return x;
});
diff --git a/traffic_portal/package-lock.json b/traffic_portal/package-lock.json
index 17a97e3..166dbc2 100644
--- a/traffic_portal/package-lock.json
+++ b/traffic_portal/package-lock.json
@@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
+ "name": "traffic_portal",
"version": "6.1.0",
"dependencies": {
"@uirouter/angularjs": "0.4.2",
@@ -43,7 +44,7 @@
"grunt-contrib-jshint": "2.1.0",
"grunt-contrib-uglify": "4.0.1",
"grunt-contrib-watch": "1.1.0",
- "grunt-dart-sass": "^2.0.1",
+ "grunt-dart-sass": "2.0.1",
"grunt-express-server": "0.5.4",
"grunt-html2js": "0.7.1",
"grunt-install-dependencies": "0.2.0",
@@ -54,7 +55,7 @@
"load-grunt-tasks": "5.1.0",
"morgan": "1.9.1",
"requirejs": "2.3.6",
- "sass": "^1.42.1",
+ "sass": "1.42.1",
"ssl-root-cas": "1.3.1",
"time-grunt": "1.3.0"
}
diff --git a/traffic_portal/test/integration/Data/jobs.ts
b/traffic_portal/test/integration/Data/jobs.ts
index 80649cc..2da6286 100644
--- a/traffic_portal/test/integration/Data/jobs.ts
+++ b/traffic_portal/test/integration/Data/jobs.ts
@@ -96,8 +96,9 @@ export const jobs = {
description: "create an invalidation
request",
DeliveryService: "dstestjob1",
Regex: "/test",
- Ttl: "1",
- validationMessage: "Invalidation
request created"
+ TtlHours: "1",
+ InvalidationType: "REFRESH",
+ validationMessage: "Invalidation
(REFRESH) request created"
}
],
}
diff --git a/traffic_portal/test/integration/PageObjects/Jobs.po.ts
b/traffic_portal/test/integration/PageObjects/Jobs.po.ts
index 661bbe3..779c758 100644
--- a/traffic_portal/test/integration/PageObjects/Jobs.po.ts
+++ b/traffic_portal/test/integration/PageObjects/Jobs.po.ts
@@ -25,14 +25,16 @@ import { SideNavigationPage } from
'./SideNavigationPage.po';
interface Job {
DeliveryService: string;
Regex: string;
- Ttl: string;
+ TtlHours: string;
+ InvalidationType: string;
validationMessage: string;
}
export class JobsPage extends BasePage {
private moreBtn = element(by.name('moreBtn'));
private createJobMenuItem = element(by.name('createJobMenuItem'));
private txtRegex = element(by.name('regex'));
- private txtTtl = element(by.name('ttl'));
+ private txtTtl = element(by.name('ttlhours'));
+ private txtInvalidationType = element(by.name('invalidationtype'));
private txtDeliveryservice = element(by.name('deliveryservice'));
private randomize = randomize;
@@ -55,7 +57,8 @@ export class JobsPage extends BasePage {
await this.createJobMenuItem.click();
await this.txtDeliveryservice.sendKeys(jobs.DeliveryService +
this.randomize)
await this.txtRegex.sendKeys(jobs.Regex);
- await this.txtTtl.sendKeys(jobs.Ttl);
+ await this.txtTtl.sendKeys(jobs.TtlHours);
+ await this.txtInvalidationType.sendKeys(jobs.InvalidationType);
await basePage.ClickCreate();
result = await basePage.GetOutputMessage().then(value =>
value.includes(jobs.validationMessage));
return result;