Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tp interface servers #4747

Merged
merged 34 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1c62200
Removed old getServer (by ID) function
ocket8888 May 27, 2020
f8e5bc5
Added utility function to extract legacy network info from interfaces
ocket8888 May 27, 2020
503db26
Reworked cachegroup servers table to extract legacy network info from…
ocket8888 May 27, 2020
f44e2c6
webpack can't handle es2015.....................
ocket8888 May 27, 2020
128d56b
Roll back ECMAScript feature that browserify can't handle
ocket8888 May 27, 2020
aa466f6
Fixed cachegroup servers table
ocket8888 May 27, 2020
378a6c1
Fixed CDN servers table and added proper ssh linking
ocket8888 May 27, 2020
5d8c558
Fixed broken injection
ocket8888 May 27, 2020
eea67c2
Added early bail-out for converting servers with no interfaces
ocket8888 May 27, 2020
f438ebd
Fixed data-search attributes broken, fixed deliveryservice servers table
ocket8888 May 27, 2020
c804d55
Fixed physical location servers tables for interfaces
ocket8888 May 28, 2020
88c6bbc
Fixed Profile servers tables for interface servers
ocket8888 May 28, 2020
5515fab
Fixed status servers tables for interface servers
ocket8888 May 28, 2020
b3395af
Fixed types servers tables for interface servers
ocket8888 May 28, 2020
aa6295c
Stripped bootstrap out of server form
ocket8888 May 29, 2020
05a9e36
Finished adding validations to interfaces fields
ocket8888 Jun 1, 2020
9dabd60
Replaced button symbols with words
ocket8888 Jun 15, 2020
59365ff
Moved interfaces to bottom of servers form
ocket8888 Jun 15, 2020
9a68178
Removed duplicated map
ocket8888 Jun 15, 2020
29c5931
Removed more duplicated maps
ocket8888 Jun 15, 2020
6f9c928
Fixed Offline Reason field
ocket8888 Jun 15, 2020
37bfa91
Removed unused injections
ocket8888 Jun 15, 2020
6bd9c2b
Fixed servers table not displaying legacy interface data properly
ocket8888 Jun 17, 2020
c75fb58
Moved add/remove interface/ip buttons
ocket8888 Jun 22, 2020
f7423a8
Added placeholders
ocket8888 Jun 22, 2020
d9cdb77
Fixed error creating new server
ocket8888 Jun 22, 2020
2ad1c57
moves actions into the caller for more control and scrolls to the top…
mitchell852 Jun 23, 2020
041733f
Switched to smaller buttons; made interface placeholder more clear
ocket8888 Jun 23, 2020
78dcf5a
fixes server that is now an array of servers
mitchell852 Jun 24, 2020
801417e
Fixed setting max-bandwidth not dirtying the form
ocket8888 Jun 25, 2020
ec83b40
fixes server config files table
mitchell852 Jun 26, 2020
feca5cb
Fixed broken update server status
ocket8888 Jun 29, 2020
7472e24
Merge branch 'tp-interface-servers' of github.com:ocket8888/trafficco…
ocket8888 Jun 29, 2020
321b48d
fixes TP server tests to work with new server form
mitchell852 Jun 30, 2020
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
16 changes: 0 additions & 16 deletions traffic_portal/app/src/common/api/ServerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,12 @@ var ServerService = function($http, locationUtils, messageModel, ENV) {
)
};

this.getServer = function(id) {
return $http.get(ENV.api['root'] + 'servers', {params: {id: id}}).then(
function (result) {
return result.data.response[0];
},
function (err) {
throw err;
}
)
};

this.createServer = function(server) {
return $http.post(ENV.api['root'] + 'servers', server).then(
function(result) {
messageModel.setMessages([ { level: 'success', text: 'Server created' } ], true);
locationUtils.navigateToPath('/servers');
return result;
},
function(err) {
messageModel.setMessages(err.data.alerts, false);
throw err;
}
);
Expand All @@ -59,11 +45,9 @@ var ServerService = function($http, locationUtils, messageModel, ENV) {
this.updateServer = function(server) {
return $http.put(ENV.api['root'] + 'servers/' + server.id, server).then(
function(result) {
messageModel.setMessages([ { level: 'success', text: 'Server updated' } ], false);
return result;
},
function(err) {
messageModel.setMessages(err.data.alerts, false);
throw err;
}
);
Expand Down
58 changes: 58 additions & 0 deletions traffic_portal/app/src/common/modules/form/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,63 @@
}
}

/* Shim for forms without bootstrap */
.has-error {
color: #a94442;

input, select, textarea {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
}

.bordered-item {
border-bottom: 1px solid gray;
padding-bottom: 5px;
margin-bottom: 5px;
}

button.right-button {
float: right;
}

.form-control-columns {
display: grid;
grid-template-columns: 16.66666667% auto;
grid-row-gap: 15px;

label {
text-align: right;
padding-right: 2em;
line-height: 2.4;
}

fieldset {
grid-column: 2;

div, li {
display: grid;
grid-template-columns: auto 1fr;
}

div {
grid-column-gap: 20px;
}

li {
grid-column-gap: 10px;
}

small.input-error {
grid-column: 2;
}

input[type="checkbox"] {
align-self: center;
justify-self: start;
}
}
}

.btn-link.request-status {
font-size: 20px;
color: #cd1323;
Expand Down Expand Up @@ -79,6 +136,7 @@ form label.has-tooltip {
width: max-content;
max-width: inherit;
cursor: auto;
line-height: 1.428;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

var FormServerController = function(server, $scope, $location, $state, $uibModal, formUtils, locationUtils, serverUtils, serverService, cacheGroupService, cdnService, physLocationService, profileService, typeService, messageModel, propertiesModel) {

$scope.IPPattern = serverUtils.IPPattern;
$scope.IPWithCIDRPattern = serverUtils.IPWithCIDRPattern;
$scope.IPv4Pattern = serverUtils.IPv4Pattern;

var getPhysLocations = function() {
physLocationService.getPhysLocations()
.then(function(result) {
Expand Down Expand Up @@ -73,11 +77,6 @@ var FormServerController = function(server, $scope, $location, $state, $uibModal
$state.reload(); // reloads all the resolves for the view
};

// supposedly matches IPv4 and IPv6 formats. but actually need one that matches each. todo.
$scope.validations = {
ipRegex: new RegExp(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-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25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/)
};

$scope.server = server;

$scope.falseTrue = [
Expand All @@ -95,6 +94,47 @@ var FormServerController = function(server, $scope, $location, $state, $uibModal

$scope.showChartsButton = propertiesModel.properties.servers.charts.show;

$scope.addIP = function(interface) {
$scope.serverForm.$setDirty();
const newIP = {
address: "",
gateway: null,
serviceAddress: false
};

if (!interface.ipAddresses) {
interface.ipAddresses = [newIP];
} else {
interface.ipAddresses.push(newIP);
}
}

$scope.deleteIP = function(interface, ip) {
$scope.serverForm.$setDirty();
interface.ipAddresses.splice(interface.ipAddresses.indexOf(ip), 1);
}

$scope.addInterface = function() {
$scope.serverForm.$setDirty();
const newInf = {
mtu: 1500,
maxBandwidth: null,
monitor: false,
ipAddresses: []
};

if (!$scope.server.interfaces) {
$scope.server.interfaces = [newInf];
} else {
$scope.server.interfaces.push(newInf);
}
}

$scope.deleteInterface = function(interface) {
$scope.serverForm.$setDirty();
$scope.server.interfaces.splice($scope.server.interfaces.indexOf(interface, 1));
}

$scope.onCDNChange = function() {
$scope.server.profileId = null; // the cdn of the server changed, so we need to blank out the selected server profile (if any)
getProfiles($scope.server.cdnId); // and get a new list of profiles (for the selected cdn)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* under the License.
*/

var FormEditServerController = function(server, $scope, $controller, $uibModal, locationUtils, serverService, statusService, messageModel) {
var FormEditServerController = function(server, $anchorScroll, $scope, $controller, $uibModal, locationUtils, serverService, statusService, messageModel) {

// extends the FormServerController to inherit common methods
angular.extend(this, $controller('FormServerController', { server: server, $scope: $scope }));
angular.extend(this, $controller('FormServerController', { server: server[0], $scope: $scope }));

var getStatuses = function() {
statusService.getStatuses()
Expand All @@ -37,7 +37,7 @@ var FormEditServerController = function(server, $scope, $controller, $uibModal,
});
};

$scope.serverName = angular.copy(server.hostName);
$scope.serverName = server[0].hostName;

$scope.settings = {
isNew: false,
Expand All @@ -46,9 +46,20 @@ var FormEditServerController = function(server, $scope, $controller, $uibModal,

$scope.save = function(server) {
serverService.updateServer(server).
then(function() {
$scope.refresh();
});
then(
function(result) {
$scope.refresh();
messageModel.setMessages(result.data.alerts, false);
},
function(fault) {
messageModel.setMessages(fault.data.alerts, false);
}
)
.finally(
function() {
$anchorScroll(); // scrolls window to top for message
}
);
};

$scope.confirmDelete = function(server) {
Expand Down Expand Up @@ -80,5 +91,5 @@ var FormEditServerController = function(server, $scope, $controller, $uibModal,

};

FormEditServerController.$inject = ['server', '$scope', '$controller', '$uibModal', 'locationUtils', 'serverService', 'statusService', 'messageModel'];
FormEditServerController.$inject = ['server', '$anchorScroll', '$scope', '$controller', '$uibModal', 'locationUtils', 'serverService', 'statusService', 'messageModel'];
module.exports = FormEditServerController;
Loading