Skip to content

Commit

Permalink
feat(notification): migrated notification module from plugins to buil…
Browse files Browse the repository at this point in the history
…t-in
  • Loading branch information
tikazyq committed Oct 6, 2022
1 parent 040d0d0 commit f01bd0f
Show file tree
Hide file tree
Showing 29 changed files with 1,284 additions and 10 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crawlab-ui",
"version": "0.6.0-13",
"version": "0.6.0-14",
"private": false,
"author": {
"name": "Marvin Zhang",
Expand Down Expand Up @@ -52,6 +52,7 @@
"@types/md5": "^2.2.1",
"@types/pinyin": "^2.8.2",
"@types/showdown": "^1.9.4",
"@types/simplemde": "^1.11.8",
"@types/url-join": "^4.0.1",
"atom-material-icons": "^3.0.0",
"axios": "^0.21.1",
Expand All @@ -72,6 +73,7 @@
"pinyin": "^2.10.2",
"point-cluster": "^3.1.8",
"showdown": "^1.9.1",
"simplemde": "^1.11.2",
"url-join": "^4.0.1",
"vue": "^3.2",
"vue-clipboard3": "^1.0.1",
Expand Down
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<link href="font-awesome.min.css" rel="stylesheet">
<title><%= htmlWebpackPlugin.options.title %></title>
<script src="js/vue3-sfc-loader.js"></script>
<script src="simplemde/simplemde.js"></script>
<link href="simplemde/simplemde.css" rel="stylesheet">
<style>
#loading-placeholder {
position: fixed;
Expand Down
7 changes: 7 additions & 0 deletions public/simplemde/simplemde.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions public/simplemde/simplemde.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/i18n/lang/en/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const common: LCommon = {
export: 'Export',
configure: 'Configure',
update: 'Update',
save: 'Save',
change: 'Change',
},
messageBox: {
confirm: {
Expand Down
1 change: 1 addition & 0 deletions src/i18n/lang/en/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const router: LRouter = {
node: 'Node.js',
},
},
notification: 'Notification',
misc: {
disclaimer: 'Disclaimer',
mySettings: 'My Settings',
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/lang/en/views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import users from './users';
import tags from './tags';
import tokens from './tokens';
import env from './env';
import notification from './notification';
import plugins from './plugins';
import misc from './misc';

Expand All @@ -24,6 +25,7 @@ const views: LViews = {
tags,
tokens,
env,
notification,
plugins,
misc,
};
Expand Down
68 changes: 68 additions & 0 deletions src/i18n/lang/en/views/notification.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const notification: LViewsNotification = {
navActions: {
new: {
label: 'New Notification',
tooltip: 'Create a new notification',
},
},
settings: {
form: {
name: 'Name',
description: 'Description',
type: 'Type',
enabled: 'Enabled',
title: 'Title',
template: 'Template',
templateContent: 'Template Content',
mail: {
smtp: {
server: 'SMTP Server',
port: 'SMTP Port',
user: 'SMTP User',
password: 'SMTP Password',
sender: {
email: 'Sender Email',
identity: 'Sender Identity',
},
},
to: 'To',
cc: 'CC',
},
mobile: {
webhook: 'Webhook',
},
},
type: {
mail: 'Mail',
mobile: 'Mobile',
},
},
triggers: {
models: {
tags: 'Tags',
nodes: 'Nodes',
projects: 'Projects',
spiders: 'Spiders',
tasks: 'Tasks',
jobs: 'Jobs',
schedules: 'Schedules',
users: 'Users',
settings: 'Settings',
tokens: 'Tokens',
variables: 'Variables',
task_stats: 'Task Stats',
plugins: 'Plugins',
spider_stats: 'Spider Stats',
data_sources: 'Data Sources',
data_collections: 'Data Collections',
passwords: 'Passwords',
},
},
tabs: {
overview: 'Overview',
triggers: 'Triggers',
template: 'Template',
},
};

export default notification;
2 changes: 2 additions & 0 deletions src/i18n/lang/zh/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const common: LCommon = {
export: '导出',
configure: '配置',
update: '更新',
save: '保存',
change: '更改',
},
messageBox: {
confirm: {
Expand Down
1 change: 1 addition & 0 deletions src/i18n/lang/zh/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const router: LRouter = {
node: 'Node.js',
},
},
notification: '消息通知',
misc: {
disclaimer: '免责声明',
mySettings: '我的设置',
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/lang/zh/views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import users from './users';
import tags from './tags';
import tokens from './tokens';
import env from './env';
import notification from './notification';
import plugins from './plugins';
import misc from './misc';

Expand All @@ -24,6 +25,7 @@ const views: LViews = {
tags,
tokens,
env,
notification,
plugins,
misc,
};
Expand Down
68 changes: 68 additions & 0 deletions src/i18n/lang/zh/views/notification.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const notification: LViewsNotification = {
navActions: {
new: {
label: '新建通知',
tooltip: '创建一个新的通知',
},
},
settings: {
form: {
name: '名称',
description: '描述',
type: '类型',
enabled: '是否启用',
title: '标题',
template: '模板',
templateContent: '模板内容',
mail: {
smtp: {
server: 'SMTP 服务器',
port: 'SMTP 端口',
user: 'SMTP 用户',
password: 'SMTP 密码',
sender: {
email: '发件人邮箱',
identity: '发件人身份',
},
},
to: '收件人',
cc: '抄送',
},
mobile: {
webhook: 'Webhook',
},
},
type: {
mail: '邮件',
mobile: '移动端',
},
},
triggers: {
models: {
tags: '标签',
nodes: '节点',
projects: '项目',
spiders: '爬虫',
tasks: '任务',
jobs: '作业',
schedules: '调度',
users: '用户',
settings: '设置',
tokens: '令牌',
variables: '变量',
task_stats: '任务统计',
plugins: '插件',
spider_stats: '爬虫统计',
data_sources: '数据源',
data_collections: '数据集',
passwords: '密码',
}
},
tabs: {
overview: '概览',
triggers: '触发器',
template: '模板',
},
};

export default notification;
1 change: 1 addition & 0 deletions src/interfaces/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ declare global {
_t?: (path: string, args?: any) => string;
_tc?: (c: number, path: string) => string;
_tp?: (pluginName: string, path: string) => string;
SimpleMDE: any;
}
}
2 changes: 2 additions & 0 deletions src/interfaces/i18n/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export declare global {
export: string;
configure: string;
update: string;
save: string;
change: string;
};
messageBox: {
confirm: {
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/i18n/router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export declare global {
node: string;
};
};
notification: string;
misc: {
disclaimer: string;
mySettings: string;
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/i18n/views/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export declare global {
tags: LViewsTags;
tokens: LViewsTokens;
env: LViewsEnv;
notification: LViewsNotification;
plugins: LViewsPlugins;
misc: LViewsMisc;
}
Expand Down
61 changes: 61 additions & 0 deletions src/interfaces/i18n/views/notification.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
interface LViewsNotification {
navActions: LNavActions;
settings: {
form: {
name: string;
description: string;
type: string;
enabled: string;
title: string;
template: string;
templateContent: string;
mail: {
smtp: {
server: string;
port: string;
user: string;
password: string;
sender: {
email: string;
identity: string;
};
};
to: string;
cc: string;
};
mobile: {
webhook: string;
};
};
type: {
mail: string;
mobile: string;
};
};
triggers: {
models: {
tags: string;
nodes: string;
projects: string;
spiders: string;
tasks: string;
jobs: string;
schedules: string;
users: string;
settings: string;
tokens: string;
variables: string;
task_stats: string;
plugins: string;
spider_stats: string;
data_sources: string;
data_collections: string;
passwords: string;
};
};
tabs: {
overview: string;
triggers: string;
template: string;
};
}
39 changes: 39 additions & 0 deletions src/interfaces/models/notification.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export declare global {
interface NotificationSetting extends BaseModel {
type?: string;
name?: string;
description?: string;
enabled?: boolean;
global?: boolean;
title?: string;
template?: string;
triggers?: string[];
targets?: NotificationSettingTarget[];
mail?: NotificationSettingMail;
mobile?: NotificationSettingMobile;
}

interface NotificationSettingMail {
server?: string;
port?: string;
user?: string;
password?: string;
sender_email?: string;
sender_identity?: string;
to?: string;
cc?: string;
}

interface NotificationSettingMobile {
webhook?: string;
}

interface NotificationSettingTarget extends BaseModel {
model?: string;
}

interface NotificationSettingTrigger {
name?: string;
event?: string;
}
}
Loading

0 comments on commit f01bd0f

Please sign in to comment.