Skip to content

Commit

Permalink
Point all machine listing routes to the react machine listing. (#966)
Browse files Browse the repository at this point in the history
  • Loading branch information
squidsoup authored Apr 14, 2020
1 parent 4c4d98f commit cc84697
Show file tree
Hide file tree
Showing 12 changed files with 492 additions and 485 deletions.
852 changes: 430 additions & 422 deletions legacy/src/app/controllers/tests/test_node_details.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion legacy/src/app/partials/cards/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h2 class="p-heading--four">Tags</h2>
<p>
<span data-ng-if="!node.tags.length"><i>No tags</i></span>
<span data-ng-repeat="tag in node.tags">
<a href="#/machines/?query=tags:({$ tag $})">{$ tag $}</a>
<a href="r/machines/?q=tags:({$ tag $})">{$ tag $}</a>
</span>
</p>
<p data-ng-if="canEdit()"><a data-ng-click="section.area = 'configuration'">Edit &rsaquo;</a></p>
Expand Down
2 changes: 1 addition & 1 deletion legacy/src/app/partials/node-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ <h2 data-ng-if="isController" class="p-heading--four">Controller configuration</
data-ng-class="{'is-disabled': !summary.editing }">Tags</label>
<div class="p-form__control col-4 tags--inline">
<span data-ng-repeat="tag in node.tags" data-ng-hide="summary.editing">
<a href="#/machines/?query=tags:({$ tag $})">{$ tag $}</a>
<a href="r/machines/?q=tags:({$ tag $})">{$ tag $}</a>
</span>
<tags-input data-ng-model="summary.tags"
data-ng-hide="!summary.editing" allowed-tags-pattern="[\w-]+">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ <h3 class="p-heading--four">Available disks and partitions</h3>
<div class="p-double-row__muted-row">
<div class="u-text-overflow">
<span class="table__tag" data-ng-repeat="tag in item.tags" data-ng-hide="item.$options.editingTags">
<a href="#/machines/?query=storage_tags:({$ tag.text $})" title="{$ tag.text $}">{$ tag.text $}</a>
<a href="r/machines/?q=storage_tags:({$ tag.text $})" title="{$ tag.text $}">{$ tag.text $}</a>
</span>
</div>
</div>
Expand Down Expand Up @@ -1149,7 +1149,7 @@ <h3 class="p-heading--four">Used disks and partitions</h3>
<div class="p-double-row__muted-row">
<div class="u-text-overflow">
<span class="table__tag" data-ng-repeat="tag in item.tags" data-ng-hide="item.$options.editingTags">
<a href="#/machines/?query=storage_tags:({$ tag.text $})" title="{$ tag.text $}">{$ tag.text $}</a>
<a href="r/machines/?q=storage_tags:({$ tag.text $})" title="{$ tag.text $}">{$ tag.text $}</a>
</span>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions legacy/src/app/partials/nodes-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ <h1 class="page-header__title">{$ title $}</h1>
<label class="p-form__label col-2 col-small-2 col-medium-2">Tag machines</label>
<div class="p-form__control col-3 col-small-2 col-medium-3 tags--inline">
<span data-ng-repeat="tag in node.tags" data-ng-hide="summary.editing">
<a href="#/machines/?query=tags:({$ tag $})">{$ tag $}</a>
<a href="r/machines/?q=tags:({$ tag $})">{$ tag $}</a>
</span>
<tags-input data-ng-model="tags" allowed-tags-pattern="[\w-]+" placeholder="Enter a tag">
<auto-complete source="tagsAutocomplete($query)"></auto-complete>
Expand Down Expand Up @@ -752,7 +752,7 @@ <h4 class="page-header__dropdown-title">Add rack controller</h4>
<div class="row">
<ul class="p-tabs__list" role="tablist">
<li class="p-tabs__item" role="presentation">
<a href="#/machines" class="p-tabs__link" role="tab"
<a href="r/machines" class="p-tabs__link" role="tab"
data-ng-class="{ 'is-active': currentpage === 'machines'}">
<ng-pluralize count="machines.length" when="{'one': '{$ machines.length $} Machine', 'other': '{$ machines.length $} Machines'}"></ng-pluralize>
</a>
Expand Down
2 changes: 1 addition & 1 deletion legacy/src/app/partials/zone-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h2 class="p-heading--four">Availability zone</h2>
<div class="p-form__group row">
<p class="p-form__label col-2 is-disabled">Machines</p>
<div class="p-form__control col-4">
<p><a href="#/machines&query=zone:({$ zone.name $})">{$ zone.machines_count $}</a></p>
<p><a href="r/machines&query=zone:({$ zone.name $})">{$ zone.machines_count $}</a></p>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion legacy/src/app/partials/zones-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ <h1 class="page-header__title">Availability zones</h1>
{$ zone.description $}
</td>
<td aria-label="Machines" class="u-align--right">
<a href="#/machines?query=zone:({$ zone.name $})">{$ zone.machines_count $}</a>
<a href="r/machines?q=zone:({$ zone.name $})">{$ zone.machines_count $}</a>
</td>
<td aria-label="Devices" class="u-align--right">
<a href="#/devices?query=zone:({$ zone.name $})">{$ zone.devices_count $}</a>
Expand Down
97 changes: 48 additions & 49 deletions legacy/src/app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,178 +18,177 @@ import vlanDetailsTmpl from "./partials/vlan-details.html";
import zoneDetailsTmpl from "./partials/zone-details.html";
import zonesListTmpl from "./partials/zones-list.html";

const configureRoutes = $routeProvider => {
/* @ngInject */
const configureRoutes = ($routeProvider) => {
let routes;
routes = $routeProvider
.when("/intro", {
template: introTmpl,
controller: "IntroController"
controller: "IntroController",
})
.when("/intro/user", {
template: introUserTmpl,
controller: "IntroUserController"
})
.when("/machines", {
template: nodesListTmpl,
controller: "NodesListController"
controller: "IntroUserController",
})
.when("/machine/:system_id/:result_type/:id", {
template: nodeResultTmpl,
controller: "NodeResultController"
controller: "NodeResultController",
})
.when("/machine/:system_id/events", {
template: nodeEventsTmpl,
controller: "NodeEventsController"
controller: "NodeEventsController",
})
.when("/machine/:system_id", {
template: nodeDetailsTmpl,
controller: "NodeDetailsController",
reloadOnSearch: false
reloadOnSearch: false,
})
.when("/devices", {
template: nodesListTmpl,
controller: "NodesListController"
controller: "NodesListController",
})
.when("/device/:system_id/:result_type/:id", {
template: nodeResultTmpl,
controller: "NodeResultController"
controller: "NodeResultController",
})
.when("/device/:system_id/events", {
template: nodeEventsTmpl,
controller: "NodeEventsController"
controller: "NodeEventsController",
})
.when("/device/:system_id", {
template: nodeDetailsTmpl,
controller: "NodeDetailsController",
reloadOnSearch: false
reloadOnSearch: false,
})
.when("/controllers", {
template: nodesListTmpl,
controller: "NodesListController"
controller: "NodesListController",
})
.when("/controller/:system_id/:result_type/:id", {
template: nodeResultTmpl,
controller: "NodeResultController"
controller: "NodeResultController",
})
.when("/controller/:system_id/events", {
template: nodeEventsTmpl,
controller: "NodeEventsController"
controller: "NodeEventsController",
})
.when("/controller/:system_id", {
template: nodeDetailsTmpl,
controller: "NodeDetailsController",
reloadOnSearch: false
reloadOnSearch: false,
})
.when("/nodes", {
redirectTo: "/machines"
redirectTo: "/machines",
})
.when("/node/machine/:system_id", {
redirectTo: "/machine/:system_id"
redirectTo: "/machine/:system_id",
})
.when("/node/machine/:system_id/:result_type/:id", {
redirectTo: "/machine/:system_id/:result_type/:id"
redirectTo: "/machine/:system_id/:result_type/:id",
})
.when("/node/machine/:system_id/events", {
redirectTo: "/machine/:system_id/events"
redirectTo: "/machine/:system_id/events",
})
.when("/node/device/:system_id", {
redirectTo: "/device/:system_id"
redirectTo: "/device/:system_id",
})
.when("/node/device/:system_id/:result_type/:id", {
redirectTo: "/device/:system_id/:result_type/:id"
redirectTo: "/device/:system_id/:result_type/:id",
})
.when("/node/device/:system_id/events", {
redirectTo: "/device/:system_id/events"
redirectTo: "/device/:system_id/events",
})
.when("/node/controller/:system_id", {
redirectTo: "/controller/:system_id"
redirectTo: "/controller/:system_id",
})
.when("/node/controller/:system_id/:result_type/:id", {
redirectTo: "/controller/:system_id/:result_type/:id"
redirectTo: "/controller/:system_id/:result_type/:id",
})
.when("/node/controller/:system_id/events", {
redirectTo: "/controller/:system_id/events"
redirectTo: "/controller/:system_id/events",
})
.when("/kvm", {
template: podsListTmpl,
controller: "PodsListController"
controller: "PodsListController",
})
.when("/kvm/:id", {
template: podDetailsTmpl,
controller: "PodDetailsController"
controller: "PodDetailsController",
})
.when("/pods", {
redirectTo: "/kvm"
redirectTo: "/kvm",
})
.when("/pod/:id", {
redirectTo: "/kvm/:id"
redirectTo: "/kvm/:id",
})
.when("/rsd", {
template: podsListTmpl,
controller: "PodsListController"
controller: "PodsListController",
})
.when("/rsd/:id", {
template: podDetailsTmpl,
controller: "PodDetailsController"
controller: "PodDetailsController",
})
.when("/images", {
template: imagesTmpl,
controller: "ImagesController"
controller: "ImagesController",
})
.when("/domains", {
template: domainsListTmpl,
controller: "DomainsListController"
controller: "DomainsListController",
})
.when("/domain/:domain_id", {
template: domainDetailsTmpl,
controller: "DomainDetailsController"
controller: "DomainDetailsController",
})
.when("/space/:space_id", {
template: spaceDetailsTmpl,
controller: "SpaceDetailsController"
controller: "SpaceDetailsController",
})
.when("/fabric/:fabric_id", {
template: fabricDetailsTmpl,
controller: "FabricDetailsController"
controller: "FabricDetailsController",
})
.when("/subnets", {
redirectTo: "/networks?by=fabric"
redirectTo: "/networks?by=fabric",
})
.when("/networks", {
template: networksListTmpl,
controller: "NetworksListController",
reloadOnSearch: false
reloadOnSearch: false,
})
.when("/subnet/:subnet_id", {
template: subnetDetailsTmpl,
controller: "SubnetDetailsController"
controller: "SubnetDetailsController",
})
.when("/vlan/:vlan_id", {
template: vlanDetailsTmpl,
controller: "VLANDetailsController",
controllerAs: "vlanDetails"
controllerAs: "vlanDetails",
})
.when("/zone/:zone_id", {
template: zoneDetailsTmpl,
controller: "ZoneDetailsController"
controller: "ZoneDetailsController",
})
.when("/zones", {
template: zonesListTmpl,
controller: "ZonesListController",
reloadOnSearch: false
reloadOnSearch: false,
})
.when("/pools", {
template: nodesListTmpl,
controller: "NodesListController"
controller: "NodesListController",
})
.when("/dashboard", {
template: dashboardTmpl,
controller: "DashboardController"
controller: "DashboardController",
});

routes.otherwise({
redirectTo: "/machines"
redirectTo: () => {
window.location.replace(`${process.env.BASENAME}/r/machines`);
},
});
}
};

export default configureRoutes;
2 changes: 1 addition & 1 deletion shared/src/components/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const Header = ({
const links = [
{
inHardwareMenu: true,
isLegacy: true,
isLegacy: false,
label: "Machines",
url: "/machines"
},
Expand Down
4 changes: 2 additions & 2 deletions shared/src/components/Header/Header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ describe("Header", () => {
basename="/MAAS"
completedIntro={true}
location={{
hash: "#/machines",
hash: "#/devices",
pathname: "/MAAS/"
}}
logout={jest.fn()}
/>
);
const selected = wrapper.find(".p-navigation__link.is-selected");
expect(selected.exists()).toBe(true);
expect(selected.text()).toEqual("Machines");
expect(selected.text()).toEqual("Devices");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ exports[`Header renders 1`] = `
>
<a
className="p-subnav__item"
href="/MAAS/#/machines"
href="/machines"
>
Machines
</a>
Expand Down Expand Up @@ -135,7 +135,7 @@ exports[`Header renders 1`] = `
role="menuitem"
>
<a
href="/MAAS/#/machines"
href="/machines"
>
Machines
</a>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Routes = () => (
exact
path="/"
component={() => {
window.location.href = `${process.env.REACT_APP_BASENAME}/#/machines`;
window.location.href = `${process.env.REACT_APP_BASENAME}/r/machines`;
return null;
}}
/>
Expand Down

0 comments on commit cc84697

Please sign in to comment.