Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2016-2017 by Teradata Corporation. All rights reserved.
- * TERADATA CORPORATION CONFIDENTIAL AND TRADE SECRET
- */
- import { Component, AfterViewInit, OnInit } from '@angular/core';
- import { Router, ActivatedRoute } from '@angular/router';
- import { TdLoadingService } from '@covalent/core';
- import { SystemsService, ISystem, IAddSystemApi, REGION_TYPES,
- RegionType, ErrorService, ToastService } from '../../../services';
- @Component({
- selector: 'system-form',
- templateUrl: './form.component.html',
- styleUrls: ['./form.component.scss'],
- viewProviders: [ SystemsService ],
- })
- export class SystemsFormComponent implements AfterViewInit, OnInit {
- system: ISystem
- types: RegionType[] = REGION_TYPES;
- tested: boolean = false;
- temp: any = {
- username: '',
- password: '',
- };
- constructor(private _systemsService: SystemsService,
- private _errorService: ErrorService,
- private _toastService: ToastService,
- private _route: ActivatedRoute,
- private _router: Router,
- private _loadingService: TdLoadingService) {}
- ngOnInit(): void {
- this._route.params.subscribe((params: {id: string}) => {
- let systemId: string = params.id;
- if (systemId) {
- this._loadingService.register('system.form');
- this._systemsService.query({'system_id': systemId})
- .subscribe((system: ISystem) => {
- this.system = system;
- console.log(this.system);
- this._loadingService.resolve('system.form');
- }, (error: any) => {
- this._errorService.open(error);
- this._loadingService.resolve('system.form');
- });
- }
- });
- }
- ngAfterViewInit(): void {
- }
- goBack(): void {
- this._router.navigate(['/syst']);
- }
- isDatabaseRequired(): boolean {
- switch (this.system.region_type) {
- case RegionType.Region1:
- return true;
- default:
- return false;
- }
- }
- isDefaultDatabaseSupport(): boolean {
- switch (this.system.region_type) {
- case RegionType.Region1:
- case RegionType.Region2:
- return true;
- default:
- return false;
- }
- }
- resetTest(): void {
- this.tested = false;
- }
- save(): void {
- let system: IAddSystemApi = {
- AddSystem: {
- system: {
- address: "system.address",
- name: "system.name",
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement