### File

`src/app/resource/resource-node-viewer/resource-node-viewer.component.ts`

### Implements

`OnInit`

### Metadata

selector | `hi-resource-node-viewer`
styleUrls | `./resource-node-viewer.component.scss`
templateUrl | `./resource-node-viewer.component.html`

### Index

###### Properties
clusterName isLoading obj path resource resourceName
###### Methods
Protected loadResource ngOnInit

### Constructor

`constructor(route: ActivatedRoute, service: ResourceService, helper: HelperService)`
Defined in src/app/resource/resource-node-viewer/resource-node-viewer.component.ts:21
Parameters :
Name | Type | Optional
route | `ActivatedRoute` | No
service | `ResourceService` | No
helper | `HelperService` | No

### Methods

Protected loadResource
`loadResource()`
Defined in src/app/resource/resource-node-viewer/resource-node-viewer.component.ts:42
Returns : `void`

ngOnInit
`ngOnInit()`
Defined in src/app/resource/resource-node-viewer/resource-node-viewer.component.ts:29
Returns : `void`

### Properties

clusterName
Type : `string`
Defined in src/app/resource/resource-node-viewer/resource-node-viewer.component.ts:17

isLoading
Default value : `true`
Defined in src/app/resource/resource-node-viewer/resource-node-viewer.component.ts:16

obj
Type : `any`
Defined in src/app/resource/resource-node-viewer/resource-node-viewer.component.ts:21

path
Type : `string`
Defined in src/app/resource/resource-node-viewer/resource-node-viewer.component.ts:20

resource
Type : `Resource`
Defined in src/app/resource/resource-node-viewer/resource-node-viewer.component.ts:19

resourceName
Type : `string`
Defined in src/app/resource/resource-node-viewer/resource-node-viewer.component.ts:18

    import { Component, OnInit } from '@angular/core';
    import { ActivatedRoute } from '@angular/router';

    import * as _ from 'lodash';

    import { Resource } from '../shared/resource.model';
    import { HelperService } from '../../shared/helper.service';
    import { ResourceService } from '../shared/resource.service';

    @Component({
      selector: 'hi-resource-node-viewer',
      templateUrl: './resource-node-viewer.component.html',
      styleUrls: ['./resource-node-viewer.component.scss'],
    })
    export class ResourceNodeViewerComponent implements OnInit {
      isLoading = true;
      clusterName: string;
      resourceName: string;
      resource: Resource;
      path: string;
      obj: any;

      constructor(
        protected route: ActivatedRoute,
        protected service: ResourceService,
        protected helper: HelperService
      ) {}

      ngOnInit() {
        if (this.route.snapshot.data.path) {
          this.path = this.route.snapshot.data.path;
        }

        if (this.route.parent) {
          this.clusterName = this.route.parent.snapshot.params.cluster_name;
          this.resourceName = this.route.parent.snapshot.params.resource_name;

          this.loadResource();
        }
      }

      protected loadResource() {
        this.isLoading = true;
        this.service.get(this.clusterName, this.resourceName).subscribe(
          (resource) => {
            this.resource = resource;
            this.obj = _.get(this.resource, this.path);
          },
          (error) => this.helper.showError(error),
          () => (this.isLoading = false)
        );
      }
    }

    <!--
      ~ Licensed to the Apache Software Foundation (ASF) under one
      ~ or more contributor license agreements.  See the NOTICE file
      ~ distributed with this work for additional information
      ~ regarding copyright ownership.  The ASF licenses this file
      ~ to you under the Apache License, Version 2.0 (the
      ~ "License"); you may not use this file except in compliance
      ~ with the License.  You may obtain a copy of the License at
      ~
      ~     http://www.apache.org/licenses/LICENSE-2.0
      ~
      ~ Unless required by applicable law or agreed to in writing,
      ~ software distributed under the License is distributed on an
      ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
      ~ KIND, either express or implied.  See the License for the
      ~ specific language governing permissions and limitations
      ~ under the License.
      -->

    <section>
      <hi-node-viewer [loadingIndicator]="isLoading" [obj]="obj"> </hi-node-viewer>
    </section>

`./resource-node-viewer.component.scss`

Legend
Html element
Component
Html element with directive

# results matching ""

# No results matching ""