-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add various extension points for security updates
In order to display information from `bringyourownideas/silverstripe-composer-security-updates` we need to be able to add various information to the summary, and badges which were previously 'not a thing'. This commit makes badges 'a thing', makes them extensible, and provides a rudimentary way to alter the summary information for the on scren report. Also added were namespaces for the GridFieldComponents, but this should affect nothing (should not affect anything).
- Loading branch information
Dylan Wagstaff
committed
May 29, 2018
1 parent
d4cdf17
commit 31861fc
Showing
14 changed files
with
277 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,62 @@ | ||
.package-summary{ | ||
margin-top: 0; | ||
.site-summary { | ||
margin-top: 0; | ||
} | ||
|
||
.package-summary .message { | ||
margin-left: 0; | ||
margin-right: 0; | ||
margin-top: 0; | ||
.site-summary.message, | ||
.site-summary .message { | ||
margin-left: 0; | ||
margin-right: 0; | ||
margin-top: 0; | ||
} | ||
|
||
.package-summary .grid-refresh-button { | ||
margin-bottom: 0; | ||
} | ||
|
||
.package-summary__title { | ||
display:block; | ||
.site-summary .grid-refresh-button { | ||
margin-bottom: 0; | ||
} | ||
|
||
/* Due to a rule applied to `.cms .ss-gridfield > div` we have to be specific here */ | ||
.cms .ss-gridfield > div.site-summary__clearfix { | ||
margin: 0; | ||
clear: both; | ||
margin: 0; | ||
clear: both; | ||
} | ||
|
||
.gridfield-button-link { | ||
margin-bottom: 12px; | ||
} | ||
|
||
.package-summary table.ss-gridfield-table tr td.col-Summary { | ||
padding: 0; | ||
margin-bottom: 12px; | ||
} | ||
|
||
a.package-summary__anchor { | ||
color: inherit; | ||
text-decoration: inherit; | ||
display: block; | ||
padding: 8px; | ||
color: inherit; | ||
text-decoration: inherit; | ||
display: block; | ||
padding: 0 8px; | ||
margin: 0 -8px; | ||
} | ||
|
||
a.package-summary__anchor:hover, | ||
a.package-summary__anchor:active { | ||
color: inherit; | ||
text-decoration: inherit; | ||
color: inherit; | ||
text-decoration: inherit; | ||
} | ||
|
||
.package-summary__badge { | ||
font-size: 0.8em; | ||
padding: 3px 5px; | ||
background: grey; | ||
border-radius: 2px; | ||
color: white; | ||
position: relative; | ||
top: -1px; | ||
} | ||
/* Colours for badge classes */ | ||
.package-summary__badge--good { | ||
background: #3fa142; | ||
} | ||
.package-summary__badge--warning { | ||
background: #ff7f22; | ||
} | ||
.package-summary__badge--bad { | ||
background: #d40404; | ||
} | ||
|
||
.package-summary__description { | ||
display:block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
(function ($) { | ||
$.entwine('ss', function ($) { | ||
// p tag that holds button | ||
$('#checkForUpdates').entwine({ | ||
// Magically set by the magic get/set{thisMemberProperty} (see poll function below) | ||
PollTimeout: null, | ||
onclick: function () { | ||
this.setLoading(); | ||
}, | ||
onmatch: function () { | ||
// Poll the current job and update the front end status | ||
if (this.getButton(true).length) { | ||
this.setLoading(); | ||
} | ||
}, | ||
setLoading: function () { | ||
// Add warning message (set as data attribute on GridFieldRefreshButton) before | ||
// first button row | ||
$('.ss-gridfield-buttonrow').first().prepend( | ||
'<p class="message warning">' + | ||
this.getButton().data('message') + | ||
'</p>' | ||
); | ||
this.poll(); | ||
}, | ||
poll: function () { | ||
var self = this; | ||
$.ajax({ | ||
url: self.getButton().data('check'), | ||
async: true, | ||
success: function (data) { | ||
self.clearLoading(JSON.parse(data)); | ||
}, | ||
error: function (error) { | ||
if (typeof console !== 'undefined') { | ||
console.log(error); | ||
} | ||
} | ||
}); | ||
}, | ||
getButton: function (disabled) { | ||
let button = 'button'; | ||
if (disabled) { | ||
button += ':disabled'; | ||
} | ||
return this.children(button).first(); | ||
}, | ||
clearLoading: function (hasRunningJob) { | ||
$.entwine('ss', function ($) { | ||
// p tag that holds button | ||
$('#checkForUpdates').entwine({ | ||
// Magically set by the magic get/set{thisMemberProperty} (see poll function below) | ||
PollTimeout: null, | ||
onclick: function () { | ||
this.setLoading(); | ||
}, | ||
onmatch: function () { | ||
// Poll the current job and update the front end status | ||
if (this.getButton(true).length) { | ||
this.setLoading(); | ||
} | ||
}, | ||
setLoading: function () { | ||
// Add warning message (set as data attribute on GridFieldRefreshButton) before | ||
// first button row | ||
$('.ss-gridfield-buttonrow').first().prepend( | ||
'<p class="message warning">' + | ||
this.getButton().data('message') + | ||
'</p>' | ||
); | ||
this.poll(); | ||
}, | ||
poll: function () { | ||
var self = this; | ||
$.ajax({ | ||
url: self.getButton().data('check'), | ||
async: true, | ||
success: function (data) { | ||
self.clearLoading(JSON.parse(data)); | ||
}, | ||
error: function (error) { | ||
if (typeof console !== 'undefined') { | ||
console.log(error); | ||
} | ||
} | ||
}); | ||
}, | ||
getButton: function (disabled) { | ||
let button = 'button'; | ||
if (disabled) { | ||
button += ':disabled'; | ||
} | ||
return this.children(button).first(); | ||
}, | ||
clearLoading: function (hasRunningJob) { | ||
|
||
if (hasRunningJob === false) { | ||
this.closest('fieldset.ss-gridfield').reload(); | ||
return; | ||
} | ||
if (hasRunningJob === false) { | ||
this.closest('fieldset.ss-gridfield').reload(); | ||
return; | ||
} | ||
|
||
// Ensure the regular poll method is run | ||
// Kill any existing timeout | ||
clearTimeout(this.getPollTimeout()); | ||
// Ensure the regular poll method is run | ||
// Kill any existing timeout | ||
clearTimeout(this.getPollTimeout()); | ||
|
||
this.setPollTimeout(setTimeout( | ||
function () { | ||
$('#checkForUpdates').poll(); | ||
}, | ||
5000 | ||
)); | ||
} | ||
}); | ||
this.setPollTimeout(setTimeout( | ||
function () { | ||
$('#checkForUpdates').poll(); | ||
}, | ||
5000 | ||
)); | ||
} | ||
}); | ||
}); | ||
}(jQuery)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.