Removed unnecessary stuff from final package
|
|
@ -97,6 +97,7 @@ module.exports = function(grunt){
|
|||
console.log(files);
|
||||
});
|
||||
grunt.registerTask("compile", "Compile all files into a single file", function(){
|
||||
var OUTDIR = "bin/";
|
||||
var libfiles = [
|
||||
"htdocs/lib/js/async.js",
|
||||
"htdocs/lib/js/js-schema.min.js",
|
||||
|
|
@ -161,9 +162,10 @@ module.exports = function(grunt){
|
|||
pluginfiles.map(function(name){
|
||||
plugins[name.replace(/^htdocs\//, "")] = JSON.parse(String(fs.readFileSync(name)));
|
||||
});
|
||||
fs.writeFileSync("htdocs/__all.css", css);
|
||||
if(!fs.existsSync(OUTDIR)) fs.mkdirSync(OUTDIR);
|
||||
fs.writeFileSync(OUTDIR+"__all.css", css);
|
||||
// TODO: really do not do it in memory!
|
||||
fs.writeFileSync("htdocs/__all.js",
|
||||
fs.writeFileSync(OUTDIR+"__all.js",
|
||||
//uglifyjs.minify(
|
||||
"var JUCI_COMPILED = 1; var JUCI_TEMPLATES = "+
|
||||
JSON.stringify(templates)+";"+
|
||||
|
|
|
|||
|
|
@ -43,7 +43,12 @@ define Package/luciexpress/install
|
|||
npm install
|
||||
grunt compile
|
||||
$(INSTALL_DIR) $(1)/www
|
||||
$(CP) ./htdocs/* $(1)/www/
|
||||
$(CP) ./bin/* $(1)/www/
|
||||
$(CP) ./htdocs/index.html $(1)/www/
|
||||
$(CP) ./htdocs/config.json $(1)/www/
|
||||
$(INSTALL_DIR) $(1)/www/themes/vodafone/
|
||||
$(CP) ./htdocs/themes/vodafone/img $(1)/www/themes/vodafone/
|
||||
$(CP) ./htdocs/themes/vodafone/fonts $(1)/www/themes/vodafone/
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd
|
||||
$(CP) ./share/* $(1)/usr/share/rpcd/
|
||||
./install_menus.sh $(1)
|
||||
|
|
|
|||
93
luciexpress/htdocs/plugins/core/widgets/luci.select.js
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
$juci.module("core")
|
||||
.directive('luciSelect', function ($compile) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
selectedItem: '=ngModel',
|
||||
items: '=ngItems',
|
||||
onChange: '&onChange',
|
||||
placeholder: '@placeholder',
|
||||
prefix: "@",
|
||||
size: '=size'
|
||||
},
|
||||
link: function (scope, element, attrs) {
|
||||
var html = '';
|
||||
switch (attrs.type) {
|
||||
case "dropdown":
|
||||
html += '<div class="dropdown dropdown-toggle" data-toggle="dropdown" ><a class="dropdown-toggle" role="button" data-toggle="dropdown" href="javascript:;">{{((selectedItem||{}).label || placeholder) | translate}}<b class="caret"></b></a>';
|
||||
break;
|
||||
default:
|
||||
html += '<div class="btn-group"><button class="btn btn-default button-label {{size_class}}">{{selectedText | translate}}</button><button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>';
|
||||
break;
|
||||
}
|
||||
html += '<ul class="dropdown-menu"><li ng-repeat="item in itemList"><a tabindex="-1" data-ng-click="selectVal(item)" href="">{{item.label}}</a></li></ul></div>';
|
||||
element.append($compile(html)(scope));
|
||||
|
||||
if(scope.size)
|
||||
scope.size_class = "btn-"+scope.size;
|
||||
|
||||
scope.$watch("size", function(){
|
||||
scope.size_class = "btn-"+scope.size;
|
||||
});
|
||||
scope.selectedText = scope.placeholder;
|
||||
|
||||
scope.$watch("items", function(value){
|
||||
if(value){
|
||||
scope.itemList = value.map(function(x){
|
||||
//console.log(JSON.stringify(x)+" "+JSON.stringify(scope.selectedItem));
|
||||
if(typeof x == "object" && "value" in x){
|
||||
if(scope.selectedItem != undefined && scope.selectedItem.value == x.value)
|
||||
scope.selectedText = scope.selectedItem.label || scope.placeholder;
|
||||
else if(scope.selectedItem == x.value){
|
||||
scope.selectedText = x.label || scope.placeholder;
|
||||
}
|
||||
//alert(JSON.stringify(x)+" "+JSON.stringify(scope.selectedItem));
|
||||
return { label: x.label, value: x.value };
|
||||
} else {
|
||||
if(scope.selectedItem == x){
|
||||
scope.selectedText = scope.selectedItem || scope.placeholder;
|
||||
}
|
||||
return { label: x, value: x };
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
scope.$watch("selectedItem", function(value){
|
||||
//console.log("Selected item: "+JSON.stringify(value));
|
||||
if(value != undefined && (typeof value) == "object" && "value" in value) scope.selectedText = value.value;
|
||||
else if(value != undefined && scope.itemList != undefined) {
|
||||
scope.itemList.map(function(x){
|
||||
if(x.value == value) scope.selectedText = x.label;
|
||||
});
|
||||
}
|
||||
else scope.selectedText = value || scope.placeholder;
|
||||
});
|
||||
|
||||
scope.selectVal = function (item) {
|
||||
if(!item) return;
|
||||
switch (attrs.type) {
|
||||
case "dropdown":
|
||||
$('a.dropdown-toggle', element).html('<b class="caret"></b> ' + item.label);
|
||||
break;
|
||||
default:
|
||||
$('button.button-label', element).html(item.label);
|
||||
break;
|
||||
}
|
||||
//console.log("DROPDOWN: "+JSON.stringify(scope.selectedItem)+", "+item.value);
|
||||
var value = item;
|
||||
if("value" in item)
|
||||
value = item.value;
|
||||
if(value instanceof Array) { // make it work for lists without changing reference
|
||||
if(!(scope.selectedItem instanceof Array)) scope.selectedItem = [];
|
||||
value.map(function(x){ scope.selectedItem.push(x); });
|
||||
} else if(value instanceof Object){ // make it work for objects without changing reference
|
||||
Object.assign(scope.selectedItem, value);
|
||||
} else {
|
||||
scope.selectedItem = value; // make it work for primitive types
|
||||
}
|
||||
scope.onChange(item);
|
||||
};
|
||||
//scope.selectVal(scope.selectedItem);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -119,12 +119,13 @@ JUCI.app
|
|||
function upgradeStart(path){
|
||||
$scope.error = "";
|
||||
$scope.progress = 'progress';
|
||||
$rpc.luci2.system.upgrade_test().done(function(result){
|
||||
console.log("Trying to upgrade from "+path);
|
||||
/*$rpc.luci2.system.upgrade_test({"path": path}).done(function(result){
|
||||
if(result.stderr){
|
||||
$scope.error = "Upgrade test has failed: "+result.stderr;
|
||||
$scope.$apply();
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
$rpc.luci2.system.upgrade_start({"path": path}).done(function(result){
|
||||
if(result && result.stderr) {
|
||||
$scope.error = gettext("Upgrade process failed") + ": "+result.stderr;
|
||||
|
|
@ -147,10 +148,10 @@ JUCI.app
|
|||
$scope.error = gettext("Upgrade process failed") + "! "+JSON.stringify(result||"");
|
||||
$scope.$apply();
|
||||
});
|
||||
}).fail(function(result){
|
||||
/*}).fail(function(result){
|
||||
$scope.error = gettext("Upgrade test has failed") + ": "+result.stderr;
|
||||
$scope.$apply();
|
||||
});
|
||||
}); */
|
||||
}
|
||||
|
||||
/*$uci.sync("system").done(function(){
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 990 B |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 846 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 482 B |
|
Before Width: | Height: | Size: 615 B |
|
Before Width: | Height: | Size: 465 B |
|
Before Width: | Height: | Size: 617 B |
|
Before Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 477 B |
|
Before Width: | Height: | Size: 397 B |
|
Before Width: | Height: | Size: 368 B |
|
Before Width: | Height: | Size: 419 B |
|
Before Width: | Height: | Size: 487 B |
|
Before Width: | Height: | Size: 632 B |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 829 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 441 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 589 B |
|
Before Width: | Height: | Size: 839 B |
|
Before Width: | Height: | Size: 309 B |
|
Before Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 354 B |
|
Before Width: | Height: | Size: 431 B |
|
Before Width: | Height: | Size: 343 B |
|
Before Width: | Height: | Size: 399 B |
|
Before Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 569 B |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 851 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 866 B |
|
Before Width: | Height: | Size: 1.5 KiB |