|
72 | 72 | </template> |
73 | 73 |
|
74 | 74 | <script lang="ts"> |
75 | | -import path from 'path'; |
76 | | -import { namespace } from 'vuex-class'; |
77 | | -import { polykeyClient } from '@/store'; |
78 | | -import { Component, Vue, Prop } from 'vue-property-decorator'; |
79 | | -import { getConfiguration } from '@/store/modules/Configuration'; |
80 | | -// const remote = window.require('electron').remote; |
81 | | -// const { app, dialog, getCurrentWindow } = remote; |
82 | | -// const fs = remote.require('fs'); |
| 75 | +import { defineComponent } from 'vue' |
83 | 76 |
|
84 | | -const alert = namespace('Alert'); |
| 77 | +export default defineComponent({ |
| 78 | + setup () { |
| 79 | + return { |
| 80 | + openFileDialog: () => {} |
| 81 | + } |
| 82 | + } |
| 83 | +}) |
| 84 | +// import path from 'path'; |
| 85 | +// import { namespace } from 'vuex-class'; |
| 86 | +// import { polykeyClient } from '@/store'; |
| 87 | +// import { Component, Vue, Prop } from 'vue-property-decorator'; |
| 88 | +// import { getConfiguration } from '@/store/modules/Configuration'; |
| 89 | +// // const remote = window.require('electron').remote; |
| 90 | +// // const { app, dialog, getCurrentWindow } = remote; |
| 91 | +// // const fs = remote.require('fs'); |
85 | 92 |
|
86 | | -// const namingRule = name => |
87 | | -// /^\b[\w]+(?:['-]?[\w]+)*\b$/.test(name) || !name || 'Name must only contain letters, numbers and hyphens'; |
88 | | -const emailRule = email => |
89 | | - /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.test( |
90 | | - email, |
91 | | - ) || |
92 | | - !email || |
93 | | - 'Email is invalid'; |
| 93 | +// const alert = namespace('Alert'); |
94 | 94 |
|
95 | | -@Component({}) |
96 | | -export default class NewSecret extends Vue { |
97 | | - @alert.Action |
98 | | - public toggleAlert!: (props: { visible: boolean; message?: string }) => void; |
| 95 | +// // const namingRule = name => |
| 96 | +// // /^\b[\w]+(?:['-]?[\w]+)*\b$/.test(name) || !name || 'Name must only contain letters, numbers and hyphens'; |
| 97 | +// const emailRule = email => |
| 98 | +// /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.test( |
| 99 | +// email, |
| 100 | +// ) || |
| 101 | +// !email || |
| 102 | +// 'Email is invalid'; |
99 | 103 |
|
100 | | - valid = false; |
101 | | - fullName = ''; |
102 | | - nameRules = []; |
103 | | - email = ''; |
104 | | - emailRules = [emailRule]; |
105 | | - passphrase = ''; |
106 | | - // passphraseRules = [passphrase => passphrase || 'Passphrase is required']; |
107 | | - passphraseRules = []; |
| 104 | +// @Component({}) |
| 105 | +// export default class NewSecret extends Vue { |
| 106 | +// @alert.Action |
| 107 | +// public toggleAlert!: (props: { visible: boolean; message?: string }) => void; |
108 | 108 |
|
109 | | - // nodePath: string = path.join(app.getPath('home'), '.polykey'); |
110 | | - // nodePathRules = [ |
111 | | - // path => !fs.existsSync(path) || fs.readdirSync(path).length == 0 || 'Path already exists and is not empty', |
112 | | - // ]; |
| 109 | +// valid = false; |
| 110 | +// fullName = ''; |
| 111 | +// nameRules = []; |
| 112 | +// email = ''; |
| 113 | +// emailRules = [emailRule]; |
| 114 | +// passphrase = ''; |
| 115 | +// // passphraseRules = [passphrase => passphrase || 'Passphrase is required']; |
| 116 | +// passphraseRules = []; |
113 | 117 |
|
114 | | - validate(): boolean { |
115 | | - return (<any>this.$refs.newKeyNodeForm).validate(); |
116 | | - } |
117 | | - reset() { |
118 | | - (<any>this.$refs.newKeyNodeForm).reset(); |
119 | | - } |
120 | | - resetValidation() { |
121 | | - this.reset(); |
122 | | - } |
123 | | - async newKeyNode() { |
124 | | - // TODO: remove this as you no longer have to create a node |
125 | | - } |
| 118 | +// // nodePath: string = path.join(app.getPath('home'), '.polykey'); |
| 119 | +// // nodePathRules = [ |
| 120 | +// // path => !fs.existsSync(path) || fs.readdirSync(path).length == 0 || 'Path already exists and is not empty', |
| 121 | +// // ]; |
126 | 122 |
|
127 | | - cancel() { |
128 | | - this.$router.back(); |
129 | | - } |
| 123 | +// validate(): boolean { |
| 124 | +// return (<any>this.$refs.newKeyNodeForm).validate(); |
| 125 | +// } |
| 126 | +// reset() { |
| 127 | +// (<any>this.$refs.newKeyNodeForm).reset(); |
| 128 | +// } |
| 129 | +// resetValidation() { |
| 130 | +// this.reset(); |
| 131 | +// } |
| 132 | +// async newKeyNode() { |
| 133 | +// // TODO: remove this as you no longer have to create a node |
| 134 | +// } |
130 | 135 |
|
131 | | - async openFileDialog() { |
132 | | - //Synchronous |
133 | | - // const result = await dialog.showOpenDialog(getCurrentWindow(), { |
134 | | - // title: 'Select New Key Node Location', |
135 | | - // defaultPath: this.nodePath, |
136 | | - // buttonLabel: 'Select', |
137 | | - // properties: ['openDirectory', 'createDirectory', 'showHiddenFiles', 'promptToCreate'], |
138 | | - // }); |
139 | | - // if (!result.canceled) { |
140 | | - // this.nodePath = result.filePaths[0]; |
141 | | - // } |
142 | | - // console.log(result.bookmarks); |
143 | | - // console.log(result.filePaths); |
144 | | - } |
145 | | -} |
| 136 | +// cancel() { |
| 137 | +// this.$router.back(); |
| 138 | +// } |
| 139 | +
|
| 140 | +// async openFileDialog() { |
| 141 | +// //Synchronous |
| 142 | +// // const result = await dialog.showOpenDialog(getCurrentWindow(), { |
| 143 | +// // title: 'Select New Key Node Location', |
| 144 | +// // defaultPath: this.nodePath, |
| 145 | +// // buttonLabel: 'Select', |
| 146 | +// // properties: ['openDirectory', 'createDirectory', 'showHiddenFiles', 'promptToCreate'], |
| 147 | +// // }); |
| 148 | +// // if (!result.canceled) { |
| 149 | +// // this.nodePath = result.filePaths[0]; |
| 150 | +// // } |
| 151 | +// // console.log(result.bookmarks); |
| 152 | +// // console.log(result.filePaths); |
| 153 | +// } |
| 154 | +// } |
146 | 155 | </script> |
147 | 156 |
|
148 | 157 | <style scoped> |
|
0 commit comments