2023-05-14 12:43:49 +00:00
|
|
|
<div x-data="magicsearchbar" @slash.window="mainMenu = true">
|
2023-05-11 13:20:02 +00:00
|
|
|
{{-- Main --}}
|
2023-05-12 09:38:23 +00:00
|
|
|
<template x-cloak x-if="isMainMenu">
|
2023-05-12 08:45:28 +00:00
|
|
|
<div>
|
2023-05-12 10:22:41 +00:00
|
|
|
<div class="main-menu">
|
|
|
|
<input class="magic-input" x-ref="search" x-model="search" x-on:click="checkMainMenu"
|
|
|
|
x-on:click.outside="closeMenus" placeholder="Search, jump or create... magically... 🪄"
|
|
|
|
x-on:keyup.escape="clearSearch" x-on:keydown.down="focusNext(items.length)"
|
|
|
|
x-on:keydown.up="focusPrev(items.length)"
|
2023-05-12 09:38:23 +00:00
|
|
|
x-on:keyup.enter="focusedIndex !== '' && await set(filteredItems()[focusedIndex]?.next ?? 'server',filteredItems()[focusedIndex]?.name)" />
|
2023-05-12 09:17:56 +00:00
|
|
|
</div>
|
2023-05-12 10:22:41 +00:00
|
|
|
<div x-show="mainMenu" class="magic-items">
|
2023-05-12 08:45:28 +00:00
|
|
|
<template x-for="(item,index) in filteredItems" :key="item.name">
|
2023-05-12 09:38:23 +00:00
|
|
|
<div x-on:click="await set(item.next ?? 'server',item.name)"
|
2023-05-12 10:22:41 +00:00
|
|
|
:class="focusedIndex === index && 'magic-item-focused'" class="magic-item">
|
2023-05-15 12:54:03 +00:00
|
|
|
<span class="px-2 mr-1 text-xs text-white bg-green-600 rounded" x-show="item.type === 'App'"
|
|
|
|
x-text="item.type"></span>
|
|
|
|
<span class="px-2 mr-1 text-xs text-white bg-indigo-600 rounded" x-show="item.type === 'Add'"
|
2023-05-12 08:45:28 +00:00
|
|
|
x-text="item.type"></span>
|
2023-05-12 13:39:07 +00:00
|
|
|
<span class="px-2 mr-1 text-xs text-white bg-purple-600 rounded" x-show="item.type === 'Jump'"
|
2023-05-12 08:45:28 +00:00
|
|
|
x-text="item.type"></span>
|
2023-05-12 13:39:07 +00:00
|
|
|
<span class="px-2 mr-1 text-xs text-white bg-blue-600 rounded" x-show="item.type === 'New'"
|
2023-05-12 09:59:02 +00:00
|
|
|
x-text="item.type"></span>
|
2023-05-12 08:45:28 +00:00
|
|
|
<span x-text="item.name"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-10 17:26:28 +00:00
|
|
|
</div>
|
2023-05-12 08:45:28 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-11 13:20:02 +00:00
|
|
|
{{-- Servers --}}
|
2023-05-12 08:45:28 +00:00
|
|
|
<template x-cloak x-if="serverMenu">
|
|
|
|
<div x-on:click.outside="closeMenus">
|
2023-05-12 11:10:09 +00:00
|
|
|
<input class="magic-input" x-ref="search" x-model="search" placeholder="Select a server..."
|
2023-05-12 10:22:41 +00:00
|
|
|
x-on:keydown.down="focusNext(servers.length)" x-on:keydown.up="focusPrev(servers.length)"
|
2023-05-12 09:38:23 +00:00
|
|
|
x-on:keyup.enter="focusedIndex !== '' && await set('destination',filteredServers()[focusedIndex].uuid)" />
|
2023-05-12 11:10:09 +00:00
|
|
|
<div class="magic-items">
|
2023-05-12 13:39:07 +00:00
|
|
|
<template x-if="servers.length === 0">
|
|
|
|
<div class="magic-item" x-on:click="set('newServer')">
|
|
|
|
<span>No server found. Click here to add a new one!</span>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-12 08:45:28 +00:00
|
|
|
<template x-for="(server,index) in filteredServers" :key="server.name ?? server">
|
|
|
|
<div x-on:click="await set('destination',server.uuid)"
|
2023-05-12 11:10:09 +00:00
|
|
|
:class="focusedIndex === index && 'magic-item-focused'" class="magic-item">
|
2023-05-12 13:39:07 +00:00
|
|
|
<span class="px-2 mr-1 text-xs text-white bg-purple-600 rounded">Server</span>
|
2023-05-12 08:45:28 +00:00
|
|
|
<span x-text="server.name"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
2023-05-11 13:20:02 +00:00
|
|
|
</div>
|
2023-05-12 08:45:28 +00:00
|
|
|
</template>
|
2023-05-11 13:20:02 +00:00
|
|
|
{{-- Destinations --}}
|
2023-05-16 12:18:09 +00:00
|
|
|
<template x-cloak x-if="destinationMenu"">
|
2023-05-12 08:45:28 +00:00
|
|
|
<div x-on:click.outside="closeMenus">
|
2023-05-12 11:10:09 +00:00
|
|
|
<input class="magic-input" x-ref="search" x-model="search" placeholder="Select a destination..."
|
|
|
|
x-on:keydown.down="focusNext(destinations.length)" x-on:keydown.up="focusPrev(destinations.length)"
|
2023-05-12 13:39:07 +00:00
|
|
|
x-on:keyup.escape="closeMenus"
|
2023-05-12 09:38:23 +00:00
|
|
|
x-on:keyup.enter="focusedIndex !== '' && await set('project',filteredDestinations()[focusedIndex].uuid)" />
|
2023-05-12 11:10:09 +00:00
|
|
|
<div class="magic-items">
|
|
|
|
<template x-if="destinations.length === 0">
|
|
|
|
<div class="magic-item" x-on:click="set('newDestination')">
|
|
|
|
<span>No destination found. Click here to add a new one!</span>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-12 08:45:28 +00:00
|
|
|
<template x-for="(destination,index) in filteredDestinations" :key="destination.name ?? destination">
|
|
|
|
<div x-on:click="await set('project',destination.uuid)"
|
2023-05-12 11:10:09 +00:00
|
|
|
:class="focusedIndex === index && 'magic-item-focused'" class="magic-item">
|
2023-05-12 13:39:07 +00:00
|
|
|
<span class="px-2 mr-1 text-xs text-white bg-purple-700 rounded">Destination</span>
|
2023-05-12 08:45:28 +00:00
|
|
|
<span x-text="destination.name"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
2023-05-11 13:20:02 +00:00
|
|
|
</div>
|
2023-05-12 08:45:28 +00:00
|
|
|
</template>
|
2023-05-12 13:39:07 +00:00
|
|
|
{{-- Project --}}
|
2023-05-12 08:45:28 +00:00
|
|
|
<template x-cloak x-if="projectMenu">
|
|
|
|
<div x-on:click.outside="closeMenus">
|
2023-05-12 11:10:09 +00:00
|
|
|
<input class="magic-input" x-ref="search" x-model="search" placeholder="Type your project name..."
|
|
|
|
x-on:keydown.down="focusNext(projects.length + 1)" x-on:keydown.up="focusPrev(projects.length + 1)"
|
2023-05-12 13:39:07 +00:00
|
|
|
x-on:keyup.escape="closeMenus"
|
2023-05-12 09:38:23 +00:00
|
|
|
x-on:keyup.enter="focusedIndex !== '' && await set('environment',filteredProjects()[focusedIndex - 1]?.uuid)" />
|
2023-05-12 11:10:09 +00:00
|
|
|
<div class="magic-items">
|
|
|
|
<div x-on:click="await newProject" class="magic-item"
|
|
|
|
:class="focusedIndex === 0 && 'magic-item-focused'">
|
2023-05-12 08:45:28 +00:00
|
|
|
<span>New Project</span>
|
|
|
|
<span x-text="search"></span>
|
2023-05-11 13:20:02 +00:00
|
|
|
</div>
|
2023-05-12 08:45:28 +00:00
|
|
|
<template x-for="(project,index) in filteredProjects" :key="project.name ?? project">
|
|
|
|
<div x-on:click="await set('environment',project.uuid)"
|
2023-05-12 11:10:09 +00:00
|
|
|
:class="focusedIndex === index + 1 && 'magic-item-focused'" class="magic-item">
|
2023-05-12 13:39:07 +00:00
|
|
|
<span class="px-2 mr-1 text-xs text-white bg-purple-700 rounded">Project</span>
|
2023-05-12 08:45:28 +00:00
|
|
|
<span x-text="project.name"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
2023-05-11 13:20:02 +00:00
|
|
|
</div>
|
2023-05-12 08:45:28 +00:00
|
|
|
</template>
|
2023-05-11 13:20:02 +00:00
|
|
|
{{-- Environments --}}
|
2023-05-12 08:45:28 +00:00
|
|
|
<template x-cloak x-if="environmentMenu">
|
|
|
|
<div x-on:click.outside="closeMenus">
|
2023-05-12 11:10:09 +00:00
|
|
|
<input class="magic-input" x-ref="search" x-model="search" placeholder="Select a environment..."
|
|
|
|
x-on:keydown.down="focusNext(environments.length + 1)"
|
2023-05-12 13:39:07 +00:00
|
|
|
x-on:keydown.up="focusPrev(environments.length + 1)" x-on:keyup.escape="closeMenus"
|
2023-05-12 09:38:23 +00:00
|
|
|
x-on:keyup.enter="focusedIndex !== '' && await set('jump',filteredEnvironments()[focusedIndex - 1]?.name)" />
|
2023-05-12 10:22:41 +00:00
|
|
|
<div class="magic-items">
|
2023-05-16 12:18:09 +00:00
|
|
|
<div x-on:click="await newEnvironment" :class="focusedIndex === 0 && 'magic-item-focused'"
|
|
|
|
class="magic-item">
|
2023-05-12 08:45:28 +00:00
|
|
|
<span>New Environment</span>
|
|
|
|
<span x-text="search"></span>
|
2023-05-11 13:20:02 +00:00
|
|
|
</div>
|
2023-05-12 08:45:28 +00:00
|
|
|
<template x-for="(environment,index) in filteredEnvironments" :key="environment.name ?? environment">
|
|
|
|
<div x-on:click="await set('jump',environment.name)"
|
2023-05-12 11:10:09 +00:00
|
|
|
:class="focusedIndex === index + 1 && 'magic-item-focused'" class="magic-item">
|
2023-05-12 13:39:07 +00:00
|
|
|
<span class="px-2 mr-1 text-xs text-white bg-purple-700 rounded">Env</span>
|
2023-05-12 08:45:28 +00:00
|
|
|
<span x-text="environment.name"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
2023-05-11 13:20:02 +00:00
|
|
|
</div>
|
2023-05-12 08:45:28 +00:00
|
|
|
</template>
|
2023-05-12 09:38:23 +00:00
|
|
|
{{-- Projects --}}
|
|
|
|
<template x-cloak x-if="projectsMenu">
|
|
|
|
<div x-on:click.outside="closeMenus">
|
2023-05-12 11:10:09 +00:00
|
|
|
<input x-ref="search" x-model="search" class="magic-input" placeholder="Select a project..."
|
2023-05-12 13:39:07 +00:00
|
|
|
x-on:keyup.escape="closeMenus" x-on:keydown.down="focusNext(projects.length)"
|
|
|
|
x-on:keydown.up="focusPrev(projects.length)"
|
|
|
|
x-on:keyup.enter="focusedIndex !== '' && await set('jumpToProject',filteredProjects()[focusedIndex]?.uuid)" />
|
2023-05-12 11:10:09 +00:00
|
|
|
<div class="magic-items">
|
2023-05-12 13:39:07 +00:00
|
|
|
<template x-if="projects.length === 0">
|
|
|
|
<div class="magic-item hover:bg-neutral-800">
|
|
|
|
<span>No projects found.</span>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-12 09:38:23 +00:00
|
|
|
<template x-for="(project,index) in filteredProjects" :key="project.name ?? project">
|
|
|
|
<div x-on:click="await set('jumpToProject',project.uuid)"
|
2023-05-16 12:18:09 +00:00
|
|
|
:class="focusedIndex === index && 'magic-item-focused'" class="magic-item">
|
2023-05-12 13:39:07 +00:00
|
|
|
<span class="px-2 mr-1 text-xs text-white bg-purple-700 rounded">Jump</span>
|
2023-05-12 09:38:23 +00:00
|
|
|
<span x-text="project.name"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-12 09:59:02 +00:00
|
|
|
{{-- Destinations --}}
|
|
|
|
<template x-cloak x-if="destinationsMenu">
|
|
|
|
<div x-on:click.outside="closeMenus">
|
2023-05-12 13:39:07 +00:00
|
|
|
<input x-ref="search" x-model="search" class="magic-input" placeholder="Select a destination..."
|
|
|
|
x-on:keyup.escape="closeMenus" x-on:keydown.down="focusNext(destinations.length)"
|
|
|
|
x-on:keydown.up="focusPrev(destinations.length)"
|
2023-05-12 09:59:02 +00:00
|
|
|
x-on:keyup.enter="focusedIndex !== '' && await set('jumpToDestination',filteredDestinations()[focusedIndex].uuid)" />
|
2023-05-12 11:10:09 +00:00
|
|
|
<div class="magic-items">
|
2023-05-12 13:39:07 +00:00
|
|
|
<template x-if="destinations.length === 0">
|
|
|
|
<div class="magic-item" x-on:click="set('newDestination')">
|
|
|
|
<span>No destination found. Click here to add a new one!</span>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-12 09:59:02 +00:00
|
|
|
<template x-for="(destination,index) in filteredDestinations" :key="destination.name ?? destination">
|
|
|
|
<div x-on:click="await set('jumpToDestination',destination.uuid)"
|
2023-05-16 12:18:09 +00:00
|
|
|
:class="focusedIndex === index && 'magic-item-focused'" class="magic-item">
|
2023-05-12 09:59:02 +00:00
|
|
|
<span class="px-2 mr-1 text-xs bg-purple-700 rounded">Jump</span>
|
|
|
|
<span x-text="destination.name"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-16 08:03:34 +00:00
|
|
|
{{-- Private Keys --}}
|
|
|
|
<template x-cloak x-if="privateKeysMenu">
|
|
|
|
<div x-on:click.outside="closeMenus">
|
|
|
|
<input x-ref="search" x-model="search" class="magic-input" placeholder="Select a private key..."
|
|
|
|
x-on:keyup.escape="closeMenus" x-on:keydown.down="focusNext(privateKeys.length)"
|
|
|
|
x-on:keydown.up="focusPrev(privateKeys.length)"
|
|
|
|
x-on:keyup.enter="focusedIndex !== '' && await set('jumpToPrivateKey',filteredPrivateKeys()[focusedIndex].uuid)" />
|
|
|
|
<div class="magic-items">
|
|
|
|
<template x-if="privateKeys.length === 0">
|
|
|
|
<div class="magic-item" x-on:click="set('newPrivateKey')">
|
|
|
|
<span>No private key found. Click here to add a new one!</span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template x-for="(privateKey,index) in filteredPrivateKeys" :key="privateKey.name ?? privateKey">
|
|
|
|
<div x-on:click="await set('jumpToPrivateKey',privateKey.uuid)"
|
2023-05-16 12:18:09 +00:00
|
|
|
:class="focusedIndex === index && 'magic-item-focused'" class="magic-item">
|
2023-05-16 08:03:34 +00:00
|
|
|
<span class="px-2 mr-1 text-xs bg-purple-700 rounded">Jump</span>
|
|
|
|
<span x-text="privateKey.name"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-16 10:17:39 +00:00
|
|
|
{{-- Sources --}}
|
|
|
|
<template x-cloak x-if="sourcesMenu">
|
|
|
|
<div x-on:click.outside="closeMenus">
|
|
|
|
<input x-ref="search" x-model="search" class="magic-input" placeholder="Select a source..."
|
|
|
|
x-on:keyup.escape="closeMenus" x-on:keydown.down="focusNext(sources.length)"
|
|
|
|
x-on:keydown.up="focusPrev(sources.length)"
|
|
|
|
x-on:keyup.enter="focusedIndex !== '' && await set('jumpToSource',filteredSources()[focusedIndex])" />
|
|
|
|
<div class="magic-items">
|
|
|
|
<template x-if="sources.length === 0">
|
|
|
|
<div class="magic-item" x-on:click="set('newSource')">
|
|
|
|
<span>No Source found. Click here to add a new one!</span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template x-for="(source,index) in filteredSources" :key="source.name ?? source">
|
|
|
|
<div x-on:click="await set('jumpToSource',source)"
|
2023-05-16 12:18:09 +00:00
|
|
|
:class="focusedIndex === index && 'magic-item-focused'" class="magic-item">
|
2023-05-16 10:17:39 +00:00
|
|
|
<span class="px-2 mr-1 text-xs bg-purple-700 rounded">Jump</span>
|
|
|
|
<span x-text="source.name"></span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-10 17:26:28 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
document.addEventListener('alpine:init', () => {
|
|
|
|
Alpine.data('magicsearchbar', () => ({
|
2023-05-12 09:38:23 +00:00
|
|
|
isMainMenu() {
|
|
|
|
return !this.serverMenu &&
|
|
|
|
!this.destinationMenu &&
|
|
|
|
!this.projectMenu &&
|
|
|
|
!this.environmentMenu &&
|
2023-05-12 09:59:02 +00:00
|
|
|
!this.projectsMenu &&
|
2023-05-16 08:03:34 +00:00
|
|
|
!this.destinationsMenu &&
|
2023-05-16 10:17:39 +00:00
|
|
|
!this.privateKeysMenu &&
|
|
|
|
!this.sourcesMenu
|
2023-05-12 09:38:23 +00:00
|
|
|
},
|
2023-05-12 08:45:28 +00:00
|
|
|
focus() {
|
|
|
|
if (this.$refs.search) this.$refs.search.focus()
|
|
|
|
},
|
2023-05-11 13:20:02 +00:00
|
|
|
init() {
|
2023-05-12 08:45:28 +00:00
|
|
|
this.$watch('search', () => {
|
|
|
|
this.focusedIndex = ""
|
|
|
|
})
|
|
|
|
this.$watch('mainMenu', () => {
|
|
|
|
this.focus()
|
2023-05-11 13:20:02 +00:00
|
|
|
})
|
2023-05-12 08:45:28 +00:00
|
|
|
this.$watch('serverMenu', () => {
|
|
|
|
this.focus()
|
2023-05-11 13:20:02 +00:00
|
|
|
})
|
2023-05-12 08:45:28 +00:00
|
|
|
this.$watch('destinationMenu', () => {
|
|
|
|
this.focus()
|
2023-05-11 13:20:02 +00:00
|
|
|
})
|
2023-05-12 08:45:28 +00:00
|
|
|
this.$watch('projectMenu', () => {
|
|
|
|
this.focus()
|
2023-05-11 13:20:02 +00:00
|
|
|
})
|
2023-05-12 08:45:28 +00:00
|
|
|
this.$watch('environmentMenu', () => {
|
|
|
|
this.focus()
|
2023-05-11 13:20:02 +00:00
|
|
|
})
|
2023-05-16 08:03:34 +00:00
|
|
|
this.$watch('privateKeysMenu', () => {
|
|
|
|
this.focus()
|
|
|
|
})
|
2023-05-16 10:17:39 +00:00
|
|
|
this.$watch('sourcesMenu', () => {
|
|
|
|
this.focus()
|
|
|
|
})
|
2023-05-11 13:20:02 +00:00
|
|
|
},
|
|
|
|
mainMenu: false,
|
|
|
|
serverMenu: false,
|
|
|
|
destinationMenu: false,
|
2023-05-12 09:59:02 +00:00
|
|
|
destinationsMenu: false,
|
2023-05-11 13:20:02 +00:00
|
|
|
projectMenu: false,
|
2023-05-12 09:38:23 +00:00
|
|
|
projectsMenu: false,
|
2023-05-11 13:20:02 +00:00
|
|
|
environmentMenu: false,
|
2023-05-16 08:03:34 +00:00
|
|
|
privateKeysMenu: false,
|
2023-05-16 10:17:39 +00:00
|
|
|
sourcesMenu: false,
|
2023-05-12 08:45:28 +00:00
|
|
|
search: '',
|
2023-05-11 13:20:02 +00:00
|
|
|
|
|
|
|
selectedAction: '',
|
|
|
|
selectedServer: '',
|
|
|
|
selectedDestination: '',
|
|
|
|
selectedProject: '',
|
|
|
|
selectedEnvironment: '',
|
|
|
|
|
|
|
|
servers: ['Loading...'],
|
|
|
|
destinations: ['Loading...'],
|
|
|
|
projects: ['Loading...'],
|
|
|
|
environments: ['Loading...'],
|
2023-05-16 08:03:34 +00:00
|
|
|
privateKeys: ['Loading...'],
|
2023-05-16 10:17:39 +00:00
|
|
|
sources: ['Loading...'],
|
2023-05-12 08:45:28 +00:00
|
|
|
|
|
|
|
focusedIndex: "",
|
2023-05-10 17:26:28 +00:00
|
|
|
items: [{
|
2023-05-15 12:54:03 +00:00
|
|
|
name: 'Public Repository',
|
|
|
|
type: 'App',
|
|
|
|
tags: 'application,public,repository,github,gitlab,bitbucket,git',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Private Repository (with GitHub App)',
|
|
|
|
type: 'App',
|
|
|
|
tags: 'application,private,repository,github,gitlab,bitbucket,git',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Private Repository (with Deploy Key)',
|
|
|
|
type: 'App',
|
|
|
|
tags: 'application,private,repository,github,gitlab,bitbucket,git',
|
|
|
|
},
|
|
|
|
{
|
2023-05-12 09:59:02 +00:00
|
|
|
name: 'Server',
|
2023-05-12 13:39:07 +00:00
|
|
|
type: 'Add',
|
2023-05-16 12:18:09 +00:00
|
|
|
tags: 'add,new,server',
|
2023-05-12 09:59:02 +00:00
|
|
|
next: 'newServer'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Destination',
|
2023-05-12 13:39:07 +00:00
|
|
|
type: 'Add',
|
2023-05-16 12:18:09 +00:00
|
|
|
tags: 'add,new,destination',
|
2023-05-12 09:59:02 +00:00
|
|
|
next: 'newDestination'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Private Key',
|
2023-05-12 13:39:07 +00:00
|
|
|
type: 'Add',
|
2023-05-16 12:18:09 +00:00
|
|
|
tags: 'add,new,private-key,ssh,key',
|
2023-05-12 09:59:02 +00:00
|
|
|
next: 'newPrivateKey'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Source',
|
2023-05-12 13:39:07 +00:00
|
|
|
type: 'Add',
|
2023-05-16 12:18:09 +00:00
|
|
|
tags: 'add,new,source,github,gitlab,bitbucket',
|
2023-05-12 09:59:02 +00:00
|
|
|
next: 'newSource'
|
2023-05-11 13:20:02 +00:00
|
|
|
},
|
2023-05-15 12:54:03 +00:00
|
|
|
|
2023-05-12 13:39:07 +00:00
|
|
|
{
|
|
|
|
name: 'Database',
|
|
|
|
type: 'Add',
|
2023-05-16 12:18:09 +00:00
|
|
|
tags: 'add,data,database,mysql,postgres,sql,sqlite,redis,mongodb,maria,percona',
|
2023-05-12 13:39:07 +00:00
|
|
|
},
|
|
|
|
|
2023-05-11 13:20:02 +00:00
|
|
|
{
|
|
|
|
name: 'Servers',
|
|
|
|
type: 'Jump',
|
2023-05-16 12:18:09 +00:00
|
|
|
tags: 'jump,servers',
|
2023-05-12 09:38:23 +00:00
|
|
|
next: 'server'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Projects',
|
|
|
|
type: 'Jump',
|
2023-05-16 12:18:09 +00:00
|
|
|
tags: 'jump,projects',
|
2023-05-12 09:38:23 +00:00
|
|
|
next: 'projects'
|
2023-05-12 09:59:02 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Destinations',
|
|
|
|
type: 'Jump',
|
2023-05-16 12:18:09 +00:00
|
|
|
tags: 'jump,destinations',
|
2023-05-12 09:59:02 +00:00
|
|
|
next: 'destinations'
|
2023-05-16 08:03:34 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Private Keys',
|
|
|
|
type: 'Jump',
|
2023-05-16 12:18:09 +00:00
|
|
|
tags: 'jump,private keys,ssh, keys, key',
|
2023-05-16 08:03:34 +00:00
|
|
|
next: 'privateKeys'
|
2023-05-16 10:17:39 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Sources',
|
|
|
|
type: 'Jump',
|
2023-05-16 12:18:09 +00:00
|
|
|
tags: 'jump,github,apps,source',
|
2023-05-16 10:17:39 +00:00
|
|
|
next: 'sources'
|
2023-05-11 13:20:02 +00:00
|
|
|
}
|
|
|
|
],
|
2023-05-12 08:45:28 +00:00
|
|
|
focusPrev(maxLength) {
|
|
|
|
if (this.focusedIndex === "") {
|
|
|
|
this.focusedIndex = maxLength - 1
|
|
|
|
} else {
|
|
|
|
if (this.focusedIndex > 0) {
|
|
|
|
this.focusedIndex = this.focusedIndex - 1
|
|
|
|
}
|
|
|
|
}
|
2023-05-11 13:20:02 +00:00
|
|
|
},
|
2023-05-12 08:45:28 +00:00
|
|
|
focusNext(maxLength) {
|
|
|
|
if (this.focusedIndex === "") {
|
|
|
|
this.focusedIndex = 0
|
|
|
|
} else {
|
|
|
|
if (maxLength > this.focusedIndex + 1) {
|
|
|
|
this.focusedIndex = this.focusedIndex + 1
|
|
|
|
}
|
|
|
|
}
|
2023-05-11 13:20:02 +00:00
|
|
|
},
|
2023-05-12 09:17:56 +00:00
|
|
|
clearSearch() {
|
|
|
|
if (this.search === '') {
|
|
|
|
this.closeMenus()
|
|
|
|
this.$nextTick(() => {
|
2023-05-12 11:10:09 +00:00
|
|
|
if (this.$refs.search) this.$refs.search.blur();
|
2023-05-12 09:17:56 +00:00
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.search = ''
|
|
|
|
this.focusedIndex = ''
|
|
|
|
},
|
2023-05-12 08:45:28 +00:00
|
|
|
closeMenus() {
|
2023-05-12 11:10:09 +00:00
|
|
|
if (this.$refs.search) this.$refs.search.blur();
|
2023-05-12 09:17:56 +00:00
|
|
|
this.search = ''
|
2023-05-12 08:45:28 +00:00
|
|
|
this.focusedIndex = ''
|
|
|
|
this.mainMenu = false
|
2023-05-11 13:20:02 +00:00
|
|
|
this.serverMenu = false
|
|
|
|
this.destinationMenu = false
|
|
|
|
this.projectMenu = false
|
|
|
|
this.environmentMenu = false
|
2023-05-16 10:17:39 +00:00
|
|
|
this.projectsMenu = false
|
|
|
|
this.destinationsMenu = false
|
|
|
|
this.privateKeysMenu = false
|
|
|
|
this.sourcesMenu = false
|
2023-05-12 08:45:28 +00:00
|
|
|
},
|
|
|
|
checkMainMenu() {
|
|
|
|
if (this.serverMenu) return
|
|
|
|
this.mainMenu = true
|
2023-05-10 17:26:28 +00:00
|
|
|
},
|
|
|
|
filteredItems() {
|
2023-05-12 08:45:28 +00:00
|
|
|
if (this.search === '') return this.items
|
2023-05-10 17:26:28 +00:00
|
|
|
return this.items.filter(item => {
|
2023-05-12 09:59:02 +00:00
|
|
|
return item.name.toLowerCase().includes(this.search.toLowerCase()) ||
|
|
|
|
item.tags.toLowerCase().includes(this.search.toLowerCase())
|
2023-05-11 13:20:02 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
filteredServers() {
|
2023-05-12 08:45:28 +00:00
|
|
|
if (this.search === '') return this.servers
|
2023-05-11 13:20:02 +00:00
|
|
|
return this.servers.filter(server => {
|
2023-05-12 08:45:28 +00:00
|
|
|
return server.name.toLowerCase().includes(this.search
|
2023-05-11 13:20:02 +00:00
|
|
|
.toLowerCase())
|
|
|
|
})
|
|
|
|
},
|
|
|
|
filteredDestinations() {
|
2023-05-12 08:45:28 +00:00
|
|
|
if (this.search === '') return this.destinations
|
2023-05-12 11:10:09 +00:00
|
|
|
if (this.destinations.length === 0) return []
|
2023-05-11 13:20:02 +00:00
|
|
|
return this.destinations.filter(destination => {
|
2023-05-12 08:45:28 +00:00
|
|
|
return destination.name.toLowerCase().includes(this.search
|
2023-05-11 13:20:02 +00:00
|
|
|
.toLowerCase())
|
2023-05-10 17:26:28 +00:00
|
|
|
})
|
|
|
|
},
|
2023-05-11 13:20:02 +00:00
|
|
|
filteredProjects() {
|
2023-05-12 08:45:28 +00:00
|
|
|
if (this.search === '') return this.projects
|
2023-05-11 13:20:02 +00:00
|
|
|
return this.projects.filter(project => {
|
2023-05-12 08:45:28 +00:00
|
|
|
return project.name.toLowerCase().includes(this.search
|
2023-05-11 13:20:02 +00:00
|
|
|
.toLowerCase())
|
|
|
|
})
|
|
|
|
},
|
|
|
|
filteredEnvironments() {
|
2023-05-12 08:45:28 +00:00
|
|
|
if (this.search === '') return this.environments
|
2023-05-11 13:20:02 +00:00
|
|
|
return this.environments.filter(environment => {
|
2023-05-12 08:45:28 +00:00
|
|
|
return environment.name.toLowerCase().includes(this.search
|
2023-05-11 13:20:02 +00:00
|
|
|
.toLowerCase())
|
|
|
|
})
|
|
|
|
},
|
2023-05-16 08:03:34 +00:00
|
|
|
filteredPrivateKeys() {
|
|
|
|
if (this.search === '') return this.privateKeys
|
|
|
|
return this.privateKeys.filter(privateKey => {
|
|
|
|
return privateKey.name.toLowerCase().includes(this.search
|
|
|
|
.toLowerCase())
|
|
|
|
})
|
|
|
|
},
|
2023-05-16 10:17:39 +00:00
|
|
|
filteredSources() {
|
|
|
|
if (this.search === '') return this.sources
|
|
|
|
return this.sources.filter(source => {
|
|
|
|
return source.name.toLowerCase().includes(this.search
|
|
|
|
.toLowerCase())
|
|
|
|
})
|
|
|
|
},
|
2023-05-11 13:20:02 +00:00
|
|
|
async newProject() {
|
|
|
|
const response = await fetch('/magic?server=' + this.selectedServer +
|
|
|
|
'&destination=' + this.selectedDestination +
|
2023-05-12 08:45:28 +00:00
|
|
|
'&project=new&name=' + this.search);
|
2023-05-11 13:20:02 +00:00
|
|
|
if (response.ok) {
|
|
|
|
const {
|
|
|
|
project_uuid
|
|
|
|
} = await response.json();
|
2023-05-12 08:45:28 +00:00
|
|
|
this.set('environment', project_uuid)
|
|
|
|
this.set('jump', 'production')
|
2023-05-11 13:20:02 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
async newEnvironment() {
|
|
|
|
const response = await fetch('/magic?server=' + this.selectedServer +
|
|
|
|
'&destination=' + this.selectedDestination +
|
|
|
|
'&project=' + this.selectedProject + '&environment=new&name=' + this
|
2023-05-12 08:45:28 +00:00
|
|
|
.search);
|
2023-05-11 13:20:02 +00:00
|
|
|
if (response.ok) {
|
2023-05-12 08:45:28 +00:00
|
|
|
const {
|
|
|
|
environment_name
|
|
|
|
} = await response.json();
|
|
|
|
this.set('jump', environment_name)
|
2023-05-11 13:20:02 +00:00
|
|
|
}
|
|
|
|
},
|
2023-05-12 08:45:28 +00:00
|
|
|
async set(action, id) {
|
2023-05-11 13:20:02 +00:00
|
|
|
let response = null
|
2023-05-10 17:26:28 +00:00
|
|
|
switch (action) {
|
2023-05-11 13:20:02 +00:00
|
|
|
case 'server':
|
|
|
|
this.items.find((item, index) => {
|
|
|
|
if (item.name.toLowerCase() === id
|
|
|
|
.toLowerCase()) {
|
|
|
|
return this.selectedAction = index
|
|
|
|
}
|
|
|
|
})
|
|
|
|
response = await fetch('/magic?servers=true');
|
|
|
|
if (response.ok) {
|
|
|
|
const {
|
|
|
|
servers
|
|
|
|
} = await response.json();
|
|
|
|
this.servers = servers;
|
|
|
|
}
|
2023-05-12 08:45:28 +00:00
|
|
|
this.closeMenus()
|
|
|
|
this.serverMenu = true
|
2023-05-10 17:26:28 +00:00
|
|
|
break
|
2023-05-11 13:20:02 +00:00
|
|
|
case 'destination':
|
2023-05-12 08:45:28 +00:00
|
|
|
this.selectedServer = id
|
2023-05-11 13:20:02 +00:00
|
|
|
if (this.items[this.selectedAction].type === "Jump") {
|
|
|
|
return window.location = '/server/' + id
|
|
|
|
}
|
|
|
|
response = await fetch('/magic?server=' + this
|
|
|
|
.selectedServer +
|
|
|
|
'&destinations=true');
|
|
|
|
if (response.ok) {
|
|
|
|
const {
|
|
|
|
destinations
|
|
|
|
} = await response.json();
|
|
|
|
this.destinations = destinations;
|
|
|
|
}
|
2023-05-12 08:45:28 +00:00
|
|
|
this.closeMenus()
|
|
|
|
this.destinationMenu = true
|
2023-05-10 17:26:28 +00:00
|
|
|
break
|
2023-05-11 13:20:02 +00:00
|
|
|
case 'project':
|
|
|
|
this.selectedDestination = id
|
|
|
|
response = await fetch('/magic?server=' + this
|
|
|
|
.selectedServer +
|
|
|
|
'&destination=' + this.selectedDestination +
|
|
|
|
'&projects=true');
|
|
|
|
if (response.ok) {
|
|
|
|
const {
|
|
|
|
projects
|
|
|
|
} = await response.json();
|
|
|
|
this.projects = projects;
|
|
|
|
}
|
2023-05-12 08:45:28 +00:00
|
|
|
this.closeMenus()
|
|
|
|
this.projectMenu = true
|
2023-05-10 17:26:28 +00:00
|
|
|
break
|
2023-05-12 09:38:23 +00:00
|
|
|
case 'projects':
|
|
|
|
response = await fetch('/magic?projects=true');
|
|
|
|
if (response.ok) {
|
|
|
|
const {
|
|
|
|
projects
|
|
|
|
} = await response.json();
|
|
|
|
this.projects = projects;
|
|
|
|
}
|
|
|
|
this.closeMenus()
|
|
|
|
this.projectsMenu = true
|
|
|
|
break
|
2023-05-12 09:59:02 +00:00
|
|
|
case 'destinations':
|
|
|
|
response = await fetch('/magic?destinations=true');
|
|
|
|
if (response.ok) {
|
|
|
|
const {
|
|
|
|
destinations
|
|
|
|
} = await response.json();
|
|
|
|
this.destinations = destinations;
|
|
|
|
}
|
|
|
|
this.closeMenus()
|
|
|
|
this.destinationsMenu = true
|
|
|
|
break
|
2023-05-16 08:03:34 +00:00
|
|
|
case 'privateKeys':
|
|
|
|
response = await fetch('/magic?privateKeys=true');
|
|
|
|
if (response.ok) {
|
|
|
|
const {
|
|
|
|
privateKeys
|
|
|
|
} = await response.json();
|
|
|
|
this.privateKeys = privateKeys;
|
|
|
|
}
|
|
|
|
this.closeMenus()
|
|
|
|
this.privateKeysMenu = true
|
|
|
|
break
|
2023-05-16 10:17:39 +00:00
|
|
|
case 'sources':
|
|
|
|
response = await fetch('/magic?sources=true');
|
|
|
|
if (response.ok) {
|
|
|
|
const {
|
|
|
|
sources
|
|
|
|
} = await response.json();
|
|
|
|
this.sources = sources;
|
|
|
|
}
|
|
|
|
this.closeMenus()
|
|
|
|
this.sourcesMenu = true
|
|
|
|
break
|
2023-05-11 13:20:02 +00:00
|
|
|
case 'environment':
|
2023-05-12 08:45:28 +00:00
|
|
|
if (this.focusedIndex === 0) {
|
|
|
|
this.focusedIndex = ''
|
|
|
|
return await this.newProject()
|
|
|
|
}
|
2023-05-11 13:20:02 +00:00
|
|
|
|
2023-05-12 08:45:28 +00:00
|
|
|
this.selectedProject = id
|
2023-05-11 13:20:02 +00:00
|
|
|
response = await fetch('/magic?server=' + this
|
|
|
|
.selectedServer +
|
|
|
|
'&destination=' + this.selectedDestination +
|
|
|
|
'&project=' + this
|
|
|
|
.selectedProject + '&environments=true');
|
|
|
|
if (response.ok) {
|
|
|
|
const {
|
|
|
|
environments
|
|
|
|
} = await response.json();
|
|
|
|
this.environments = environments;
|
|
|
|
}
|
2023-05-12 08:45:28 +00:00
|
|
|
|
|
|
|
this.closeMenus()
|
|
|
|
this.environmentMenu = true
|
2023-05-11 13:20:02 +00:00
|
|
|
break
|
|
|
|
case 'jump':
|
2023-05-12 08:45:28 +00:00
|
|
|
if (this.focusedIndex === 0) {
|
|
|
|
this.focusedIndex = ''
|
|
|
|
return await this.newEnvironment()
|
|
|
|
}
|
2023-05-11 13:20:02 +00:00
|
|
|
this.selectedEnvironment = id
|
|
|
|
if (this.selectedAction === 0) {
|
|
|
|
window.location =
|
|
|
|
`/project/${this.selectedProject}/${this.selectedEnvironment}/new?type=public&destination=${this.selectedDestination}`
|
|
|
|
} else if (this.selectedAction === 1) {
|
|
|
|
window.location =
|
|
|
|
`/project/${this.selectedProject}/${this.selectedEnvironment}/new?type=private-gh-app&destination=${this.selectedDestination}`
|
|
|
|
} else if (this.selectedAction === 2) {
|
|
|
|
window.location =
|
|
|
|
`/project/${this.selectedProject}/${this.selectedEnvironment}/new?type=private-deploy-key&destination=${this.selectedDestination}`
|
|
|
|
} else if (this.selectedAction === 3) {
|
|
|
|
console.log('new Database')
|
|
|
|
}
|
2023-05-12 08:45:28 +00:00
|
|
|
this.closeMenus()
|
2023-05-10 17:26:28 +00:00
|
|
|
break
|
2023-05-12 09:38:23 +00:00
|
|
|
case 'jumpToProject':
|
2023-05-12 09:59:02 +00:00
|
|
|
window.location = `/project/${id}`
|
|
|
|
this.closeMenus()
|
|
|
|
break
|
|
|
|
case 'jumpToDestination':
|
|
|
|
window.location = `/destination/${id}`
|
|
|
|
this.closeMenus()
|
2023-05-16 08:03:34 +00:00
|
|
|
break
|
|
|
|
case 'jumpToPrivateKey':
|
|
|
|
window.location = `/private-key/${id}`
|
|
|
|
this.closeMenus()
|
2023-05-16 10:17:39 +00:00
|
|
|
break
|
|
|
|
case 'jumpToSource':
|
|
|
|
window.location = `/source/${id.type}/${id.uuid}`
|
|
|
|
this.closeMenus()
|
2023-05-12 09:59:02 +00:00
|
|
|
break
|
|
|
|
case 'newServer':
|
|
|
|
window.location = `/server/new`
|
|
|
|
this.closeMenus()
|
|
|
|
break
|
|
|
|
case 'newDestination':
|
2023-05-12 11:10:09 +00:00
|
|
|
if (this.selectedServer !== '') {
|
|
|
|
window.location = `/destination/new?server=${this.selectedServer}`
|
|
|
|
return
|
|
|
|
}
|
2023-05-12 09:59:02 +00:00
|
|
|
window.location = `/destination/new`
|
|
|
|
this.closeMenus()
|
|
|
|
break
|
|
|
|
case 'newPrivateKey':
|
|
|
|
window.location = `/private-key/new`
|
|
|
|
this.closeMenus()
|
|
|
|
break
|
|
|
|
case 'newSource':
|
|
|
|
window.location = `/source/new`
|
2023-05-12 09:38:23 +00:00
|
|
|
this.closeMenus()
|
|
|
|
break
|
2023-05-10 17:26:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
})
|
|
|
|
</script>
|