2022-04-01 01:01:34 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<!-- Top Notice -->
|
2022-06-22 05:24:06 +00:00
|
|
|
<center style="margin: 2em">
|
2022-08-23 10:58:11 +00:00
|
|
|
<h1>{{ lang.registryeditor }}</h1>
|
2022-04-01 01:01:34 +00:00
|
|
|
<v-alert text outlined type="warning">
|
2022-08-23 10:58:11 +00:00
|
|
|
{{ lang.registrywarning }}
|
2022-04-01 01:01:34 +00:00
|
|
|
</v-alert>
|
|
|
|
</center>
|
|
|
|
|
2022-04-01 01:23:30 +00:00
|
|
|
<!-- Add New Key Button -->
|
|
|
|
<center>
|
2022-06-22 05:24:06 +00:00
|
|
|
<v-btn
|
|
|
|
@click="
|
|
|
|
addDialog = !addDialog;
|
|
|
|
selectedKey = null;
|
|
|
|
selectedKeyData = null;
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<v-icon style="margin-right: 0.25em">mdi-plus</v-icon>
|
2022-08-23 10:58:11 +00:00
|
|
|
{{ lang.createentry }}
|
2022-04-01 01:23:30 +00:00
|
|
|
</v-btn>
|
|
|
|
</center>
|
|
|
|
|
2022-04-01 01:01:34 +00:00
|
|
|
<!-- Registry List Loader -->
|
|
|
|
<v-list-item v-for="(item, index) in keys" :key="index">
|
2022-06-22 05:24:06 +00:00
|
|
|
<v-card
|
|
|
|
class="card"
|
|
|
|
:class="
|
|
|
|
$vuetify.theme.dark ? 'background lighten-1' : 'background darken-1'
|
|
|
|
"
|
|
|
|
:style="{ borderRadius: `${roundTweak / 2}rem` }"
|
|
|
|
>
|
2022-04-01 01:01:34 +00:00
|
|
|
<v-card-title v-text="item.key" />
|
|
|
|
<v-card-text v-text="item.value" />
|
|
|
|
<v-card-actions>
|
|
|
|
<v-spacer />
|
2022-06-22 05:24:06 +00:00
|
|
|
<v-btn text class="actionButton" @click="confirmEdit(item)"
|
|
|
|
><v-icon color="primary">mdi-pencil</v-icon></v-btn
|
|
|
|
>
|
|
|
|
<v-btn text class="actionButton" @click="confirmDelete(item)"
|
|
|
|
><v-icon color="error">mdi-delete</v-icon></v-btn
|
|
|
|
>
|
2022-04-01 01:01:34 +00:00
|
|
|
</v-card-actions>
|
|
|
|
</v-card>
|
|
|
|
</v-list-item>
|
|
|
|
|
|
|
|
<!-- Delete Entry Dialog -->
|
|
|
|
<v-dialog v-model="deleteDialog" width="500">
|
2022-06-22 05:24:06 +00:00
|
|
|
<v-card
|
|
|
|
class="rounded-lg"
|
|
|
|
:class="
|
|
|
|
$vuetify.theme.dark ? 'background lighten-1' : 'background darken-1'
|
|
|
|
"
|
|
|
|
>
|
2022-08-23 10:58:11 +00:00
|
|
|
<v-card-title class="text-h5">{{ lang.confirmdelete }}</v-card-title>
|
2022-06-22 05:24:06 +00:00
|
|
|
<v-card-text
|
2022-08-23 10:58:11 +00:00
|
|
|
>{{ lang.areyousure }}
|
2022-06-22 05:24:06 +00:00
|
|
|
<span class="highlight" v-text="selectedKey" />?</v-card-text
|
|
|
|
>
|
2022-04-01 01:10:28 +00:00
|
|
|
<v-divider />
|
2022-04-01 01:01:34 +00:00
|
|
|
<v-card-actions>
|
|
|
|
<v-spacer></v-spacer>
|
2022-08-27 20:02:20 +00:00
|
|
|
<v-btn color="primary" text @click="deleteDialog = false">
|
|
|
|
{{ lang.cancel }}
|
|
|
|
</v-btn>
|
|
|
|
<v-btn color="primary" text @click="deleteKey()">
|
|
|
|
{{ lang.delete }}
|
|
|
|
</v-btn>
|
2022-04-01 01:01:34 +00:00
|
|
|
</v-card-actions>
|
|
|
|
</v-card>
|
|
|
|
</v-dialog>
|
|
|
|
|
2022-04-01 01:10:28 +00:00
|
|
|
<!-- Edit Entry Dialog -->
|
|
|
|
<v-dialog v-model="editDialog" width="500">
|
2022-06-22 05:24:06 +00:00
|
|
|
<v-card
|
|
|
|
class="rounded-lg"
|
|
|
|
:class="
|
|
|
|
$vuetify.theme.dark ? 'background lighten-1' : 'background darken-1'
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<v-card-title class="text-h5" v-text="selectedKey" />
|
2022-04-01 01:10:28 +00:00
|
|
|
<v-card-text>
|
2022-06-22 05:24:06 +00:00
|
|
|
<v-text-field v-model="selectedKeyData" label="Value" solo />
|
2022-04-01 01:10:28 +00:00
|
|
|
</v-card-text>
|
|
|
|
<v-divider />
|
|
|
|
<v-card-actions>
|
|
|
|
<v-spacer></v-spacer>
|
2022-08-27 20:02:20 +00:00
|
|
|
<v-btn color="primary" text @click="editDialog = false">
|
|
|
|
{{ lang.cancel }}
|
|
|
|
</v-btn>
|
|
|
|
<v-btn color="primary" text @click="updateKey()">
|
|
|
|
{{ lang.change }}
|
|
|
|
</v-btn>
|
2022-04-01 01:23:30 +00:00
|
|
|
</v-card-actions>
|
|
|
|
</v-card>
|
|
|
|
</v-dialog>
|
|
|
|
|
|
|
|
<!-- Add Entry Dialog -->
|
|
|
|
<v-dialog v-model="addDialog" width="500">
|
2022-06-22 05:24:06 +00:00
|
|
|
<v-card
|
|
|
|
class="rounded-lg"
|
|
|
|
:class="
|
|
|
|
$vuetify.theme.dark ? 'background lighten-1' : 'background darken-1'
|
|
|
|
"
|
|
|
|
>
|
2022-08-23 10:58:11 +00:00
|
|
|
<v-card-title class="text-h5">{{ lang.createentryfull }}</v-card-title>
|
2022-04-01 01:23:30 +00:00
|
|
|
<v-card-text>
|
2022-08-28 20:59:51 +00:00
|
|
|
<v-text-field v-model="selectedKey" label="lang.key" solo />
|
2022-04-01 01:23:30 +00:00
|
|
|
<v-text-field
|
|
|
|
v-model="selectedKeyData"
|
2022-08-28 20:59:51 +00:00
|
|
|
label="lang.value"
|
2022-04-01 01:23:30 +00:00
|
|
|
solo
|
2022-06-22 05:24:06 +00:00
|
|
|
style="margin-bottom: -2em"
|
2022-04-01 01:23:30 +00:00
|
|
|
/>
|
|
|
|
</v-card-text>
|
|
|
|
<v-divider />
|
|
|
|
<v-card-actions>
|
|
|
|
<v-spacer></v-spacer>
|
2022-08-27 20:02:20 +00:00
|
|
|
<v-btn color="primary" text @click="addDialog = false">
|
|
|
|
{{ lang.cancel }}
|
|
|
|
</v-btn>
|
|
|
|
<v-btn color="primary" text @click="createKey()">
|
|
|
|
{{ lang.create }}
|
|
|
|
</v-btn>
|
2022-04-01 01:10:28 +00:00
|
|
|
</v-card-actions>
|
|
|
|
</v-card>
|
|
|
|
</v-dialog>
|
2022-04-01 01:01:34 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2022-08-27 20:02:20 +00:00
|
|
|
lang: {},
|
2022-04-01 01:01:34 +00:00
|
|
|
keys: [],
|
|
|
|
|
|
|
|
selectedKey: null,
|
2022-04-01 01:10:28 +00:00
|
|
|
selectedKeyData: null,
|
|
|
|
deleteDialog: false,
|
2022-04-01 01:23:30 +00:00
|
|
|
editDialog: false,
|
2022-06-22 05:24:06 +00:00
|
|
|
addDialog: false,
|
2022-04-01 01:01:34 +00:00
|
|
|
};
|
|
|
|
},
|
2022-08-27 20:02:20 +00:00
|
|
|
computed: {
|
|
|
|
roundTweak() {
|
|
|
|
return this.$store.state.tweaks.roundTweak;
|
|
|
|
},
|
|
|
|
},
|
2022-04-01 01:01:34 +00:00
|
|
|
mounted() {
|
|
|
|
this.syncRegistry();
|
2022-08-23 13:34:49 +00:00
|
|
|
const lang = this.$lang();
|
2022-08-27 20:02:20 +00:00
|
|
|
this.lang = lang.mods.developer;
|
2022-04-01 01:01:34 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
syncRegistry() {
|
|
|
|
this.keys = [];
|
2022-06-22 05:24:06 +00:00
|
|
|
const localStorageKeys = Object.keys(localStorage);
|
2022-04-01 01:01:34 +00:00
|
|
|
for (const i in localStorageKeys) {
|
|
|
|
const key = localStorageKeys[i];
|
|
|
|
const keyValue = localStorage.getItem(key);
|
2022-06-22 05:24:06 +00:00
|
|
|
this.keys.push({ key: key, value: keyValue });
|
2022-04-01 01:01:34 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
confirmDelete(item) {
|
|
|
|
this.selectedKey = item.key;
|
|
|
|
this.deleteDialog = true;
|
|
|
|
},
|
2022-04-01 01:10:28 +00:00
|
|
|
confirmEdit(item) {
|
|
|
|
this.selectedKey = item.key;
|
|
|
|
this.selectedKeyData = item.value;
|
|
|
|
this.editDialog = true;
|
|
|
|
},
|
|
|
|
|
2022-04-01 01:01:34 +00:00
|
|
|
deleteKey() {
|
|
|
|
this.deleteDialog = false;
|
|
|
|
localStorage.removeItem(this.selectedKey);
|
|
|
|
this.syncRegistry();
|
2022-04-01 01:10:28 +00:00
|
|
|
},
|
|
|
|
updateKey() {
|
|
|
|
this.editDialog = false;
|
|
|
|
localStorage.setItem(this.selectedKey, this.selectedKeyData);
|
|
|
|
this.syncRegistry();
|
2022-04-01 01:23:30 +00:00
|
|
|
},
|
|
|
|
createKey() {
|
|
|
|
this.addDialog = false;
|
|
|
|
localStorage.setItem(this.selectedKey, this.selectedKeyData);
|
|
|
|
this.syncRegistry();
|
2022-06-22 05:24:06 +00:00
|
|
|
},
|
|
|
|
},
|
2022-04-01 01:01:34 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.card {
|
|
|
|
margin: 1em;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
.actionButton {
|
|
|
|
min-width: 1em !important;
|
|
|
|
}
|
|
|
|
.highlight {
|
|
|
|
background: #999;
|
|
|
|
border-radius: 5px;
|
|
|
|
padding: 0.25em;
|
|
|
|
}
|
|
|
|
</style>
|