mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[python] limit custom response to python job survey to 25 symbols (PY-74269)
(cherry picked from commit 020574e608d450ebb44fe89b8484e6ebab65e258) IJ-CR-149662 GitOrigin-RevId: 1f83e0ee622609d07ed360a46b8b31e7f7c1ac54
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f0b1bdbb11
commit
00cf06cd4a
@@ -642,7 +642,6 @@ The Python plug-in provides smart editing for Python scripts. The feature set of
|
||||
<feedback.idleFeedbackSurvey implementation="com.jetbrains.python.statistics.feedback.PythonJobSurvey"/>
|
||||
<statistics.counterUsagesCollector implementationClass="com.jetbrains.python.statistics.feedback.PythonJobStatisticsCollector"/>
|
||||
<backgroundPostStartupActivity implementation="com.jetbrains.python.statistics.feedback.PythonFirstLaunchChecker"/>
|
||||
<statistics.validation.customValidationRule implementation="com.jetbrains.python.statistics.feedback.TrueValidationRule"/>
|
||||
</extensions>
|
||||
|
||||
<extensionPoints>
|
||||
|
||||
@@ -6,14 +6,11 @@ import com.intellij.internal.statistic.eventLog.EventLogGroup
|
||||
import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
|
||||
import com.intellij.internal.statistic.eventLog.events.EventId2
|
||||
import com.intellij.internal.statistic.eventLog.validator.ValidationResultType
|
||||
import com.intellij.internal.statistic.eventLog.validator.rules.EventContext
|
||||
import com.intellij.internal.statistic.eventLog.validator.rules.impl.CustomValidationRule
|
||||
|
||||
object PythonJobStatisticsCollector : CounterUsagesCollector() {
|
||||
private val GROUP = EventLogGroup("python.job.statistics", 1)
|
||||
private val GROUP = EventLogGroup("python.job.statistics", 2)
|
||||
private val USE_FOR = EventFields.StringList("use_for", listOf("data_analysis", "ml", "web_dev", "scripts"))
|
||||
private val OTHER = EventFields.StringValidatedByCustomRule<TrueValidationRule>("other")
|
||||
private val OTHER = EventFields.StringValidatedByInlineRegexp("other", "[\\w\\s,.!?-]{1,25}")
|
||||
private val JOB_EVENT: EventId2<List<String>, String?> = GROUP.registerEvent("job.survey.triggered", USE_FOR, OTHER)
|
||||
|
||||
@JvmStatic
|
||||
@@ -25,14 +22,3 @@ object PythonJobStatisticsCollector : CounterUsagesCollector() {
|
||||
return GROUP
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TrueValidationRule() : CustomValidationRule() {
|
||||
override fun getRuleId(): String {
|
||||
return "python-user-job-other"
|
||||
}
|
||||
|
||||
override fun doValidate(data: String, context: EventContext): ValidationResultType {
|
||||
return ValidationResultType.ACCEPTED
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,8 @@ class PythonUserJobFeedbackDialog(
|
||||
val builder = StringBuilder()
|
||||
(myBlocks[1] as CheckBoxGroupBlock).collectBlockTextDescription(builder)
|
||||
val selectedItems = items.filter { it.property }.map { it.jsonElementName }
|
||||
val other = builder.toString().lines()[5].substringAfter(message("python.survey.user.job.dialog.blocks.checkbox.other") + ": ")
|
||||
val other = builder.toString()
|
||||
.lines()[5].substringAfter(message("python.survey.user.job.dialog.blocks.checkbox.other") + ": ").take(25)
|
||||
|
||||
PythonJobStatisticsCollector.logJobEvent(selectedItems, other)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user