mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
Use new home dashboard (#2212)
Adapted from @RachelElysia's original #1640.
This commit is contained in:
parent
9083230491
commit
55aa8c702e
1
changes/homepage
Normal file
1
changes/homepage
Normal file
@ -0,0 +1 @@
|
||||
* Update default homepage to new dashboard.
|
@ -8,3 +8,4 @@
|
||||
"openMode": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ describe(
|
||||
},
|
||||
},
|
||||
() => {
|
||||
cy.visit("/");
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
cy.contains("button", /add new host/i).click();
|
||||
|
||||
@ -50,7 +50,7 @@ describe(
|
||||
// testing, but may vary by environment).
|
||||
cy.waitUntil(
|
||||
() => {
|
||||
cy.visit("/");
|
||||
cy.visit("/hosts/manage");
|
||||
return Cypress.$('button[title="Online"]').length > 0;
|
||||
},
|
||||
{ timeout: 30000, interval: 1000 }
|
||||
|
@ -15,8 +15,8 @@ describe("Sessions", () => {
|
||||
cy.get("button").click();
|
||||
|
||||
// Verify dashboard
|
||||
cy.url().should("include", "/hosts/manage");
|
||||
cy.contains("All Hosts");
|
||||
cy.url().should("include", "/dashboard");
|
||||
cy.contains("Host");
|
||||
|
||||
// Log out
|
||||
cy.get(".avatar").first().click();
|
||||
|
@ -17,8 +17,8 @@ describe("SSO Sessions", () => {
|
||||
cy.contains("button", "Login").click();
|
||||
|
||||
// Verify dashboard
|
||||
cy.url().should("include", "/hosts/manage");
|
||||
cy.contains("All Hosts");
|
||||
cy.url().should("include", "/dashboard");
|
||||
cy.contains("Hosts");
|
||||
|
||||
// Log out
|
||||
cy.get(".avatar").first().click();
|
||||
|
@ -19,7 +19,7 @@ describe(
|
||||
|
||||
it("Can perform the appropriate free-tier admin actions", () => {
|
||||
cy.login("anna@organization.com", "user123#");
|
||||
cy.visit("/");
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
// Ensure page is loaded
|
||||
cy.contains("All hosts");
|
||||
|
@ -19,7 +19,7 @@ describe(
|
||||
|
||||
it("Can perform the appropriate core global maintainer actions", () => {
|
||||
cy.login("mary@organization.com", "user123#");
|
||||
cy.visit("/");
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
// Ensure page is loaded
|
||||
// cy.wait(3000); // eslint-disable-line cypress/no-unnecessary-waiting
|
||||
|
@ -14,7 +14,7 @@ describe("Free tier - Observer user", () => {
|
||||
|
||||
it("Can perform the appropriate free global observer actions", () => {
|
||||
cy.login("oliver@organization.com", "user123#");
|
||||
cy.visit("/");
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
// Ensure page is loaded
|
||||
cy.contains("All hosts");
|
||||
|
@ -26,7 +26,7 @@ describe(
|
||||
},
|
||||
() => {
|
||||
cy.login("anna@organization.com", "user123#");
|
||||
cy.visit("/");
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
// Ensure the hosts page is loaded
|
||||
cy.contains("All hosts");
|
||||
|
@ -19,7 +19,7 @@ describe(
|
||||
|
||||
it("Can perform the appropriate basic global maintainer actions", () => {
|
||||
cy.login("mary@organization.com", "user123#");
|
||||
cy.visit("/");
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
// Ensure page is loaded
|
||||
cy.contains("All hosts");
|
||||
|
@ -1,97 +1,92 @@
|
||||
describe(
|
||||
"Premium tier - Observer user",
|
||||
{
|
||||
defaultCommandTimeout: 20000,
|
||||
},
|
||||
() => {
|
||||
beforeEach(() => {
|
||||
cy.setup();
|
||||
cy.login();
|
||||
cy.seedPremium();
|
||||
cy.seedQueries();
|
||||
cy.addDockerHost("apples");
|
||||
cy.logout();
|
||||
describe("Premium tier - Observer user", () => {
|
||||
beforeEach(() => {
|
||||
cy.setup();
|
||||
cy.login();
|
||||
cy.seedPremium();
|
||||
cy.seedQueries();
|
||||
cy.addDockerHost("apples");
|
||||
cy.logout();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.stopDockerHost();
|
||||
});
|
||||
|
||||
it("Can perform the appropriate basic global observer actions", () => {
|
||||
cy.login("oliver@organization.com", "user123#");
|
||||
// Host manage page: Can see team column
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
// Ensure page is loaded
|
||||
cy.wait(5000); // eslint-disable-line cypress/no-unnecessary-waiting
|
||||
cy.contains("All hosts");
|
||||
|
||||
cy.get("thead").within(() => {
|
||||
cy.findByText(/team/i).should("exist");
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.stopDockerHost();
|
||||
// Host details page: Can see team on host
|
||||
cy.get("tbody").within(() => {
|
||||
// Test host text varies
|
||||
cy.findByRole("button").click();
|
||||
});
|
||||
|
||||
it("Can perform the appropriate basic global observer actions", () => {
|
||||
cy.login("oliver@organization.com", "user123#");
|
||||
// Host manage page: Can see team column
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
// Ensure page is loaded
|
||||
cy.wait(5000); // eslint-disable-line cypress/no-unnecessary-waiting
|
||||
cy.contains("All hosts");
|
||||
|
||||
cy.get("thead").within(() => {
|
||||
cy.findByText(/team/i).should("exist");
|
||||
});
|
||||
|
||||
// Host details page: Can see team on host
|
||||
cy.get("tbody").within(() => {
|
||||
// Test host text varies
|
||||
cy.findByRole("button").click();
|
||||
});
|
||||
cy.get(".title").within(() => {
|
||||
cy.findByText("Team").should("exist");
|
||||
});
|
||||
cy.contains("button", /transfer/i).should("not.exist");
|
||||
cy.contains("button", /delete/i).should("not.exist");
|
||||
cy.contains("button", /query/i).click();
|
||||
cy.contains("button", /create custom query/i).should("not.exist");
|
||||
|
||||
// Not see the “Show enroll secret” button
|
||||
cy.contains("button", /show enroll secret/i).should("not.exist");
|
||||
|
||||
// TODO - Fix tests according to improved query experience - MP
|
||||
// Query pages: Can see team in select targets dropdown
|
||||
// cy.visit("/queries/manage");
|
||||
|
||||
// cy.findByText(/detect presence/i).click();
|
||||
|
||||
// cy.findByRole("button", { name: /run/i }).click();
|
||||
|
||||
// cy.get(".target-select").within(() => {
|
||||
// cy.findByText(/Label name, host name, IP address, etc./i).click();
|
||||
// cy.findByText(/teams/i).should("exist");
|
||||
// });
|
||||
cy.get(".title").within(() => {
|
||||
cy.findByText("Team").should("exist");
|
||||
});
|
||||
cy.contains("button", /transfer/i).should("not.exist");
|
||||
cy.contains("button", /delete/i).should("not.exist");
|
||||
cy.contains("button", /query/i).click();
|
||||
cy.contains("button", /create custom query/i).should("not.exist");
|
||||
|
||||
// Pseudo code for team observer only
|
||||
// TODO: Rebuild this test according to new manual QA
|
||||
it("Can perform the appropriate basic team observer only actions", () => {
|
||||
cy.login("toni@organization.com", "user123#");
|
||||
cy.visit("/hosts/manage");
|
||||
cy.wait(3000); // eslint-disable-line cypress/no-unnecessary-waiting
|
||||
// Not see the “Show enroll secret” button
|
||||
cy.contains("button", /show enroll secret/i).should("not.exist");
|
||||
|
||||
cy.findByText("Hosts").should("exist");
|
||||
// TODO - Fix tests according to improved query experience - MP
|
||||
// Query pages: Can see team in select targets dropdown
|
||||
// cy.visit("/queries/manage");
|
||||
|
||||
// Nav restrictions
|
||||
cy.findByText(/settings/i).should("not.exist");
|
||||
cy.findByText(/schedule/i).should("not.exist");
|
||||
cy.visit("/settings/organization");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
cy.visit("/packs/manage");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
cy.visit("/schedule/manage");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
// cy.findByText(/detect presence/i).click();
|
||||
|
||||
cy.contains(".table-container .data-table__table th", "Team").should(
|
||||
"be.visible"
|
||||
);
|
||||
// cy.findByRole("button", { name: /run/i }).click();
|
||||
|
||||
// On the Profile page, they should…
|
||||
// See Global in the Team section and Observer in the Role section
|
||||
cy.visit("/profile");
|
||||
cy.findByText(/team/i)
|
||||
.next()
|
||||
.contains(/apples/i);
|
||||
cy.findByText("Role")
|
||||
.next()
|
||||
.contains(/observer/i);
|
||||
});
|
||||
}
|
||||
);
|
||||
// cy.get(".target-select").within(() => {
|
||||
// cy.findByText(/Label name, host name, IP address, etc./i).click();
|
||||
// cy.findByText(/teams/i).should("exist");
|
||||
// });
|
||||
});
|
||||
|
||||
// Pseudo code for team observer only
|
||||
// TODO: Rebuild this test according to new manual QA
|
||||
it("Can perform the appropriate basic team observer only actions", () => {
|
||||
cy.login("toni@organization.com", "user123#");
|
||||
cy.visit("/hosts/manage");
|
||||
cy.wait(3000); // eslint-disable-line cypress/no-unnecessary-waiting
|
||||
|
||||
cy.findByText("Hosts").should("exist");
|
||||
|
||||
// Nav restrictions
|
||||
cy.findByText(/settings/i).should("not.exist");
|
||||
cy.findByText(/schedule/i).should("not.exist");
|
||||
cy.visit("/settings/organization");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
cy.visit("/packs/manage");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
cy.visit("/schedule/manage");
|
||||
cy.findByText(/you do not have permissions/i).should("exist");
|
||||
|
||||
cy.visit("/hosts/manage");
|
||||
cy.contains(".table-container .data-table__table th", "Team").should(
|
||||
"be.visible"
|
||||
);
|
||||
|
||||
// On the Profile page, they should…
|
||||
// See Global in the Team section and Observer in the Role section
|
||||
cy.visit("/profile");
|
||||
cy.findByText(/team/i)
|
||||
.next()
|
||||
.contains(/apples/i);
|
||||
cy.findByText("Role")
|
||||
.next()
|
||||
.contains(/observer/i);
|
||||
});
|
||||
});
|
||||
|
@ -18,7 +18,7 @@ describe(
|
||||
|
||||
it("Can perform the appropriate team observer actions", () => {
|
||||
cy.login("marco@organization.com", "user123#");
|
||||
cy.visit("/");
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
// Ensure page is loaded
|
||||
cy.contains("Hosts");
|
||||
@ -111,7 +111,7 @@ describe(
|
||||
|
||||
it("Can perform the appropriate maintainer actions", () => {
|
||||
cy.login("marco@organization.com", "user123#");
|
||||
cy.visit("/");
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
// Ensure page is loaded and appropriate nav links are displayed
|
||||
cy.contains("Hosts");
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { mount } from "enzyme";
|
||||
|
||||
import paths from "router/paths";
|
||||
import ConnectedAdminRoutes from "./AuthenticatedAdminRoutes";
|
||||
import { connectedComponent, reduxMockStore } from "../../test/helpers";
|
||||
|
||||
@ -8,7 +9,7 @@ describe("AuthenticatedAdminRoutes - layout", () => {
|
||||
type: "@@router/CALL_HISTORY_METHOD",
|
||||
payload: {
|
||||
method: "push",
|
||||
args: ["/"],
|
||||
args: [paths.HOME],
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -21,8 +21,8 @@ export default (currentUser) => {
|
||||
name: "Home",
|
||||
iconName: "logo",
|
||||
location: {
|
||||
regex: new RegExp(`^${URL_PREFIX}/home/dashboard`),
|
||||
pathname: PATHS.HOMEPAGE,
|
||||
regex: new RegExp(`^${URL_PREFIX}/dashboard`),
|
||||
pathname: PATHS.HOME,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { mount } from "enzyme";
|
||||
|
||||
import paths from "router/paths";
|
||||
import { connectedComponent, reduxMockStore } from "../../test/helpers";
|
||||
import local from "../../utilities/local";
|
||||
import LoginPage from "./LoginPage";
|
||||
@ -50,7 +51,7 @@ describe("LoginPage - component", () => {
|
||||
type: "@@router/CALL_HISTORY_METHOD",
|
||||
payload: {
|
||||
method: "push",
|
||||
args: ["/"],
|
||||
args: [paths.HOME],
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { mount, shallow } from "enzyme";
|
||||
|
||||
import paths from "router/paths";
|
||||
import { connectedComponent, reduxMockStore } from "test/helpers";
|
||||
import ConnectedRegistrationPage, {
|
||||
RegistrationPage,
|
||||
@ -17,7 +18,7 @@ const user = {
|
||||
};
|
||||
|
||||
describe("RegistrationPage - component", () => {
|
||||
it("redirects to the login page when a user is logged in", () => {
|
||||
it("redirects to the home page when a user is logged in", () => {
|
||||
const storeWithUser = {
|
||||
...baseStore,
|
||||
auth: {
|
||||
@ -35,7 +36,7 @@ describe("RegistrationPage - component", () => {
|
||||
type: "@@router/CALL_HISTORY_METHOD",
|
||||
payload: {
|
||||
method: "push",
|
||||
args: ["/"],
|
||||
args: [paths.HOME],
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -70,7 +70,7 @@ const AppWrapper = ({ children }: IAppWrapperProps) => (
|
||||
const routes = (
|
||||
<Provider store={store}>
|
||||
<Router history={history}>
|
||||
<Route path={PATHS.HOME} component={AppWrapper}>
|
||||
<Route path={PATHS.ROOT} component={AppWrapper}>
|
||||
<Route path="setup" component={RegistrationPage} />
|
||||
<Route path="login" component={LoginRoutes}>
|
||||
<Route path="invites/:invite_token" component={ConfirmInvitePage} />
|
||||
@ -85,8 +85,8 @@ const routes = (
|
||||
<Route path="email/change/:token" component={EmailTokenRedirect} />
|
||||
<Route path="logout" component={LogoutPage} />
|
||||
<Route component={CoreLayout}>
|
||||
<IndexRedirect to={PATHS.MANAGE_HOSTS} />
|
||||
<Route path="home/dashboard" component={Homepage} />
|
||||
<IndexRedirect to={"dashboard"} />
|
||||
<Route path="dashboard" component={Homepage} />
|
||||
<Route path="settings" component={AuthenticatedAdminRoutes}>
|
||||
<Route component={SettingsWrapper}>
|
||||
<Route path="organization" component={AdminAppSettingsPage} />
|
||||
|
@ -4,6 +4,8 @@ import { IQuery } from "../interfaces/query";
|
||||
import URL_PREFIX from "./url_prefix";
|
||||
|
||||
export default {
|
||||
ROOT: `${URL_PREFIX}/`,
|
||||
HOME: `${URL_PREFIX}/dashboard`,
|
||||
ADMIN_USERS: `${URL_PREFIX}/settings/users`,
|
||||
ADMIN_SETTINGS: `${URL_PREFIX}/settings/organization`,
|
||||
ADMIN_TEAMS: `${URL_PREFIX}/settings/teams`,
|
||||
@ -18,12 +20,10 @@ export default {
|
||||
return `${URL_PREFIX}/queries/${query.id}`;
|
||||
},
|
||||
FORGOT_PASSWORD: `${URL_PREFIX}/login/forgot`,
|
||||
HOME: `${URL_PREFIX}/`,
|
||||
API_ONLY_USER: `${URL_PREFIX}/apionlyuser`,
|
||||
FLEET_403: `${URL_PREFIX}/403`,
|
||||
FLEET_500: `${URL_PREFIX}/500`,
|
||||
LOGIN: `${URL_PREFIX}/login`,
|
||||
HOMEPAGE: `${URL_PREFIX}/home/dashboard`,
|
||||
LOGOUT: `${URL_PREFIX}/logout`,
|
||||
MANAGE_HOSTS: `${URL_PREFIX}/hosts/manage`,
|
||||
HOST_DETAILS: (host: IHost): string => {
|
||||
|
Loading…
Reference in New Issue
Block a user