Skip to content
Closed
Changes from all commits
Commits
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
110 changes: 94 additions & 16 deletions plugins/core/webview/src/q-ui/components/ssoLoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,27 @@
<div>
<div class="title no-bold">Region</div>
<div class="hint">AWS Region that hosts identity directory</div>
<select
class="region-select font-amazon"
id="regions"
name="regions"
v-model="selectedRegion"
@change="handleRegionInput"
tabindex="0"
>
<option v-for="region in regions" :key="region.id" :value="region.id">
{{ `${region.name} (${region.id})` }}
</option>
</select>
<div class="region-select" :class="{ 'is-open': isOpen }">
<div class="select-trigger"
@click="toggleDropdown"
tabindex="0"
@keydown.space.prevent="toggleDropdown"
@keydown.enter.prevent="toggleDropdown">
<template v-for="region in regions" :key="region.id">
<span v-if="region.id === selectedRegion">{{ region.name }} ({{ region.id }})</span>
</template>
<span v-if="!selectedRegion">Select a Region</span>
</div>
<div class="options-container" v-if="isOpen">
<div class="option"
v-for="region in regions"
:key="region.id"
@click="selectRegion({regionId : region.id})"
:class="{ 'selected': region.id === selectedRegion }">
{{ `${region.name} (${region.id})` }}
</div>
</div>
</div>
</div>
<br/><br/>
<button
Expand All @@ -70,7 +79,8 @@ export default defineComponent({
data() {
return {
startUrlRegex: /^https:\/\/(([\w-]+(?:\.gamma)?\.awsapps\.com\/start(?:-beta|-alpha)?[\/#]?)|(start\.(?:us-gov-home|us-gov-east-1\.us-gov-home|us-gov-west-1\.us-gov-home)\.awsapps\.com|start\.(?:home|cn-north-1\.home|cn-northwest-1\.home)\.awsapps\.cn)\/directory\/[\w-]+[\/#]?)$/,
issueUrlRegex: /^https:\/\/([\w-]+\.)?identitycenter\.(amazonaws\.com|amazonaws\.com\.cn|us-gov\.amazonaws\.com)\/[\w\/-]+[\/#]?$/
issueUrlRegex: /^https:\/\/([\w-]+\.)?identitycenter\.(amazonaws\.com|amazonaws\.com\.cn|us-gov\.amazonaws\.com)\/[\w\/-]+[\/#]?$/,
isOpen: false,
}
},
computed: {
Expand Down Expand Up @@ -128,6 +138,14 @@ export default defineComponent({
handleRegionInput() {
this.isRegionValid = this.selectedRegion != "";
},
toggleDropdown() {
this.isOpen = !this.isOpen;
},
selectRegion({regionId}: { regionId: any }){
this.selectedRegion = regionId;
this.isOpen = false;
this.handleRegionInput();
},
async handleContinueClick() {
if (!this.isInputValid) {
return
Expand All @@ -151,6 +169,57 @@ export default defineComponent({
</script>

<style scoped lang="scss">
.region-select {
position: relative;
width: 100%;
}

.select-trigger {
padding: 10px;
padding-right: 20px;
cursor: pointer;
position: relative;
}

.select-trigger::after {
content: '';
position: absolute;
right: 10px;
top: 50%;
transform: translateY(-50%);
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid currentColor;
}

.select-trigger-content {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.is-open .select-trigger::after {
transform: translateY(-50%) rotate(180deg);
}


.options-container {
position: absolute;
top: 100%;
left: 0;
right: 0;
max-height: 200px;
overflow-y: auto;
z-index: 1000;
}

.option {
padding: 10px;
cursor: pointer;
}

.hint {
color: #909090;
margin-bottom: 5px;
Expand All @@ -165,17 +234,26 @@ export default defineComponent({

/* Theme specific styles */
body.jb-dark {
.url-input, .region-select, .sso-profile {
.url-input, .region-select, .sso-profile, .select-trigger, .options-container {
background-color: #252526;
color: white;
border: none;
border: 1px solid #3c3c3c;
}

.option:hover, .option.selected {
background-color: #3c3c3c;
}
}

body.jb-light {
.url-input, .region-select, .sso-profile {
.url-input, .region-select, .sso-profile, .select-trigger, .options-container {
background-color: white;
color: black;
border: 1px solid #c9ccd6;
}

.option:hover, .option.selected {
background-color: #f0f0f0;
}
}
</style>
Loading