Skip to content

Commit

Permalink
Fix sending empty DNS server IPs or empty search domain to the server
Browse files Browse the repository at this point in the history
fix wrong var name

Handle server exceptions on update_dns_servers

Fix layout, scroll and spacing issues with allowed IPs list
  • Loading branch information
nb-ohad committed Jun 29, 2017
1 parent 175a630 commit 23ae6fb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
22 changes: 11 additions & 11 deletions frontend/src/app/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import api from 'services/api';
import config from 'config';
import * as routes from 'routes';
import JSZip from 'jszip';
import { isDefined, last, makeArray, deepFreeze, flatMap, groupBy } from 'utils/core-utils';
import { last, makeArray, deepFreeze, flatMap, groupBy } from 'utils/core-utils';
import { aggregateStorage } from 'utils/storage-utils';
import { all, sleep, execInOrder } from 'utils/promise-utils';
import { getModeFilterFromState } from 'utils/ui-utils';
import { realizeUri, downloadFile, httpRequest, httpWaitForResponse,
toFormData } from 'utils/browser-utils';
import { realizeUri, downloadFile, httpRequest, httpWaitForResponse, toFormData } from 'utils/browser-utils';
import { Buffer } from 'buffer';

// Action dispathers from refactored code.
Expand All @@ -20,7 +19,8 @@ import {
restoreSession,
fetchSystemInfo,
signOut,
showNotification
showNotification,
closeModal
} from 'action-creators';

// Use preconfigured hostname or the addrcess of the serving computer.
Expand Down Expand Up @@ -1512,16 +1512,16 @@ export function updateServerDNSSettings(serverSecret, primaryDNS, secondaryDNS,

api.cluster_server.update_dns_servers({
target_secret: serverSecret,
dns_servers: [primaryDNS, secondaryDNS].filter(isDefined),
dns_servers: [primaryDNS, secondaryDNS].filter(Boolean),
search_domains: searchDomains
})
.then(
() => sleep(config.serverRestartWaitInterval)
)
.then(
() => httpWaitForResponse('/version', 200)
)
.then(() => sleep(config.serverRestartWaitInterval))
.then(() => httpWaitForResponse('/version', 200))
.then(reload)
.catch(() => {
dispatch(closeModal());
notify('Updating server DNS setting failed, Please try again later', 'error');
})
.done();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h2 class="heading3 greedy push-next">
</button>
</div>

<property-sheet class="s3-access-details pad greedy push-next " params="properties: s3AccessInfo">
<property-sheet class="s3-access-details pad push-next " params="properties: s3AccessInfo">
</property-sheet>

<div class="row alt-bg pad content-middle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { openEditAccountS3AccessModal, openSetAccountIpRestrictions } from 'acti
const disabledActionTooltip = 'This option is unavailable for accounts without S3 access';

function _createIpListHtml(ipList) {
return `<ul class="list-no-style row multiline">${
return `<ul class="allowed-ips list-no-style row multiline">${
ipList
.map(ip => `<li class="ip-box">${ip}</li>`)
.join('')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
account-s3-access-form {
.column();

.s3-access-details {
overflow: scroll;
.s3-access-details .prop-name {
.align-start();
width: 250px;
}

.prop-name {
.align-start();
width: 250px;
}
.allowed-ips {
max-height: 176px;
overflow: scroll;

.ip-box {
font-size: @font-size1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ class EditServerDNSSettingsModalViewModel extends BaseViewModel {
this.errors.showAllMessages();

} else {
const sdomains = (this.searchDomains() ? this.searchDomains().split(',') : []).map(d => d.trim());
updateServerDNSSettings(this.serverSecret, this.primaryDNS(), this.secondaryDNS(), sdomains);
const searchDomains = (this.searchDomains() || '')
.split(',')
.map(domain => domain.trim())
.filter(Boolean);

updateServerDNSSettings(this.serverSecret, this.primaryDNS(), this.secondaryDNS(), searchDomains);

dispatch(lockModal());
this.updating(true);
Expand Down

0 comments on commit 23ae6fb

Please sign in to comment.