--添加校验界面
This commit is contained in:
parent
3a23cc0b79
commit
a99f3620c1
|
@ -38,7 +38,9 @@
|
|||
"human-date": "^1.3.2",
|
||||
"js-yaml": "^3.5.4",
|
||||
"ng-table": "^1.0.0",
|
||||
"ng-dialog": "^0.6.4"
|
||||
"ng-dialog": "^0.6.4",
|
||||
"ng-file-upload-shim": "^12.2.12",
|
||||
"ng-file-upload": "^12.2.12"
|
||||
},
|
||||
"overrides": {
|
||||
"term.js": {
|
||||
|
|
19985
compiled.js
19985
compiled.js
File diff suppressed because one or more lines are too long
|
@ -45,7 +45,6 @@ declare module Configs {
|
|||
constructor();
|
||||
updateAllData(): void;
|
||||
updateVolumeData(): void;
|
||||
updateCodeInfo(): void;
|
||||
updateOracleParam(): void;
|
||||
getFolderByVolumeName(name: string): any[];
|
||||
}
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
declare module Configs {
|
||||
var TableEdit: ng.IModule;
|
||||
var VolumeController: ng.IModule;
|
||||
var SystemInfoController: ng.IModule;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/// <reference path="../../includes.d.ts" />
|
||||
/// <reference path="systemPlugin.d.ts" />
|
||||
/// <reference path="systemHelpers.d.ts" />
|
||||
/// <reference path="../../configs/ts/configsDataService.d.ts" />
|
||||
declare module System {
|
||||
var SystemCodeController: ng.IModule;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/// <reference path="../../includes.d.ts" />
|
||||
/// <reference path="systemHelpers.d.ts" />
|
||||
/// <reference path="../../configs/ts/configPlugin.d.ts" />
|
||||
declare module System {
|
||||
var _module: ng.IModule;
|
||||
var controller: (name: string, inlineAnnotatedConstructor: any[]) => ng.IModule;
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
/// <reference path="../../includes.d.ts" />
|
||||
/// <reference path="systemPlugin.d.ts" />
|
||||
declare module System {
|
||||
function classifyCity(regionalismInfo: Array<any>): any[];
|
||||
function classifyCountry(regionalismInfo: Array<any>, cityName: string): any[];
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
/// <reference path="../../includes.d.ts" />
|
||||
/// <reference path="systemPlugin.d.ts" />
|
||||
/// <reference path="systemHelpers.d.ts" />
|
||||
/// <reference path="systemServices.d.ts" />
|
||||
declare module System {
|
||||
var SystemVerificationController: ng.IModule;
|
||||
}
|
|
@ -1,15 +1,22 @@
|
|||
/// <reference path="d.ts/includes.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/configPlugin.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/configsDataService.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/developerNavigation.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/kubernetesInterfaces.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/utilHelpers.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/customAlert.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/readPlacedivision.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/configPlugin.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/configsDataService.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/ConfigsHelper.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/kubernetesHelpers.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/developerHelpers.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/dataManagerHelper.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/ConfigsHelper.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/configsUtils.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/kubernetesPlugin.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/watcher.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/term.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/shareController.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/glusterfsSetting.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/kubeClusterSetting.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/developerPlugin.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/dataManagerModel.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/developerEnrichers.d.ts"/>
|
||||
|
@ -18,7 +25,6 @@
|
|||
/// <reference path="d.ts/developer/ts/home.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/jenkinsJob.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/jenkinsJobs.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/kubernetesPlugin.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/kubernetesModel.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/jenkinsLog.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/jenkinsMetrics.d.ts"/>
|
||||
|
@ -31,20 +37,6 @@
|
|||
/// <reference path="d.ts/developer/ts/projects.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/workspace.d.ts"/>
|
||||
/// <reference path="d.ts/developer/ts/workspaces.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/configsUtils.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/watcher.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/term.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/shareController.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/glusterfsSetting.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/kubeClusterSetting.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/regionalismCodeSearch.d.ts"/>
|
||||
/// <reference path="d.ts/configs/ts/systemCodeSearch.d.ts"/>
|
||||
/// <reference path="d.ts/navigation/ts/navigationPlugin.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/systemHelpers.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/systemPlugin.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/regionalismCodeSearch.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/systemCodeSearch.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/systemList.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/apps.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/breadcrumbs.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/build.d.ts"/>
|
||||
|
@ -85,3 +77,11 @@
|
|||
/// <reference path="d.ts/kubernetes/ts/sharedControllers.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/tabs.d.ts"/>
|
||||
/// <reference path="d.ts/kubernetes/ts/templates.d.ts"/>
|
||||
/// <reference path="d.ts/navigation/ts/navigationPlugin.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/systemHelpers.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/systemPlugin.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/regionalismCodeSearch.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/systemCodeSearch.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/systemList.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/systemServices.d.ts"/>
|
||||
/// <reference path="d.ts/system/ts/systemVerification.d.ts"/>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,970 @@
|
|||
/*
|
||||
* MIT Licensed
|
||||
* http://www.23developer.com/opensource
|
||||
* http://github.com/23/resumable.js
|
||||
* Steffen Tiedemann Christensen, steffen@23company.com
|
||||
*/
|
||||
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
var Resumable = function(opts){
|
||||
if ( !(this instanceof Resumable) ) {
|
||||
return new Resumable(opts);
|
||||
}
|
||||
this.version = 1.0;
|
||||
// SUPPORTED BY BROWSER?
|
||||
// Check if these features are support by the browser:
|
||||
// - File object type
|
||||
// - Blob object type
|
||||
// - FileList object type
|
||||
// - slicing files
|
||||
this.support = (
|
||||
(typeof(File)!=='undefined')
|
||||
&&
|
||||
(typeof(Blob)!=='undefined')
|
||||
&&
|
||||
(typeof(FileList)!=='undefined')
|
||||
&&
|
||||
(!!Blob.prototype.webkitSlice||!!Blob.prototype.mozSlice||!!Blob.prototype.slice||false)
|
||||
);
|
||||
if(!this.support) return(false);
|
||||
|
||||
|
||||
// PROPERTIES
|
||||
var $ = this;
|
||||
$.files = [];
|
||||
$.defaults = {
|
||||
chunkSize:1*1024*1024,
|
||||
forceChunkSize:false,
|
||||
simultaneousUploads:3,
|
||||
fileParameterName:'file',
|
||||
chunkNumberParameterName: 'resumableChunkNumber',
|
||||
chunkSizeParameterName: 'resumableChunkSize',
|
||||
currentChunkSizeParameterName: 'resumableCurrentChunkSize',
|
||||
totalSizeParameterName: 'resumableTotalSize',
|
||||
typeParameterName: 'resumableType',
|
||||
identifierParameterName: 'resumableIdentifier',
|
||||
fileNameParameterName: 'resumableFilename',
|
||||
relativePathParameterName: 'resumableRelativePath',
|
||||
totalChunksParameterName: 'resumableTotalChunks',
|
||||
throttleProgressCallbacks: 0.5,
|
||||
query:{},
|
||||
headers:{},
|
||||
preprocess:null,
|
||||
method:'multipart',
|
||||
uploadMethod: 'POST',
|
||||
testMethod: 'GET',
|
||||
prioritizeFirstAndLastChunk:false,
|
||||
target:'/',
|
||||
parameterNamespace:'',
|
||||
testChunks:true,
|
||||
generateUniqueIdentifier:null,
|
||||
getTarget:null,
|
||||
maxChunkRetries:undefined,
|
||||
chunkRetryInterval:undefined,
|
||||
permanentErrors:[400, 404, 415, 500, 501],
|
||||
maxFiles:undefined,
|
||||
withCredentials:false,
|
||||
xhrTimeout:0,
|
||||
clearInput:true,
|
||||
maxFilesErrorCallback:function (files, errorCount) {
|
||||
var maxFiles = $.getOpt('maxFiles');
|
||||
alert('Please upload no more than ' + maxFiles + ' file' + (maxFiles === 1 ? '' : 's') + ' at a time.');
|
||||
},
|
||||
minFileSize:1,
|
||||
minFileSizeErrorCallback:function(file, errorCount) {
|
||||
alert(file.fileName||file.name +' is too small, please upload files larger than ' + $h.formatSize($.getOpt('minFileSize')) + '.');
|
||||
},
|
||||
maxFileSize:undefined,
|
||||
maxFileSizeErrorCallback:function(file, errorCount) {
|
||||
alert(file.fileName||file.name +' is too large, please upload files less than ' + $h.formatSize($.getOpt('maxFileSize')) + '.');
|
||||
},
|
||||
fileType: [],
|
||||
fileTypeErrorCallback: function(file, errorCount) {
|
||||
alert(file.fileName||file.name +' has type not allowed, please upload files of type ' + $.getOpt('fileType') + '.');
|
||||
}
|
||||
};
|
||||
$.opts = opts||{};
|
||||
$.getOpt = function(o) {
|
||||
var $opt = this;
|
||||
// Get multiple option if passed an array
|
||||
if(o instanceof Array) {
|
||||
var options = {};
|
||||
$h.each(o, function(option){
|
||||
options[option] = $opt.getOpt(option);
|
||||
});
|
||||
return options;
|
||||
}
|
||||
// Otherwise, just return a simple option
|
||||
if ($opt instanceof ResumableChunk) {
|
||||
if (typeof $opt.opts[o] !== 'undefined') { return $opt.opts[o]; }
|
||||
else { $opt = $opt.fileObj; }
|
||||
}
|
||||
if ($opt instanceof ResumableFile) {
|
||||
if (typeof $opt.opts[o] !== 'undefined') { return $opt.opts[o]; }
|
||||
else { $opt = $opt.resumableObj; }
|
||||
}
|
||||
if ($opt instanceof Resumable) {
|
||||
if (typeof $opt.opts[o] !== 'undefined') { return $opt.opts[o]; }
|
||||
else { return $opt.defaults[o]; }
|
||||
}
|
||||
};
|
||||
|
||||
// EVENTS
|
||||
// catchAll(event, ...)
|
||||
// fileSuccess(file), fileProgress(file), fileAdded(file, event), fileRetry(file), fileError(file, message),
|
||||
// complete(), progress(), error(message, file), pause()
|
||||
$.events = [];
|
||||
$.on = function(event,callback){
|
||||
$.events.push(event.toLowerCase(), callback);
|
||||
};
|
||||
$.fire = function(){
|
||||
// `arguments` is an object, not array, in FF, so:
|
||||
var args = [];
|
||||
for (var i=0; i<arguments.length; i++) args.push(arguments[i]);
|
||||
// Find event listeners, and support pseudo-event `catchAll`
|
||||
var event = args[0].toLowerCase();
|
||||
for (var i=0; i<=$.events.length; i+=2) {
|
||||
if($.events[i]==event) $.events[i+1].apply($,args.slice(1));
|
||||
if($.events[i]=='catchall') $.events[i+1].apply(null,args);
|
||||
}
|
||||
if(event=='fileerror') $.fire('error', args[2], args[1]);
|
||||
if(event=='fileprogress') $.fire('progress');
|
||||
};
|
||||
|
||||
|
||||
// INTERNAL HELPER METHODS (handy, but ultimately not part of uploading)
|
||||
var $h = {
|
||||
stopEvent: function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
},
|
||||
each: function(o,callback){
|
||||
if(typeof(o.length)!=='undefined') {
|
||||
for (var i=0; i<o.length; i++) {
|
||||
// Array or FileList
|
||||
if(callback(o[i])===false) return;
|
||||
}
|
||||
} else {
|
||||
for (i in o) {
|
||||
// Object
|
||||
if(callback(i,o[i])===false) return;
|
||||
}
|
||||
}
|
||||
},
|
||||
generateUniqueIdentifier:function(file){
|
||||
var custom = $.getOpt('generateUniqueIdentifier');
|
||||
if(typeof custom === 'function') {
|
||||
return custom(file);
|
||||
}
|
||||
var relativePath = file.webkitRelativePath||file.fileName||file.name; // Some confusion in different versions of Firefox
|
||||
var size = file.size;
|
||||
return(size + '-' + relativePath.replace(/[^0-9a-zA-Z_-]/img, ''));
|
||||
},
|
||||
contains:function(array,test) {
|
||||
var result = false;
|
||||
|
||||
$h.each(array, function(value) {
|
||||
if (value == test) {
|
||||
result = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
return result;
|
||||
},
|
||||
formatSize:function(size){
|
||||
if(size<1024) {
|
||||
return size + ' bytes';
|
||||
} else if(size<1024*1024) {
|
||||
return (size/1024.0).toFixed(0) + ' KB';
|
||||
} else if(size<1024*1024*1024) {
|
||||
return (size/1024.0/1024.0).toFixed(1) + ' MB';
|
||||
} else {
|
||||
return (size/1024.0/1024.0/1024.0).toFixed(1) + ' GB';
|
||||
}
|
||||
},
|
||||
getTarget:function(params){
|
||||
var target = $.getOpt('target');
|
||||
if(typeof target === 'function') {
|
||||
return target(params);
|
||||
}
|
||||
if(target.indexOf('?') < 0) {
|
||||
target += '?';
|
||||
} else {
|
||||
target += '&';
|
||||
}
|
||||
return target + params.join('&');
|
||||
}
|
||||
};
|
||||
|
||||
var onDrop = function(event){
|
||||
$h.stopEvent(event);
|
||||
|
||||
//handle dropped things as items if we can (this lets us deal with folders nicer in some cases)
|
||||
if (event.dataTransfer && event.dataTransfer.items) {
|
||||
loadFiles(event.dataTransfer.items, event);
|
||||
}
|
||||
//else handle them as files
|
||||
else if (event.dataTransfer && event.dataTransfer.files) {
|
||||
loadFiles(event.dataTransfer.files, event);
|
||||
}
|
||||
};
|
||||
var preventDefault = function(e) {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
var queueLength = 0;
|
||||
|
||||
var loadFiles = function (items, event) {
|
||||
$.fire('beforeAdd');
|
||||
|
||||
var entry, item, i, ii;
|
||||
for (i = 0, ii = items.length; i < ii; i++) {
|
||||
item = items[i];
|
||||
if ((item.webkitGetAsEntry != null) && (entry = item.webkitGetAsEntry())) {
|
||||
if (entry.isFile) {
|
||||
queueLength++;
|
||||
enqueueFileAddition(item.getAsFile(), event);
|
||||
} else if (entry.isDirectory) {
|
||||
processDirectory(entry, entry.name, event);
|
||||
}
|
||||
} else if (item.getAsFile != null) {
|
||||
if ((item.kind == null) || item.kind === 'file') {
|
||||
queueLength++;
|
||||
enqueueFileAddition(item.getAsFile(), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var processDirectory = function (directory, path, event) {
|
||||
var dirReader, readEntries;
|
||||
|
||||
dirReader = directory.createReader();
|
||||
|
||||
readEntries = (function() {
|
||||
return function() {
|
||||
return dirReader.readEntries(function(entries) {
|
||||
var entry, i;
|
||||
if (entries.length > 0) {
|
||||
for (i = 0; i < entries.length; i++) {
|
||||
entry = entries[i];
|
||||
if (entry.isFile) {
|
||||
queueLength++;
|
||||
entry.file(function(file) {
|
||||
file.relativePath = '/' + path + '/' + file.name;
|
||||
return enqueueFileAddition(file, event);
|
||||
}, function() { // Error
|
||||
queueLength--;
|
||||
});
|
||||
} else if (entry.isDirectory) {
|
||||
processDirectory(entry, path + '/' + entry.name, event);
|
||||
}
|
||||
}
|
||||
readEntries();
|
||||
}
|
||||
return null;
|
||||
});
|
||||
};
|
||||
})(this);
|
||||
|
||||
return readEntries();
|
||||
};
|
||||
|
||||
var queueFiles = [];
|
||||
/**
|
||||
* @summary Add a file to the queue of processed files, if it brings the total up to the expected total, flush the queue
|
||||
* @param file {Object} - File object to be passed along to appendFilesFromFileList eventually
|
||||
* @param [path] {String} - the file's relative path from the originally dropped folder if we are parsing folder content (Chrome only for now)
|
||||
*/
|
||||
var enqueueFileAddition = function(file, event){
|
||||
if (!file.relativePath) file.fullPath;
|
||||
queueFiles.push(file);
|
||||
|
||||
// If all the files we expect have shown up, then flush the queue.
|
||||
if (queueFiles.length == queueLength) {
|
||||
appendFilesFromFileList(queueFiles, event);
|
||||
}
|
||||
};
|
||||
|
||||
var appendFilesFromFileList = function(fileList, event){
|
||||
// check for uploading too many files
|
||||
var errorCount = 0;
|
||||
var o = $.getOpt(['maxFiles', 'minFileSize', 'maxFileSize', 'maxFilesErrorCallback', 'minFileSizeErrorCallback', 'maxFileSizeErrorCallback', 'fileType', 'fileTypeErrorCallback']);
|
||||
if (typeof(o.maxFiles)!=='undefined' && o.maxFiles<(fileList.length+$.files.length)) {
|
||||
// if single-file upload, file is already added, and trying to add 1 new file, simply replace the already-added file
|
||||
if (o.maxFiles===1 && $.files.length===1 && fileList.length===1) {
|
||||
$.removeFile($.files[0]);
|
||||
} else {
|
||||
o.maxFilesErrorCallback(fileList, errorCount++);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var files = [];
|
||||
$h.each(fileList, function(file){
|
||||
var fileName = file.name;
|
||||
if(o.fileType.length > 0){
|
||||
var fileTypeFound = false;
|
||||
for(var index in o.fileType){
|
||||
var extension = '.' + o.fileType[index];
|
||||
if(fileName.indexOf(extension, fileName.length - extension.length) !== -1){
|
||||
fileTypeFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!fileTypeFound) {
|
||||
o.fileTypeErrorCallback(file, errorCount++);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof(o.minFileSize)!=='undefined' && file.size<o.minFileSize) {
|
||||
o.minFileSizeErrorCallback(file, errorCount++);
|
||||
return false;
|
||||
}
|
||||
if (typeof(o.maxFileSize)!=='undefined' && file.size>o.maxFileSize) {
|
||||
o.maxFileSizeErrorCallback(file, errorCount++);
|
||||
return false;
|
||||
}
|
||||
|
||||
function addFile(uniqueIdentifier){
|
||||
var pathIndex = $.files.length ? $.files.length : 0;
|
||||
if (!$.getFromUniqueIdentifier(uniqueIdentifier)) {(function(){
|
||||
file.uniqueIdentifier = uniqueIdentifier;
|
||||
var f = new ResumableFile($, file, uniqueIdentifier);
|
||||
$.files.push(f);
|
||||
files.push(f);
|
||||
f.container = (typeof event != 'undefined' ? event.srcElement : null);
|
||||
window.setTimeout(function(){
|
||||
$.fire('fileAdded', f, event)
|
||||
},0);
|
||||
})()};
|
||||
}
|
||||
// directories have size == 0
|
||||
var uniqueIdentifier = $h.generateUniqueIdentifier(file)
|
||||
if(uniqueIdentifier && typeof uniqueIdentifier.done === 'function' && typeof uniqueIdentifier.fail === 'function'){
|
||||
uniqueIdentifier
|
||||
.done(function(uniqueIdentifier){
|
||||
addFile(uniqueIdentifier);
|
||||
})
|
||||
.fail(function(){
|
||||
addFile();
|
||||
});
|
||||
}else{
|
||||
addFile(uniqueIdentifier);
|
||||
}
|
||||
|
||||
});
|
||||
window.setTimeout(function(){
|
||||
$.fire('filesAdded', files)
|
||||
},0);
|
||||
};
|
||||
|
||||
// INTERNAL OBJECT TYPES
|
||||
function ResumableFile(resumableObj, file, uniqueIdentifier){
|
||||
var $ = this;
|
||||
$.opts = {};
|
||||
$.getOpt = resumableObj.getOpt;
|
||||
$._prevProgress = 0;
|
||||
$.resumableObj = resumableObj;
|
||||
$.file = file;
|
||||
$.fileName = file.fileName||file.name; // Some confusion in different versions of Firefox
|
||||
$.size = file.size;
|
||||
$.relativePath = file.relativePath || file.webkitRelativePath || $.fileName;
|
||||
$.uniqueIdentifier = uniqueIdentifier;
|
||||
$._pause = false;
|
||||
$.container = '';
|
||||
var _error = uniqueIdentifier !== undefined;
|
||||
|
||||
// Callback when something happens within the chunk
|
||||
var chunkEvent = function(event, message){
|
||||
// event can be 'progress', 'success', 'error' or 'retry'
|
||||
switch(event){
|
||||
case 'progress':
|
||||
$.resumableObj.fire('fileProgress', $);
|
||||
break;
|
||||
case 'error':
|
||||
$.abort();
|
||||
_error = true;
|
||||
$.chunks = [];
|
||||
$.resumableObj.fire('fileError', $, message);
|
||||
break;
|
||||
case 'success':
|
||||
if(_error) return;
|
||||
$.resumableObj.fire('fileProgress', $); // it's at least progress
|
||||
if($.isComplete()) {
|
||||
$.resumableObj.fire('fileSuccess', $, message);
|
||||
}
|
||||
break;
|
||||
case 'retry':
|
||||
$.resumableObj.fire('fileRetry', $);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// Main code to set up a file object with chunks,
|
||||
// packaged to be able to handle retries if needed.
|
||||
$.chunks = [];
|
||||
$.abort = function(){
|
||||
// Stop current uploads
|
||||
var abortCount = 0;
|
||||
$h.each($.chunks, function(c){
|
||||
if(c.status()=='uploading') {
|
||||
c.abort();
|
||||
abortCount++;
|
||||
}
|
||||
});
|
||||
if(abortCount>0) $.resumableObj.fire('fileProgress', $);
|
||||
};
|
||||
$.cancel = function(){
|
||||
// Reset this file to be void
|
||||
var _chunks = $.chunks;
|
||||
$.chunks = [];
|
||||
// Stop current uploads
|
||||
$h.each(_chunks, function(c){
|
||||
if(c.status()=='uploading') {
|
||||
c.abort();
|
||||
$.resumableObj.uploadNextChunk();
|
||||
}
|
||||
});
|
||||
$.resumableObj.removeFile($);
|
||||
$.resumableObj.fire('fileProgress', $);
|
||||
};
|
||||
$.retry = function(){
|
||||
$.bootstrap();
|
||||
var firedRetry = false;
|
||||
$.resumableObj.on('chunkingComplete', function(){
|
||||
if(!firedRetry) $.resumableObj.upload();
|
||||
firedRetry = true;
|
||||
});
|
||||
};
|
||||
$.bootstrap = function(){
|
||||
$.abort();
|
||||
_error = false;
|
||||
// Rebuild stack of chunks from file
|
||||
$.chunks = [];
|
||||
$._prevProgress = 0;
|
||||
var round = $.getOpt('forceChunkSize') ? Math.ceil : Math.floor;
|
||||
var maxOffset = Math.max(round($.file.size/$.getOpt('chunkSize')),1);
|
||||
for (var offset=0; offset<maxOffset; offset++) {(function(offset){
|
||||
window.setTimeout(function(){
|
||||
$.chunks.push(new ResumableChunk($.resumableObj, $, offset, chunkEvent));
|
||||
$.resumableObj.fire('chunkingProgress',$,offset/maxOffset);
|
||||
},0);
|
||||
})(offset)}
|
||||
window.setTimeout(function(){
|
||||
$.resumableObj.fire('chunkingComplete',$);
|
||||
},0);
|
||||
};
|
||||
$.progress = function(){
|
||||
if(_error) return(1);
|
||||
// Sum up progress across everything
|
||||
var ret = 0;
|
||||
var error = false;
|
||||
$h.each($.chunks, function(c){
|
||||
if(c.status()=='error') error = true;
|
||||
ret += c.progress(true); // get chunk progress relative to entire file
|
||||
});
|
||||
ret = (error ? 1 : (ret>0.99999 ? 1 : ret));
|
||||
ret = Math.max($._prevProgress, ret); // We don't want to lose percentages when an upload is paused
|
||||
$._prevProgress = ret;
|
||||
return(ret);
|
||||
};
|
||||
$.isUploading = function(){
|
||||
var uploading = false;
|
||||
$h.each($.chunks, function(chunk){
|
||||
if(chunk.status()=='uploading') {
|
||||
uploading = true;
|
||||
return(false);
|
||||
}
|
||||
});
|
||||
return(uploading);
|
||||
};
|
||||
$.isComplete = function(){
|
||||
var outstanding = false;
|
||||
$h.each($.chunks, function(chunk){
|
||||
var status = chunk.status();
|
||||
if(status=='pending' || status=='uploading' || chunk.preprocessState === 1) {
|
||||
outstanding = true;
|
||||
return(false);
|
||||
}
|
||||
});
|
||||
return(!outstanding);
|
||||
};
|
||||
$.pause = function(pause){
|
||||
if(typeof(pause)==='undefined'){
|
||||
$._pause = ($._pause ? false : true);
|
||||
}else{
|
||||
$._pause = pause;
|
||||
}
|
||||
};
|
||||
$.isPaused = function() {
|
||||
return $._pause;
|
||||
};
|
||||
|
||||
|
||||
// Bootstrap and return
|
||||
$.resumableObj.fire('chunkingStart', $);
|
||||
$.bootstrap();
|
||||
return(this);
|
||||
}
|
||||
|
||||
|
||||
function ResumableChunk(resumableObj, fileObj, offset, callback){
|
||||
var $ = this;
|
||||
$.opts = {};
|
||||
$.getOpt = resumableObj.getOpt;
|
||||
$.resumableObj = resumableObj;
|
||||
$.fileObj = fileObj;
|
||||
$.fileObjSize = fileObj.size;
|
||||
$.fileObjType = fileObj.file.type;
|
||||
$.offset = offset;
|
||||
$.callback = callback;
|
||||
$.lastProgressCallback = (new Date);
|
||||
$.tested = false;
|
||||
$.retries = 0;
|
||||
$.pendingRetry = false;
|
||||
$.preprocessState = 0; // 0 = unprocessed, 1 = processing, 2 = finished
|
||||
|
||||
// Computed properties
|
||||
var chunkSize = $.getOpt('chunkSize');
|
||||
$.loaded = 0;
|
||||
$.startByte = $.offset*chunkSize;
|
||||
$.endByte = Math.min($.fileObjSize, ($.offset+1)*chunkSize);
|
||||
if ($.fileObjSize-$.endByte < chunkSize && !$.getOpt('forceChunkSize')) {
|
||||
// The last chunk will be bigger than the chunk size, but less than 2*chunkSize
|
||||
$.endByte = $.fileObjSize;
|
||||
}
|
||||
$.xhr = null;
|
||||
|
||||
// test() makes a GET request without any data to see if the chunk has already been uploaded in a previous session
|
||||
$.test = function(){
|
||||
// Set up request and listen for event
|
||||
$.xhr = new XMLHttpRequest();
|
||||
|
||||
var testHandler = function(e){
|
||||
$.tested = true;
|
||||
var status = $.status();
|
||||
if(status=='success') {
|
||||
$.callback(status, $.message());
|
||||
$.resumableObj.uploadNextChunk();
|
||||
} else {
|
||||
$.send();
|
||||
}
|
||||
};
|
||||
$.xhr.addEventListener('load', testHandler, false);
|
||||
$.xhr.addEventListener('error', testHandler, false);
|
||||
$.xhr.addEventListener('timeout', testHandler, false);
|
||||
|
||||
// Add data from the query options
|
||||
var params = [];
|
||||
var parameterNamespace = $.getOpt('parameterNamespace');
|
||||
var customQuery = $.getOpt('query');
|
||||
if(typeof customQuery == 'function') customQuery = customQuery($.fileObj, $);
|
||||
$h.each(customQuery, function(k,v){
|
||||
params.push([encodeURIComponent(parameterNamespace+k), encodeURIComponent(v)].join('='));
|
||||
});
|
||||
// Add extra data to identify chunk
|
||||
params.push([parameterNamespace + $.getOpt('chunkNumberParameterName'), encodeURIComponent($.offset + 1)].join('='));
|
||||
params.push([parameterNamespace + $.getOpt('chunkSizeParameterName'), encodeURIComponent($.getOpt('chunkSize'))].join('='));
|
||||
params.push([parameterNamespace + $.getOpt('currentChunkSizeParameterName'), encodeURIComponent($.endByte - $.startByte)].join('='));
|
||||
params.push([parameterNamespace + $.getOpt('totalSizeParameterName'), encodeURIComponent($.fileObjSize)].join('='));
|
||||
params.push([parameterNamespace + $.getOpt('typeParameterName'), encodeURIComponent($.fileObjType)].join('='));
|
||||
params.push([parameterNamespace + $.getOpt('identifierParameterName'), encodeURIComponent($.fileObj.uniqueIdentifier)].join('='));
|
||||
params.push([parameterNamespace + $.getOpt('fileNameParameterName'), encodeURIComponent($.fileObj.fileName)].join('='));
|
||||
params.push([parameterNamespace + $.getOpt('relativePathParameterName'), encodeURIComponent($.fileObj.relativePath)].join('='));
|
||||
params.push([parameterNamespace + $.getOpt('totalChunksParameterName'), encodeURIComponent($.fileObj.chunks.length)].join('='));
|
||||
// Append the relevant chunk and send it
|
||||
$.xhr.open($.getOpt('testMethod'), $h.getTarget(params));
|
||||
$.xhr.timeout = $.getOpt('xhrTimeout');
|
||||
$.xhr.withCredentials = $.getOpt('withCredentials');
|
||||
// Add data from header options
|
||||
var customHeaders = $.getOpt('headers');
|
||||
if(typeof customHeaders === 'function') {
|
||||
customHeaders = customHeaders($.fileObj, $);
|
||||
}
|
||||
$h.each(customHeaders, function(k,v) {
|
||||
$.xhr.setRequestHeader(k, v);
|
||||
});
|
||||
$.xhr.send(null);
|
||||
};
|
||||
|
||||
$.preprocessFinished = function(){
|
||||
$.preprocessState = 2;
|
||||
$.send();
|
||||
};
|
||||
|
||||
// send() uploads the actual data in a POST call
|
||||
$.send = function(){
|
||||
var preprocess = $.getOpt('preprocess');
|
||||
if(typeof preprocess === 'function') {
|
||||
switch($.preprocessState) {
|
||||
case 0: $.preprocessState = 1; preprocess($); return;
|
||||
case 1: return;
|
||||
case 2: break;
|
||||
}
|
||||
}
|
||||
if($.getOpt('testChunks') && !$.tested) {
|
||||
$.test();
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up request and listen for event
|
||||
$.xhr = new XMLHttpRequest();
|
||||
|
||||
// Progress
|
||||
$.xhr.upload.addEventListener('progress', function(e){
|
||||
if( (new Date) - $.lastProgressCallback > $.getOpt('throttleProgressCallbacks') * 1000 ) {
|
||||
$.callback('progress');
|
||||
$.lastProgressCallback = (new Date);
|
||||
}
|
||||
$.loaded=e.loaded||0;
|
||||
}, false);
|
||||
$.loaded = 0;
|
||||
$.pendingRetry = false;
|
||||
$.callback('progress');
|
||||
|
||||
// Done (either done, failed or retry)
|
||||
var doneHandler = function(e){
|
||||
var status = $.status();
|
||||
if(status=='success'||status=='error') {
|
||||
$.callback(status, $.message());
|
||||
$.resumableObj.uploadNextChunk();
|
||||
} else {
|
||||
$.callback('retry', $.message());
|
||||
$.abort();
|
||||
$.retries++;
|
||||
var retryInterval = $.getOpt('chunkRetryInterval');
|
||||
if(retryInterval !== undefined) {
|
||||
$.pendingRetry = true;
|
||||
setTimeout($.send, retryInterval);
|
||||
} else {
|
||||
$.send();
|
||||
}
|
||||
}
|
||||
};
|
||||
$.xhr.addEventListener('load', doneHandler, false);
|
||||
$.xhr.addEventListener('error', doneHandler, false);
|
||||
$.xhr.addEventListener('timeout', doneHandler, false);
|
||||
|
||||
// Set up the basic query data from Resumable
|
||||
var query = {};
|
||||
query[$.getOpt('chunkNumberParameterName')] = $.offset + 1;
|
||||
query[$.getOpt('chunkSizeParameterName')] = $.getOpt('chunkSize');
|
||||
query[$.getOpt('currentChunkSizeParameterName')] = $.endByte - $.startByte;
|
||||
query[$.getOpt('totalSizeParameterName')] = $.fileObjSize;
|
||||
query[$.getOpt('typeParameterName')] = $.fileObjType;
|
||||
query[$.getOpt('identifierParameterName')] = $.fileObj.uniqueIdentifier;
|
||||
query[$.getOpt('fileNameParameterName')] = $.fileObj.fileName;
|
||||
query[$.getOpt('relativePathParameterName')] = $.fileObj.relativePath;
|
||||
query[$.getOpt('totalChunksParameterName')] = $.fileObj.chunks.length;
|
||||
// Mix in custom data
|
||||
var customQuery = $.getOpt('query');
|
||||
if(typeof customQuery == 'function') customQuery = customQuery($.fileObj, $);
|
||||
$h.each(customQuery, function(k,v){
|
||||
query[k] = v;
|
||||
});
|
||||
|
||||
var func = ($.fileObj.file.slice ? 'slice' : ($.fileObj.file.mozSlice ? 'mozSlice' : ($.fileObj.file.webkitSlice ? 'webkitSlice' : 'slice'))),
|
||||
bytes = $.fileObj.file[func]($.startByte,$.endByte),
|
||||
data = null,
|
||||
target = $.getOpt('target');
|
||||
|
||||
var parameterNamespace = $.getOpt('parameterNamespace');
|
||||
if ($.getOpt('method') === 'octet') {
|
||||
// Add data from the query options
|
||||
data = bytes;
|
||||
var params = [];
|
||||
$h.each(query, function(k,v){
|
||||
params.push([encodeURIComponent(parameterNamespace+k), encodeURIComponent(v)].join('='));
|
||||
});
|
||||
target = $h.getTarget(params);
|
||||
} else {
|
||||
// Add data from the query options
|
||||
data = new FormData();
|
||||
$h.each(query, function(k,v){
|
||||
data.append(parameterNamespace+k,v);
|
||||
});
|
||||
data.append(parameterNamespace+$.getOpt('fileParameterName'), bytes);
|
||||
}
|
||||
|
||||
var method = $.getOpt('uploadMethod');
|
||||
$.xhr.open(method, target);
|
||||
if ($.getOpt('method') === 'octet') {
|
||||
$.xhr.setRequestHeader('Content-Type', 'application/octet-stream');
|
||||
}
|
||||
$.xhr.timeout = $.getOpt('xhrTimeout');
|
||||
$.xhr.withCredentials = $.getOpt('withCredentials');
|
||||
// Add data from header options
|
||||
var customHeaders = $.getOpt('headers');
|
||||
if(typeof customHeaders === 'function') {
|
||||
customHeaders = customHeaders($.fileObj, $);
|
||||
}
|
||||
$h.each(customHeaders, function(k,v) {
|
||||
$.xhr.setRequestHeader(k, v);
|
||||
});
|
||||
$.xhr.send(data);
|
||||
};
|
||||
$.abort = function(){
|
||||
// Abort and reset
|
||||
if($.xhr) $.xhr.abort();
|
||||
$.xhr = null;
|
||||
};
|
||||
$.status = function(){
|
||||
// Returns: 'pending', 'uploading', 'success', 'error'
|
||||
if($.pendingRetry) {
|
||||
// if pending retry then that's effectively the same as actively uploading,
|
||||
// there might just be a slight delay before the retry starts
|
||||
return('uploading');
|
||||
} else if(!$.xhr) {
|
||||
return('pending');
|
||||
} else if($.xhr.readyState<4) {
|
||||
// Status is really 'OPENED', 'HEADERS_RECEIVED' or 'LOADING' - meaning that stuff is happening
|
||||
return('uploading');
|
||||
} else {
|
||||
if($.xhr.status == 200 || $.xhr.status == 201) {
|
||||
// HTTP 200, 201 (created)
|
||||
return('success');
|
||||
} else if($h.contains($.getOpt('permanentErrors'), $.xhr.status) || $.retries >= $.getOpt('maxChunkRetries')) {
|
||||
// HTTP 415/500/501, permanent error
|
||||
return('error');
|
||||
} else {
|
||||
// this should never happen, but we'll reset and queue a retry
|
||||
// a likely case for this would be 503 service unavailable
|
||||
$.abort();
|
||||
return('pending');
|
||||
}
|
||||
}
|
||||
};
|
||||
$.message = function(){
|
||||
return($.xhr ? $.xhr.responseText : '');
|
||||
};
|
||||
$.progress = function(relative){
|
||||
if(typeof(relative)==='undefined') relative = false;
|
||||
var factor = (relative ? ($.endByte-$.startByte)/$.fileObjSize : 1);
|
||||
if($.pendingRetry) return(0);
|
||||
if(!$.xhr || !$.xhr.status) factor*=.95;
|
||||
var s = $.status();
|
||||
switch(s){
|
||||
case 'success':
|
||||
case 'error':
|
||||
return(1*factor);
|
||||
case 'pending':
|
||||
return(0*factor);
|
||||
default:
|
||||
return($.loaded/($.endByte-$.startByte)*factor);
|
||||
}
|
||||
};
|
||||
return(this);
|
||||
}
|
||||
|
||||
// QUEUE
|
||||
$.uploadNextChunk = function(){
|
||||
var found = false;
|
||||
|
||||
// In some cases (such as videos) it's really handy to upload the first
|
||||
// and last chunk of a file quickly; this let's the server check the file's
|
||||
// metadata and determine if there's even a point in continuing.
|
||||
if ($.getOpt('prioritizeFirstAndLastChunk')) {
|
||||
$h.each($.files, function(file){
|
||||
if(file.chunks.length && file.chunks[0].status()=='pending' && file.chunks[0].preprocessState === 0) {
|
||||
file.chunks[0].send();
|
||||
found = true;
|
||||
return(false);
|
||||
}
|
||||
if(file.chunks.length>1 && file.chunks[file.chunks.length-1].status()=='pending' && file.chunks[file.chunks.length-1].preprocessState === 0) {
|
||||
file.chunks[file.chunks.length-1].send();
|
||||
found = true;
|
||||
return(false);
|
||||
}
|
||||
});
|
||||
if(found) return(true);
|
||||
}
|
||||
|
||||
// Now, simply look for the next, best thing to upload
|
||||
$h.each($.files, function(file){
|
||||
if(file.isPaused()===false){
|
||||
$h.each(file.chunks, function(chunk){
|
||||
if(chunk.status()=='pending' && chunk.preprocessState === 0) {
|
||||
chunk.send();
|
||||
found = true;
|
||||
return(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
if(found) return(false);
|
||||
});
|
||||
if(found) return(true);
|
||||
|
||||
// The are no more outstanding chunks to upload, check is everything is done
|
||||
var outstanding = false;
|
||||
$h.each($.files, function(file){
|
||||
if(!file.isComplete()) {
|
||||
outstanding = true;
|
||||
return(false);
|
||||
}
|
||||
});
|
||||
if(!outstanding) {
|
||||
// All chunks have been uploaded, complete
|
||||
$.fire('complete');
|
||||
}
|
||||
return(false);
|
||||
};
|
||||
|
||||
|
||||
// PUBLIC METHODS FOR RESUMABLE.JS
|
||||
$.assignBrowse = function(domNodes, isDirectory){
|
||||
if(typeof(domNodes.length)=='undefined') domNodes = [domNodes];
|
||||
|
||||
$h.each(domNodes, function(domNode) {
|
||||
var input;
|
||||
if(domNode.tagName==='INPUT' && domNode.type==='file'){
|
||||
input = domNode;
|
||||
} else {
|
||||
input = document.createElement('input');
|
||||
input.setAttribute('type', 'file');
|
||||
input.style.display = 'none';
|
||||
domNode.addEventListener('click', function(){
|
||||
input.style.opacity = 0;
|
||||
input.style.display='block';
|
||||
input.focus();
|
||||
input.click();
|
||||
input.style.display='none';
|
||||
}, false);
|
||||
domNode.appendChild(input);
|
||||
}
|
||||
var maxFiles = $.getOpt('maxFiles');
|
||||
if (typeof(maxFiles)==='undefined'||maxFiles!=1){
|
||||
input.setAttribute('multiple', 'multiple');
|
||||
} else {
|
||||
input.removeAttribute('multiple');
|
||||
}
|
||||
if(isDirectory){
|
||||
input.setAttribute('webkitdirectory', 'webkitdirectory');
|
||||
} else {
|
||||
input.removeAttribute('webkitdirectory');
|
||||
}
|
||||
// When new files are added, simply append them to the overall list
|
||||
input.addEventListener('change', function(e){
|
||||
appendFilesFromFileList(e.target.files,e);
|
||||
var clearInput = $.getOpt('clearInput');
|
||||
if (clearInput) {
|
||||
e.target.value = '';
|
||||
}
|
||||
}, false);
|
||||
});
|
||||
};
|
||||
$.assignDrop = function(domNodes){
|
||||
if(typeof(domNodes.length)=='undefined') domNodes = [domNodes];
|
||||
|
||||
$h.each(domNodes, function(domNode) {
|
||||
domNode.addEventListener('dragover', preventDefault, false);
|
||||
domNode.addEventListener('dragenter', preventDefault, false);
|
||||
domNode.addEventListener('drop', onDrop, false);
|
||||
});
|
||||
};
|
||||
$.unAssignDrop = function(domNodes) {
|
||||
if (typeof(domNodes.length) == 'undefined') domNodes = [domNodes];
|
||||
|
||||
$h.each(domNodes, function(domNode) {
|
||||
domNode.removeEventListener('dragover', preventDefault);
|
||||
domNode.removeEventListener('dragenter', preventDefault);
|
||||
domNode.removeEventListener('drop', onDrop);
|
||||
});
|
||||
};
|
||||
$.isUploading = function(){
|
||||
var uploading = false;
|
||||
$h.each($.files, function(file){
|
||||
if (file.isUploading()) {
|
||||
uploading = true;
|
||||
return(false);
|
||||
}
|
||||
});
|
||||
return(uploading);
|
||||
};
|
||||
$.upload = function(){
|
||||
// Make sure we don't start too many uploads at once
|
||||
if($.isUploading()) return;
|
||||
// Kick off the queue
|
||||
$.fire('uploadStart');
|
||||
for (var num=1; num<=$.getOpt('simultaneousUploads'); num++) {
|
||||
$.uploadNextChunk();
|
||||
}
|
||||
};
|
||||
$.pause = function(){
|
||||
// Resume all chunks currently being uploaded
|
||||
$h.each($.files, function(file){
|
||||
file.abort();
|
||||
});
|
||||
$.fire('pause');
|
||||
};
|
||||
$.cancel = function(){
|
||||
$.fire('beforeCancel');
|
||||
for(var i = $.files.length - 1; i >= 0; i--) {
|
||||
$.files[i].cancel();
|
||||
}
|
||||
$.fire('cancel');
|
||||
};
|
||||
$.progress = function(){
|
||||
var totalDone = 0;
|
||||
var totalSize = 0;
|
||||
// Resume all chunks currently being uploaded
|
||||
$h.each($.files, function(file){
|
||||
totalDone += file.progress()*file.size;
|
||||
totalSize += file.size;
|
||||
});
|
||||
return(totalSize>0 ? totalDone/totalSize : 0);
|
||||
};
|
||||
$.addFile = function(file, event){
|
||||
appendFilesFromFileList([file], event);
|
||||
};
|
||||
$.removeFile = function(file){
|
||||
for(var i = $.files.length - 1; i >= 0; i--) {
|
||||
if($.files[i] === file) {
|
||||
$.files.splice(i, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
$.getFromUniqueIdentifier = function(uniqueIdentifier){
|
||||
var ret = false;
|
||||
$h.each($.files, function(f){
|
||||
if(f.uniqueIdentifier==uniqueIdentifier) ret = f;
|
||||
});
|
||||
return(ret);
|
||||
};
|
||||
$.getSize = function(){
|
||||
var totalSize = 0;
|
||||
$h.each($.files, function(file){
|
||||
totalSize += file.size;
|
||||
});
|
||||
return(totalSize);
|
||||
};
|
||||
$.handleDropEvent = function (e) {
|
||||
onDrop(e);
|
||||
};
|
||||
$.handleChangeEvent = function (e) {
|
||||
appendFilesFromFileList(e.target.files, e);
|
||||
e.target.value = '';
|
||||
};
|
||||
|
||||
return(this);
|
||||
};
|
||||
|
||||
|
||||
// Node.js-style export for Node and Component
|
||||
if (typeof module != 'undefined') {
|
||||
module.exports = Resumable;
|
||||
} else if (typeof define === "function" && define.amd) {
|
||||
// AMD/requirejs: Define the module
|
||||
define(function(){
|
||||
return Resumable;
|
||||
});
|
||||
} else {
|
||||
// Browser: Expose to window
|
||||
window.Resumable = Resumable;
|
||||
}
|
||||
|
||||
})();
|
|
@ -248,8 +248,8 @@ gulp.task('connect', ['watch'], function() {
|
|||
targetPath: '/hawtio/git'
|
||||
}, {
|
||||
proto: "http",
|
||||
port: "8080",
|
||||
hostname: "192.168.191.5",
|
||||
port: "8088",
|
||||
hostname: "192.168.0.101",
|
||||
path: '/java/console/api',
|
||||
targetPath: "/"
|
||||
}];
|
||||
|
|
|
@ -85,6 +85,8 @@
|
|||
<script src="libs/hawtio-kubernetes-api/dist/hawtio-kubernetes-api.js"></script>
|
||||
<script src="libs/js-yaml/dist/js-yaml.js"></script>
|
||||
<script src="libs/ng-dialog/js/ngDialog.js"></script>
|
||||
<script src="libs/ng-file-upload/ng-file-upload.js"></script>
|
||||
<script src="libs/ng-file-upload-shim/ng-file-upload-shim.js"></script>
|
||||
<!-- endbower -->
|
||||
<script type="text/javascript" src="libs/codemirror/addon/edit/closetag.js"></script>
|
||||
<script type="text/javascript" src="libs/codemirror/addon/edit/continuelist.js"></script>
|
||||
|
@ -111,6 +113,7 @@
|
|||
<script src="libs/hawtio-preferences/dist/hawtio-preferences.js"></script>
|
||||
<!-- NOTE we need to make sure this is loaded much later than d3.js! -->
|
||||
<script src="libs/nvd3/build/nv.d3.js"></script>
|
||||
<script type="text/javascript" src="extendJs/resumable.js"></script>
|
||||
<style>
|
||||
.navbar-brand > img {
|
||||
height: 20px;
|
||||
|
@ -143,11 +146,6 @@
|
|||
<a href="/" class="log fl sj_logo"><img src="new/images/logo.png" class="log-img"></a>
|
||||
<ul class="nav navbar-nav navbar-primary sj_topnav " hawtio-main-nav></ul>
|
||||
<ul class="nav navbar-nav navbar-utility sj_setting">
|
||||
<li class="">
|
||||
<a href="/config/regionalism-code/searching" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="glyphicon glyphicon-search"></span> 帮助
|
||||
</a>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="glyphicon glyphicon-cog"></span> 配置<b class="caret"></b>
|
||||
|
|
|
@ -155,3 +155,12 @@ treecontrol li:hover{}
|
|||
.sj_c_green{ color:#58b358;}
|
||||
.sj_c_red{ color:#c00000;}
|
||||
.sj_table_border{ border:1px solid #ddd;}
|
||||
|
||||
/*查看弹框 20161018byLB*/
|
||||
.box_chakan{ width: 750px; padding:15px; line-height: 1.9; }
|
||||
.box_chakan h2{ font-size: 14px; border-bottom: 1px solid #e4e4e4; padding-bottom: 5px; padding-left: 15px;}
|
||||
.box_chakan li{ margin-bottom: 10px;}
|
||||
.box_chakan_leftinfo{ display:inline-block; width: 120px; text-align: right;}
|
||||
.box_chakan_maxinfo{ display:inline-block; width: 600px; text-align: left; color: #666; }
|
||||
.box_chakan_mininfo{ display:inline-block; width: 230px; text-align: left; color: #666; }
|
||||
.box_chakan_smallinfo{ display:inline-block; width: 140px; text-align: left; color: #666; }
|
|
@ -1,23 +0,0 @@
|
|||
<div ng-controller="Configs.RegionalismCodeController">
|
||||
<div hawtio-breadcrumbs></div>
|
||||
<div hawtio-tabs></div>
|
||||
<div class="container-content ">
|
||||
<div class="container-fluid sj_fluid">
|
||||
<div ng-hide="model.regionalismInfo.length" class="align-center">
|
||||
<p class="alert alert-info">当前没有可以查看的数据.</p>
|
||||
</div>
|
||||
<div ng-show="model.regionalismInfo.length">
|
||||
<table ng-table="tableParams" class="table table-condensed table-bordered table-striped" show-filter="true">
|
||||
<tr ng-repeat="row in $data">
|
||||
<td title="'行政区划代码'" filter="{ code: 'text'}" sortable="'code'">
|
||||
{{row.code}}</td>
|
||||
<td title="'市'" filter="{ cityName: 'text'}" sortable="'cityName'">
|
||||
{{row.cityName}}</td>
|
||||
<td title="'区县'" filter="{ districtName: 'text'}" sortable="'districtName'">
|
||||
{{row.districtName}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -101,6 +101,78 @@
|
|||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/ng-template" id="systemInfo.html">
|
||||
<div class="sj_new_box">
|
||||
<div class=" mb10">
|
||||
<ul class="box_chakan">
|
||||
<h2 class="mb10">查看详情</h2>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">行政区划代码:</span>
|
||||
<p class="fl box_chakan_mininfo">321202</p>
|
||||
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">行政区划:</span>
|
||||
<p class="fl box_chakan_mininfo"><span class="mr5">泰州市</span><span class="mr5">海陵区</span><span class="mr5">县级</span></p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">信息系统名称:</span>
|
||||
<p class="fl box_chakan_mininfo">国库集中支付管理</p>
|
||||
<span class="fl box_chakan_leftinfo">信息系统版本:</span>
|
||||
<p class="fl box_chakan_mininfo">11B</p>
|
||||
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">数据库类型:</span>
|
||||
<p class="fl box_chakan_mininfo"><span>ORACLE</span><span class="ml5 mr5">/</span><span >11B</span></p>
|
||||
<span class="fl box_chakan_leftinfo">字符集:</span>
|
||||
<p class="fl box_chakan_mininfo">GBK</p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">投入使用时间:</span>
|
||||
<p class="fl box_chakan_mininfo"><span class="mr5">2009年</span><span>12月</span></p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">开发商全称:</span>
|
||||
<p class="fl box_chakan_maxinfo">常州富深协通技术有限公司</p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">联系人:</span>
|
||||
<p class="fl box_chakan_mininfo">姚虫虫</p>
|
||||
<span class="fl box_chakan_leftinfo">联系电话(手机):</span>
|
||||
<p class="fl box_chakan_mininfo">15515551555</p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">功能描述:</span>
|
||||
<p class="fl box_chakan_maxinfo">记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账记账</p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">业务范围:</span>
|
||||
<p class="fl box_chakan_maxinfo">
|
||||
<span class="mr5">部门预算管理</span>
|
||||
<span class="mr5">预算指标管理</span>
|
||||
<span class="mr5">财政经济景气预测与分析</span>
|
||||
<span class="mr5">政府性债务管理</span>
|
||||
<span class="mr5">部门预算管理</span>
|
||||
<span class="mr5">预算指标管理</span>
|
||||
<span class="mr5">财政经济景气预测与分析</span>
|
||||
<span class="mr5">政府性债务管理</span>
|
||||
</p>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl box_chakan_leftinfo">脚本文件:</span>
|
||||
<p class="fl box_chakan_maxinfo">
|
||||
192.168.0.110 /home/script/<br/>
|
||||
UserTablespace_321202_05.sql<br/>
|
||||
Checkout_Indicate_321202_05.sql<br/>
|
||||
Checkout_Pay_321202_05.sql<br/>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<div ng-controller="Kubernetes.TopLevel">
|
||||
<div class="wiki-icon-view" ng-controller="Kubernetes.FileDropController" nv-file-drop nv-file-over uploader="uploader" over-class="ready-drop">
|
||||
<div class="row kubernetes-view" ng-view></div>
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<div ng-controller="System.SystemCodeController">
|
||||
<div hawtio-breadcrumbs></div>
|
||||
<div hawtio-tabs></div>
|
||||
<div class="container-content ">
|
||||
<div class="container-fluid sj_fluid">
|
||||
<div ng-hide="model.systemInfo.length" class="align-center">
|
||||
<p class="alert alert-info">当前没有可以查看的数据.</p>
|
||||
</div>
|
||||
<div ng-show="model.systemInfo.length">
|
||||
<table ng-table="tableParams" class="table table-condensed table-bordered table-striped" show-filter="true">
|
||||
<tr ng-repeat="row in $data">
|
||||
<td title="'系统编码'" filter="{ code: 'text'}" sortable="'code'">
|
||||
{{row.code}}</td>
|
||||
<td title="'系统名称'" filter="{ systemName: 'text'}" sortable="'systemName'">
|
||||
{{row.systemName}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -13,8 +13,6 @@ module Configs {
|
|||
_module.config(['$provide', '$routeProvider', ($provide, $routeProvider) =>{
|
||||
$routeProvider.when(UrlHelpers.join(context, 'gluster-fs/setting'), route('glusterfsSetting.html', false))
|
||||
.when(UrlHelpers.join(context, 'kube-cluster/setting'), route('kubeClusterSetting.html', false))
|
||||
.when(UrlHelpers.join(context, 'regionalism-code/searching'), route('regionalismCodeSearch.html', false))
|
||||
.when(UrlHelpers.join(context, 'system-code/searching'), route('systemCodeSearch.html', false))
|
||||
.when(context, {redirectTo: UrlHelpers.join(context, '/kube-cluster/setting')});
|
||||
}]);
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ module Configs{
|
|||
public updateAllData(){
|
||||
this.updateVolumeData();
|
||||
this.updateOracleParam();
|
||||
this.updateCodeInfo();
|
||||
//this.updateCodeInfo();
|
||||
}
|
||||
public updateVolumeData(){
|
||||
var result=null;
|
||||
|
@ -118,7 +118,7 @@ module Configs{
|
|||
formatVolumes(this.cluster);
|
||||
}
|
||||
|
||||
public updateCodeInfo(){
|
||||
/*public updateCodeInfo(){
|
||||
var result=null;
|
||||
$.ajax({
|
||||
async: false,
|
||||
|
@ -132,7 +132,7 @@ module Configs{
|
|||
});
|
||||
this.regionalismInfo = result.regionalism;
|
||||
this.systemInfo = result.system;
|
||||
}
|
||||
}*/
|
||||
|
||||
public updateOracleParam(){
|
||||
var result=null;
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
/// <reference path="../../includes.ts"/>
|
||||
/// <reference path="configPlugin.ts"/>
|
||||
/// <reference path="configsHelper.ts"/>
|
||||
/// <reference path="configsUtils.ts"/>
|
||||
/// <reference path="configsDataService.ts"/>
|
||||
module Configs{
|
||||
|
||||
export var RegionalismCodeController = controller('RegionalismCodeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", 'ConfigsModel', 'NgTableParams',
|
||||
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel, NgTableParams) =>{
|
||||
$scope.subTabConfig = createConfigHelperNavBar($scope, $location, $routeParams);
|
||||
$scope.model = ConfigsModel;
|
||||
|
||||
$scope.tableParams = new NgTableParams({count: 25}, {
|
||||
counts: [25, 50, 100],
|
||||
dataset: $scope.model.regionalismInfo
|
||||
});
|
||||
}]);
|
||||
}
|
|
@ -72,4 +72,8 @@ module Configs{
|
|||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
export var SystemInfoController = controller('SystemInfoController', ['$scope', ($scope) =>{
|
||||
|
||||
}]);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/// <reference path="../../includes.ts"/>
|
||||
/// <reference path="configPlugin.ts"/>
|
||||
/// <reference path="configsHelper.ts"/>
|
||||
/// <reference path="configsUtils.ts"/>
|
||||
/// <reference path="configsDataService.ts"/>
|
||||
module Configs{
|
||||
|
||||
|
||||
export var SystemCodeController = controller('SystemCodeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", 'ConfigsModel', 'NgTableParams',
|
||||
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel, NgTableParams) =>{
|
||||
$scope.subTabConfig = createConfigHelperNavBar($scope, $location, $routeParams);
|
||||
|
||||
$scope.model = ConfigsModel;
|
||||
|
||||
$scope.tableParams = new NgTableParams({count: 25}, {
|
||||
counts: [25, 50, 100],
|
||||
dataset: $scope.model.systemInfo
|
||||
});
|
||||
}]);
|
||||
}
|
|
@ -1,4 +1,42 @@
|
|||
<div ng-controller="System.SystemListController">
|
||||
<div hawtio-tabs></div>
|
||||
<div class="container-content "></div>
|
||||
<div class="container-content ">
|
||||
<div class="container-fluid sj_fluid">
|
||||
<div class="row clear fl">
|
||||
<!--<input type="checkbox" class="fl mr5 " style="margin-top: 8px;" />
|
||||
<label class="fl mr5 " style="margin-top: 5px; font-style:nomal;">全选</label>-->
|
||||
<span class="pull-right"> </span>
|
||||
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="deletePrompt(id || tableConfig.selectedItems)">
|
||||
<i class="glyphicon glyphicon-open"></i> 脚本上传
|
||||
</button>
|
||||
<span class="pull-right"> </span>
|
||||
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="migrationClick.open(id || tableConfig.selectedItems)">
|
||||
<i class="glyphicon glyphicon-save"></i> 文件包导出
|
||||
</button>
|
||||
<span class="pull-right"> </span>
|
||||
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="downLoadExcelFile()">
|
||||
<i class="glyphicon glyphicon-export"></i> Excel导出
|
||||
</button>
|
||||
<span class="pull-right"> </span>
|
||||
<button class="btn pull-right sj_btn_grey " ng-disabled="!id && tableConfig.selectedItems.length == 0" ng-click="createOracleService(id || tableConfig.selectedItems)">
|
||||
<i class="glyphicon glyphicon-import"></i> Excel导入
|
||||
</button>
|
||||
<div class="btn pull-right sj_btn_grey ">
|
||||
<a class="data_file_btn fl" >导入到服务器</a><input type="file" name="file-upload[]" id="file-uploads" onchange="angular.element(this).scope().upLoadExcelFile(this.files)" multiple />
|
||||
</div>
|
||||
</div>
|
||||
<div ng-show="true">
|
||||
<div class="col-md-12" >
|
||||
<table ng-table-dynamic="tableParams with columns" class="table table-condensed table-bordered table-striped" >
|
||||
<tr ng-repeat="row in $data">
|
||||
<td ng-repeat="col in $columns">
|
||||
<span ng-show="col.field != 'id'">{{row[col.field]}}</span>
|
||||
<button class="btn sj_btn" ng-hide="col.field != 'id'" ng-click="viewClick(row)">查看</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,37 @@
|
|||
<div ng-controller="System.SystemVerificationController">
|
||||
<div hawtio-tabs></div>
|
||||
<div class="container-content ">
|
||||
<div class="container-fluid sj_fluid">
|
||||
<div class="row clear fl">
|
||||
<label>行政区划代码</label>
|
||||
</div>
|
||||
<div class="row clear fl">
|
||||
<select class="form-control" ng-change="citySelect(x)" ng-model="x" ng-init="x='all'">
|
||||
<option value="all">全部</option>
|
||||
<option ng-repeat="city in cities">{{city}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row clear fl">
|
||||
<select class="form-control" ng-change="countrySelect(y)" ng-model="y" ng-init="y='all'">
|
||||
<option value="all">全部</option>
|
||||
<option ng-repeat="country in countries">{{country.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row clear fl">
|
||||
<button class="btn pull-right sj_btn_grey " ng-click="check()">
|
||||
<i class="glyphicon glyphicon-save"></i> 校验
|
||||
</button>
|
||||
</div>
|
||||
<div ng-show="true">
|
||||
<div class="col-md-12">
|
||||
<table ng-table-dynamic="tableParams with columns" class="table table-condensed table-bordered table-striped">
|
||||
<tr ng-repeat="row in $data" ng-class="{'danger': row.checkResult = '否'}">
|
||||
<td ng-repeat="col in $columns">{{row[col.field]}}</td>
|
||||
{{row}}
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -4,12 +4,14 @@
|
|||
/// <reference path="../../configs/ts/configsDataService.ts"/>
|
||||
module System{
|
||||
|
||||
export var RegionalismCodeController = controller('RegionalismCodeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", 'ConfigsModel', 'NgTableParams',
|
||||
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel, NgTableParams) =>{
|
||||
export var RegionalismCodeController = controller('RegionalismCodeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", 'SystemModel', 'NgTableParams',
|
||||
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, SystemModel, NgTableParams) =>{
|
||||
|
||||
shareInit($scope);
|
||||
|
||||
$scope.model = ConfigsModel;
|
||||
$scope.model = SystemModel;
|
||||
|
||||
//console.log($scope.model.regionalismInfo);
|
||||
|
||||
$scope.tableParams = new NgTableParams({count: 25}, {
|
||||
counts: [25, 50, 100],
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
/// <reference path="../../includes.ts"/>
|
||||
/// <reference path="systemPlugin.ts"/>
|
||||
/// <reference path="systemHelpers.ts"/>\
|
||||
/// <reference path="../../configs/ts/configsDataService.ts"/>
|
||||
/// <reference path="systemHelpers.ts"/>
|
||||
module System{
|
||||
|
||||
export var SystemCodeController = controller('SystemCodeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", 'ConfigsModel', 'NgTableParams',
|
||||
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, ConfigsModel, NgTableParams) =>{
|
||||
export var SystemCodeController = controller('SystemCodeController', ["$scope", "$templateCache", "$location", "$routeParams", "$http", "$timeout", 'SystemModel', 'NgTableParams',
|
||||
($scope, $templateCache:ng.ITemplateCacheService, $location, $routeParams, $http, $timeout, SystemModel, NgTableParams) =>{
|
||||
|
||||
shareInit($scope);
|
||||
|
||||
$scope.model = ConfigsModel;
|
||||
$scope.model = SystemModel;
|
||||
|
||||
$scope.tableParams = new NgTableParams({count: 25}, {
|
||||
counts: [25, 50, 100],
|
||||
|
|
|
@ -3,7 +3,214 @@
|
|||
/// <reference path="systemHelpers.ts"/>
|
||||
|
||||
module System{
|
||||
export var SystemListController = controller('SystemListController', ['$scope', ($scope) => {
|
||||
export var SystemListController = controller('SystemListController', ['$scope', '$location', '$http', '$templateCache', 'Upload', 'NgTableParams', 'ngDialog', ($scope, $location, $http, $templateCache, Upload, NgTableParams, ngDialog) => {
|
||||
shareInit($scope);
|
||||
|
||||
// 表头显示的信息
|
||||
$scope.columns= [
|
||||
{ field: 'id', title: '操作', show: true},
|
||||
{ field: "object", title: "采集对象", filter: { object: "select" }, filterData: booleanChoose(), show: true },
|
||||
{ field: "city", title: "市", filter: { city: 'text' }, show: true },
|
||||
{ field: "county", title: "区/县", filter: { county: 'text' }, show: true },
|
||||
{ field: "regionalismCode", title: "行政区划代码", filter: {regionalismCode: 'text'}, show: true },
|
||||
{ field: "level", title: "级次", filter: { level: "select" }, filterData: levelType(), show: true },
|
||||
{ field: "systemCode", title: "系统编码", filter: { systemCode: "text" }, show: true },
|
||||
{ field: "systemName", title: "信息系统名称", filter: { systemName: "text" }, show: true },
|
||||
{ field: "contactsPerson", title: "联系人", filter: { contactsPerson: "text" }, show: true },
|
||||
{ field: "contactsMethod", title: "联系方式", filter: { contactsMethod: "text" }, show: true },
|
||||
{ field: "databaseType", title: "数据库类型", filter: { databaseType: "select" }, filterData: databaseType(), show: true},
|
||||
{ field: "userSql", title: "oracle用户名表空间", filter: { userSql: "select" }, filterData: booleanChoose(), show: true},
|
||||
{ field: "checkSql", title: "支付信息标准表脚本", filter: { checkSql: "select" }, filterData: booleanChoose(), show: true},
|
||||
{ field: "execSql", title: "可执行标准表脚本", filter: { execSql: "select" }, filterData: booleanChoose(), show: true},
|
||||
];
|
||||
|
||||
$scope.model = [{
|
||||
id: 1,
|
||||
object: '是',
|
||||
city: '南京市',
|
||||
county: '玄武区',
|
||||
regionalismCode: '321001',
|
||||
level: '市级',
|
||||
systemCode: '5',
|
||||
systemName: '非税系统',
|
||||
contactsPerson: '唐僧',
|
||||
contactsMethod: '15575170786',
|
||||
databaseType: 'oracle',
|
||||
userSql: '是',
|
||||
checkSql: '是',
|
||||
execSql: '是'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
object: '是',
|
||||
city: '南京市',
|
||||
county: '浦口区',
|
||||
regionalismCode: '321011',
|
||||
level: '市级',
|
||||
systemCode: '5',
|
||||
systemName: '预算执行',
|
||||
contactsPerson: '唐僧',
|
||||
contactsMethod: '15675170786',
|
||||
databaseType: 'oracle',
|
||||
userSql: '是',
|
||||
checkSql: '是',
|
||||
execSql: '是'
|
||||
}]
|
||||
|
||||
// 点击查看按钮事件处理函数
|
||||
$scope.viewClick = (selected) => {
|
||||
ngDialog.open({
|
||||
template: 'systemInfo.html',
|
||||
controller: 'Configs.SystemInfoController',
|
||||
width: 790,
|
||||
closeByDocument: false,
|
||||
data: selected,
|
||||
className: 'ngdialog-theme-default'
|
||||
});
|
||||
}
|
||||
|
||||
// 表数据
|
||||
$scope.tableParams = new NgTableParams({count: 25}, {
|
||||
counts: [25, 50, 100],
|
||||
dataset: $scope.model
|
||||
});
|
||||
|
||||
// 文件上传
|
||||
$scope.upLoadExcelFile = (files) =>{
|
||||
var r = new Resumable({
|
||||
target:'/java/console/api/fileOperation/file/upload',
|
||||
chunkSize:1*1024*1024,
|
||||
simultaneousUploads:4,
|
||||
testChunks: true,
|
||||
throttleProgressCallbacks:1,
|
||||
method: "octet"
|
||||
});
|
||||
if(!r.support){
|
||||
throw "当前浏览器不支持Resumable.js文件上传";
|
||||
}else{
|
||||
console.log(files);
|
||||
angular.forEach(files, (file) => {
|
||||
r.addFile(file);
|
||||
})
|
||||
|
||||
r.on('fileAdded', function(file){
|
||||
console.log(file);
|
||||
r.upload();
|
||||
});
|
||||
|
||||
r.on('complete', function(){
|
||||
// Hide pause/resume when the upload has completed
|
||||
console.log("文件上传完毕");
|
||||
});
|
||||
|
||||
r.on('fileProgress', function(file){
|
||||
// Handle progress for both the file and the overall upload
|
||||
//$('.resumable-file-'+file.uniqueIdentifier+' .resumable-file-progress').html(Math.floor(file.progress()*100) + '%');
|
||||
//$('.progress-bar').css({width:Math.floor(r.progress()*100) + '%'});
|
||||
console.log(Math.floor(r.progress()*100) + '%');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//excel下载
|
||||
$scope.downLoadExcelFile = () =>{
|
||||
$http.get('/java/console/api/fileOperation/file/download', { responseType: 'arraybuffer' })
|
||||
.success( function(data, status, headers) {
|
||||
var octetStreamMime = 'application/octet-stream';
|
||||
var success = false;
|
||||
// Get the headers
|
||||
headers = headers();
|
||||
// Get the filename from the x-filename header or default to "服务列表"
|
||||
var filename = headers['x-filename'] || '服务列表.xls';
|
||||
// Determine the content type from the header or default to "application/octet-stream"
|
||||
var contentType = headers['content-type'] || octetStreamMime;
|
||||
try{
|
||||
// Try using msSaveBlob if supported
|
||||
console.log("Trying saveBlob method ...");
|
||||
var blob = new Blob([data], { type: contentType });
|
||||
if(navigator.msSaveBlob)
|
||||
navigator.msSaveBlob(blob, filename);
|
||||
else {
|
||||
// Try using other saveBlob implementations, if available
|
||||
var saveBlob = navigator["webkitSaveBlob"] || navigator["mozSaveBlob"] || navigator["saveBlob"];
|
||||
if(saveBlob === undefined) throw "Not supported";
|
||||
saveBlob(blob, filename);
|
||||
}
|
||||
console.log("saveBlob succeeded");
|
||||
success = true;
|
||||
} catch(ex){
|
||||
console.log("saveBlob method failed with the following exception:");
|
||||
console.log(ex);
|
||||
}
|
||||
if(!success){
|
||||
// Get the blob url creator
|
||||
var urlCreator = window.URL || window["webkitURL"] || window["mozURL"] || window["msURL"];
|
||||
if(urlCreator){
|
||||
// Try to use a download link
|
||||
var link = document.createElement('a');
|
||||
if('download' in link){
|
||||
// Try to simulate a click
|
||||
try{
|
||||
// Prepare a blob URL
|
||||
console.log("Trying download link method with simulated click ...");
|
||||
var blob = new Blob([data], { type: contentType });
|
||||
var url = urlCreator.createObjectURL(blob);
|
||||
link.setAttribute('href', url);
|
||||
// Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
|
||||
link.setAttribute("download", filename);
|
||||
// Simulate clicking the download link
|
||||
var event = document.createEvent('MouseEvents');
|
||||
event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
link.dispatchEvent(event);
|
||||
console.log("Download link method with simulated click succeeded");
|
||||
success = true;
|
||||
}catch(ex) {
|
||||
console.log("Download link method with simulated click failed with the following exception:");
|
||||
console.log(ex);
|
||||
}
|
||||
}
|
||||
if(!success){
|
||||
// Fallback to window.location method
|
||||
try{
|
||||
// Prepare a blob URL
|
||||
// Use application/octet-stream when using window.location to force download
|
||||
console.log("Trying download link method with window.location ...");
|
||||
var blob = new Blob([data], { type: octetStreamMime });
|
||||
var url = urlCreator.createObjectURL(blob);
|
||||
window.location = url;
|
||||
console.log("Download link method with window.location succeeded");
|
||||
success = true;
|
||||
}catch(ex){
|
||||
console.log("Download link method with window.location failed with the following exception:");
|
||||
console.log(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!success){
|
||||
// Fallback to window.open method
|
||||
console.log("No methods worked for saving the arraybuffer, using last resort window.open");
|
||||
window.open('_blank', '');
|
||||
}
|
||||
}).error(function(data, status) {
|
||||
console.log("Request failed with status: " + status);
|
||||
// Optionally write the error out to scope
|
||||
$scope.errorDetails = "Request failed with status: " + status;
|
||||
});
|
||||
}
|
||||
|
||||
//boolean选择条件:是/否
|
||||
function booleanChoose(){
|
||||
return [{id: '是', title: '是'}, {id: '否', title: '否'}];
|
||||
}
|
||||
// 数据库类型选择条件:oracle/sqlServer
|
||||
function databaseType(){
|
||||
return [{id: 'oracle', title: 'Oracle'}, {id: 'sqlServer', title: 'sqlServer'}];
|
||||
}
|
||||
|
||||
//level选择条件
|
||||
function levelType(){
|
||||
return [{id: '省', title: '省'}, {id: '市', title: '市'}, {id: '县', title: '县'}];
|
||||
}
|
||||
}])
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
/// <reference path="../../includes.ts"/>
|
||||
/// <reference path="systemHelpers.ts"/>
|
||||
/// <reference path="../../configs/ts/configPlugin.ts"/>
|
||||
|
||||
module System{
|
||||
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'ui.validate','kubernetesUI']);
|
||||
export var _module = angular.module(pluginName, ['hawtio-core', 'hawtio-ui', 'ui.codemirror', 'ui.validate', 'kubernetesUI', 'ngFileUpload', 'ngDialog']);
|
||||
export var controller = PluginHelpers.createControllerFunction(_module, pluginName);
|
||||
export var route = PluginHelpers.createRoutingFunction(templatePath);
|
||||
|
||||
|
@ -15,6 +16,7 @@ module System{
|
|||
.when(UrlHelpers.join(context, 'system-help'), route('regionalismCodeSearch.html', false))
|
||||
.when(UrlHelpers.join(context, 'system-help', 'regionalism-search'), route('regionalismCodeSearch.html', false))
|
||||
.when(UrlHelpers.join(context, 'system-help', 'system-search'), route('systemCodeSearch.html', false))
|
||||
.when(UrlHelpers.join(context, 'system-verification'), route('systemVerification.html', false))
|
||||
.when(context, {redirectTo: UrlHelpers.join(context, 'system-list')});
|
||||
}]);
|
||||
|
||||
|
@ -22,7 +24,7 @@ module System{
|
|||
模块加载后初始化配置
|
||||
*/
|
||||
_module.run(['viewRegistry', '$templateCache', 'HawtioNav', '$compile', (viewRegistry, $templateCache:ng.ITemplateCacheService, HawtioNav, $compile:ng.ICompileService) => {
|
||||
viewRegistry['config'] = templatePath + "shareLayout.html";
|
||||
viewRegistry['system'] = Configs.templatePath + "shareLayout.html";
|
||||
/*
|
||||
信息系统一级菜单导航
|
||||
*/
|
||||
|
@ -34,7 +36,6 @@ module System{
|
|||
//.isValid(() => !Core.isRemoteConnection())
|
||||
.build();
|
||||
HawtioNav.add(systemTab);
|
||||
|
||||
}]);
|
||||
|
||||
// 加载模块
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/// <reference path="../../includes.ts"/>
|
||||
/// <reference path="systemPlugin.ts"/>
|
||||
module System{
|
||||
|
||||
export function classifyCity(regionalismInfo: Array<any>){
|
||||
var result = [];
|
||||
angular.forEach(regionalismInfo, (item) =>{
|
||||
if(result.indexOf(item.cityName) == -1)
|
||||
result.push(item.cityName);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
export function classifyCountry(regionalismInfo: Array<any>, cityName: string){
|
||||
var result = [];
|
||||
angular.forEach(regionalismInfo, (item) =>{
|
||||
if(item.cityName == cityName)
|
||||
result.push({
|
||||
name: item.districtName,
|
||||
code: item.code
|
||||
});
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
class systemModelServices{
|
||||
public systemInfoList: Array<any> = [];
|
||||
public systemInfo: Array<any> = [];
|
||||
public regionalismInfo: Array<any> = [];
|
||||
|
||||
public constructor(){
|
||||
//this.updateSystemInfoList();
|
||||
this.updateCodeInfo();
|
||||
//console.log(classifyCountry(this.regionalismInfo, '南京市'));
|
||||
}
|
||||
|
||||
//执行数据更新操作
|
||||
public updateSystemInfoList(){
|
||||
var result = [];
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/java/console/api/system/infoList',
|
||||
success: (data) =>{
|
||||
if(data)
|
||||
result = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public updateCodeInfo(){
|
||||
var result=null;
|
||||
$.ajax({
|
||||
async: false,
|
||||
type : "POST",
|
||||
url : "/java/console/api/code/list",
|
||||
success : function(data) {
|
||||
if(data){
|
||||
result = data;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.regionalismInfo = result.regionalism;
|
||||
this.systemInfo = result.system;
|
||||
}
|
||||
}
|
||||
|
||||
_module.factory('SystemModel', ['$rootScope', '$http', ($rootScope, $http) => {
|
||||
return new systemModelServices();
|
||||
}]);
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/// <reference path="../../includes.ts"/>
|
||||
/// <reference path="systemPlugin.ts"/>
|
||||
/// <reference path="systemHelpers.ts"/>
|
||||
/// <reference path="systemServices.ts"/>
|
||||
module System{
|
||||
export var SystemVerificationController = controller('SystemVerificationController', ['$scope', '$location', '$templateCache', 'Upload', 'NgTableParams', 'ngDialog', 'SystemModel', ($scope, $location, $templateCache, Upload, NgTableParams, ngDialog, SystemModel) => {
|
||||
shareInit($scope);
|
||||
$scope.cities = classifyCity(SystemModel.regionalismInfo);
|
||||
|
||||
$scope.columns = [
|
||||
{ field: "id", title: '序号', show: false},
|
||||
{ field: "checkResult", title: "验证结果", show: true},
|
||||
{ field: "hasCollect", title: "采集", show: true },
|
||||
{ field: "hasCheckSql", title: "支付信息标准表", show: true },
|
||||
{ field: "hasExecSql", title: "可执行标准表", show: true },
|
||||
{ field: "city", title: "市", show: true },
|
||||
{ field: "county", title: "区/县", show: true },
|
||||
{ field: "regionalismCode", title: "行政区划代码", show: true },
|
||||
{ field: "systemCode", title: "信息系统代码", show: true },
|
||||
{ field: "contactsPerson", title: "联系人", show: true },
|
||||
{ field: "contactsMethod", title: "联系方式", show: true },
|
||||
{ field: "databaseType", title: "数据库类型", show: true}
|
||||
];
|
||||
|
||||
$scope.model = [{
|
||||
id: 1,
|
||||
checkResult: '是',
|
||||
hasCollect: '是',
|
||||
hasCheckSql: '是',
|
||||
hasExecSql: '是',
|
||||
city: '南京市',
|
||||
county: '玄武区',
|
||||
regionalismCode: '320105',
|
||||
systemCode: '2',
|
||||
contactsPerson: '文豆豆',
|
||||
contactsMethod: '15578203146',
|
||||
databaseType: 'oracle'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
checkResult: '否',
|
||||
hasCollect: '是',
|
||||
hasCheckSql: '否',
|
||||
hasExecSql: '是',
|
||||
city: '连云港市',
|
||||
county: '浦口区',
|
||||
regionalismCode: '320105',
|
||||
systemCode: '6',
|
||||
contactsPerson: '文豆豆',
|
||||
contactsMethod: '15578203147',
|
||||
databaseType: 'sqlServer'
|
||||
}];
|
||||
|
||||
console.log($scope.model);
|
||||
|
||||
$scope.filterResult = $scope.model;
|
||||
|
||||
// 表数据
|
||||
$scope.tableParams = new NgTableParams({count: 25}, {
|
||||
counts: [25, 50, 100],
|
||||
dataset: $scope.filterResult
|
||||
});
|
||||
|
||||
$scope.citySelect = (x) =>{
|
||||
if(x != 'all'){
|
||||
$scope.countries = classifyCountry(SystemModel.regionalismInfo, x);
|
||||
$scope.filterResult = [];
|
||||
angular.forEach($scope.model, (item) => {
|
||||
if(item.city == x)
|
||||
$scope.filterResult.push(item);
|
||||
});
|
||||
$scope.tableParams.settings({
|
||||
dataset: $scope.filterResult
|
||||
});
|
||||
}else{
|
||||
$scope.filterResult = $scope.model;
|
||||
$scope.tableParams.settings({
|
||||
dataset: $scope.filterResult
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$scope.countrySelect = (y) => {
|
||||
if(y != 'all'){
|
||||
var result = [];
|
||||
angular.forEach($scope.filterResult, (item) => {
|
||||
if(item.county == y)
|
||||
result.push(item);
|
||||
});
|
||||
$scope.tableParams.settings({
|
||||
dataset: result
|
||||
});
|
||||
}else{
|
||||
$scope.tableParams.settings({
|
||||
dataset: $scope.filterResult
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$scope.check = () => {
|
||||
console.log($scope.tableParams.data[0]);
|
||||
}
|
||||
}]);
|
||||
}
|
78
templates.js
78
templates.js
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue