File

components/content/content.component.ts

Description

Main content for application with:

Metadata

Index

Properties

Constructor

constructor(service: AppService)
Parameters :
Name Type Optional
service AppService No

Properties

componentData
Default value : this.service.componentData
disaggData
Default value : this.service.disaggData

Disaggregation data

formGroup
Default value : this.service.formGroup
hasData
Default value : computed(() => this.service.serviceResponse() !== null)
hasLayers
Default value : computed(() => { const serviceResponse = this.service.serviceResponse(); if (serviceResponse === null || serviceResponse === undefined) { return false; } const layers = serviceResponse.response.disaggs.find(disaggs => disaggs.data.find(data => data.sources.find( source => source.latitude !== null && source.longitude !== null, ), ), ); return layers !== undefined; })

Has geo disagg layers

repositories
Default value : computed(() => this.service.usage()?.metadata.repositories)

Repo metadata

import {Component, computed} from '@angular/core';
import {MatDivider} from '@angular/material/divider';
import {MatExpansionModule} from '@angular/material/expansion';
import {NshmpLibNgAppMetadataComponent} from '@ghsc/nshmp-lib-ng/nshmp';

import {AppService} from '../../services/app.service';
import {DisaggContributorsComponent} from '../disagg-contributors/disagg-contributors.component';
import {DisaggDataComponent} from '../disagg-data/disagg-data.component';
import {DisaggSummaryComponent} from '../disagg-summary/disagg-summary.component';
import {GeoDisaggComponent} from '../geo-disagg/geo-disagg.component';
import {ParameterSummaryComponent} from '../parameter-summary/parameter-summary.component';
import {PlotsComponent} from '../plots/plots.component';

/**
 * Main content for application with:
 *  - disagg plot: {@link ../plots/plots.component.ts}
 *  - parameter summary: {@link ../parameter-summary/parameter-summary.component.ts}
 *  - disagg summary: {@link ../disagg-summary/disagg-summary.component.ts}
 *  - disagg contributions: {@link ../disagg-contributions/disagg-contributions.component.ts}
 */
@Component({
  imports: [
    MatExpansionModule,
    PlotsComponent,
    MatDivider,
    GeoDisaggComponent,
    ParameterSummaryComponent,
    NshmpLibNgAppMetadataComponent,
    DisaggSummaryComponent,
    DisaggContributorsComponent,
    DisaggDataComponent,
  ],
  selector: 'app-content',
  styleUrl: './content.component.scss',
  templateUrl: './content.component.html',
})
export class ContentComponent {
  componentData = this.service.componentData;
  /** Disaggregation data */
  disaggData = this.service.disaggData;
  formGroup = this.service.formGroup;

  hasData = computed(() => this.service.serviceResponse() !== null);

  /** Has geo disagg layers */
  hasLayers = computed(() => {
    const serviceResponse = this.service.serviceResponse();

    if (serviceResponse === null || serviceResponse === undefined) {
      return false;
    }

    const layers = serviceResponse.response.disaggs.find(disaggs =>
      disaggs.data.find(data =>
        data.sources.find(
          source => source.latitude !== null && source.longitude !== null,
        ),
      ),
    );

    return layers !== undefined;
  });

  /** Repo metadata */
  repositories = computed(() => this.service.usage()?.metadata.repositories);

  constructor(private service: AppService) {}
}
<div class="height-full overflow-auto report">
  <div class="grid-container-widescreen">
    <!-- Report title, show only on print -->
    <div class="print-content-only">
      <h2>Disaggregation Report</h2>
    </div>

    <div class="padding-y-4">
      <mat-accordion multi>
        <!-- Disagg plot panel -->
        <mat-expansion-panel expanded class="disagg-panel">
          <mat-expansion-panel-header>
            <mat-panel-title>Disaggregation</mat-panel-title>
          </mat-expansion-panel-header>

          <app-plots />
        </mat-expansion-panel>

        <!-- Geographical disagg panel -->
        <mat-expansion-panel
          [expanded]="hasLayers()"
          [disabled]="hasLayers() === false"
          class="geo-disagg-panel print-page-break"
        >
          <mat-expansion-panel-header>
            <mat-panel-title>Geographical Disaggregation</mat-panel-title>
          </mat-expansion-panel-header>

          <mat-divider />

          <app-geo-disagg />
        </mat-expansion-panel>

        <!-- Parameter summary panel -->
        <mat-expansion-panel expanded>
          <mat-expansion-panel-header>
            <mat-panel-title>Parameter Summary</mat-panel-title>
          </mat-expansion-panel-header>

          <app-parameter-summary />
        </mat-expansion-panel>

        <!-- Summary report -->
        <mat-expansion-panel
          class="summary-report print-full-page print-page-break"
          [expanded]="disaggData()"
          [disabled]="disaggData() === null"
        >
          <mat-expansion-panel-header>
            <mat-panel-title
              >Disaggregation Summary:
              {{ formGroup.getRawValue().disaggComponent }}</mat-panel-title
            >
          </mat-expansion-panel-header>

          <app-disagg-summary [componentData]="componentData()" />
        </mat-expansion-panel>

        <!-- Contributions -->
        <mat-expansion-panel
          class="contributions print-full-page print-page-break"
          [expanded]="componentData()?.sources.length > 0"
          [disabled]="componentData()?.sources.length === 0"
        >
          <mat-expansion-panel-header>
            <mat-panel-title
              >Disaggregation Contributions:
              {{ formGroup.getRawValue().disaggComponent }}</mat-panel-title
            >
          </mat-expansion-panel-header>

          <app-disagg-contributors [componentData]="componentData()" />
        </mat-expansion-panel>

        <!-- Data -->
        <mat-expansion-panel
          class="print-display-none"
          [expanded]="componentData()?.data.length > 0"
          [disabled]="componentData()?.data.length === 0"
        >
          <mat-expansion-panel-header>
            <mat-panel-title
              >Disaggregation Data:
              {{ formGroup.getRawValue().disaggComponent }}</mat-panel-title
            >
          </mat-expansion-panel-header>

          <app-disagg-data [componentData]="componentData()" />
        </mat-expansion-panel>

        <!-- App metadata -->
        <mat-expansion-panel class="print-page-break" expanded>
          <mat-expansion-panel-header>
            <mat-panel-title>Application Metadata</mat-panel-title>
          </mat-expansion-panel-header>

          <mat-divider />
          <nshmp-lib-ng-app-metadata [repositories]="repositories()" />
        </mat-expansion-panel>
      </mat-accordion>
    </div>
  </div>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""