Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
77025d7
statuses parity - table,details, new,delete
Feb 21, 2023
4acb595
Merge branch 'master' into kannan-victory-1
gbkannan89 Feb 22, 2023
26211f5
monu statuses moved under servers
gbkannan89 Feb 27, 2023
057fa66
breadcrumbs removed,license added,model from lib
gbkannan89 Feb 27, 2023
07869be
lint fixes
gbkannan89 Feb 27, 2023
4bcdc44
lint error fixes
gbkannan89 Feb 27, 2023
2c9c9cb
statuses test cases added
gbkannan89 Feb 28, 2023
9b2c389
lint fixes
gbkannan89 Mar 6, 2023
9e4a8fb
added last line
gbkannan89 Mar 6, 2023
b5ed031
lazy load and statuses service removed
gbkannan89 Mar 6, 2023
defc015
lint error and comments addressed
gbkannan89 Mar 6, 2023
97dac47
removed reactive forms module import
gbkannan89 Mar 7, 2023
9703619
comments addressed
gbkannan89 Mar 7, 2023
dadee3f
statuses parity - table,details, new,delete
Feb 21, 2023
406c053
monu statuses moved under servers
gbkannan89 Feb 27, 2023
8727cea
breadcrumbs removed,license added,model from lib
gbkannan89 Feb 27, 2023
c0a237a
lint fixes
gbkannan89 Feb 27, 2023
64669c7
lint error fixes
gbkannan89 Feb 27, 2023
e26344a
statuses test cases added
gbkannan89 Feb 28, 2023
34edeb2
lint fixes
gbkannan89 Mar 6, 2023
869aea5
added last line
gbkannan89 Mar 6, 2023
c234a37
lazy load and statuses service removed
gbkannan89 Mar 6, 2023
d3cec1f
lint error and comments addressed
gbkannan89 Mar 6, 2023
d0c2728
removed reactive forms module import
gbkannan89 Mar 7, 2023
0270d98
comments addressed
gbkannan89 Mar 7, 2023
5fd8e1d
Merge branch 'kannan-victory-1' of https://github.com/gbkannan89/traf…
gbkannan89 Mar 7, 2023
8f4026b
Merge branch 'master' into kannan-victory-1
gbkannan89 Mar 7, 2023
cfcadaf
lint fixes
gbkannan89 Mar 7, 2023
3b58033
test clean up statuses
gbkannan89 Mar 24, 2023
9fd113f
Merge branch 'master' into kannan-victory-1
gbkannan89 Mar 24, 2023
7c42dc3
test file base correction for future test cases
gbkannan89 Mar 24, 2023
501a8f8
Merge branch 'master' into kannan-victory-1
gbkannan89 Apr 7, 2023
7a4698f
latest changes for comments
gbkannan89 Apr 7, 2023
fb0b0b3
latest changes
gbkannan89 Apr 7, 2023
4669bc0
added button for new status
gbkannan89 Apr 7, 2023
b1f8f01
latest changes applied to review comments
gbkannan89 Apr 7, 2023
4c2a5ca
Merge branch 'master' into kannan-victory-1
gbkannan89 Apr 11, 2023
91cc331
latest changes
gbkannan89 Apr 11, 2023
152b395
lint fixes
gbkannan89 Apr 12, 2023
f3613f1
reactive form corrections lint error
gbkannan89 Apr 12, 2023
64fa23b
latest changes
gbkannan89 Apr 12, 2023
c5f623b
merge comments fixes
gbkannan89 Apr 17, 2023
edb7b4c
Merge branch 'master' into kannan-victory-1
gbkannan89 Apr 17, 2023
8d84b2f
Merge branch 'master' into kannan-victory-1
gbkannan89 Apr 18, 2023
d2a684f
e2e test cases added
gbkannan89 Apr 18, 2023
a13384d
url corrected
gbkannan89 Apr 19, 2023
b05fa6a
added name to fix selector in dom
gbkannan89 Apr 19, 2023
758314f
e2e test error fix
gbkannan89 Apr 19, 2023
9156cb9
added element id and lastdate to dom
gbkannan89 Apr 19, 2023
b3af5ec
error fix
gbkannan89 Apr 19, 2023
cfdb3e6
Merge branch 'master' into kannan-victory-1
gbkannan89 Apr 25, 2023
a4fd9fa
comment addressed
gbkannan89 Apr 25, 2023
0b59682
comments addressed
gbkannan89 Apr 26, 2023
789cdde
comment addressed
gbkannan89 Apr 26, 2023
d3ab71a
comment fixed
gbkannan89 Apr 27, 2023
cdedbec
Merge branch 'master' into kannan-victory-1
gbkannan89 Apr 27, 2023
e3d51d5
# removed
gbkannan89 Apr 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions experimental/traffic-portal/nightwatch/globals/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import type { ProfilePageObject } from "nightwatch/page_objects/profiles/profile
import type { PhysLocDetailPageObject } from "nightwatch/page_objects/servers/physLocDetail";
import type { PhysLocTablePageObject } from "nightwatch/page_objects/servers/physLocTable";
import type { ServersPageObject } from "nightwatch/page_objects/servers/servers";
import type { StatusDetailPageObject } from "nightwatch/page_objects/statuses/statusDetail";
import type { StatusesTablePageObject } from "nightwatch/page_objects/statuses/statusesTable";
import type { ChangeLogsPageObject } from "nightwatch/page_objects/users/changeLogs";
import type { TenantDetailPageObject } from "nightwatch/page_objects/users/tenantDetail";
import type { TenantsPageObject } from "nightwatch/page_objects/users/tenants";
Expand Down Expand Up @@ -66,6 +68,8 @@ import {
ResponseCoordinate,
RequestCoordinate,
RequestType,
ResponseStatus,
RequestStatus,
ResponseProfile,
RequestProfile,
ProfileType
Expand Down Expand Up @@ -110,6 +114,10 @@ declare module "nightwatch" {
physLocTable: () => PhysLocTablePageObject;
servers: () => ServersPageObject;
};
statuses: {
statusesTable: () => StatusesTablePageObject;
statusDetail: () => StatusDetailPageObject;
};
users: {
changeLogs: () => ChangeLogsPageObject;
tenants: () => TenantsPageObject;
Expand Down Expand Up @@ -151,6 +159,7 @@ export interface CreatedData {
steeringDS: ResponseDeliveryService;
tenant: ResponseTenant;
type: TypeFromResponse;
statuses: ResponseStatus;
profile: ResponseProfile;
}

Expand Down Expand Up @@ -390,6 +399,16 @@ const globals = {
console.log(`Successfully created Type ${respType.name}`);
data.type = respType;

const status: RequestStatus = {
description: "blah",
name: `status${globals.uniqueString}`,
};
url = `${apiUrl}/statuses`;
resp = await client.post(url, JSON.stringify(status));
const respStatus: ResponseStatus = resp.data.response;
console.log(`Successfully created Profile ${respStatus.name}`);
data.statuses = respStatus;

const profile: RequestProfile = {
cdn: 1,
description: "blah",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const commonPageObject = {
regions: "[aria-label='Navigate to Regions']",
servers: "[aria-label='Navigate to Servers']",
serversContainer: "[aria-label='Toggle Servers']",
statuses: "[aria-label='Navigate to Statuses']",
tenants: "[aria-label='Navigate to Tenants']",
types: "[aria-label='Navigate to Types']",
users: "[aria-label='Navigate to Users']",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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 { EnhancedPageObject } from "nightwatch";

/**
* Defines the PageObject for Status Details.
*/
export type StatusDetailPageObject = EnhancedPageObject<{}, typeof statusDetailPageObject.elements>;

const statusDetailPageObject = {
elements: {
description: {
selector: "input[name='description']"
},
id: {
selector: "input[name='id']"
},
lastUpdated: {
selector: "input[name='lastUpdated']"
},
name: {
selector: "input[name='name']"
},
saveBtn: {
selector: "button[type='submit']"
}
},
};

export default statusDetailPageObject;
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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 { EnhancedPageObject, EnhancedSectionInstance, NightwatchAPI } from "nightwatch";

import { TABLE_COMMANDS, TableSectionCommands } from "../../globals/tables";

/**
* Defines the Statuses table commands
*/
type StatusesTableCommands = TableSectionCommands;

/**
* Defines the Page Object for the Statuses page.
*/
export type StatusesTablePageObject = EnhancedPageObject<{}, {}, EnhancedSectionInstance<StatusesTableCommands>>;

const statusesTablePageObject = {
api: {} as NightwatchAPI,
sections: {
statusesTable: {
commands: {
...TABLE_COMMANDS
},
elements: {},
selector: "mat-card"
}
},
url(): string {
return `${this.api.launchUrl}/core/statuses`;
}
};

export default statusesTablePageObject;
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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.
*/

describe("Status Detail Spec", () => {
it("Test status", () => {
const page = browser.page.statuses.statusDetail();
browser.url(`${page.api.launchUrl}/core/statuses/${browser.globals.testData.statuses.id}`, res => {
browser.assert.ok(res.status === 0);
page.waitForElementVisible("mat-card")
.assert.enabled("@name")
.assert.enabled("@description")
.assert.enabled("@saveBtn")
.assert.not.enabled("@id")
.assert.not.enabled("@lastUpdated")
.assert.valueEquals("@name", browser.globals.testData.statuses.name)
.assert.valueEquals("@id", String(browser.globals.testData.statuses.id));
});
});

it("New Status", () => {
const page = browser.page.statuses.statusDetail();
browser.url(`${page.api.launchUrl}/core/statuses/new`, res => {
browser.assert.ok(res.status === 0);
page.waitForElementVisible("mat-card")
.assert.enabled("@name")
.assert.enabled("@description")
.assert.enabled("@saveBtn")
.assert.not.elementPresent("@id")
.assert.not.elementPresent("@lastUpdated")
.assert.valueEquals("@name", "");
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.
*/

describe("Statuses Spec", () => {
it("Loads elements", async () => {
await browser.page.common()
.section.sidebar
.navigateToNode("statuses", ["serversContainer"]);
await browser.waitForElementPresent("input[name=fuzzControl]");
await browser.elements("css selector", "div.ag-row", rows => {
browser.assert.ok(rows.status === 0);
browser.assert.ok((rows.value as []).length >= 2);
});
});
});
35 changes: 33 additions & 2 deletions experimental/traffic-portal/src/app/api/server.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import type { RequestServer, ResponseServer, ResponseStatus, Servercheck } from "trafficops-types";
import type { RequestServer, RequestStatus, ResponseServer, ResponseStatus, Servercheck } from "trafficops-types";

import { APIService } from "./base-api.service";

Expand Down Expand Up @@ -118,7 +118,8 @@ export class ServerService extends APIService {
let ret;
switch (typeof idOrName) {
case "number":
ret = this.get<[ResponseStatus]>(path, {params: {id: String(idOrName)}}).toPromise();
const response = await this.get<[ResponseStatus]>(path, undefined, { id: String(idOrName) }).toPromise();
ret = response[0];
break;
case "string":
ret = this.get<[ResponseStatus]>(path, {params: {name: idOrName}}).toPromise();
Expand Down Expand Up @@ -186,4 +187,34 @@ export class ServerService extends APIService {

return this.put(`servers/${id}/status`, {offlineReason, status}).toPromise();
}

/**
* Creating new Status.
*
* @param status The status to create.
* @returns The created status.
*/
public async createStatus(status: RequestStatus): Promise<ResponseStatus> {
return this.post<ResponseStatus>("statuses", status).toPromise();
}

/**
* Updates status Details.
*
* @param status The status to update.
* @returns The updated status.
*/
public async updateStatusDetail(status: ResponseStatus): Promise<ResponseStatus> {
return this.put<ResponseStatus>(`statuses/${status.id}`, status).toPromise();
}

/**
* Deletes an existing Status.
*
* @param statusId The Status ID
*/
public async deleteStatus(statusId: number | ResponseStatus): Promise<ResponseStatus> {
const id = typeof (statusId) === "number" ? statusId : statusId.id;
return this.delete<ResponseStatus>(`statuses/${id}`).toPromise();
}
}
56 changes: 54 additions & 2 deletions experimental/traffic-portal/src/app/api/testing/server.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

import { Injectable } from "@angular/core";
import type { RequestServer, ResponseServer, ResponseStatus, Servercheck } from "trafficops-types";
import type { RequestServer, RequestStatus, ResponseServer, ResponseStatus, Servercheck } from "trafficops-types";

import { CDNService, PhysicalLocationService, ProfileService, TypeService } from "..";

Expand Down Expand Up @@ -47,7 +47,7 @@ export class ServerService {

public servers = new Array<ResponseServer>();

private readonly statuses = [
private readonly statuses: ResponseStatus[] = [
{
description: "Sever is administrative down and does not receive traffic.",
id: 4,
Expand Down Expand Up @@ -87,6 +87,7 @@ export class ServerService {
];

private idCounter = 1;
private statusIdCounter = 6;

constructor(
private readonly cdnService: CDNService,
Expand Down Expand Up @@ -302,4 +303,55 @@ export class ServerService {
srv.statusId = status.id;
srv.offlineReason = offlineReason ?? null;
}

/**
* Creates a status.
*
* @param status The status details (name & description) to create. Description is an optional property in status.
* @returns The status as created and returned by the API.
*/
public async createStatus(status: RequestStatus): Promise<ResponseStatus> {
const newStatus = {
description: status.description ? status.description : null,
id: ++this.statusIdCounter,
lastUpdated: new Date(),
name: status.name
};
this.statuses.push(newStatus);
return newStatus;
}

/**
* Updates status Details.
*
* @param payload containes name and description for the status., unique identifier thereof.
*/
public async updateStatusDetail(payload: ResponseStatus): Promise<ResponseStatus> {
const index = this.statuses.findIndex(u => u.id === payload.id);
if (index < 0) {
throw new Error(`no such status with id: ${payload.id}`);
}
const updated = {
...payload,
lastUpdated: new Date()
} as { description: string; id: number; lastUpdated: Date; name: string };
this.statuses[index] = updated;

return updated;
}

/**
* Deletes a Status.
*
* @param statusId The ID of the Status to delete.
* @returns The deleted status.
*/
public async deleteStatus(statusId: number | ResponseStatus): Promise<ResponseStatus> {
const id = typeof (statusId) === "number" ? statusId : statusId.id;
const idx = this.statuses.findIndex(j => j.id === id);
if (idx < 0) {
throw new Error(`no such status: #${id}`);
}
return this.statuses.splice(idx, 1)[0];
}
}
14 changes: 10 additions & 4 deletions experimental/traffic-portal/src/app/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ import { PhysLocTableComponent } from "./servers/phys-loc/table/phys-loc-table.c
import { ServerDetailsComponent } from "./servers/server-details/server-details.component";
import { ServersTableComponent } from "./servers/servers-table/servers-table.component";
import { UpdateStatusComponent } from "./servers/update-status/update-status.component";
import {TypeDetailComponent} from "./types/detail/type-detail.component";
import {TypesTableComponent} from "./types/table/types-table.component";
import { StatusDetailsComponent } from "./statuses/status-details/status-details.component";
import { StatusesTableComponent } from "./statuses/statuses-table/statuses-table.component";
import { TypeDetailComponent } from "./types/detail/type-detail.component";
import { TypesTableComponent } from "./types/table/types-table.component";
import { TenantDetailsComponent } from "./users/tenants/tenant-details/tenant-details.component";
import { TenantsComponent } from "./users/tenants/tenants.component";
import { UserDetailsComponent } from "./users/user-details/user-details.component";
Expand Down Expand Up @@ -90,6 +92,8 @@ export const ROUTES: Routes = [
{ component: CoordinatesTableComponent, path: "coordinates" },
{ component: TypesTableComponent, path: "types" },
{ component: TypeDetailComponent, path: "types/:id"},
{ component: StatusesTableComponent, path: "statuses" },
{ component: StatusDetailsComponent, path: "statuses/:id" },
{ component: ISOGenerationFormComponent, path: "iso-gen"},
{ component: ProfileTableComponent, path: "profiles"},
].map(r => ({...r, canActivate: [AuthenticatedGuard]}));
Expand Down Expand Up @@ -128,10 +132,12 @@ export const ROUTES: Routes = [
RegionsTableComponent,
RegionDetailComponent,
CacheGroupDetailsComponent,
CoordinatesTableComponent,
CoordinateDetailComponent,
TypesTableComponent,
TypeDetailComponent,
CoordinatesTableComponent,
CoordinateDetailComponent,
StatusesTableComponent,
StatusDetailsComponent,
ISOGenerationFormComponent,
ProfileTableComponent,
CDNDetailComponent,
Expand Down
Loading