Skip to content

Commit 5b207fc

Browse files
authored
Merge pull request Stigmatoz#113 from Stigmatoz/remove-all-data
Remove all data
2 parents 6325429 + 1785130 commit 5b207fc

File tree

13 files changed

+165
-2
lines changed

13 files changed

+165
-2
lines changed

src/_locales/de/messages.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,5 +235,18 @@
235235
"enjoyAndReview": {
236236
"message": "Genießen Sie die Erweiterung?",
237237
"description": "Bewerten Web Activity Time Tracker"
238+
},
239+
"removeAllData": {
240+
"message": "Alle Daten entfernen",
241+
"description": "Sie können alle Daten und Statistiken der besuchten Websites für immer löschen."
242+
},
243+
"remove": {
244+
"message": "Entfernen"
245+
},
246+
"removeAllDataConfirm": {
247+
"message": "Sind Sie sicher, dass Sie alle Daten löschen möchten?"
248+
},
249+
"cancel": {
250+
"message": "Annullierung"
238251
}
239252
}

src/_locales/en/messages.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,5 +235,18 @@
235235
"enjoyAndReview": {
236236
"message": "Enjoying the extension?",
237237
"description": "Rate Web Activity Time Tracker"
238+
},
239+
"removeAllData": {
240+
"message": "Remove all data",
241+
"description": "You can delete all data and statistics of visited websites for all time"
242+
},
243+
"remove": {
244+
"message": "Remove"
245+
},
246+
"removeAllDataConfirm": {
247+
"message": "Are you sure you want to delete all data?"
248+
},
249+
"cancel": {
250+
"message": "Cancel"
238251
}
239252
}

src/_locales/ru/messages.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,5 +235,18 @@
235235
"enjoyAndReview": {
236236
"message": "Вам нравится расширение?",
237237
"description": "Оцените Web Activity Time Tracker"
238+
},
239+
"removeAllData": {
240+
"message": "Удалить все данные",
241+
"description": "Вы можете удалить все данные и статистику посещенных сайтов за все время"
242+
},
243+
"remove": {
244+
"message": "Удалить"
245+
},
246+
"removeAllDataConfirm": {
247+
"message": "Вы уверены, что хотите удалить все данные, включая статистику посещенных сайтов?"
248+
},
249+
"cancel": {
250+
"message": "Отмена"
238251
}
239252
}

src/assets/css/general.css

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,58 @@ input[type='button']:hover {
7979
text-decoration: none;
8080
}
8181

82+
input[type='button'].alert {
83+
background: #fe5c5c !important;
84+
}
85+
86+
input[type='button'].info {
87+
background: #ffffff !important;
88+
color: black;
89+
border: 1px solid black;
90+
}
91+
8292
input[type='button'][disabled] {
8393
border: 1px solid #999999;
8494
background-color: #cccccc;
8595
color: #666666;
8696
}
97+
.modal {
98+
display: block;
99+
position: fixed;
100+
z-index: 1;
101+
left: 0;
102+
top: 0;
103+
width: 100%;
104+
height: 100%;
105+
overflow: auto;
106+
background-color: rgb(0,0,0);
107+
background-color: rgba(0,0,0,0.4);
108+
}
109+
110+
.modal-content {
111+
background-color: #fefefe;
112+
margin: 15% auto;
113+
padding: 20px;
114+
border: 1px solid #888;
115+
width: 40%;
116+
border-radius: 10px;
117+
}
118+
119+
.modal-content p{
120+
font-size: 18px;
121+
font-weight: 600;
122+
}
123+
124+
.close {
125+
color: #aaa;
126+
float: right;
127+
font-size: 28px;
128+
font-weight: bold;
129+
}
130+
131+
.close:hover,
132+
.close:focus {
133+
color: black;
134+
text-decoration: none;
135+
cursor: pointer;
136+
}

src/assets/icons/dashboard.svg

Lines changed: 5 additions & 1 deletion
Loading

src/assets/icons/settings.svg

Lines changed: 4 additions & 1 deletion
Loading

src/components/GeneralSettings.vue

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,25 @@
8181
<input type="button" :value="t('exportToCsv.message')" @click="exportToCsv()" />
8282
</div>
8383
</div>
84+
<div class="settings-item">
85+
<label class="setting-header d-inline-block">{{ t('removeAllData.message') }}</label>
86+
<p class="description">{{ t('removeAllData.description') }}</p>
87+
<input type="button" :value="t('remove.message')" @click="removeAll()" />
88+
</div>
89+
<div id="removeAllConfirmModal" class="modal" v-if="needToConfirmDeleteAllData">
90+
<div class="modal-content">
91+
<p class="text-center">{{ t('removeAllDataConfirm.message') }}</p>
92+
<div class="text-center">
93+
<input
94+
type="button"
95+
class="alert"
96+
:value="t('remove.message')"
97+
@click="removeAllConfirm()"
98+
/>
99+
<input type="button" class="info ml-10" :value="t('cancel.message')" @click="cancel()" />
100+
</div>
101+
</div>
102+
</div>
84103
</template>
85104

86105
<script lang="ts">
@@ -105,6 +124,7 @@ import {
105124
import { ranges, ThisWeekRange } from '../utils/date';
106125
import { useImportToCsv } from '../compositions/toCsv';
107126
import { FileType, useFile } from '../compositions/loadFile';
127+
import { removeAllData } from '../compositions/remove-all-data';
108128
109129
const { t } = useI18n();
110130
@@ -119,6 +139,8 @@ const selectedDate = ref<Date[]>();
119139
120140
const presetRanges = ranges();
121141
142+
const needToConfirmDeleteAllData = ref<boolean>();
143+
122144
onMounted(async () => {
123145
viewTimeInBadge.value = await settingsStorage.getValue(
124146
StorageParams.VIEW_TIME_IN_BADGE,
@@ -169,6 +191,19 @@ async function exportToCsv() {
169191
);
170192
}
171193
}
194+
195+
async function removeAll() {
196+
needToConfirmDeleteAllData.value = true;
197+
}
198+
199+
async function removeAllConfirm() {
200+
await removeAllData();
201+
needToConfirmDeleteAllData.value = false;
202+
}
203+
204+
function cancel() {
205+
needToConfirmDeleteAllData.value = false;
206+
}
172207
</script>
173208

174209
<style scoped>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Browser from 'webextension-polyfill';
2+
import { injecStorage } from '../storage/inject-storage';
3+
import { Messages } from '../utils/messages';
4+
5+
export async function removeAllData() {
6+
const storage = injecStorage();
7+
await storage.saveIntervalList([]);
8+
9+
Browser.runtime.sendMessage(Messages.ClearAllData);
10+
}

src/pages/Block.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<img class="favicon" height="35" :src="favicon" />
1212
<span>{{ webSite }}</span>
1313
</div>
14+
<p class="source-url">{{ sourceUrl }}</p>
1415
<table>
1516
<tr>
1617
<td class="title">{{ t('limit.message') }}:</td>
@@ -145,4 +146,9 @@ table .value {
145146
.favicon {
146147
margin: 0 10px;
147148
}
149+
.source-url {
150+
margin: 5px;
151+
font-size: 14px !important;
152+
color: grey;
153+
}
148154
</style>

src/repository/tabs-repository-interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Tab } from '../entity/tab';
22

33
export interface ITabsRepository {
44
getTabs(): Tab[];
5+
removeAllTabs(): void;
56
getTodayTabs(): Tab[];
67
getTab(domain: string): Tab | undefined;
78
addTab(domain: string, favicon: string | undefined): Promise<Tab | undefined>;

0 commit comments

Comments
 (0)