Skip to content

Commit 0289d21

Browse files
author
sheepzh
committed
Delete code lines of archive function (#141)
1 parent e0e4021 commit 0289d21

File tree

10 files changed

+8
-247
lines changed

10 files changed

+8
-247
lines changed

src/app/locale/components/data-manage.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export type DataManageMessage = {
1818
filterTime: string
1919
filterDate: string
2020
unlimited: string
21-
archiveAlert: string
2221
dateShortcut: {
2322
tillYesterday: string
2423
till7DaysAgo: string
@@ -27,8 +26,6 @@ export type DataManageMessage = {
2726
paramError: string
2827
deleteConfirm: string
2928
deleteSuccess: string
30-
archiveConfirm: string
31-
archiveSuccess: string
3229
migrationAlert: string
3330
importError: string
3431
migrated: string
@@ -48,7 +45,6 @@ const _default: Messages<DataManageMessage> = {
4845
filterTime: '当日打开次数在 {start} 次至 {end} 次之间。',
4946
filterDate: '{picker} 产生的数据。',
5047
unlimited: '无限',
51-
archiveAlert: '归档后的数据不再按天统计,将累加至域名的归档数据中。',
5248
dateShortcut: {
5349
tillYesterday: '直到昨天',
5450
till7DaysAgo: '直到7天前',
@@ -57,8 +53,6 @@ const _default: Messages<DataManageMessage> = {
5753
paramError: '参数错误,请检查!',
5854
deleteConfirm: '共筛选出 {count} 条数据,是否全部删除?',
5955
deleteSuccess: '删除成功',
60-
archiveConfirm: '共筛选出 {count} 条数据,是否全部归档?',
61-
archiveSuccess: '归档成功',
6256
migrationAlert: '使用导入/导出在不同浏览器之间迁移数据',
6357
importError: '文件格式错误',
6458
migrated: '成功导入',
@@ -76,7 +70,6 @@ const _default: Messages<DataManageMessage> = {
7670
filterTime: '當日打開次數在 {start} 次至 {end} 次之間。',
7771
filterDate: '{picker} 産生的數據。',
7872
unlimited: '無限',
79-
archiveAlert: '歸檔後的數據不再按天統計,將累加至域名的歸檔數據中。',
8073
dateShortcut: {
8174
tillYesterday: '直到昨天',
8275
till7DaysAgo: '直到7天前',
@@ -85,8 +78,6 @@ const _default: Messages<DataManageMessage> = {
8578
paramError: '參數錯誤,請檢查!',
8679
deleteConfirm: '共篩選出 {count} 條數據,是否全部刪除?',
8780
deleteSuccess: '刪除成功',
88-
archiveConfirm: '共篩選出 {count} 條數據,是否全部歸檔?',
89-
archiveSuccess: '歸檔成功',
9081
migrationAlert: '使用導入/導出在不同瀏覽器之間遷移數據',
9182
importError: '文件格式錯誤',
9283
migrated: '成功導入',
@@ -104,7 +95,6 @@ const _default: Messages<DataManageMessage> = {
10495
filterTime: 'The number of visits for the day is between {start} and {end}',
10596
filterDate: 'Recorded between {picker}',
10697
unlimited: '∞',
107-
archiveAlert: 'Archived records are cumulative, not daily.',
10898
dateShortcut: {
10999
tillYesterday: 'Until yesterday',
110100
till7DaysAgo: 'Until 7 days ago',
@@ -113,8 +103,6 @@ const _default: Messages<DataManageMessage> = {
113103
paramError: 'The parameter is wrong, please check!',
114104
deleteConfirm: 'A total of {count} records have been filtered out. Do you want to delete them all?',
115105
deleteSuccess: 'Deleted successfully!',
116-
archiveConfirm: 'A total of {count} records have been filtered out. Do you want to archive them all?',
117-
archiveSuccess: 'Archived successfully!',
118106
migrationAlert: 'Migrate data between browsers using import and export',
119107
importError: 'Wrong file extension',
120108
migrated: 'Imported successfully!',
@@ -132,7 +120,6 @@ const _default: Messages<DataManageMessage> = {
132120
filterTime: '当日のオープン数は {start} から {end} の間です。',
133121
filterDate: '{picker} までに生成されたデータ',
134122
unlimited: '無制限',
135-
archiveAlert: 'アーカイブされたデータは毎日カウントされなくなり、ドメイン名のアーカイブされたデータに追加されます。',
136123
dateShortcut: {
137124
tillYesterday: '昨日まで',
138125
till7DaysAgo: '7日前まで',
@@ -141,8 +128,6 @@ const _default: Messages<DataManageMessage> = {
141128
paramError: 'パラメータエラー、確認してください!',
142129
deleteConfirm: '合計 {count} 個のデータが除外されました。すべて削除しますか?',
143130
deleteSuccess: '正常に削除されました',
144-
archiveConfirm: '合計 {count} 個のデータが除外されました。それらはすべてアーカイブされていますか?',
145-
archiveSuccess: '正常にアーカイブされました',
146131
migrationAlert: 'インポート/エクスポートを使用して、異なるブラウザ間でデータを移行します',
147132
importError: 'ファイル形式エラー',
148133
migrated: '正常にインポートされました',

src/background/version-manager/1-3-0/archived-data-cleaner.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/background/version-manager/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import IVersionProcessor from "./i-version-processor"
99
import HostMergeInitializer from "./0-1-2/host-merge-initializer"
1010
import LocalFileInitializer from "./0-7-0/local-file-initializer"
11-
import ArchivedDataCleaner from "./1-3-0/archived-data-cleaner"
1211

1312
/**
1413
* Version manager
@@ -22,7 +21,6 @@ class VersionManager {
2221
this.processorChain.push(
2322
new HostMergeInitializer(),
2423
new LocalFileInitializer(),
25-
new ArchivedDataCleaner(),
2624
)
2725
this.processorChain = this.processorChain.sort((a, b) => a.since() >= b.since() ? 1 : 0)
2826
}

src/database/archived-database.ts

Lines changed: 0 additions & 114 deletions
This file was deleted.

src/database/common/constant.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
* https://opensource.org/licenses/MIT
66
*/
77

8-
/**
9-
* The prefix of archived data
10-
*
11-
* @since 0.0.9
12-
*/
13-
export const ARCHIVED_PREFIX = '_a_'
14-
158
/**
169
* Prefix of remain words
1710
*

src/database/timer-database.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { log } from "../common/logger"
99
import { formatTime } from "@util/time"
1010
import BaseDatabase from "./common/base-database"
11-
import { ARCHIVED_PREFIX, DATE_FORMAT, REMAIN_WORD_PREFIX } from "./common/constant"
11+
import { DATE_FORMAT, REMAIN_WORD_PREFIX } from "./common/constant"
1212
import { createZeroResult, mergeResult, isNotZeroResult } from "@util/stat"
1313

1414
export type TimerCondition = {
@@ -131,7 +131,12 @@ class TimerDatabase extends BaseDatabase {
131131
const result = await this.storage.get(null)
132132
const items = {}
133133
Object.entries(result)
134-
.filter(([key]) => !key.startsWith(REMAIN_WORD_PREFIX) && !key.startsWith(ARCHIVED_PREFIX))
134+
.filter(([key]) =>
135+
!key.startsWith(REMAIN_WORD_PREFIX)
136+
// The prefix of archived data, historical issues
137+
// todo: delete this line
138+
&& !key.startsWith('_a_')
139+
)
135140
.forEach(([key, value]) => items[key] = value)
136141
return Promise.resolve(items)
137142
}

src/service/timer-service.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
import TimerDatabase, { TimerCondition } from "@db/timer-database"
9-
import ArchivedDatabase from "@db/archived-database"
109
import { log } from "../common/logger"
1110
import CustomizedHostMergeRuler from "./components/host-merge-ruler"
1211
import MergeRuleDatabase from "@db/merge-rule-database"
@@ -22,7 +21,6 @@ import { getBirthday } from "@util/time"
2221
const storage = chrome.storage.local
2322

2423
const timerDatabase = new TimerDatabase(storage)
25-
const archivedDatabase = new ArchivedDatabase(storage)
2624
const iconUrlDatabase = new IconUrlDatabase(storage)
2725
const hostAliasDatabase = new HostAliasDatabase(storage)
2826
const mergeRuleDatabase = new MergeRuleDatabase(storage)
@@ -126,18 +124,6 @@ class TimerService {
126124
return { origin, merged }
127125
}
128126

129-
/**
130-
* Archive the data and delete all of them
131-
*
132-
* @param rows rows
133-
* @since 0.0.9
134-
* @deprecated 1.2.0
135-
*/
136-
async archive(rows: timer.stat.Row[]): Promise<void> {
137-
await archivedDatabase.updateArchived(rows)
138-
return timerDatabase.delete(rows)
139-
}
140-
141127
/**
142128
* Count the items
143129
*

src/util/i18n/components/item.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export type ItemMessage = {
2222
delete: string
2323
add2Whitelist: string
2424
removeFromWhitelist: string
25-
archive: string
2625
deleteConfirmMsgAll: string
2726
deleteConfirmMsgRange: string
2827
deleteConfirmMsg: string
@@ -45,7 +44,6 @@ const _default: Messages<ItemMessage> = {
4544
delete: '删除',
4645
add2Whitelist: '白名单',
4746
removeFromWhitelist: '启用',
48-
archive: '归档',
4947
jumpToTrend: '趋势',
5048
deleteConfirmMsgAll: '{url} 的所有访问记录将被删除',
5149
deleteConfirmMsgRange: '{url} 在 {start} 到 {end} 的访问记录将被删除',
@@ -66,7 +64,6 @@ const _default: Messages<ItemMessage> = {
6664
delete: '刪除',
6765
add2Whitelist: '白名單',
6866
removeFromWhitelist: '啟用',
69-
archive: '歸檔',
7067
jumpToTrend: '趨勢',
7168
deleteConfirmMsgAll: '{url} 的所有拜訪記錄將被刪除',
7269
deleteConfirmMsgRange: '{url} 在 {start} 到 {end} 的拜訪記錄將被刪除',
@@ -87,7 +84,6 @@ const _default: Messages<ItemMessage> = {
8784
delete: 'Delete',
8885
add2Whitelist: 'Whitelist',
8986
removeFromWhitelist: 'Enable',
90-
archive: 'Archive',
9187
jumpToTrend: 'Trend',
9288
deleteConfirmMsgAll: 'All records of {url} will be deleted!',
9389
deleteConfirmMsgRange: 'All records of {url} between {start} and {end} will be deleted!',
@@ -108,7 +104,6 @@ const _default: Messages<ItemMessage> = {
108104
delete: '削除',
109105
add2Whitelist: 'ホワイトリスト',
110106
removeFromWhitelist: '有効にする',
111-
archive: 'アーカイブ',
112107
jumpToTrend: '傾向',
113108
deleteConfirmMsgAll: '{url} のすべての拜訪記録が削除されます',
114109
deleteConfirmMsgRange: '{url} {start} から {end} までの拜訪記録は削除されます',

0 commit comments

Comments
 (0)