mirror of
https://github.com/openwrt/luci
synced 2025-01-09 04:28:37 +08:00
build: luci.mk: gracefully handle missing or unversioned po subdirectories
Fixes: #3911
Fixes: 9d8e99f9b
build: gracefully handle non-Git source trees
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
6c82e2a678
commit
e6f77d5d72
10
luci.mk
10
luci.mk
@ -65,9 +65,13 @@ define findrev
|
|||||||
$(shell \
|
$(shell \
|
||||||
if git log -1 >/dev/null 2>/dev/null; then \
|
if git log -1 >/dev/null 2>/dev/null; then \
|
||||||
set -- $$(git log -1 --format="%ct %h" --abbrev=7 -- '$(if $(1),:(exclude))po'); \
|
set -- $$(git log -1 --format="%ct %h" --abbrev=7 -- '$(if $(1),:(exclude))po'); \
|
||||||
secs="$$(($$1 % 86400))"; \
|
if [ -n "$$1" ]; then
|
||||||
yday="$$(date --utc --date="@$$1" "+%y.%j")"; \
|
secs="$$(($$1 % 86400))"; \
|
||||||
printf 'git-%s.%05d-%s' "$$yday" "$$secs" "$$2"; \
|
yday="$$(date --utc --date="@$$1" "+%y.%j")"; \
|
||||||
|
printf 'git-%s.%05d-%s' "$$yday" "$$secs" "$$2"; \
|
||||||
|
else \
|
||||||
|
echo "unknown"; \
|
||||||
|
fi; \
|
||||||
else \
|
else \
|
||||||
ts=$$(find . -type f $(if $(1),-not) -path './po/*' -printf '%T@\n' 2>/dev/null | sort -rn | head -n1 | cut -d. -f1); \
|
ts=$$(find . -type f $(if $(1),-not) -path './po/*' -printf '%T@\n' 2>/dev/null | sort -rn | head -n1 | cut -d. -f1); \
|
||||||
if [ -n "$$ts" ]; then \
|
if [ -n "$$ts" ]; then \
|
||||||
|
@ -2051,7 +2051,15 @@
|
|||||||
* methods are overwritten with `null`.
|
* methods are overwritten with `null`.
|
||||||
*/
|
*/
|
||||||
addFooter: function() {
|
addFooter: function() {
|
||||||
var footer = E([]);
|
var footer = E([]),
|
||||||
|
vp = document.getElementById('view'),
|
||||||
|
readonly = true;
|
||||||
|
|
||||||
|
vp.querySelectorAll('.cbi-map').forEach(function(map) {
|
||||||
|
var m = DOM.findClassInstance(map);
|
||||||
|
if (m && !m.readonly)
|
||||||
|
readonly = false;
|
||||||
|
});
|
||||||
|
|
||||||
var saveApplyBtn = this.handleSaveApply ? new L.ui.ComboButton('0', {
|
var saveApplyBtn = this.handleSaveApply ? new L.ui.ComboButton('0', {
|
||||||
0: [ _('Save & Apply') ],
|
0: [ _('Save & Apply') ],
|
||||||
@ -2061,7 +2069,8 @@
|
|||||||
0: 'btn cbi-button cbi-button-apply important',
|
0: 'btn cbi-button cbi-button-apply important',
|
||||||
1: 'btn cbi-button cbi-button-negative important'
|
1: 'btn cbi-button cbi-button-negative important'
|
||||||
},
|
},
|
||||||
click: L.ui.createHandlerFn(this, 'handleSaveApply')
|
click: L.ui.createHandlerFn(this, 'handleSaveApply'),
|
||||||
|
disabled: readonly || null
|
||||||
}).render() : E([]);
|
}).render() : E([]);
|
||||||
|
|
||||||
if (this.handleSaveApply || this.handleSave || this.handleReset) {
|
if (this.handleSaveApply || this.handleSave || this.handleReset) {
|
||||||
@ -2069,11 +2078,13 @@
|
|||||||
saveApplyBtn, ' ',
|
saveApplyBtn, ' ',
|
||||||
this.handleSave ? E('button', {
|
this.handleSave ? E('button', {
|
||||||
'class': 'cbi-button cbi-button-save',
|
'class': 'cbi-button cbi-button-save',
|
||||||
'click': L.ui.createHandlerFn(this, 'handleSave')
|
'click': L.ui.createHandlerFn(this, 'handleSave'),
|
||||||
|
'disabled': readonly || null
|
||||||
}, [ _('Save') ]) : '', ' ',
|
}, [ _('Save') ]) : '', ' ',
|
||||||
this.handleReset ? E('button', {
|
this.handleReset ? E('button', {
|
||||||
'class': 'cbi-button cbi-button-reset',
|
'class': 'cbi-button cbi-button-reset',
|
||||||
'click': L.ui.createHandlerFn(this, 'handleReset')
|
'click': L.ui.createHandlerFn(this, 'handleReset'),
|
||||||
|
'disabled': readonly || null
|
||||||
}, [ _('Reset') ]) : ''
|
}, [ _('Reset') ]) : ''
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
@ -3062,6 +3073,35 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the current session has been granted the given ACL
|
||||||
|
* group permissions.
|
||||||
|
*
|
||||||
|
* @param {string} aclGroupName
|
||||||
|
* The ACL group name to check.
|
||||||
|
*
|
||||||
|
* @return {boolean|null}
|
||||||
|
* Returns `null` if the session does not have the specified grant,
|
||||||
|
* returns `false` if the permissions are granted readonly or
|
||||||
|
* `true` if they're granted read/write.
|
||||||
|
*/
|
||||||
|
hasAcl: function(aclGroupName) {
|
||||||
|
if (!this.isObject(this.env.accessgroups) ||
|
||||||
|
!this.env.accessgroups.hasOwnProperty(aclGroupName) ||
|
||||||
|
!Array.isArray(this.env.accessgroups[aclGroupName]))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
for (var i = 0; i < this.env.accessgroups[aclGroupName].length; i++)
|
||||||
|
if (this.env.accessgroups[aclGroupName][i] == 'write')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
for (var i = 0; i < this.env.accessgroups[aclGroupName].length; i++)
|
||||||
|
if (this.env.accessgroups[aclGroupName][i] == 'read')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deprecated wrapper around {@link LuCI.poll.remove Poll.remove()}.
|
* Deprecated wrapper around {@link LuCI.poll.remove Poll.remove()}.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user