@enso-ui/users 2.0.21 → 2.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/src/bulma/components/navbar/ProfileControl.vue +1 -1
- package/src/bulma/pages/users/components/Avatar.vue +18 -5
- package/src/bulma/pages/users/components/Tokens.vue +1 -1
- package/src/bulma/pages/users/components/Url.vue +63 -0
- package/src/bulma/pages/users/components/UserProfile.vue +9 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enso-ui/users",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.24",
|
|
4
4
|
"description": "Basic users package",
|
|
5
5
|
"main": "bulma/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"@enso-ui/confirmation": "^2.0",
|
|
27
27
|
"@enso-ui/directives": "^2.0",
|
|
28
28
|
"@enso-ui/divider": "^2.0",
|
|
29
|
-
"@enso-ui/files": "^4.0",
|
|
30
29
|
"@enso-ui/forms": "^3.0",
|
|
31
30
|
"@enso-ui/modal": "^3.0",
|
|
32
31
|
"@enso-ui/tables": "^3.0",
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<figure class="image avatar"
|
|
2
|
+
<figure class="image avatar"
|
|
3
|
+
v-tooltip="label"
|
|
4
|
+
:key="avatarKey">
|
|
3
5
|
<img class="is-rounded"
|
|
4
6
|
:src="link">
|
|
5
7
|
</figure>
|
|
6
8
|
</template>
|
|
7
9
|
|
|
8
10
|
<script>
|
|
11
|
+
import 'v-tooltip/dist/v-tooltip.css';
|
|
12
|
+
import { VTooltip } from 'v-tooltip';
|
|
13
|
+
import { mapState } from 'vuex';
|
|
9
14
|
|
|
10
15
|
export default {
|
|
11
16
|
name: 'Avatar',
|
|
12
17
|
|
|
18
|
+
directives: { tooltip: VTooltip },
|
|
19
|
+
|
|
13
20
|
inject: ['route'],
|
|
14
21
|
|
|
15
22
|
props: {
|
|
23
|
+
tooltip: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false,
|
|
26
|
+
},
|
|
16
27
|
user: {
|
|
17
28
|
type: Object,
|
|
18
29
|
required: true,
|
|
@@ -20,13 +31,15 @@ export default {
|
|
|
20
31
|
},
|
|
21
32
|
|
|
22
33
|
computed: {
|
|
34
|
+
...mapState(['avatarKey']),
|
|
35
|
+
label() {
|
|
36
|
+
return this.tooltip
|
|
37
|
+
? this.user.person?.appellative ?? this.user.person?.name
|
|
38
|
+
: null;
|
|
39
|
+
},
|
|
23
40
|
link() {
|
|
24
41
|
return this.route('core.avatars.show', this.user.avatar.id);
|
|
25
42
|
},
|
|
26
|
-
tooltip() {
|
|
27
|
-
return this.user.person?.appellative
|
|
28
|
-
?? this.user.person?.name;
|
|
29
|
-
},
|
|
30
43
|
},
|
|
31
44
|
};
|
|
32
45
|
</script>
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
import { FontAwesomeIcon as Fa } from '@fortawesome/vue-fontawesome';
|
|
63
63
|
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
64
64
|
import { faPlus, faSync, faSearch } from '@fortawesome/free-solid-svg-icons';
|
|
65
|
-
import { Url } from '
|
|
65
|
+
import { Url } from './Url.vue';
|
|
66
66
|
import Token from './Token.vue';
|
|
67
67
|
import TokenForm from './TokenForm.vue';
|
|
68
68
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<modal v-if="show">
|
|
3
|
+
<div class="box">
|
|
4
|
+
<div class="field has-addons">
|
|
5
|
+
<div class="control is-expanded">
|
|
6
|
+
<input class="input"
|
|
7
|
+
:value="link"
|
|
8
|
+
v-select-on-focus
|
|
9
|
+
v-focus>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="control">
|
|
12
|
+
<a class="button"
|
|
13
|
+
@click="copy">
|
|
14
|
+
<span class="icon is-small">
|
|
15
|
+
<fa icon="copy"/>
|
|
16
|
+
</span>
|
|
17
|
+
</a>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<clipboard ref="clipboard"/>
|
|
21
|
+
</div>
|
|
22
|
+
</modal>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import { FontAwesomeIcon as Fa } from '@fortawesome/vue-fontawesome';
|
|
27
|
+
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
28
|
+
import { faCopy } from '@fortawesome/free-solid-svg-icons';
|
|
29
|
+
import { focus, selectOnFocus } from '@enso-ui/directives';
|
|
30
|
+
import { Modal } from '@enso-ui/modal/bulma';
|
|
31
|
+
import Clipboard from '@enso-ui/clipboard';
|
|
32
|
+
|
|
33
|
+
library.add(faCopy);
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
name: 'Url',
|
|
37
|
+
|
|
38
|
+
directives: { focus, selectOnFocus },
|
|
39
|
+
|
|
40
|
+
components: { Clipboard, Fa, Modal },
|
|
41
|
+
|
|
42
|
+
inject: ['i18n', 'toastr'],
|
|
43
|
+
|
|
44
|
+
props: {
|
|
45
|
+
show: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
link: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
methods: {
|
|
57
|
+
copy() {
|
|
58
|
+
this.$refs.clipboard.copy(this.link);
|
|
59
|
+
this.toastr.success(this.i18n('Copied to clipboard'));
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
@@ -14,15 +14,13 @@
|
|
|
14
14
|
<divider class="my-2"/>
|
|
15
15
|
<div class="columns mt-3">
|
|
16
16
|
<div class="column">
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
:src="route('core.avatars.show', avatarId)">
|
|
20
|
-
</figure>
|
|
17
|
+
<avatar class="is-128x128"
|
|
18
|
+
:user="isSelfVisiting ? user : profile"/>
|
|
21
19
|
<div class="field is-grouped is-justify-content-center mt-3">
|
|
22
20
|
<p class="control">
|
|
23
21
|
<a class="button is-primary"
|
|
24
22
|
v-if="isSelfVisiting"
|
|
25
|
-
@click="
|
|
23
|
+
@click="generateAvatar">
|
|
26
24
|
<span class="icon">
|
|
27
25
|
<fa icon="sync-alt"/>
|
|
28
26
|
</span>
|
|
@@ -32,7 +30,7 @@
|
|
|
32
30
|
</a>
|
|
33
31
|
</p>
|
|
34
32
|
<p class="control">
|
|
35
|
-
<enso-uploader @upload-successful="
|
|
33
|
+
<enso-uploader @upload-successful="updateAvatar"
|
|
36
34
|
:url="route('core.avatars.store')"
|
|
37
35
|
file-key="avatar"
|
|
38
36
|
v-if="isSelfVisiting">
|
|
@@ -155,6 +153,7 @@ import { library } from '@fortawesome/fontawesome-svg-core';
|
|
|
155
153
|
import {
|
|
156
154
|
faUser, faUserCircle, faSyncAlt, faTrashAlt, faUpload, faSignOutAlt, faPencilAlt,
|
|
157
155
|
} from '@fortawesome/free-solid-svg-icons';
|
|
156
|
+
import Avatar from '@enso-ui/users/src/bulma/pages/users/components/Avatar.vue';
|
|
158
157
|
import { EnsoUploader } from '@enso-ui/uploader/bulma';
|
|
159
158
|
import eventBus from '@enso-ui/ui/src/core/services/eventBus';
|
|
160
159
|
import Divider from '@enso-ui/divider';
|
|
@@ -165,7 +164,7 @@ library.add(faUser, faUserCircle, faSyncAlt, faTrashAlt, faUpload, faSignOutAlt,
|
|
|
165
164
|
export default {
|
|
166
165
|
name: 'UserProfile',
|
|
167
166
|
|
|
168
|
-
components: { Divider, Fa, EnsoUploader },
|
|
167
|
+
components: { Avatar, Divider, Fa, EnsoUploader },
|
|
169
168
|
|
|
170
169
|
inject: [
|
|
171
170
|
'canAccess', 'errorHandler', 'http', 'i18n',
|
|
@@ -186,11 +185,6 @@ export default {
|
|
|
186
185
|
isSelfVisiting() {
|
|
187
186
|
return this.user.id === this.profile.id;
|
|
188
187
|
},
|
|
189
|
-
avatarId() {
|
|
190
|
-
return this.isSelfVisiting
|
|
191
|
-
? this.user.avatar.id
|
|
192
|
-
: this.profile.avatar.id;
|
|
193
|
-
},
|
|
194
188
|
},
|
|
195
189
|
|
|
196
190
|
created() {
|
|
@@ -200,7 +194,7 @@ export default {
|
|
|
200
194
|
},
|
|
201
195
|
|
|
202
196
|
methods: {
|
|
203
|
-
...mapMutations(['
|
|
197
|
+
...mapMutations(['updateAvatar']),
|
|
204
198
|
dateFormat(date) {
|
|
205
199
|
return date
|
|
206
200
|
? format(date, this.meta.dateFormat)
|
|
@@ -214,9 +208,9 @@ export default {
|
|
|
214
208
|
startImpersonating() {
|
|
215
209
|
eventBus.$emit('start-impersonating', this.profile.id);
|
|
216
210
|
},
|
|
217
|
-
|
|
211
|
+
generateAvatar() {
|
|
218
212
|
this.http.patch(this.route('core.avatars.update', this.user.avatar.id))
|
|
219
|
-
.then(
|
|
213
|
+
.then(this.updateAvatar)
|
|
220
214
|
.catch(this.errorHandler);
|
|
221
215
|
},
|
|
222
216
|
},
|
|
@@ -224,10 +218,6 @@ export default {
|
|
|
224
218
|
</script>
|
|
225
219
|
|
|
226
220
|
<style lang="scss" scoped>
|
|
227
|
-
.avatar {
|
|
228
|
-
margin: auto;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
221
|
.controls, .details {
|
|
232
222
|
justify-content: center;
|
|
233
223
|
}
|