Skip to content

Commit

Permalink
Explorer-UI connections:
Browse files Browse the repository at this point in the history
Small fixes for devops api and setting correct
auth header
  • Loading branch information
thfries committed Jul 12, 2022
1 parent 2b9cd92 commit b0c5197
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ui/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ document.addEventListener('DOMContentLoaded', async function() {
e.addEventListener('click', (event) => {
mainNavbar.querySelectorAll('.nav-link,.active').forEach((n) => n.classList.remove('active'));
event.currentTarget.classList.add('active');
API.setAuthHeader(dom.collapseConnections.classList.contains('show'));
API.setAuthHeader(event.currentTarget.parentNode.id === 'tabConnections');
});
});

Expand Down
21 changes: 16 additions & 5 deletions ui/modules/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ const config = {
createConnection: {
path: '/api/2/solutions/{{solutionId}}/connections',
method: 'POST',
body: '{{param}}',
body: null,
unwrapJsonPath: null,
},
modifyConnection: {
path: '/api/2/solutions/{{solutionId}}/connections/{{connectionId}}',
method: 'PUT',
body: '{{param}}',
body: null,
unwrapJsonPath: null,
},
deleteConnection: {
Expand Down Expand Up @@ -181,8 +181,18 @@ const config = {
retrieveConnectionMetrics: {
path: '/devops/piggyback/connectivity',
method: 'POST',
body: null,
unwrapJsonPath: null,
body: {
'targetActorSelection': '/system/sharding/connection',
'headers': {
'aggregate': false,
'is-group-topic': true,
},
'piggybackCommand': {
'type': 'connectivity.commands:retrieveConnectionMetrics',
'connectionId': '{{connectionId}}',
},
},
unwrapJsonPath: '?.?',
},
connectionCommand: {
path: '/devops/piggyback/connectivity',
Expand Down Expand Up @@ -284,7 +294,8 @@ export async function callConnectionsAPI(operation, successCallback, connectionI
},
body: params.body ?
JSON.stringify(params.body)
.replace('{{connectionId}}', connectionId) :
.replace('{{connectionId}}', connectionId)
.replace('{{param}}', param) :
param,
});
if (!response.ok) {
Expand Down
2 changes: 1 addition & 1 deletion ui/modules/connections/connections.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h5 data-bs-toggle="collapse" data-bs-target="#connectionsEdit">
<i class="bi bi-trash3"></i>
</button>
</div>
<div class="table-wrap">
<div class="table-wrap mb-3">
<table class="table table-striped table-hover table-sm">
<thead>
<tr>
Expand Down
3 changes: 2 additions & 1 deletion ui/modules/environments/authorization.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ let dom = {
password: null,
devOpsUserName: null,
devOpsPassword: null,
collapseConnections: null,
};

export function ready() {
Expand Down Expand Up @@ -54,5 +55,5 @@ function onEnvironmentChanged() {
dom.devOpsUserName.value = usernamePassword.split(':')[0];
dom.devOpsPassword.value = usernamePassword.split(':')[1];
dom.bearer.value = Environments.current().bearer ? Environments.current().bearer : '';
API.setAuthHeader();
API.setAuthHeader(dom.collapseConnections.classList.contains('show'));
};
2 changes: 1 addition & 1 deletion ui/modules/environments/environments.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h5>Environments</h5>
<a class="nav-link" data-bs-toggle="tab" data-bs-target="#tabEnvJson">Full JSON</a>
</li>
</ul>
<div class="tab-content" style="flex-grow: 1;">
<div class="tab-content" style="flex-grow: 1; overflow: hidden;">
<div class="tab-pane container active no-margin" id="tabEnvDetails">
<div class="input-group input-group-sm mt-1">
<label class="input-group-text" data-bs-toggle="tooltip"
Expand Down
2 changes: 0 additions & 2 deletions ui/modules/environments/environments.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ let dom = {
inputEnvironmentName: null,
inputApiUri: null,
tbodyEnvironments: null,
collapseConnections: null,
};

let observers = [];
Expand Down Expand Up @@ -107,7 +106,6 @@ export function ready() {
});

document.getElementById('environmentSelector').onchange = () => {
API.setAuthHeader(dom.collapseConnections.classList.contains('show'));
notifyAll();
};

Expand Down

0 comments on commit b0c5197

Please sign in to comment.