fujaba / fulib.org

The fulib web app: fulibScenarios, fulibWorkflows, Docs, Projects and Assignments in one app.
https://fulib.org
MIT License
5 stars 1 forks source link

doesn't download examples if selected #345

Open github-actions[bot] opened 1 year ago

github-actions[bot] commented 1 year ago

https://api.github.com/fujaba/fulib.org/blob/1c9ac6c/frontend/src/app/workflows/download-es/download-es.component.ts#L33


import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PrivacyService} from '../../services/privacy.service';
import {ExportOptions} from '../model/ExportOptions';
import {WorkflowsService} from '../workflows.service';

@Component({
  selector: 'app-download-es',
  templateUrl: './download-es.component.html',
  styleUrls: ['./download-es.component.scss'],
})
export class DownloadESComponent implements OnInit {
  yamlContent?: string | null;
  localStorageAllowed = this.privacyService.allowLocalStorage;

  exportOptions: ExportOptions = {
    yaml: false,
    board: true,
    pages: false,
    objects: false,
    class: false,
    fxmls: false,
  };

  constructor(
    public route: ActivatedRoute,
    private workflowsService: WorkflowsService,
    private privacyService: PrivacyService,
  ) {
  }

  ngOnInit() {
    // TODO doesn't download examples if selected
    this.yamlContent = this.privacyService.getStorage('workflows');
  }

  selectAll() {
    this.exportOptions = {
      yaml: true,
      board: true,
      pages: true,
      objects: true,
      class: true,
      fxmls: true,
    };
  }

  deselectAll() {
    this.exportOptions = {
      yaml: false,
      board: false,
      pages: false,
      objects: false,
      class: false,
      fxmls: false,
    };
  }

  download() {
    if (this.yamlContent) {
      this.workflowsService.downloadZip(this.yamlContent, this.exportOptions);
    }
  }
}