mirror of https://github.com/Lissy93/dashy.git
🔥 Replaces old export code, with new export modal
This commit is contained in:
parent
269e6a93bf
commit
2876357297
|
@ -4,7 +4,7 @@
|
||||||
<div class="main-options-container">
|
<div class="main-options-container">
|
||||||
<div class="config-buttons">
|
<div class="config-buttons">
|
||||||
<h2>Configuration Options</h2>
|
<h2>Configuration Options</h2>
|
||||||
<a class="hyperlink-wrapper" @click="downloadConfigFile('conf.yml', yaml)">
|
<a class="hyperlink-wrapper" @click="openExportConfigModal()">
|
||||||
<button class="config-button center">
|
<button class="config-button center">
|
||||||
<DownloadIcon class="button-icon"/>
|
<DownloadIcon class="button-icon"/>
|
||||||
{{ $t('config.download-config-button') }}
|
{{ $t('config.download-config-button') }}
|
||||||
|
@ -134,9 +134,8 @@ export default {
|
||||||
openLanguageSwitchModal() {
|
openLanguageSwitchModal() {
|
||||||
this.$modal.show(modalNames.LANG_SWITCHER);
|
this.$modal.show(modalNames.LANG_SWITCHER);
|
||||||
},
|
},
|
||||||
copyConfigToClipboard() {
|
openExportConfigModal() {
|
||||||
navigator.clipboard.writeText(this.jsonParser(this.config));
|
this.$modal.show(modalNames.EXPORT_CONFIG_MENU);
|
||||||
this.$toasted.show(this.$t('config.data-copied-msg'));
|
|
||||||
},
|
},
|
||||||
/* Checks that the user is sure, then resets site-wide local storage, and reloads page */
|
/* Checks that the user is sure, then resets site-wide local storage, and reloads page */
|
||||||
resetLocalSettings() {
|
resetLocalSettings() {
|
||||||
|
@ -151,16 +150,6 @@ export default {
|
||||||
}, 1900);
|
}, 1900);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* Generates a new file, with the YAML contents, and triggers a download */
|
|
||||||
downloadConfigFile(filename, filecontents) {
|
|
||||||
const element = document.createElement('a');
|
|
||||||
element.setAttribute('href', `data:text/plain;charset=utf-8, ${encodeURIComponent(filecontents)}`);
|
|
||||||
element.setAttribute('download', filename);
|
|
||||||
element.style.display = 'none';
|
|
||||||
document.body.appendChild(element);
|
|
||||||
element.click();
|
|
||||||
document.body.removeChild(element);
|
|
||||||
},
|
|
||||||
getLanguage() {
|
getLanguage() {
|
||||||
const lang = getUsersLanguage();
|
const lang = getUsersLanguage();
|
||||||
return lang ? `${lang.flag} ${lang.name}` : '';
|
return lang ? `${lang.flag} ${lang.name}` : '';
|
||||||
|
|
Loading…
Reference in New Issue