diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2020-08-20 22:13:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-20 22:13:02 -0400 |
| commit | eedcd016f620e8e3fe939978becf496d77d4080c (patch) | |
| tree | b27caab4f3942b9e9f27eff7efc2bf6c468cca48 /electron/src/renderer/components | |
| parent | 4dcb07c3d801d033df94c2a400adc7ce163d2d4e (diff) | |
| parent | 6e34f5f7fc8598e564adf9b3e08e6cb4275923b5 (diff) | |
Merge pull request #793 from inkstitch/lexelby/install-extension-electron
migrate install extension to electron
Diffstat (limited to 'electron/src/renderer/components')
| -rw-r--r-- | electron/src/renderer/components/InstallPalettes.vue | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/electron/src/renderer/components/InstallPalettes.vue b/electron/src/renderer/components/InstallPalettes.vue new file mode 100644 index 00000000..85bf5578 --- /dev/null +++ b/electron/src/renderer/components/InstallPalettes.vue @@ -0,0 +1,109 @@ +<template> + <v-dialog max-width="500px" value="true"> + <v-card v-if="step == 'pick'" key="pick" rounded="lg" :loading="installing" :disabled="installing"> + <v-card-title> + <translate> + Install Palettes + </translate> + </v-card-title> + <v-card-text class="text--primary"> + <translate>Ink/Stitch can install palettes for Inkscape matching the thread colors from popular machine embroidery thread manufacturers. + </translate> + </v-card-text> + <v-file-input class="mb-3 mx-3" webkitdirectory hide-details v-model="path" + :label="$gettext('Choose Inkscape directory')"></v-file-input> + <v-card-actions> + <v-btn text color="primary" v-on:click="install"> + <v-icon>mdi-palette</v-icon> + <translate>Install</translate> + </v-btn> + <v-btn text color="primary" v-on:click="close"> + <translate>Cancel</translate> + </v-btn> + </v-card-actions> + </v-card> + <v-card v-if="step == 'done'" key="done"> + <v-card-title> + <translate> + Installation Completed + </translate> + </v-card-title> + <v-card-text class="text--primary"> + <translate> + Inkscape palettes have been installed. Please restart Inkscape to load the new palettes. + </translate> + </v-card-text> + <v-card-actions> + <v-btn text color="primary" v-on:click="close"> + Done + </v-btn> + </v-card-actions> + </v-card> + <v-card v-if="step == 'error'" key="error"> + <v-card-title> + <translate> + Installation Failed + </translate> + </v-card-title> + <v-card-text class="text--primary"> + <translate>Inkscape add-on installation failed</translate> + </v-card-text> + <v-card-text class="text--secondary"> + {{ error }} + </v-card-text> + <v-card-actions> + <v-btn text color="primary" v-on:click="retry"> + <translate>Try again</translate> + </v-btn> + <v-btn text color="primary" v-on:click="close"> + <translate>Cancel</translate> + </v-btn> + </v-card-actions> + </v-card> + </v-dialog> +</template> + +<script> +const inkStitch = require("../../lib/api") + +export default { + name: "InstallPalettes", + data: function () { + return { + path: null, + installing: false, + step: "pick", + error: null + } + }, + methods: { + install() { + this.installing = true + inkStitch.post('install/palettes', {path: this.path.path || this.path.name}).then(response => { + this.step = "done" + }).catch(error => { + this.step = "error" + this.error = error.response.data.error + }).then(() => { + this.installing = false + }) + }, + close() { + window.close() + }, + retry() { + this.installing = false + this.step = "pick" + } + }, + created: function () { + inkStitch.get("install/default-path").then(response => { + this.path = new File([""], response.data, {}) + }) + } +} +</script> + +<style scoped> + +</style> |
