Skip to content

Commit

Permalink
Merge pull request #3836 from pnrgenc/SER-338
Browse files Browse the repository at this point in the history
[SER-338] Column titles are not user friendly
  • Loading branch information
Cookiezaurs authored Jan 10, 2023
2 parents b814674 + d42ad7f commit 168e150
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 2 deletions.
59 changes: 59 additions & 0 deletions plugins/hooks/frontend/public/javascripts/countly.models.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,64 @@
return triggerEffectDom;
};

hooksPlugin.generateTriggerActionsTreeForExport = function(row) {
var triggerNames = {
"APIEndPointTrigger": jQuery.i18n.map["hooks.trigger-api-endpoint-uri"],
"IncomingDataTrigger": jQuery.i18n.map["hooks.IncomingData"],
"InternalEventTrigger": jQuery.i18n.map["hooks.internal-event-selector-title"],
"ScheduledTrigger": jQuery.i18n.map["hooks.ScheduledTrigger"],
};
var triggerText = triggerNames[row.trigger.type];
var triggerDesc = '';
try {
if (row.trigger.type === "IncomingDataTrigger") {
var event = row.trigger.configuration.event;
var parts = event[0].split("***");
triggerDesc = ' ' + parts[1] + ' ';
}

if (row.trigger.type === "APIEndPointTrigger") {
var path = row.trigger.configuration.path;
triggerDesc = ' ' + path + ' ';
}

if (row.trigger.type === "InternalEventTrigger") {
var eventType = row.trigger.configuration.eventType;
triggerDesc = ' ' + eventType + ' ';
}
}
catch (e) {
//silent catch
}

var effectNames = {
"EmailEffect": jQuery.i18n.map["hooks.EmailEffect"],
"HTTPEffect": jQuery.i18n.map["hooks.HTTPEffect"],
"CustomCodeEffect": jQuery.i18n.map["hooks.CustomCodeEffect"],
};
var effectList = "";
var arrow = ' -> ';
row.effects.forEach(function(effect) {
effectList += arrow + (effectNames[effect.type] && effectNames[effect.type].toUpperCase()) + ' ';
if (effect.type === "EmailEffect") {
effectList += ' ' + effect.configuration.address + ' ';
}
if (effect.type === "HTTPEffect") {
effectList += ' ' + effect.configuration.url + ' ';
}
if (effect.type === "CustomCodeEffect") {
effectList += ' ' + effect.configuration.code + ' ';
}
});

var triggerEffectDom = triggerText.toUpperCase() + ' ';
triggerEffectDom += triggerDesc;
triggerEffectDom += ' ';
triggerEffectDom += effectList;
triggerEffectDom += ' ';
return triggerEffectDom;
};

hooksPlugin.getVuexModule = function() {
var getEmptyState = function() {
return {
Expand Down Expand Up @@ -329,6 +387,7 @@


var triggerEffectDom = hooksPlugin.generateTriggerActionsTreeDom(row);

tableData.push({
_id: hookList[i]._id,
name: hookList[i].name || '',
Expand Down
17 changes: 17 additions & 0 deletions plugins/hooks/frontend/public/javascripts/countly.views.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,23 @@
onRowClick: function(params) {
app.navigate("/manage/hooks/" + params._id, true);
},
formatExportFunction: function() {
var tableData = this.tableRows;
var table = [];
for (var i = 0; i < tableData.length; i++) {
var item = {};
item[CV.i18n('hooks.hook-name').toUpperCase()] = tableData[i].name;
item[CV.i18n('hooks.description').toUpperCase()] = tableData[i].description;
item[CV.i18n('hooks.trigger-and-actions').toUpperCase()] = hooksPlugin.generateTriggerActionsTreeForExport(tableData[i]);
item[CV.i18n('hooks.trigger-count').toUpperCase()] = tableData[i].triggerCount;
item[CV.i18n('hooks.trigger-last-time').toUpperCase()] = tableData[i].lastTriggerTimestampString === "-" ? "" : tableData[i].lastTriggerTimestampString;
item[CV.i18n('hooks.create-by').toUpperCase()] = tableData[i].createdByUser;

table.push(item);
}
return table;

},
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ hooks.trigger-instruction = TIPS
hooks.trigger-copy-url = Copy URL
hooks.test-hook=Test hook
hooks.ScheduledTrigger = Scheduled Trigger

hooks.trigger-and-actions = Trigger -> Actions

#efffects
hooks.CustomCodeEffect = Custom Code
Expand Down
3 changes: 2 additions & 1 deletion plugins/hooks/frontend/public/templates/vue-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class="cly-vue-hook-table is-clickable"
:tracked-fields="localTableTrackedFields"
:rows="tableRows" :resizable="false"
:exportFormat="formatExportFunction"
:available-dynamic-cols="tableDynamicCols" >
<template v-slot:header-left="scope">
<div class="bu-mr-2">
Expand Down Expand Up @@ -44,7 +45,7 @@
</template>
</el-table-column>

<el-table-column min-width="270" prop="triggerEffectColumn" label="Trigger -> Actions">
<el-table-column min-width="270" label="Trigger -> Actions">
<template v-slot:header="scope">
<span>{{i18n('hooks.trigger')}} <i class="el-icon-arrow-right el-icon-right"></i> {{ i18n('hooks.effects') }}</span>
</template>
Expand Down

0 comments on commit 168e150

Please sign in to comment.