CC-2652: display info about import
- temp commit
This commit is contained in:
parent
c0e07dbd9e
commit
9ff5bdaf0f
4 changed files with 38 additions and 1 deletions
|
@ -451,6 +451,9 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
// update import timestamp
|
||||
Application_Model_Preference::SetImportTimestamp();
|
||||
|
||||
if ($mode == "create") {
|
||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||
$filepath = str_replace("\\", "", $filepath);
|
||||
|
@ -508,7 +511,6 @@ class ApiController extends Zend_Controller_Action
|
|||
$file->delete();
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->id = $file->getId();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
->addActionContext('change-stor-directory', 'json')
|
||||
->addActionContext('reload-watch-directory', 'json')
|
||||
->addActionContext('remove-watch-directory', 'json')
|
||||
->addActionContext('is-import-in-progress', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -157,6 +158,15 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||
$this->view->subform = $watched_dirs_form->render();
|
||||
}
|
||||
|
||||
public function isImportInProgressAction(){
|
||||
$now = time();
|
||||
$res = false;
|
||||
if(Application_Model_Preference::GetImportTimestamp()+5 > $now){
|
||||
$res = true;
|
||||
}
|
||||
die(json_encode($res));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -356,5 +356,14 @@ class Application_Model_Preference
|
|||
public static function GetRemindMeDate(){
|
||||
return Application_Model_Preference::GetValue("remindme");
|
||||
}
|
||||
|
||||
public static function SetImportTimestamp(){
|
||||
$now = time();
|
||||
Application_Model_Preference::SetValue("import_timestamp", $now);
|
||||
}
|
||||
|
||||
public static function GetImportTimestamp(){
|
||||
return Application_Model_Preference::GetValue("import_timestamp");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,19 @@ function confirmDeletePlaylist(params){
|
|||
}
|
||||
}
|
||||
|
||||
function checkImportStatus(){
|
||||
$.getJSON('/Preference/is-import-in-progress', function(data){
|
||||
var div = $('#library_display_processing');
|
||||
if(data == true){
|
||||
div.html("Import is being processed");
|
||||
div.css('visibility', 'visible');
|
||||
}else{
|
||||
div.css('visibility', 'hidden');
|
||||
div.html("Processing...");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function deletePlaylist(json) {
|
||||
if(json.message) {
|
||||
alert(json.message);
|
||||
|
@ -172,4 +185,7 @@ $(document).ready(function() {
|
|||
"sSearch": ""
|
||||
}
|
||||
}).fnSetFilteringDelay(350);
|
||||
|
||||
checkImportStatus()
|
||||
setInterval( "checkImportStatus()", 2000 );
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue