Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc091b3e

Browse files
gitstart_botjschwartzentruber
gitstart_bot
authored andcommitted
Migrate Notification component to Vue3
1 parent750224d commitc091b3e

File tree

5 files changed

+176
-123
lines changed

5 files changed

+176
-123
lines changed

‎server/frontend/src/components/Notifications/BucketHit.vue‎

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
22
<divclass="row override-row">
33
<smallclass="col-md-1">
4-
Received {{ notification.timestamp | formatDate }}
4+
Received {{formatDate(notification.timestamp) }}
55
</small>
66
<spanclass="label label-info">Bucket hit</span>
77
<spanclass="description">
88
{{ notification.description }}
99
</span>
10-
<buttontype="button"class="close"v-on:click="dismiss">
10+
<buttontype="button"class="close"@click="dismiss">
1111
<spanaria-hidden="true"title="Dismiss">&times;</span>
1212
</button>
1313
<divclass="btn-group pull-right"role="group">
@@ -20,35 +20,41 @@
2020
</template>
2121

2222
<script>
23-
import {errorParser,formatClientTimestamp}from"../../helpers";
23+
import {defineComponent}from"vue";
2424
import*asapifrom"../../api";
25+
import {errorParser,formatClientTimestamp }from"../../helpers";
2526
26-
exportdefault {
27+
exportdefaultdefineComponent({
28+
name:"BucketHit",
2729
props: {
2830
notification: {
2931
type:Object,
3032
required:true,
3133
},
3234
},
33-
filters: {
34-
formatDate: formatClientTimestamp,
35-
},
36-
methods: {
37-
asyncdismiss() {
35+
setup(props, { emit }) {
36+
constdismiss=async ()=> {
3837
try {
39-
awaitapi.dismissNotification(this.notification.id);
40-
this.$emit("remove-notification",this.notification.id);
38+
awaitapi.dismissNotification(props.notification.id);
39+
emit("remove-notification",props.notification.id);
4140
}catch (err) {
42-
this.$emit(
41+
emit(
4342
"update-dismiss-error",
4443
`An error occurred while marking notification${
45-
this.notification.id
44+
props.notification.id
4645
} as read:${errorParser(err)}`,
4746
);
4847
}
49-
},
48+
};
49+
50+
return {
51+
dismiss,
52+
};
53+
},
54+
methods: {
55+
formatDate: formatClientTimestamp,
5056
},
51-
};
57+
});
5258
</script>
5359

5460
<style scoped>

‎server/frontend/src/components/Notifications/CoverageDrop.vue‎

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
<template>
22
<divclass="row override-row">
33
<smallclass="col-md-1">
4-
Received {{ notification.timestamp | formatDate }}
4+
Received {{formatDate(notification.timestamp) }}
55
</small>
66
<spanclass="label label-danger">Coverage drop</span>
77
<spanclass="description">
88
{{ notification.description }}
99
</span>
10-
<buttontype="button"class="close"v-on:click="dismiss">
10+
<buttontype="button"class="close"@click="dismiss">
1111
<spanaria-hidden="true"title="Dismiss">&times;</span>
1212
</button>
1313
<divclass="btn-group pull-right"role="group">
14-
<aclass="btn btn-default":href="notification.data.diff_url"
14+
<a
15+
v-if="notification.data?.diff_url"
16+
class="btn btn-default"
17+
:href="notification.data?.diff_url"
1518
>View diff</a
1619
>
1720
<aclass="btn btn-default":href="notification.actor_url"
@@ -22,35 +25,42 @@
2225
</template>
2326

2427
<script>
25-
import {errorParser,formatClientTimestamp}from"../../helpers";
28+
import {defineComponent}from"vue";
2629
import*asapifrom"../../api";
30+
import {errorParser,formatClientTimestamp }from"../../helpers";
2731
28-
exportdefault {
32+
exportdefaultdefineComponent({
33+
name:"CoverageDrop",
2934
props: {
3035
notification: {
3136
type:Object,
3237
required:true,
3338
},
3439
},
35-
filters: {
36-
formatDate: formatClientTimestamp,
37-
},
38-
methods: {
39-
asyncdismiss() {
40+
setup(props, { emit }) {
41+
console.log(JSON.parse(JSON.stringify(props.notification)));
42+
constdismiss=async ()=> {
4043
try {
41-
awaitapi.dismissNotification(this.notification.id);
42-
this.$emit("remove-notification",this.notification.id);
44+
awaitapi.dismissNotification(props.notification.id);
45+
emit("remove-notification",props.notification.id);
4346
}catch (err) {
44-
this.$emit(
47+
emit(
4548
"update-dismiss-error",
4649
`An error occurred while marking notification${
47-
this.notification.id
50+
props.notification.id
4851
} as read:${errorParser(err)}`,
4952
);
5053
}
51-
},
54+
};
55+
56+
return {
57+
dismiss,
58+
};
59+
},
60+
methods: {
61+
formatDate: formatClientTimestamp,
5262
},
53-
};
63+
});
5464
</script>
5565

5666
<style scoped>

‎server/frontend/src/components/Notifications/InaccessibleBug.vue‎

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
22
<divclass="row override-row">
33
<smallclass="col-md-1">
4-
Received {{ notification.timestamp | formatDate }}
4+
Received {{formatDate(notification.timestamp) }}
55
</small>
66
<spanclass="label label-danger">Inaccessible bug</span>
77
<spanclass="description">
88
{{ notification.description }}
99
</span>
10-
<buttontype="button"class="close"v-on:click="dismiss">
10+
<buttontype="button"class="close"@click="dismiss">
1111
<spanaria-hidden="true"title="Dismiss">&times;</span>
1212
</button>
1313
<a
@@ -21,35 +21,43 @@
2121
</template>
2222

2323
<script>
24-
import {errorParser,formatClientTimestamp}from"../../helpers";
24+
import {defineComponent}from"vue";
2525
import*asapifrom"../../api";
26+
import {errorParser,formatClientTimestamp }from"../../helpers";
2627
27-
exportdefault {
28+
exportdefaultdefineComponent({
29+
name:"InaccessibleBug",
2830
props: {
2931
notification: {
3032
type:Object,
3133
required:true,
3234
},
3335
},
34-
filters: {
35-
formatDate: formatClientTimestamp,
36-
},
37-
methods: {
38-
asyncdismiss() {
36+
setup(props, { emit }) {
37+
constformatDate= (timestamp)=> {
38+
returnformatClientTimestamp(timestamp);
39+
};
40+
41+
constdismiss=async ()=> {
3942
try {
40-
awaitapi.dismissNotification(this.notification.id);
41-
this.$emit("remove-notification",this.notification.id);
43+
awaitapi.dismissNotification(props.notification.id);
44+
emit("remove-notification",props.notification.id);
4245
}catch (err) {
43-
this.$emit(
46+
emit(
4447
"update-dismiss-error",
4548
`An error occurred while marking notification${
46-
this.notification.id
49+
props.notification.id
4750
} as read:${errorParser(err)}`,
4851
);
4952
}
50-
},
53+
};
54+
55+
return {
56+
formatDate,
57+
dismiss,
58+
};
5159
},
52-
};
60+
});
5361
</script>
5462

5563
<style scoped>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp