-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update create resource button to create any resource type
This commit makes the following changes: - The create resource button in the bottom right corner gives options to create any resource - In the edit pages, the cancel button goes back to the previous page you were on
- Loading branch information
1 parent
17ded57
commit a26566b
Showing
21 changed files
with
210 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ server { | |
|
||
location / { | ||
root /frontend; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
location /api/ { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<template> | ||
<q-btn | ||
class="fixedButton" | ||
round | ||
color="primary" | ||
icon="add" | ||
size="lg" | ||
> | ||
<span class="sr-only">Create new resource</span> | ||
<q-tooltip> | ||
Create new resource | ||
</q-tooltip> | ||
<q-menu anchor="top middle" self="bottom middle"> | ||
<q-list separator> | ||
<q-item | ||
v-for="resource in resources" | ||
clickable | ||
:active="false" | ||
@click="handleClick(resource)" | ||
> | ||
<q-item-section class="text-capitalize"> | ||
Create {{ resource.name }} | ||
</q-item-section> | ||
</q-item> | ||
</q-list> | ||
</q-menu> | ||
</q-btn> | ||
</template> | ||
|
||
<script setup> | ||
import { useLoginStore } from '@/stores/LoginStore.ts' | ||
import { computed } from 'vue' | ||
import { useRoute, useRouter } from 'vue-router' | ||
const route = useRoute() | ||
const router = useRouter() | ||
const store = useLoginStore() | ||
const defaultResources = [ | ||
{ | ||
name: 'experiment', | ||
url: '/experiments/new' | ||
}, | ||
{ | ||
name: 'entrypoint', | ||
url: '/entrypoints/new' | ||
}, | ||
{ | ||
name: 'plugin', | ||
url: '/plugins', | ||
popup: true | ||
}, | ||
{ | ||
name: 'queue', | ||
url: '/queues', | ||
popup: true | ||
}, | ||
{ | ||
name: 'job', | ||
url: '/jobs/new' | ||
}, | ||
{ | ||
name: 'plugin param', | ||
url: '/pluginParams', | ||
popup: true | ||
}, | ||
{ | ||
name: 'tag', | ||
url: '/tags', | ||
popup: true | ||
}, | ||
{ | ||
name: 'model', | ||
url: '/models', | ||
popup: true | ||
}, | ||
] | ||
const resources = computed(() => { | ||
if(route.name === 'pluginFiles') { | ||
const modifiedResources = [...defaultResources] | ||
modifiedResources.splice(3, 0, { | ||
name: 'plugin file', | ||
url: `/plugins/${route.params.id}/files/new`, | ||
}) | ||
return modifiedResources | ||
} | ||
return defaultResources | ||
}) | ||
function handleClick(resource) { | ||
if(resource.url) { | ||
router.push(resource.url).then(() => { | ||
if(resource.popup) { | ||
store.triggerPopup = true | ||
} | ||
}) | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.