Merge ~steverydz/maas:dhcp-snippets-for-machines into maas:master

Proposed by Steve Rydz
Status: Merged
Approved by: Steve Rydz
Approved revision: 2ed994c6065aceaf2ecb8e0f848d2cc322b0833d
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~steverydz/maas:dhcp-snippets-for-machines
Merge into: maas:master
Diff against target: 123 lines (+17/-55)
4 files modified
src/maasserver/static/js/angular/controllers/node_details_networking.js (+4/-4)
src/maasserver/static/js/angular/directives/dhcp_snippets_table.js (+2/-1)
src/maasserver/static/partials/dhcp-snippets-table.html (+10/-1)
src/maasserver/static/partials/settings.html (+1/-49)
Reviewer Review Type Date Requested Status
LukeWH (community) code Approve
Lilyana Videnova (community) ux Approve
Anthony Dillon Pending
Review via email: mp+370864@code.launchpad.net

Commit message

only show dhcp snippets that apply to machines and devices

Description of the change

Done:
- add link to all snippets on the dhcp snippets table
- removed commented out code
- for devices and machine details interfaces tab, only show snippets that apply to that machine/device

QA:
- go to a machine that has DHCP snippets (you should be able to see which machine by looking at all snippets in settings)
- see that the snippets only apply to that machine
- see that there is a link to all snippets in the settings section
- go to a device that has DHCP snippets (you should be able to see which device by looking at all snippets in settings)
- see that the snippets only apply to that machine
- see that there is a link to all snippets in the settings section
- see that there is no link to all settings on the settings dhcp snippets table

To post a comment you must log in.
Revision history for this message
Lilyana Videnova (lilyanavidenova) wrote :

LGTM! :)

review: Approve (ux)
Revision history for this message
LukeWH (0-luke) wrote :

Code looks good +1

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/static/js/angular/controllers/node_details_networking.js b/src/maasserver/static/js/angular/controllers/node_details_networking.js
2index e70405c..d0a80ec 100644
3--- a/src/maasserver/static/js/angular/controllers/node_details_networking.js
4+++ b/src/maasserver/static/js/angular/controllers/node_details_networking.js
5@@ -310,6 +310,7 @@ export function NodeNetworkingController(
6 $scope.editInterfaceLinkMonitoring = null;
7 $scope.isSaving = false;
8 $scope.snippets = DHCPSnippetsManager.getItems();
9+ $scope.filteredSnippets = [];
10 $scope.modes = [
11 {
12 mode: LINK_MODE.AUTO,
13@@ -508,10 +509,9 @@ export function NodeNetworkingController(
14 }
15 });
16
17- $scope.filteredSnippets = DHCPSnippetsManager.getFilteredSnippets(
18- $scope.snippets,
19- subnetIPs
20- );
21+ $scope.filteredSnippets = $scope.snippets.filter(snippet => {
22+ return snippet.node === $scope.node.system_id;
23+ });
24
25 // Update the scope interface links mapping.
26 $scope.interfaceLinksMap = {};
27diff --git a/src/maasserver/static/js/angular/directives/dhcp_snippets_table.js b/src/maasserver/static/js/angular/directives/dhcp_snippets_table.js
28index e2d5f97..86df4ea 100644
29--- a/src/maasserver/static/js/angular/directives/dhcp_snippets_table.js
30+++ b/src/maasserver/static/js/angular/directives/dhcp_snippets_table.js
31@@ -11,7 +11,8 @@ function maasDhcpSnippetsTable($window) {
32 scope: {
33 snippets: "=",
34 allowAddNew: "=",
35- allowDelete: "="
36+ allowDelete: "=",
37+ hideAllSnippetsLink: "="
38 },
39 templateUrl:
40 "static/partials/dhcp-snippets-table.html?v=" +
41diff --git a/src/maasserver/static/partials/dhcp-snippets-table.html b/src/maasserver/static/partials/dhcp-snippets-table.html
42index 56f36a5..c99b5a4 100644
43--- a/src/maasserver/static/partials/dhcp-snippets-table.html
44+++ b/src/maasserver/static/partials/dhcp-snippets-table.html
45@@ -190,4 +190,13 @@
46 <button class="p-button--neutral" data-ng-disabled="editing" data-ng-if="!newSnippet" data-ng-click="editing || snippetAdd()">Add custom snippet</button>
47 </div>
48 </div>
49-<p><a class="p-link--external" href="https://maas.io/docs/{$ MAAS_VERSION_NUMBER $}/en/installconfig-network-dhcp#dhcp-snippets" target="_blank">About DHCP snippets</a></p>
50\ No newline at end of file
51+<ul class="p-inline-list--middot">
52+ <li class="p-inline-list__item" data-ng-if="!hideAllSnippetsLink">
53+ <a href="/#/settings/dhcp">All snippets: Settings > DHCP snippets</a>
54+ </li>
55+ <li class="p-inline-list__item">
56+ <a class="p-link--external"
57+ href="https://maas.io/docs/{$ MAAS_VERSION_NUMBER $}/en/installconfig-network-dhcp#dhcp-snippets"
58+ target="_blank">About DHCP snippets</a>
59+ </li>
60+</ul>
61\ No newline at end of file
62diff --git a/src/maasserver/static/partials/settings.html b/src/maasserver/static/partials/settings.html
63index a53aff1..28a81fb 100644
64--- a/src/maasserver/static/partials/settings.html
65+++ b/src/maasserver/static/partials/settings.html
66@@ -43,56 +43,8 @@
67 <div data-ng-show="!loading && currentpage === 'dhcp'" width-width>
68 <section class="p-strip">
69 <div class="row" data-ng-if="snippets.length">
70- <!-- XXX 04-01-2016 blake_r: Need to add the ability to show the compiled DHCP configuration.
71- <div class="twelve-col">
72- <div class="four-col last-col align-right">
73- <a href="" class=" u-float--right">View compiled configuration</a>
74- </div>
75- </div>
76- -->
77- <maas-dhcp-snippets-table snippets="snippets" allow-add-new="true" allow-delete="true"></maas-dhcp-snippets-table>
78+ <maas-dhcp-snippets-table snippets="snippets" allow-add-new="true" allow-delete="true" hide-all-snippets-link="true"></maas-dhcp-snippets-table>
79 </div>
80-
81- <!--
82- XXX 04-01-2016 blake_r: Need to add the ability to show the compiled DHCP configuration.
83- <div class="ng-hide">
84- <div class="twelve-col">
85- <div class="equal-height">
86- <div class="eight-col">
87- <h2 class="u-margin--none">Compiled configuration</h2>
88- </div>
89- <div class="four-col last-col align-right">
90- <a href="" class="right margin-top">Download as text</a>
91- </div>
92- </div>
93- <div class="twelve-col">
94- <form class="form form--inline">
95- <div class="form__group">
96- <label for="" class="u-margin--right-small">Compiled DHCP configuration for</label>
97- <select name="rack" id="rack">
98- <option value="">rack-controller-1</option>
99- <option value="">rack-controller-2</option>
100- <option value="" selected="selected">rack-controller-3</option>
101- </select>
102- </div>
103- <div class="form__group">
104- <label for="" class="u-margin--right-small">For</label>
105- <select name="dhcp" id="dhcp">
106- <option value="" selected="selected">DHCP v4</option>
107- <option value="">DHCP v4</option>
108- <option value="">DHCP v4</option>
109- </select>
110- </div>
111- </form>
112- </div>
113- <div class="twelve-col">
114- <pre>
115- <code data-maas-code-lines="getConfigurationData()"></code>
116- </pre>
117- </div>
118- </div>
119- </div>
120- -->
121 </section>
122 </div>
123 <div data-ng-show="!loading && currentpage === 'repositories'" window-width>

Subscribers

People subscribed via source and target branches