Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Use ExportServices from climate-change-components #348

Merged
merged 1 commit into from
Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@
"@angular/router": "^4.4.7",
"@types/geojson": "^7946.0.5",
"bootstrap-sass": "^3.4.0",
"climate-change-components": "^0.3.1",
"climate-change-components": "^0.4.0",
"core-js": "^2.6.4",
"d3": "^4.13.0",
"d3-tip": "^0.9.1",
"enhanced-resolve": "^3.4.1",
"file-saver": "^1.3.8",
"jquery": "^3.3.1",
"lodash.clonedeep": "^4.5.0",
"moment": "^2.24.0",
Expand All @@ -49,7 +48,6 @@
"ngx-clipboard": "^8.1.4",
"nouislider": "^10.1.0",
"rxjs": "^5.5.11",
"save-svg-as-png": "^1.4.9",
"zone.js": "0.8.29"
},
"devDependencies": {
Expand Down
4 changes: 0 additions & 4 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ import { apiHttpProvider } from './auth/api-http.provider';
import { AuthService } from './auth/auth.service';
import { AuthGuard } from './auth/auth.guard';

import { DataExportService } from './services/data-export.service';
import { ImageExportService } from './services/image-export.service';
import { MapCellService } from './services/map-cell.service';
import { ProjectService } from './services/project.service';

Expand Down Expand Up @@ -104,8 +102,6 @@ const AGM_CONFIG = {
apiHttpProvider,
AuthService,
AuthGuard,
DataExportService,
ImageExportService,
MapCellService,
ProjectService
]
Expand Down
2 changes: 2 additions & 0 deletions src/app/auth/api-http.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Injectable } from '@angular/core';
import { ConnectionBackend, Http, Headers, Request, RequestOptions, RequestOptionsArgs,
Response, URLSearchParams } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/throw';

import { ApiHttp } from 'climate-change-components';

Expand Down
2 changes: 1 addition & 1 deletion src/app/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Headers, Http, RequestOptions } from '@angular/http';
import { Router } from '@angular/router';
import { Observable } from 'rxjs/Observable';

import 'rxjs/add/operator/catch';
import { apiHost } from '../constants';

@Injectable()
Expand Down
14 changes: 9 additions & 5 deletions src/app/charts/chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import * as cloneDeep from 'lodash.clonedeep';

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/forkJoin';
import { Subscription } from 'rxjs/Subscription';

import {
Expand All @@ -31,11 +32,11 @@ import {
isHistoricIndicator,
isPercentileIndicator,
isThresholdIndicator,
DataExportService,
ImageExportService
} from 'climate-change-components';

import { AuthService } from '../auth/auth.service';
import { DataExportService } from '../services/data-export.service';
import { ImageExportService } from '../services/image-export.service';

import { environment } from '../../environments/environment';

Expand All @@ -45,7 +46,11 @@ import { environment } from '../../environments/environment';
*/
@Component({
selector: 'ccl-chart', // if this selector is renamed, image export service must also be updated
templateUrl: './chart.component.html'
templateUrl: './chart.component.html',
providers: [
DataExportService,
ImageExportService
]
})
export class ChartComponent implements OnChanges, OnDestroy, AfterViewInit {

Expand Down Expand Up @@ -203,8 +208,7 @@ export class ChartComponent implements OnChanges, OnDestroy, AfterViewInit {
this.dataset.name,
this.scenario.name
].join('_');

this.imageExportService.downloadAsPNG(this.chart.indicator.name, fileName);
this.imageExportService.downloadAsPNG(this.chart.indicator.name, fileName, 'ccl-chart');
}

public onExtraParamsSelected(params: IndicatorDistanceQueryParams) {
Expand Down
1 change: 1 addition & 0 deletions src/app/lab/components/city-dropdown.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { MapsAPILoader } from '@agm/core';
import { City } from 'climate-change-components';
import { Point } from 'geojson';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/catch';

import { MapCell } from '../../models/map-cell.model';
import { MapCellService } from '../../services/map-cell.service';
Expand Down
15 changes: 0 additions & 15 deletions src/app/services/data-export.service.spec.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/app/services/data-export.service.ts

This file was deleted.

33 changes: 0 additions & 33 deletions src/app/services/image-export.service.ts

This file was deleted.

15 changes: 9 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -908,15 +908,18 @@ cli-width@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"

climate-change-components@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/climate-change-components/-/climate-change-components-0.3.1.tgz#445cbd7de892293612d020ea148776ab4bb12137"
climate-change-components@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/climate-change-components/-/climate-change-components-0.4.0.tgz#d4aac7f8c117df5d9193fc4529ffb90b011a032a"
integrity sha512-YNzKapAXplwdJomUBrXV50SjmCamlF/W3zYS0nFZwo+KYIK02RZ75+mHkv5uVV/7vBH1ikNQZK62XrzkOdE41g==
dependencies:
"@types/geojson" "^1.0.3"
d3 "^4.10.0"
file-saver "^1.3.8"
jquery "^3.2.1"
lodash "^4.17.4"
moment "^2.18.1"
save-svg-as-png "^1.4.12"

cliui@^2.1.0:
version "2.1.0"
Expand Down Expand Up @@ -4920,9 +4923,9 @@ saucelabs@^1.5.0:
dependencies:
https-proxy-agent "^2.2.1"

save-svg-as-png@^1.4.9:
version "1.4.9"
resolved "https://registry.yarnpkg.com/save-svg-as-png/-/save-svg-as-png-1.4.9.tgz#0ac8e037de150e202dd80cc63061a2fe3e15199e"
save-svg-as-png@^1.4.12:
version "1.4.12"
resolved "https://registry.yarnpkg.com/save-svg-as-png/-/save-svg-as-png-1.4.12.tgz#6acaa3b542d0236d6e96ff38c1da40a6b18bc15e"

[email protected]:
version "0.5.8"
Expand Down