saby-customizer 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { toolbar } from 'saby-customizer/lib.js'
1
+ import { toolbar, sendCloudStatistic } from 'saby-customizer/lib.js'
2
2
  import { octicons } from 'saby-customizer/octicons.js'
3
3
  import { GitBranchCardData } from 'saby-customizer/features/git-branch.js'
4
4
 
@@ -11,6 +11,7 @@ toolbar.addButton({
11
11
  onclick: card => {
12
12
  const gitCard = new GitBranchCardData(card.data)
13
13
 
14
+ sendCloudStatistic('Тулбар задачи', 'Копирование ссылки')
14
15
  gitCard.restoreFromHistory()
15
16
  .then(() => gitCard.copyLink())
16
17
  .catch(console.error)
@@ -1,5 +1,5 @@
1
1
  import { oom } from '@notml/core'
2
- import { toolbar, PopupDialog, getListOfOpenCards, snackbar, context, db } from 'saby-customizer/lib.js'
2
+ import { toolbar, PopupDialog, getListOfOpenCards, snackbar, context, db, sendCloudStatistic } from 'saby-customizer/lib.js'
3
3
  import { octicons } from 'saby-customizer/octicons.js'
4
4
 
5
5
 
@@ -110,6 +110,7 @@ export class GitBranchCardData {
110
110
 
111
111
  /** Копирование ссылки на задачу */
112
112
  copyLink() {
113
+ sendCloudStatistic('Типы задач', this.name)
113
114
  navigator.clipboard.writeText(this.raw.url)
114
115
  snackbar.show(`Скопирована ссылка: ${this.raw.url}`)
115
116
  }
@@ -118,6 +119,7 @@ export class GitBranchCardData {
118
119
  async copyBranchName() {
119
120
  const branchName = await this.getBranchName()
120
121
 
122
+ sendCloudStatistic('Типы задач', this.name)
121
123
  navigator.clipboard.writeText(branchName)
122
124
  snackbar.show(`Скопировано имя ветки: ${branchName}`)
123
125
 
@@ -132,6 +134,7 @@ export class GitBranchCardData {
132
134
  this.raw.url + '\n' +
133
135
  this.raw.description
134
136
 
137
+ sendCloudStatistic('Типы задач', this.name)
135
138
  navigator.clipboard.writeText(description)
136
139
  snackbar.show(`Скопировано описание для git commit:\n${description}`)
137
140
 
@@ -321,7 +324,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
321
324
  }).dom,
322
325
  /** @type {import('@material/mwc-icon-button').IconButton} */// @ts-ignore
323
326
  descriptionEdit: oom.mwcIconButton({
324
- title: 'Редактировать описание для git commit',
327
+ title: 'Редактировать описание для Git коммита',
325
328
  class: 'icon_18',
326
329
  innerHTML: octicons.pencil.toSVG({ width: 18 }),
327
330
  onclick: () => this.editDescription()
@@ -512,6 +515,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
512
515
 
513
516
  /** Открывает форму редактирования редактирование описания для коммита */
514
517
  editDescription() {
518
+ sendCloudStatistic('Диалог - Ветки для Git', 'Редактирование описания для Git коммита')
515
519
  this.elements.descriptionEdit.classList.toggle('hide')
516
520
  this.elements.description.classList.toggle('hide')
517
521
  this.elements.descriptionTextarea.classList.toggle('hide')
@@ -531,11 +535,13 @@ class GitBranchCard extends oom.extends(HTMLElement) {
531
535
  const version = this.versionsList[index]
532
536
 
533
537
  if (version === 'Произвольная') {
538
+ sendCloudStatistic('Диалог - Ветки для Git', 'Выбор произвольной версии для ветки Git')
534
539
  this.elements.branchVersionTextfield.classList.toggle('hide')
535
540
  this.elements.branchButton.classList.toggle('hide')
536
541
  this.elements.branchVersionTextfield.focus()
537
542
  this.elements.branchVersionTextfield.select()
538
543
  } else {
544
+ sendCloudStatistic('Диалог - Ветки для Git', 'Выбор версии для ветки Git из списка')
539
545
  this.version = version
540
546
  }
541
547
  }
@@ -570,6 +576,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
570
576
 
571
577
  /** Открывает форму редактирования доп. имени ветки */
572
578
  editBranchSubName() {
579
+ sendCloudStatistic('Диалог - Ветки для Git', 'Редактирование имени ветки для Git')
573
580
  this.elements.branchSubName.classList.toggle('hide')
574
581
  this.elements.branchSubNameTextfield.classList.toggle('hide')
575
582
  this.elements.branchSubNameTextfield.focus()
@@ -593,6 +600,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
593
600
 
594
601
  /** Копирование ссылки на задачу */
595
602
  copyLink() {
603
+ sendCloudStatistic('Диалог - Ветки для Git', 'Копирование ссылки')
596
604
  this.data.copyLink()
597
605
  }
598
606
 
@@ -602,6 +610,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
602
610
  this.elements.branchVersionTextfield.checkValidity()
603
611
 
604
612
  if (valid) {
613
+ sendCloudStatistic('Диалог - Ветки для Git', 'Копирование ветки для Git')
605
614
  await this.data.copyBranchName()
606
615
  }
607
616
  }
@@ -612,6 +621,7 @@ class GitBranchCard extends oom.extends(HTMLElement) {
612
621
  this.elements.branchVersionTextfield.checkValidity()
613
622
 
614
623
  if (valid) {
624
+ sendCloudStatistic('Диалог - Ветки для Git', 'Копирование описания для Git коммита')
615
625
  await this.data.copyDescription()
616
626
  }
617
627
  }
@@ -689,6 +699,7 @@ class GitBranchCardList extends oom.extends(HTMLElement) {
689
699
  this.openTaskList.dom.classList.remove('hide')
690
700
  break
691
701
  case 1:
702
+ sendCloudStatistic('Диалог - Ветки для Git', 'Открытие истории задач')
692
703
  this.historyTaskList({ innerHTML: '' }, oom.div({ class: 'empty' }, 'Загрузка ...'))
693
704
  this.openTaskList.dom.classList.add('hide')
694
705
  this.historyTaskList.dom.classList.remove('hide')
@@ -782,11 +793,14 @@ toolbar.addButton({
782
793
  title: 'История веток для Git (Alt+H)',
783
794
  iconSVG: octicons['git-branch'].toSVG({ width: 24 }),
784
795
  keysMapping: 'alt-KeyH',
785
- onclick: () => PopupDialog.toggle({
786
- key: 'git-branch-dialog',
787
- title: 'Ветки для Git',
788
- Element: GitBranchCardList
789
- })
796
+ onclick: () => {
797
+ sendCloudStatistic('Правая панель', 'Открытие диалога - Ветки для Git')
798
+ PopupDialog.toggle({
799
+ key: 'git-branch-dialog',
800
+ title: 'Ветки для Git',
801
+ Element: GitBranchCardList
802
+ })
803
+ }
790
804
  })
791
805
 
792
806
  toolbar.addButton({
@@ -798,6 +812,7 @@ toolbar.addButton({
798
812
  onclick: card => {
799
813
  const gitCard = new GitBranchCardData(card.data)
800
814
 
815
+ sendCloudStatistic('Тулбар задачи', 'Копирование ветки для Git')
801
816
  gitCard.restoreFromHistory()
802
817
  .then(() => gitCard.copyBranchName())
803
818
  .catch(console.error)
@@ -812,6 +827,7 @@ toolbar.addButton({
812
827
  onclick: card => {
813
828
  const gitCard = new GitBranchCardData(card.data)
814
829
 
830
+ sendCloudStatistic('Тулбар задачи', 'Копирование описания для Git коммита')
815
831
  gitCard.restoreFromHistory()
816
832
  .then(() => gitCard.copyDescription())
817
833
  .catch(console.error)
@@ -827,6 +843,7 @@ toolbar.addButton({
827
843
  const links = []
828
844
  const view = card.element.querySelector('.fed2-DocumentPrint__content-view')?.shadowRoot
829
845
 
846
+ sendCloudStatistic('Тулбар задачи', 'Открытие ветки для Review кода')
830
847
  if (view) {
831
848
  const rows = Array.from(view.querySelectorAll('.git_row'))
832
849
  const rc = `div[title="rc-${card.data.version}"]`
@@ -846,6 +863,7 @@ toolbar.addButton({
846
863
  window.open(link, '_blank')
847
864
  }
848
865
  } else {
866
+ sendCloudStatistic('Ошибки SABY Customizer', 'Не удалось найти ветки для Review кода')
849
867
  snackbar.show('Не удалось найти ветки для Review кода')
850
868
  }
851
869
  }
@@ -1,3 +1,25 @@
1
- // Собрать стату по использованию фич кастомайзера
2
- // https://online.sbis.ru/news/4a005fd5-c99b-4e8d-a78b-eeb67b78d892
3
- // https://git.sbis.ru/contragents/online/-/blob/rc-22.1200/client/ContractorCommon/_statisticCollection/Helper.ts
1
+ /*
2
+ Сбор статы по использованию фич кастомайзера
3
+ */
4
+ /* global requirejs */
5
+ let sendStatistic = null
6
+ const loadSender = () => new Promise((resolve) => {
7
+ if (sendStatistic) {
8
+ return resolve(sendStatistic)
9
+ }
10
+ requirejs(['CloudStatisticsHelper/cloudStatisticsHelper'], ({ sendCloudStatistic }) => {
11
+ sendStatistic = sendCloudStatistic
12
+ resolve(sendStatistic)
13
+ })
14
+ })
15
+
16
+ /**
17
+ * Отправка прикладной статистики
18
+ * @param {string} context Элемент системы
19
+ * @param {string} action Действие
20
+ */
21
+ export function sendCloudStatistic(context, action) {
22
+ loadSender().then((sendStatistic) => {
23
+ sendStatistic({ functionality: 'SABY Customizer', context, action })
24
+ })
25
+ }
package/lib.js CHANGED
@@ -3,6 +3,7 @@ export * from './lib/database.js'
3
3
  export * from './lib/hotkeys.js'
4
4
  export * from './lib/layout.js'
5
5
  export * from './lib/popup-dialog.js'
6
+ export * from './lib/saby-lib/cloud-statistic.js'
6
7
  export * from './lib/saby-lib/edo.js'
7
8
  export * from './lib/saby-lib/rpc.js'
8
9
  export * from './lib/saby-lib/toolbar.js'
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "repository": "github:saby-customizer/saby-customizer.github.io",
11
11
  "license": "Unlicense",
12
- "version": "0.0.7",
12
+ "version": "0.0.8",
13
13
  "type": "module",
14
14
  "main": "./userscript.js",
15
15
  "exports": {