mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
feat(apps): add default apps
This commit is contained in:
parent
d3d34041da
commit
b5ba69f4f6
14
api/apps.go
14
api/apps.go
@ -79,6 +79,18 @@ func appMiddleware(next http.Handler) http.Handler {
|
||||
}
|
||||
|
||||
func getApps(w http.ResponseWriter, r *http.Request) {
|
||||
defaultApps := map[string]util.App{
|
||||
string(db.TemplateAnsible): {},
|
||||
string(db.TemplateTerraform): {},
|
||||
string(db.TemplateTofu): {},
|
||||
string(db.TemplateBash): {},
|
||||
string(db.TemplatePowerShell): {},
|
||||
string(db.TemplatePython): {},
|
||||
}
|
||||
|
||||
for k, a := range util.Config.Apps {
|
||||
defaultApps[k] = a
|
||||
}
|
||||
|
||||
type app struct {
|
||||
ID string `json:"id"`
|
||||
@ -91,7 +103,7 @@ func getApps(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
apps := make([]app, 0)
|
||||
|
||||
for k, a := range util.Config.Apps {
|
||||
for k, a := range defaultApps {
|
||||
|
||||
apps = append(apps, app{
|
||||
ID: k,
|
||||
|
@ -114,3 +114,5 @@ export const APP_INVENTORY_TITLE = {
|
||||
terraform: 'Terraform Workspace',
|
||||
tofu: 'OpenTofu Workspace',
|
||||
};
|
||||
|
||||
export const DEFAULT_APPS = Object.keys(APP_ICONS);
|
||||
|
@ -58,6 +58,7 @@
|
||||
<template v-slot:item.actions="{ item }">
|
||||
<div style="white-space: nowrap">
|
||||
<v-btn
|
||||
v-if="!isDefaultApp(item.id)"
|
||||
icon
|
||||
class="mr-1"
|
||||
@click="askDeleteItem(item.id)"
|
||||
@ -67,6 +68,7 @@
|
||||
</v-btn>
|
||||
|
||||
<v-btn
|
||||
v-if="!isDefaultApp(item.id)"
|
||||
icon
|
||||
class="mr-1"
|
||||
@click="editItem(item.id)"
|
||||
@ -85,6 +87,7 @@ import ItemListPageBase from '@/components/ItemListPageBase';
|
||||
import EditDialog from '@/components/EditDialog.vue';
|
||||
import axios from 'axios';
|
||||
import AppForm from '../components/AppForm.vue';
|
||||
import { DEFAULT_APPS } from '../lib/constants';
|
||||
|
||||
export default {
|
||||
mixins: [ItemListPageBase],
|
||||
@ -140,6 +143,10 @@ export default {
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
isDefaultApp(appId) {
|
||||
return DEFAULT_APPS.includes(appId);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user