Skip to content

Commit

Permalink
fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBrax committed Nov 8, 2023
1 parent 8aa4f16 commit 318ccfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions client-vue/src/components/forms/SettingsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@
<textarea v-if="data.multiline" :id="`input_${key}`" v-model="formData.config[key] as string" class="input" type="text" :name="key" />
<input v-else :id="`input_${key}`" v-model="formData.config[key]" class="input" type="text" :name="key" />
<ul class="template-replacements">
<li v-for="(item, ix) in data.replacements" :key="ix">
<button v-if="item.deprecated" type="button" class="deprecated" title="Deprecated" @click="insertReplacement(key, ix)">
<span class="strikethrough">&lbrace;{{ ix }}&rbrace;</span>
<li v-for="(item, word) in data.replacements" :key="word">
<button v-if="item.deprecated" type="button" class="deprecated" title="Deprecated" @click="insertReplacement(key, word)">
<span class="strikethrough">&lbrace;{{ word }}&rbrace;</span>
</button>
<button v-else type="button" @click="insertReplacement(key, ix)">&lbrace;{{ ix }}&rbrace;</button>
<button v-else type="button" @click="insertReplacement(key, word)">&lbrace;{{ word }}&rbrace;</button>
</li>
</ul>
<p class="template-preview">
Expand Down Expand Up @@ -183,7 +183,7 @@ library.add(faGlobe, faSave);
interface SettingsGroup {
name: string;
fields: Record<string, SettingField<string | number | boolean>>;
fields: Record<string, SettingField>;
}
// emit
Expand Down Expand Up @@ -349,8 +349,9 @@ function doValidateExternalURL() {
});
}
function templatePreview(data: SettingField<any>, template: string): string {
function templatePreview(data: SettingField, template: string): string {
// console.debug("templatePreview", data, template);
if (data.type !== "template") return "";
if (!data.replacements) return "";
const replaced_string = formatString(template, Object.fromEntries(Object.entries(data.replacements).map(([key, value]) => [key, value.display])));
if (data.context) {
Expand Down
1 change: 1 addition & 0 deletions common/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export interface ObjectSettingField extends BaseSettingField {
export interface TemplateSettingField extends BaseSettingField {
type: "template";
default?: string;
multiline?: boolean;
replacements?: Record<
string,
{ display: string; description?: string; deprecated?: boolean }
Expand Down

0 comments on commit 318ccfd

Please sign in to comment.