saby-customizer 0.0.0 → 0.0.1

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.
@@ -125,7 +125,9 @@ export class GitBranchCardData {
125
125
  navigator.clipboard.writeText(branchName)
126
126
  snackbar.show(`Скопировано имя ветки: ${branchName}`)
127
127
 
128
- await this.saveToHistory()
128
+ if (this.milestones.length) {
129
+ await this.saveToHistory()
130
+ }
129
131
  }
130
132
 
131
133
  /** Копирование описания для git commit */
@@ -137,7 +139,10 @@ export class GitBranchCardData {
137
139
  navigator.clipboard.writeText(description)
138
140
  snackbar.show(`Скопировано описание для git commit:\n${description}`)
139
141
 
140
- await this.saveToHistory()
142
+ if (this.milestones.length) {
143
+ await this.saveToHistory()
144
+ }
145
+
141
146
  }
142
147
 
143
148
  /** Сохраняет данные в историю по карточкам для которых копировали имя ветки или описание */
@@ -821,3 +826,34 @@ toolbar.addButton({
821
826
  .catch(console.error)
822
827
  }
823
828
  })
829
+ toolbar.addButton({
830
+ position: 'top',
831
+ filter: { names: ['Merge request'] },
832
+ title: 'Открыть ветки для Review кода',
833
+ iconSVG: octicons['codescan'].toSVG({ width: 18 }),
834
+ onclick: card => {
835
+ const links = []
836
+ const view = card.element.querySelector('.fed2-DocumentPrint__content-view')?.shadowRoot
837
+ if (view) {
838
+ const rows = Array.from(view.querySelectorAll('.git_row'))
839
+ const rc = `div[title="rc-${card.data.version}"]`
840
+
841
+ for (const row of rows) {
842
+ if (row.querySelector(rc)) {
843
+ const diff = row.querySelector('a.git_diff')
844
+
845
+ if (diff) {
846
+ links.push(diff.href)
847
+ }
848
+ }
849
+ }
850
+ }
851
+ if (links.length) {
852
+ for (const link of links) {
853
+ window.open(link, '_blank')
854
+ }
855
+ } else {
856
+ snackbar.show(`Не удалось найти ветки для Review кода`)
857
+ }
858
+ }
859
+ })