Commit a9ccfc5e authored by François Agneray's avatar François Agneray
Browse files

Delete download archive property (entity dataset)

parent 88b73f21
......@@ -98,10 +98,6 @@
<input class="custom-control-input" type="checkbox" id="download_vo" name="download_vo" formControlName="download_vo">
<label class="custom-control-label" for="download_vo">Display download results button in VO format</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="download_archive" name="download_archive" formControlName="download_archive">
<label class="custom-control-label" for="download_archive">Display download results archive button</label>
</div>
</accordion-group>
<accordion-group heading="Summary" [isOpen]="true">
<div class="custom-control custom-switch">
......
......@@ -52,7 +52,6 @@ export class DatasetFormComponent implements OnInit, OnChanges {
download_csv: new FormControl(true),
download_ascii: new FormControl(true),
download_vo: new FormControl(false),
download_archive: new FormControl(false),
summary_enabled: new FormControl(false),
summary_opened: new FormControl({value: false, disabled: true}),
server_link_enabled: new FormControl(false),
......
......@@ -39,8 +39,8 @@
</button>
</div>
</div>
<hr *ngIf="getConfigDownloadResultFormat('download_archive')" class="my-4">
<div *ngIf="getConfigDownloadResultFormat('download_archive')" class="row">
<hr *ngIf="isArchiveIsAvailable()" class="my-4">
<div *ngIf="isArchiveIsAvailable()" class="row">
<div class="col-auto align-self-center">
<p>Download archive files just here:</p>
</div>
......
......@@ -10,7 +10,7 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Criterion, ConeSearch } from '../../../store/models';
import { Dataset } from 'src/app/metamodel/models';
import { Dataset, Attribute } from 'src/app/metamodel/models';
/**
* @class
......@@ -23,6 +23,7 @@ import { Dataset } from 'src/app/metamodel/models';
export class DownloadComponent {
@Input() datasetSelected: string;
@Input() datasetList: Dataset[];
@Input() attributeList: Attribute[];
@Input() criteriaList: Criterion[];
@Input() outputList: number[];
@Input() coneSearch: ConeSearch;
......@@ -61,6 +62,13 @@ export class DownloadComponent {
return this.datasetList.find(d => d.name === this.datasetSelected)[format];
}
isArchiveIsAvailable() {
return this.attributeList
.filter(attribute => this.outputList.includes(attribute.id))
.filter(attribute => attribute.archive)
.length > 0;
}
downloadResult(format: string) {
this.startTaskCreateResult.emit({
format,
......
......@@ -44,6 +44,7 @@
<app-download
[datasetSelected]="datasetSelected | async"
[datasetList]="datasetList | async"
[attributeList]="attributeList | async"
[criteriaList]="criteriaList | async"
[outputList]="outputList | async"
[coneSearch]="coneSearch | async"
......
......@@ -62,11 +62,11 @@ curl -d '{"label":"SVOM dataset family","display":20,"opened":true}' --header 'C
curl -d '{"label":"IRiS dataset family","display":30,"opened":true}' --header 'Content-Type: application/json' -X POST http://localhost/instance/default/dataset-family
# Add datasets
curl -d '{"name":"vipers_dr2_w1","table_ref":"aspic_vipers_dr2_w1","label":"VIPERS-W1 (DR2)","description":"VIPERS W1 dataset","display":10,"data_path":"\/ASPIC\/VIPERS_DR2","public":true,"info_survey_enabled":true,"info_survey_label":"More about this survey","cone_search_enabled":false,"cone_search_opened":true,"cone_search_column_ra":null,"cone_search_column_dec":null,"cone_search_plot_enabled":false,"download_enabled":true,"download_opened":false,"download_json":true,"download_csv":true,"download_ascii":true,"download_vo":false,"download_archive":true,"summary_enabled":true,"summary_opened":false,"server_link_enabled":false,"server_link_opened":false,"datatable_enabled":true,"datatable_opened":false,"datatable_selectable_rows":false,"survey_name":"anis_survey"}' --header 'Content-Type: application/json' -X POST http://localhost/dataset-family/1/dataset
curl -d '{"name":"sp_cards","table_ref":"sp_cards","label":"SP Metadata","description":"Contains metadata of scientific products (Core Program & General Program)","display":30,"data_path":"","public":true,"info_survey_enabled":true,"info_survey_label":"More about this survey","cone_search_enabled":false,"cone_search_opened":true,"cone_search_column_ra":null,"cone_search_column_dec":null,"cone_search_plot_enabled":false,"download_enabled":true,"download_opened":false,"download_json":true,"download_csv":true,"download_ascii":true,"download_vo":false,"download_archive":true,"summary_enabled":true,"summary_opened":false,"server_link_enabled":false,"server_link_opened":false,"datatable_enabled":true,"datatable_opened":false,"datatable_selectable_rows":false,"survey_name":"svom"}' --header 'Content-Type: application/json' -X POST http://localhost/dataset-family/2/dataset
curl -d '{"name":"observations","table_ref":"v_observation","label":"IRiS obs","description":"IRiS observations","display":10,"data_path":"\/IRIS\/observations","public":true,"info_survey_enabled":true,"info_survey_label":"More about this survey","cone_search_enabled":false,"cone_search_opened":true,"cone_search_column_ra":null,"cone_search_column_dec":null,"cone_search_plot_enabled":false,"download_enabled":true,"download_opened":false,"download_json":true,"download_csv":true,"download_ascii":true,"download_vo":false,"download_archive":true,"summary_enabled":true,"summary_opened":false,"server_link_enabled":false,"server_link_opened":false,"datatable_enabled":true,"datatable_opened":false,"datatable_selectable_rows":false,"survey_name":"iris"}' --header 'Content-Type: application/json' -X POST http://localhost/dataset-family/3/dataset
curl -d '{"name":"vvds_f02_udeep","table_ref":"aspic_vvds_f02_udeep","label":"VVDS2h Ultra Deep","description":"VVDS2h Ultra Deep","display":20,"data_path":"","public":true,"info_survey_enabled":true,"info_survey_label":"More about this survey","cone_search_enabled":false,"cone_search_opened":true,"cone_search_column_ra":null,"cone_search_column_dec":null,"cone_search_plot_enabled":false,"download_enabled":true,"download_opened":false,"download_json":true,"download_csv":true,"download_ascii":true,"download_vo":false,"download_archive":true,"summary_enabled":true,"summary_opened":false,"server_link_enabled":false,"server_link_opened":false,"datatable_enabled":true,"datatable_opened":false,"datatable_selectable_rows":false,"survey_name":"anis_survey"}' --header 'Content-Type: application/json' -X POST http://localhost/dataset-family/1/dataset
curl -d '{"name":"products","table_ref":"products","label":"Scientific Products","description":"SR3 & SR4 products list","display":20,"data_path":"","public":true,"info_survey_enabled":true,"info_survey_label":"More about this survey","cone_search_enabled":false,"cone_search_opened":true,"cone_search_column_ra":null,"cone_search_column_dec":null,"cone_search_plot_enabled":false,"download_enabled":true,"download_opened":false,"download_json":true,"download_csv":true,"download_ascii":true,"download_vo":false,"download_archive":true,"summary_enabled":true,"summary_opened":false,"server_link_enabled":false,"server_link_opened":false,"datatable_enabled":true,"datatable_opened":false,"datatable_selectable_rows":false,"survey_name":"svom"}' --header 'Content-Type: application/json' -X POST http://localhost/dataset-family/2/dataset
curl -d '{"name":"vipers_dr2_w1","table_ref":"aspic_vipers_dr2_w1","label":"VIPERS-W1 (DR2)","description":"VIPERS W1 dataset","display":10,"data_path":"\/ASPIC\/VIPERS_DR2","public":true,"info_survey_enabled":true,"info_survey_label":"More about this survey","cone_search_enabled":false,"cone_search_opened":true,"cone_search_column_ra":null,"cone_search_column_dec":null,"cone_search_plot_enabled":false,"download_enabled":true,"download_opened":false,"download_json":true,"download_csv":true,"download_ascii":true,"download_vo":false,"summary_enabled":true,"summary_opened":false,"server_link_enabled":false,"server_link_opened":false,"datatable_enabled":true,"datatable_opened":false,"datatable_selectable_rows":false,"survey_name":"anis_survey"}' --header 'Content-Type: application/json' -X POST http://localhost/dataset-family/1/dataset
curl -d '{"name":"sp_cards","table_ref":"sp_cards","label":"SP Metadata","description":"Contains metadata of scientific products (Core Program & General Program)","display":30,"data_path":"","public":true,"info_survey_enabled":true,"info_survey_label":"More about this survey","cone_search_enabled":false,"cone_search_opened":true,"cone_search_column_ra":null,"cone_search_column_dec":null,"cone_search_plot_enabled":false,"download_enabled":true,"download_opened":false,"download_json":true,"download_csv":true,"download_ascii":true,"download_vo":false,"summary_enabled":true,"summary_opened":false,"server_link_enabled":false,"server_link_opened":false,"datatable_enabled":true,"datatable_opened":false,"datatable_selectable_rows":false,"survey_name":"svom"}' --header 'Content-Type: application/json' -X POST http://localhost/dataset-family/2/dataset
curl -d '{"name":"observations","table_ref":"v_observation","label":"IRiS obs","description":"IRiS observations","display":10,"data_path":"\/IRIS\/observations","public":true,"info_survey_enabled":true,"info_survey_label":"More about this survey","cone_search_enabled":false,"cone_search_opened":true,"cone_search_column_ra":null,"cone_search_column_dec":null,"cone_search_plot_enabled":false,"download_enabled":true,"download_opened":false,"download_json":true,"download_csv":true,"download_ascii":true,"download_vo":false,"summary_enabled":true,"summary_opened":false,"server_link_enabled":false,"server_link_opened":false,"datatable_enabled":true,"datatable_opened":false,"datatable_selectable_rows":false,"survey_name":"iris"}' --header 'Content-Type: application/json' -X POST http://localhost/dataset-family/3/dataset
curl -d '{"name":"vvds_f02_udeep","table_ref":"aspic_vvds_f02_udeep","label":"VVDS2h Ultra Deep","description":"VVDS2h Ultra Deep","display":20,"data_path":"","public":true,"info_survey_enabled":true,"info_survey_label":"More about this survey","cone_search_enabled":false,"cone_search_opened":true,"cone_search_column_ra":null,"cone_search_column_dec":null,"cone_search_plot_enabled":false,"download_enabled":true,"download_opened":false,"download_json":true,"download_csv":true,"download_ascii":true,"download_vo":false,"summary_enabled":true,"summary_opened":false,"server_link_enabled":false,"server_link_opened":false,"datatable_enabled":true,"datatable_opened":false,"datatable_selectable_rows":false,"survey_name":"anis_survey"}' --header 'Content-Type: application/json' -X POST http://localhost/dataset-family/1/dataset
curl -d '{"name":"products","table_ref":"products","label":"Scientific Products","description":"SR3 & SR4 products list","display":20,"data_path":"","public":true,"info_survey_enabled":true,"info_survey_label":"More about this survey","cone_search_enabled":false,"cone_search_opened":true,"cone_search_column_ra":null,"cone_search_column_dec":null,"cone_search_plot_enabled":false,"download_enabled":true,"download_opened":false,"download_json":true,"download_csv":true,"download_ascii":true,"download_vo":false,"summary_enabled":true,"summary_opened":false,"server_link_enabled":false,"server_link_opened":false,"datatable_enabled":true,"datatable_opened":false,"datatable_selectable_rows":false,"survey_name":"svom"}' --header 'Content-Type: application/json' -X POST http://localhost/dataset-family/2/dataset
# Add vipers_dr2_w1 attributes
curl -d '{"label":"Default","display":10,"opened":true}' --header 'Content-Type: application/json' -X POST http://localhost/dataset/vipers_dr2_w1/criteria-family
......
......@@ -67,10 +67,10 @@ class Dataset extends \App\Entity\Dataset implements \Doctrine\ORM\Proxy\Proxy
public function __sleep()
{
if ($this->__isInitialized__) {
return ['__isInitialized__', 'name', 'tableRef', 'label', 'description', 'display', 'dataPath', 'public', 'infoSurveyEnabled', 'infoSurveyLabel', 'coneSearchEnabled', 'coneSearchOpened', 'coneSearchColumnRa', 'coneSearchColumnDec', 'coneSearchPlotEnabled', 'downloadEnabled', 'downloadOpened', 'downloadJson', 'downloadCsv', 'downloadAscii', 'downloadVo', 'downloadArchive', 'summaryEnabled', 'summaryOpened', 'serverLinkEnabled', 'serverLinkOpened', 'datatableEnabled', 'datatableOpened', 'datatableSelectableRows', 'survey', 'datasetFamily', 'attributes'];
return ['__isInitialized__', 'name', 'tableRef', 'label', 'description', 'display', 'dataPath', 'public', 'infoSurveyEnabled', 'infoSurveyLabel', 'coneSearchEnabled', 'coneSearchOpened', 'coneSearchColumnRa', 'coneSearchColumnDec', 'coneSearchPlotEnabled', 'downloadEnabled', 'downloadOpened', 'downloadJson', 'downloadCsv', 'downloadAscii', 'downloadVo', 'summaryEnabled', 'summaryOpened', 'serverLinkEnabled', 'serverLinkOpened', 'datatableEnabled', 'datatableOpened', 'datatableSelectableRows', 'survey', 'datasetFamily', 'attributes'];
}
return ['__isInitialized__', 'name', 'tableRef', 'label', 'description', 'display', 'dataPath', 'public', 'infoSurveyEnabled', 'infoSurveyLabel', 'coneSearchEnabled', 'coneSearchOpened', 'coneSearchColumnRa', 'coneSearchColumnDec', 'coneSearchPlotEnabled', 'downloadEnabled', 'downloadOpened', 'downloadJson', 'downloadCsv', 'downloadAscii', 'downloadVo', 'downloadArchive', 'summaryEnabled', 'summaryOpened', 'serverLinkEnabled', 'serverLinkOpened', 'datatableEnabled', 'datatableOpened', 'datatableSelectableRows', 'survey', 'datasetFamily', 'attributes'];
return ['__isInitialized__', 'name', 'tableRef', 'label', 'description', 'display', 'dataPath', 'public', 'infoSurveyEnabled', 'infoSurveyLabel', 'coneSearchEnabled', 'coneSearchOpened', 'coneSearchColumnRa', 'coneSearchColumnDec', 'coneSearchPlotEnabled', 'downloadEnabled', 'downloadOpened', 'downloadJson', 'downloadCsv', 'downloadAscii', 'downloadVo', 'summaryEnabled', 'summaryOpened', 'serverLinkEnabled', 'serverLinkOpened', 'datatableEnabled', 'datatableOpened', 'datatableSelectableRows', 'survey', 'datasetFamily', 'attributes'];
}
/**
......@@ -621,28 +621,6 @@ class Dataset extends \App\Entity\Dataset implements \Doctrine\ORM\Proxy\Proxy
return parent::setDownloadVo($downloadVo);
}
/**
* {@inheritDoc}
*/
public function getDownloadArchive()
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getDownloadArchive', []);
return parent::getDownloadArchive();
}
/**
* {@inheritDoc}
*/
public function setDownloadArchive($downloadArchive)
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'setDownloadArchive', [$downloadArchive]);
return parent::setDownloadArchive($downloadArchive);
}
/**
* {@inheritDoc}
*/
......
......@@ -134,7 +134,6 @@ final class DatasetAction extends AbstractAction
$dataset->setDownloadCsv($parsedBody['download_csv']);
$dataset->setDownloadAscii($parsedBody['download_ascii']);
$dataset->setDownloadVo($parsedBody['download_vo']);
$dataset->setDownloadArchive($parsedBody['download_archive']);
$dataset->setSummaryEnabled($parsedBody['summary_enabled']);
$dataset->setSummaryOpened($parsedBody['summary_opened']);
$dataset->setServerLinkEnabled($parsedBody['server_link_enabled']);
......
......@@ -138,7 +138,6 @@ final class DatasetListAction extends AbstractAction
$dataset->setDownloadCsv($parsedBody['download_csv']);
$dataset->setDownloadAscii($parsedBody['download_ascii']);
$dataset->setDownloadVo($parsedBody['download_vo']);
$dataset->setDownloadArchive($parsedBody['download_archive']);
$dataset->setSummaryEnabled($parsedBody['summary_enabled']);
$dataset->setSummaryOpened($parsedBody['summary_opened']);
$dataset->setServerLinkEnabled($parsedBody['server_link_enabled']);
......
......@@ -164,13 +164,6 @@ class Dataset implements \JsonSerializable
*/
protected $downloadVo;
/**
* @var bool
*
* @Column(type="boolean", name="download_archive", nullable=false)
*/
protected $downloadArchive;
/**
* @var bool
*
......@@ -449,16 +442,6 @@ class Dataset implements \JsonSerializable
$this->downloadVo = $downloadVo;
}
public function getDownloadArchive()
{
return $this->downloadArchive;
}
public function setDownloadArchive($downloadArchive)
{
$this->downloadArchive = $downloadArchive;
}
public function getSummaryEnabled()
{
return $this->summaryEnabled;
......@@ -577,7 +560,6 @@ class Dataset implements \JsonSerializable
'download_csv' => $this->getDownloadCsv(),
'download_ascii' => $this->getDownloadAscii(),
'download_vo' => $this->getDownloadVo(),
'download_archive' => $this->getDownloadArchive(),
'summary_enabled' => $this->getSummaryEnabled(),
'summary_opened' => $this->getSummaryOpened(),
'server_link_enabled' => $this->getServerLinkEnabled(),
......
......@@ -151,7 +151,7 @@ final class AttributeActionTest extends TestCase
'display_detail' => 10,
'selected' => false,
'order_by' => false,
'order_display' => null,
'archive' => false,
'detail' => false,
'renderer_detail' => null,
'renderer_detail_config' => null,
......
......@@ -86,12 +86,11 @@ final class AttributeListActionTest extends TestCase
'label' => 'id',
'form_label' => 'ID',
'primary_key' => false,
'order_primary_key' => null,
'type' => 'integer',
'criteria_display' => 10,
'output_display' => 10,
'display_detail' => 10,
'order_display' => 10,
'archive' => false,
'selected' => true,
'order_by' => false,
'detail' => false
......
......@@ -140,7 +140,6 @@ final class DatasetActionTest extends TestCase
'download_csv' => true,
'download_ascii' => true,
'download_vo' => false,
'download_archive' => true,
'summary_enabled' => true,
'summary_opened' => false,
'server_link_enabled' => false,
......
......@@ -136,7 +136,6 @@ final class DatasetListActionTest extends TestCase
'download_csv' => true,
'download_ascii' => true,
'download_vo' => false,
'download_archive' => true,
'summary_enabled' => true,
'summary_opened' => false,
'server_link_enabled' => false,
......
......@@ -14,7 +14,7 @@ def archive_handler(ch, method, properties, body):
# Retrieve metadata information
dataset = utils.get_dataset(message["dataset_name"])
attributes = utils.get_attributes(message["dataset_name"])
attributes_selected = get_attributes_selected(attributes, message["param_a"])
attributes_selected = get_attributes_selected_archive_files(attributes, message["param_a"])
# Retrieve data
data = utils.search_data(message["dataset_name"], message["query"], message["token"])
......@@ -27,13 +27,11 @@ def archive_handler(ch, method, properties, body):
# Search files
for row in data.json():
files_added = []
for attribute in attributes_selected:
attribute_label = attribute["label"]
file_path = utils.get_data_path() + dataset["full_data_path"] + "/" + str(row[attribute_label])
if (os.path.exists(file_path) and os.path.isfile(file_path) and file_path not in files_added):
if (os.path.exists(file_path) and os.path.isfile(file_path) and file_path):
# Adds file to the zip archive
files_added.append(file_path)
zip.write(file_path, row[attribute_label])
# close the Zip File
......@@ -44,11 +42,11 @@ def archive_handler(ch, method, properties, body):
logging.info("Zip created: " + zip_path)
def get_attributes_selected(attributes, param_a):
def get_attributes_selected_archive_files(attributes, param_a):
attributes_selected = []
ids = param_a.split(";")
for attribute in attributes:
if (str(attribute["id"]) in ids):
if (str(attribute["id"]) in ids and attribute["archive"]):
attributes_selected.append(attribute)
return attributes_selected
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment