add irccloud log import options
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-08-20 21:02:57 +02:00
parent a10b29a0ea
commit b75c3461f7
2 changed files with 20 additions and 1 deletions
@@ -14,6 +14,7 @@ module.exports = class {
channelName: "",
date: "",
data: "",
sessionThresholdHours: 12,
},
timezones: tz.names(),
}
@@ -58,12 +59,24 @@ module.exports = class {
return
}
} else if (input.importer === "MircLike") {
this.state.error = "Date is required for mIRC-like logs"
this.state.error = "Date is required for mIRC-like logs."
return
} else {
input.date = null;
}
if (input.importer === "IRCCloudLog") {
const hours = parseFloat(input.sessionThresholdHours)
if (Number.isNaN(hours)) {
this.state.error = "The session change threshold must be a number."
return
}
input.sessionThresholdMs = Math.floor(hours * 3600000)
}
delete input.sessionThresholdHours
if (input.channelName.length < 2 || input.channelName.includes(" ") || input.channelName.includes(" ") || input.channelName.charAt(0) !== "#") {
this.state.error = "A valid channelName name is required"
return
@@ -10,6 +10,7 @@ import moment from "moment"
<select key="importer" autofocus class="big" placeholder="Kind" on-change("change", "importer") value=state.values.importer>
<option value="MircLike" selected=(state.values.importer === "MircLike")>mIRC-Like log</option>
<option value="ForumLog" selected=(state.values.importer === "ForumLog")>Forum Log</option>
<option value="IrcCloud" selected=(state.values.importer === "IrcCloud")>IRCCloud log export</option>
</select>
<label>Timezone</label>
@@ -25,6 +26,11 @@ import moment from "moment"
<input key="date" class="big" placeholder="(Required)" on-change("change", "date") value=state.values.date />
</if>
<if(state.values.importer === "IrcCloud")>
<label>Session Change Threshold (Hours)</label>
<input key="sessionThreshold" class="big" placeholder="(Required)" on-change("change", "sessionThresholdHours") value=state.values.sessionThresholdHours />
</if>
<label>Content</label>
<textarea key="data" placeholder="(Required)" class="tall" on-change("change", "data") value=state.values.data />