Skip to content

Commit

Permalink
Ditto Explorer UI - Environment selection fixed
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Fries <thomas.fries0@gmail.com>
  • Loading branch information
thfries committed Jul 4, 2022
1 parent f63c6b9 commit fe9dc0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/modules/environments/authorization.js
Expand Up @@ -53,6 +53,6 @@ function onEnvironmentChanged() {
':';
dom.devOpsUserName.value = usernamePassword.split(':')[0];
dom.devOpsPassword.value = usernamePassword.split(':')[1];
dom.bearer.value = Environments.current().bearer;
dom.bearer.value = Environments.current().bearer ? Environments.current().bearer : '';
API.setAuthHeader();
};
7 changes: 5 additions & 2 deletions ui/modules/environments/environments.js
Expand Up @@ -127,8 +127,9 @@ export function environmentsJsonChanged() {
}

function updateEnvSelector() {
if (!dom.environmentSelector.value || !environments[dom.environmentSelector.value]) {
dom.environmentSelector.value = environments[0];
let activeEnvironment = dom.environmentSelector.value;
if (!activeEnvironment || !environments[activeEnvironment]) {
activeEnvironment = Object.keys(environments)[0];
};

dom.environmentSelector.innerHTML = '';
Expand All @@ -138,6 +139,8 @@ function updateEnvSelector() {
option.text = key;
dom.environmentSelector.add(option);
});

dom.environmentSelector.value = activeEnvironment;
}

function updateEnvEditors() {
Expand Down

0 comments on commit fe9dc0e

Please sign in to comment.