mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-01-10 17:23:12 +01:00
fef2e09aa9
LittleLink Custom now includes an .env config editor. This editor can be accessed via the Admin Panel under Admin>Config. This editor allows admins to edit, backup, download and upload the .env configuration file. All in all, the new feature, allows users to more easily edit the configuration file, contributing to my goal of making LittleLink Custom easier to use. Read more about this topic on the Blog https://blog.littlelink-custom.com/built-in-config-editor
88 lines
3.4 KiB
PHP
88 lines
3.4 KiB
PHP
@php($translatePrefix='env-editor::env-editor.views.currentEnv.')
|
|
<template id="env-editor-main-tab">
|
|
<div>
|
|
<div class="h5 my-4">{{__($translatePrefix.'title')}}</div>
|
|
<div class="py-3 text-right">
|
|
<button class="btn btn-info" @click="addNew()">{{__($translatePrefix.'btn.addNewKey')}}</button>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-sm">
|
|
<thead>
|
|
<tr class="table-secondary ">
|
|
<th class="py-2" scope="col">{{__($translatePrefix.'tableTitles.key')}}</th>
|
|
<th class="py-2" scope="col">{{__($translatePrefix.'tableTitles.value')}}</th>
|
|
<th class="py-2" scope="col">{{__($translatePrefix.'tableTitles.actions')}}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(item, index) in items" :key="item.key" v-bind="item" v-if="!item.separator">
|
|
<th scope="row" class="font-weight-bold ">@{{ item.key }}</th>
|
|
<td>@{{ item.value }}</td>
|
|
<td>
|
|
<div class="btn-group" role="group">
|
|
<button class="btn btn-info" @click="edit(item)" title="{{__($translatePrefix.'btn.edit')}}"><span class="fas fa-edit"></span></button>
|
|
<button class="btn btn-secondary" @click="addAfter(item)" title="{{__($translatePrefix.'btn.addAfterKey')}}"><span class="fas fa-share"></span></button>
|
|
<button class="btn btn-danger" @click="remove(item)" title="{{__($translatePrefix.'btn.delete')}}"><span class="fas fa-trash"></span></button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr v-else>
|
|
<td colspan="100%"> </td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
@push('scripts')
|
|
|
|
|
|
<script>
|
|
const itemsWrapper = {
|
|
template: '#env-editor-main-tab',
|
|
data: () => {
|
|
return {
|
|
items: [],
|
|
}
|
|
},
|
|
mounted() {
|
|
envEventBus.$on('env:changed', () => {
|
|
this.getItemsWithAjax();
|
|
});
|
|
this.getItemsWithAjax()
|
|
},
|
|
methods: {
|
|
edit: function (item) {
|
|
envEventBus.$emit('env:item:edit', item);
|
|
},
|
|
addNew() {
|
|
envEventBus.$emit('env:item:new');
|
|
},
|
|
addAfter(item) {
|
|
let oldItem = {
|
|
key: null,
|
|
value: null,
|
|
group: item.group,
|
|
index: item.index + 0.1,
|
|
}
|
|
|
|
envEventBus.$emit('env:item:new', oldItem);
|
|
},
|
|
remove(item) {
|
|
envEventBus.$emit('env:item:delete', item);
|
|
},
|
|
getItemsWithAjax() {
|
|
envClient('{{route(config($package.'.route.name').'.index')}}')
|
|
.then(data => this.items = data.items)
|
|
}
|
|
},
|
|
}
|
|
;
|
|
|
|
|
|
</script>
|
|
@endpush
|