Skip to content

Commit 5aed4fb

Browse files
authored
OTWO 7677 Fix enlistments and Highcharts related bugs in New UI/UX (#1910)
* OTWO-7677 Fix new code locations upload issue * OTWO-7677 Removed watermark from charts * OTWO-7677 Removed download functionality from charts
1 parent e066049 commit 5aed4fb

8 files changed

Lines changed: 41 additions & 220 deletions

File tree

app/assets/javascripts/charts.js

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ var Charts = {
2525
var options = chart.data();
2626
var data = $.parseJSON(chart.attr('data-value'));
2727
if(options.pname) data.series.name = options.pname;
28-
Charts.applyDarkModeWatermark(chart, data);
2928
Charts.renderChart(this, data, '200', options);
3029
});
3130
},
@@ -149,6 +148,12 @@ var Charts = {
149148
width: 950,
150149
lang: {
151150
thousandsSep: ','
151+
},
152+
exporting: {
153+
enabled: false
154+
},
155+
credits: {
156+
enabled: false
152157
}
153158
})
154159

@@ -168,7 +173,6 @@ var Charts = {
168173

169174
success: function(data, textStatus) {
170175
if(options.pname) data.series.name = options.pname;
171-
Charts.applyDarkModeWatermark($chart, data);
172176
setTimeout(function(){
173177
Charts.renderChart(chart, data, textStatus, options);
174178
}, 100);
@@ -184,57 +188,6 @@ var Charts = {
184188
}
185189

186190
},
187-
// Only swap background-image when dark mode is active — never touch it in light mode
188-
applyDarkModeWatermark: function($chart, data) {
189-
if (!$('html').hasClass('dark')) return;
190-
var darkUrl = $chart.data('dark-watermark');
191-
var lightUrl = $chart.data('light-watermark');
192-
if (darkUrl && data.chart && data.chart.style && data.chart.style['background-image']) {
193-
if (darkUrl === lightUrl) {
194-
// CSS ::before handles dark appearance — remove background-image so inline style doesn't block CSS
195-
delete data.chart.style['background-image'];
196-
} else {
197-
data.chart.style['background-image'] = 'url(' + darkUrl + ')';
198-
}
199-
}
200-
},
201-
202-
// Update already-rendered charts when theme toggles
203-
updateWatermarks: function(isDark) {
204-
$('.chart[data-dark-watermark], .chart-with-data[data-dark-watermark]').each(function() {
205-
var $chart = $(this);
206-
var $container = $chart.find('.highcharts-container');
207-
if (!$container.length) return;
208-
var darkUrl = $chart.data('dark-watermark');
209-
var lightUrl = $chart.data('light-watermark');
210-
if (isDark) {
211-
if (darkUrl === lightUrl) {
212-
// CSS ::before handles dark appearance — clear inline style so CSS background-image: none applies
213-
$container[0].style.removeProperty('background-image');
214-
} else {
215-
if (darkUrl) $container[0].style.setProperty('background-image', 'url(' + darkUrl + ')', 'important');
216-
}
217-
} else {
218-
if (lightUrl) $container[0].style.setProperty('background-image', 'url(' + lightUrl + ')', 'important');
219-
}
220-
});
221-
222-
// Handle streamgraph (D3 SVG) watermark
223-
// Dark mode: CSS ::before on #ohloh_streamgraph handles watermark — clear SVG inline style
224-
// Light mode: restore watermark on SVG since html.dark class is gone
225-
var $streamgraph = $('#ohloh_streamgraph[data-dark-watermark]');
226-
if ($streamgraph.length) {
227-
var $svg = $streamgraph.find('svg.background-watermark');
228-
if ($svg.length) {
229-
if (isDark) {
230-
$svg[0].style.removeProperty('background-image');
231-
} else {
232-
var lightUrl = $streamgraph.data('light-watermark');
233-
if (lightUrl) $svg[0].style.backgroundImage = 'url(' + lightUrl + ')';
234-
}
235-
}
236-
}
237-
},
238191

239192
commit_volume_formatter: function() {
240193
return '<strong>' + this.series.name + '</strong><br/>' + this.y + ' Commits (' + Math.floor(this.percentage) + '%)';

app/assets/javascripts/enlistments.js.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class App.EnlistmentSelect
1414
showSpinnerAndSubmit = ->
1515
$(this).attr('disabled', 'disabled')
1616
$('.enlistment .spinner').show()
17-
$('.well.enlistment form').submit()
17+
$('.enlistment form').submit()
1818

1919
hideAllScmInfo = ->
2020
$('.enlistment .scm_info').hide()

app/assets/javascripts/theme_toggle.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,6 @@ var ThemeToggle = {
147147
}
148148

149149
this.setCookie(this.COOKIE_NAME, theme, this.COOKIE_DAYS);
150-
151-
if (typeof Charts !== 'undefined') {
152-
Charts.updateWatermarks(theme === 'dark');
153-
}
154150
},
155151

156152
toggleTheme: function() {

app/assets/stylesheets/api/custom.sass

Lines changed: 33 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,59 +1687,43 @@
16871687
padding: 6px
16881688

16891689
#cve-cvss3, #cvss3, #cve-cvss3-mobile, #cvss3-mobile
1690-
background: asset-url("charts/watermark_340.png") no-repeat center
1691-
background-size: contain
16921690
position: relative
16931691
width: 100%
16941692
height: 100%
16951693

1696-
html.dark &
1697-
background-image: none
1698-
1699-
&::before
1700-
content: ''
1701-
position: absolute
1702-
top: 0
1703-
left: 0
1704-
right: 0
1705-
bottom: 0
1706-
background: asset-url("charts/watermark_340.png") no-repeat center
1707-
background-size: contain
1708-
filter: hue-rotate(260deg) saturate(1.2) brightness(0.3)
1709-
opacity: 0.2
1710-
pointer-events: none
1711-
1712-
.highcharts-axis-labels text,
1713-
.highcharts-axis-title text
1714-
fill: #d1d5db !important
1715-
stroke: none !important
1716-
stroke-width: 0 !important
1717-
-webkit-text-stroke: 0 !important
1718-
paint-order: stroke fill !important
1719-
1720-
.highcharts-legend text
1721-
fill: #d1d5db !important
1722-
stroke: none !important
1723-
stroke-width: 0 !important
1724-
-webkit-text-stroke: 0 !important
1725-
paint-order: stroke fill !important
1726-
1727-
svg text
1728-
stroke: none !important
1729-
stroke-width: 0 !important
1730-
-webkit-text-stroke: 0 !important
1731-
1732-
text[stroke]
1733-
stroke: none !important
1734-
stroke-width: 0 !important
1735-
-webkit-text-stroke: 0 !important
1736-
1737-
.highcharts-axis-line
1738-
stroke: #6b7280 !important
1739-
1740-
.highcharts-grid-line
1741-
stroke: #374151 !important
1742-
opacity: 0.3
1694+
html.dark
1695+
#cve-cvss3, #cvss3, #cve-cvss3-mobile, #cvss3-mobile
1696+
.highcharts-axis-labels text,
1697+
.highcharts-axis-title text
1698+
fill: #d1d5db !important
1699+
stroke: none !important
1700+
stroke-width: 0 !important
1701+
-webkit-text-stroke: 0 !important
1702+
paint-order: stroke fill !important
1703+
1704+
.highcharts-legend text
1705+
fill: #d1d5db !important
1706+
stroke: none !important
1707+
stroke-width: 0 !important
1708+
-webkit-text-stroke: 0 !important
1709+
paint-order: stroke fill !important
1710+
1711+
svg text
1712+
stroke: none !important
1713+
stroke-width: 0 !important
1714+
-webkit-text-stroke: 0 !important
1715+
1716+
text[stroke]
1717+
stroke: none !important
1718+
stroke-width: 0 !important
1719+
-webkit-text-stroke: 0 !important
1720+
1721+
.highcharts-axis-line
1722+
stroke: #6b7280 !important
1723+
1724+
.highcharts-grid-line
1725+
stroke: #374151 !important
1726+
opacity: 0.3
17431727

17441728
.search-container
17451729
display: flex

app/assets/stylesheets/charts.sass

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,3 @@
1-
.watermark340 .highcharts-container
2-
background: asset-url("charts/watermark_340.png") no-repeat center
3-
background-size: contain
4-
5-
.watermark440 .highcharts-container
6-
background: asset-url("charts/watermark_440.png") no-repeat center
7-
background-size: contain
8-
9-
#project_contributions .highcharts-container
10-
background: asset-url("charts/watermark_692.png") no-repeat 18% 50%
11-
background-size: contain
12-
13-
.watermark860 .highcharts-container
14-
background: asset-url("charts/watermark_860.png") no-repeat center
15-
background-size: contain
16-
17-
.watermark900white .highcharts-container
18-
background: asset-url("charts/watermark_white_900.png") no-repeat center
19-
background-size: contain
20-
background-color: #ffffff
21-
22-
.watermark914 .highcharts-container,
23-
#all_projects .highcharts-container
24-
background: asset-url("charts/watermark_914.png") no-repeat center
25-
background-size: contain
261

272
#vulnerabilities_index_page,
283
#vulnerability_version_chart

app/assets/stylesheets/dark_theme.sass

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -459,48 +459,6 @@ html.dark
459459
#all_projects
460460
.highcharts-container
461461
background-image: none
462-
position: relative
463-
&::before
464-
content: ''
465-
position: absolute
466-
top: 0
467-
left: 0
468-
right: 0
469-
bottom: 0
470-
z-index: 1
471-
background: asset-url("charts/watermark_340.png") no-repeat center
472-
background-size: contain
473-
filter: hue-rotate(260deg) saturate(1.2) brightness(0.3)
474-
opacity: 0.2
475-
pointer-events: none
476-
477-
// Per-class background overrides — shared block above always uses watermark_340.png
478-
html.dark
479-
.watermark440
480-
.highcharts-container
481-
&::before
482-
background: asset-url("charts/watermark_440.png") no-repeat center
483-
background-size: contain
484-
html.dark
485-
.watermark860
486-
.highcharts-container
487-
&::before
488-
background: asset-url("charts/watermark_860.png") no-repeat center
489-
background-size: contain
490-
html.dark
491-
.watermark900white
492-
.highcharts-container
493-
background-color: #1D0631 !important
494-
&::before
495-
background: asset-url("charts/watermark_white_900.png") no-repeat center
496-
background-size: contain
497-
html.dark
498-
.watermark914,
499-
#all_projects
500-
.highcharts-container
501-
&::before
502-
background: asset-url("charts/watermark_914.png") no-repeat center
503-
background-size: contain
504462

505463
// Vulnerability all-version chart dark mode (index page — no .project-show-redesign wrapper)
506464
html.dark #vulnerability_all_version_chart

app/assets/stylesheets/streamgraph.sass

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -61,50 +61,6 @@
6161
font-size: 12px
6262
line-height: 1
6363

64-
.full
65-
.background-watermark
66-
background: asset_url('charts/watermark_860.png') no-repeat center
67-
68-
.regular
69-
.background-watermark
70-
background: asset_url('charts/watermark_692.png') no-repeat center left
71-
background-size: contain
72-
73-
html.dark .regular .background-watermark
74-
background: none
75-
76-
html.dark #ohloh_streamgraph.regular
77-
position: relative
78-
&::before
79-
content: ''
80-
position: absolute
81-
top: 0
82-
left: 0
83-
right: 0
84-
bottom: 0
85-
background: asset_url('charts/watermark_692.png') no-repeat center left
86-
background-size: contain
87-
filter: hue-rotate(260deg) saturate(1.2) brightness(0.3)
88-
opacity: 0.2
89-
pointer-events: none
90-
91-
html.dark .full .background-watermark
92-
background: none
93-
94-
html.dark #ohloh_streamgraph.full
95-
position: relative
96-
&::before
97-
content: ''
98-
position: absolute
99-
top: 0
100-
left: 0
101-
right: 0
102-
bottom: 0
103-
background: asset_url('charts/watermark_860.png') no-repeat center
104-
background-size: contain
105-
filter: hue-rotate(260deg) saturate(1.2) brightness(0.3)
106-
opacity: 0.2
107-
pointer-events: none
10864
@media only all and (min-width: 320px) and (max-width: 480px)
10965
#ohloh_streamgraph
11066
&.languages

app/decorators/analysis/code_history_chart.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ def initialize(analysis)
99
end
1010

1111
def data
12-
series_and_range_data(@defaults).deep_merge(chart_watermark)
12+
series_and_range_data(@defaults)
1313
end
1414

1515
def data_for_lines_of_code
1616
data.deep_merge(ANALYSIS_CHARTS_OPTIONS['no_auxillaries'])
1717
.deep_merge(ANALYSIS_CHARTS_OPTIONS['lines_of_code'])
18-
.deep_merge(chart_watermark)
1918
end
2019

2120
private

0 commit comments

Comments
 (0)