Skip to content

Commit

Permalink
Lark Alerter Support & Library Update
Browse files Browse the repository at this point in the history
  • Loading branch information
nsano-rururu committed Nov 7, 2023
1 parent 28b8e61 commit 6e36e63
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 46 deletions.
86 changes: 43 additions & 43 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -29,7 +29,7 @@
"canvas": "^2.11.2",
"change-case": "4.1.2",
"comma-number": "2.1.0",
"core-js": "^3.33.1",
"core-js": "^3.33.2",
"cron-ui": "1.0.3",
"dayjs": "^1.11.10",
"debounce": "1.2.1",
Expand Down Expand Up @@ -78,8 +78,8 @@
"chai": "4.3.10",
"coverage-istanbul-loader": "^3.0.5",
"cross-env": "7.0.3",
"cypress": "^13.3.3",
"eslint": "^8.52.0",
"cypress": "^13.4.0",
"eslint": "^8.53.0",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-vue": "^9.18.1",
Expand Down
14 changes: 14 additions & 0 deletions src/components/config/alert/ConfigAlert.vue
Expand Up @@ -189,6 +189,9 @@
<el-checkbox id="destinationGelf" label="gelf" border>
Gelf
</el-checkbox>
<el-checkbox id="destinationLark" label="lark" border>
Lark
</el-checkbox>
</el-checkbox-group>
</el-form-item>

Expand All @@ -205,6 +208,7 @@
alert.includes('googlechat') ||
alert.includes('hivealerter') ||
alert.includes('jira') ||
alert.includes('lark') ||
alert.includes('linenotify') ||
alert.includes('mattermost') ||
alert.includes('ms_teams') ||
Expand Down Expand Up @@ -493,6 +497,14 @@
</template>
<ConfigAlertGelf ref="gelf" :view-only="viewOnly" />
</el-tab-pane>

<!-- Lark -->
<el-tab-pane v-if="alert.includes('lark')">
<template #label>
Lark
</template>
<ConfigAlertLark ref="lark" :view-only="viewOnly" />
</el-tab-pane>
</el-tabs>
</el-form>
</template>
Expand All @@ -518,6 +530,7 @@ import ConfigAlertGoogleChat from './ConfigAlertGoogleChat';
import ConfigAlertHttpPost from './ConfigAlertHttpPost';
import ConfigAlertHttpPost2 from './ConfigAlertHttpPost2';
import ConfigAlertJira from './ConfigAlertJira';
import ConfigAlertLark from './ConfigAlertLark';
import ConfigAlertLineNotify from './ConfigAlertLineNotify';
import ConfigAlertMattermost from './ConfigAlertMattermost';
import ConfigAlertMsTeams from './ConfigAlertMsTeams';
Expand Down Expand Up @@ -635,6 +648,7 @@ export default {
ConfigAlertHttpPost,
ConfigAlertHttpPost2,
ConfigAlertJira,
ConfigAlertLark,
ConfigAlertLineNotify,
ConfigAlertMattermost,
ConfigAlertMsTeams,
Expand Down
28 changes: 28 additions & 0 deletions src/components/config/alert/ConfigAlertLark.vue
@@ -0,0 +1,28 @@
<template>
<div>
<praeco-form-item label="Bot Id" prop="larkBotId" required>
<el-input id="larkBotId" v-model="larkBotId" :disabled="viewOnly" />
<label>Lark bot id.</label>
</praeco-form-item>
</div>
</template>

<script>
export default {
props: ['viewOnly'],
computed: {
larkBotId: {
get() {
return this.$store.state.config.alert.larkBotId;
},
set(value) {
this.$store.commit('config/alert/UPDATE_LARK_BOT_ID', value);
}
}
}
};
</script>

<style lang="scss" scoped>
</style>
2 changes: 2 additions & 0 deletions src/registration.js
Expand Up @@ -31,6 +31,7 @@ import ConfigAlertGoogleChat from '@/components/config/alert/ConfigAlertGoogleCh
import ConfigAlertHttpPost from '@/components/config/alert/ConfigAlertHttpPost.vue';
import ConfigAlertHttpPost2 from '@/components/config/alert/ConfigAlertHttpPost2.vue';
import ConfigAlertJira from '@/components/config/alert/ConfigAlertJira.vue';
import ConfigAlertLark from '@/components/config/alert/ConfigAlertLark.vue';
import ConfigAlertLineNotify from '@/components/config/alert/ConfigAlertLineNotify.vue';
import ConfigAlertMattermost from '@/components/config/alert/ConfigAlertMattermost.vue';
import ConfigAlertMsTeams from '@/components/config/alert/ConfigAlertMsTeams.vue';
Expand Down Expand Up @@ -78,6 +79,7 @@ Vue.component('ConfigAlertGoogleChat', ConfigAlertGoogleChat);
Vue.component('ConfigAlertHttpPost', ConfigAlertHttpPost);
Vue.component('ConfigAlertHttpPost2', ConfigAlertHttpPost2);
Vue.component('ConfigAlertJira', ConfigAlertJira);
Vue.component('ConfigAlertLark', ConfigAlertLark);
Vue.component('ConfigAlertLineNotify', ConfigAlertLineNotify);
Vue.component('ConfigAlertMattermost', ConfigAlertMattermost);
Vue.component('ConfigAlertMsTeams', ConfigAlertMsTeams);
Expand Down
13 changes: 13 additions & 0 deletions src/store/config/alert.js
Expand Up @@ -203,6 +203,10 @@ function initialState() {
/* Line Notify */
linenotifyAccessToken: '',

/* Lark */
larkBotId: '',
larkMsgtype: 'text',

/* Mattermost */
mattermostWebhookUrl: [],
mattermostChannelOverride: [],
Expand Down Expand Up @@ -1241,6 +1245,15 @@ export default {
state.jiraDescription = jiraDescription;
},

/* Lark */
UPDATE_LARK_BOT_ID(state, larkBotId) {
state.larkBotId = larkBotId;
},

UPDATE_LARK_MSGTYPE(state, larkMsgtype) {
state.larkMsgtype = larkMsgtype;
},

/* LineNotify */
UPDATE_LINENOTIFY_ACCESS_TOKEN(state, linenotifyAccessToken) {
state.linenotifyAccessToken = linenotifyAccessToken;
Expand Down
24 changes: 24 additions & 0 deletions src/store/config/index.js
Expand Up @@ -551,6 +551,14 @@ export default {
commit('alert/UPDATE_ZBX_HOST_FROM_FIELD', config.zbx_host_from_field);
}

/* Lark */
commit('alert/UPDATE_LARK_BOT_ID', config.lark_bot_id);
if (config.lark_msgtype) {
commit('alert/UPDATE_LARK_MSGTYPE', config.lark_msgtype);
} else {
commit('alert/UPDATE_LARK_MSGTYPE', 'text');
}

/* Line Notify */
commit('alert/UPDATE_LINENOTIFY_ACCESS_TOKEN', config.linenotify_access_token);

Expand Down Expand Up @@ -2228,6 +2236,17 @@ export default {
return config;
},

lark(state) {
let config = {};

if (state.alert.larkBotId) {
config.lark_bot_id = state.alert.larkBotId;
config.lark_msgtype = state.alert.larkMsgtype;
}

return config;
},

linenotify(state) {
let config = {};

Expand Down Expand Up @@ -3074,6 +3093,10 @@ export default {
config = { ...config, ...getters.jira };
}

if (state.alert.alert.includes('lark')) {
config = { ...config, ...getters.lark };
}

if (state.alert.alert.includes('linenotify')) {
config = { ...config, ...getters.linenotify };
}
Expand Down Expand Up @@ -3162,6 +3185,7 @@ export default {
|| state.alert.alert.includes('googlechat')
|| state.alert.alert.includes('hivealerter')
|| state.alert.alert.includes('jira')
|| state.alert.alert.includes('lark')
|| state.alert.alert.includes('linenotify')
|| state.alert.alert.includes('mattermost')
|| state.alert.alert.includes('ms_teams')
Expand Down

0 comments on commit 6e36e63

Please sign in to comment.