/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { SecretVO } from '../../../vo/secret.vo';
import { API } from '../../../../../api';
var IdentityClientsUpdateSecretComponent = /** @class */ (function () {
    function IdentityClientsUpdateSecretComponent() {
        this.visible = false;
        this.visibleChange = new EventEmitter();
        this.clientId = '';
        this.secrets = [];
        this.secretsFetching = false;
        this.identityClientsUpdateSecretCreateComponentProp = { visible: false };
    }
    /**
     * @return {?}
     */
    IdentityClientsUpdateSecretComponent.prototype.fetchSecrets = /**
     * @return {?}
     */
    function () {
        var _this = this;
        this.secretsFetching = true;
        API.Identity.ClientController.Secrets({
            client: this.clientId,
        }).subscribe({
            next: (/**
             * @param {?} data
             * @return {?}
             */
            function (data) {
                _this.secrets = SecretVO.fromArray(data);
                _this.secretsFetching = false;
            }),
            error: (/**
             * @return {?}
             */
            function () {
                _this.secretsFetching = false;
            }),
        });
    };
    /**
     * @param {?} item
     * @return {?}
     */
    IdentityClientsUpdateSecretComponent.prototype.deleteSecret = /**
     * @param {?} item
     * @return {?}
     */
    function (item) {
        var _this = this;
        item.deleting = true;
        API.Identity.ClientController.RemoveSecret(new API.Identity.ClientController.RemoveSecretParam(tslib_1.__assign({}, item, { client: this.clientId }))).subscribe({
            next: (/**
             * @return {?}
             */
            function () {
                item.deleting = false;
                _this.fetchSecrets();
            }),
            error: (/**
             * @return {?}
             */
            function () {
                item.deleting = false;
            }),
        });
    };
    /**
     * @return {?}
     */
    IdentityClientsUpdateSecretComponent.prototype.openIdentityClientsUpdateSecretCreateComponent = /**
     * @return {?}
     */
    function () {
        this.identityClientsUpdateSecretCreateComponentProp.visible = true;
    };
    /**
     * @return {?}
     */
    IdentityClientsUpdateSecretComponent.prototype.handleIdentityClientsUpdateSecretCreateComponentOk = /**
     * @return {?}
     */
    function () {
        this.fetchSecrets();
    };
    /**
     * @return {?}
     */
    IdentityClientsUpdateSecretComponent.prototype.handleCancel = /**
     * @return {?}
     */
    function () {
        this.visibleChange.emit(false);
    };
    /**
     * @return {?}
     */
    IdentityClientsUpdateSecretComponent.prototype.handleAfterOpen = /**
     * @return {?}
     */
    function () {
        this.fetchSecrets();
    };
    IdentityClientsUpdateSecretComponent.decorators = [
        { type: Component, args: [{
                    selector: 'kg---identity--clients--update--secret',
                    template: "<nz-modal\r\n  (nzOnCancel)=\"handleCancel()\"\r\n  (nzAfterOpen)=\"handleAfterOpen()\"\r\n  [nzBodyStyle]=\"{\r\n    padding: '12px 16px 6px 16px'\r\n  }\"\r\n  [nzKeyboard]=\"false\"\r\n  [nzMaskClosable]=\"false\"\r\n  [nzTitle]=\"\r\n    'projects/fe-ng/src/lib/page/identity/clients/update/secret/identity--clients--update--secret.title' | i18n\r\n  \"\r\n  [nzVisible]=\"visible\"\r\n  nzWidth=\"1198px\"\r\n>\r\n  <div>\r\n    <button\r\n      (click)=\"fetchSecrets()\"\r\n      [ngStyle]=\"{\r\n        float: 'left',\r\n        marginBottom: '10px'\r\n      }\"\r\n      [nzLoading]=\"secretsFetching\"\r\n      class=\"btn-outline-primary\"\r\n      nz-button\r\n    >\r\n      <i nz-icon nzType=\"reload\" nzTheme=\"outline\"></i>\r\n      {{ 'app.common.refresh' | i18n }}\r\n    </button>\r\n\r\n    <button\r\n      (click)=\"openIdentityClientsUpdateSecretCreateComponent()\"\r\n      [ngStyle]=\"{\r\n        float: 'left',\r\n        marginBottom: '10px'\r\n      }\"\r\n      nz-button\r\n      nzType=\"primary\"\r\n    >\r\n      <i nz-icon nzType=\"plus-circle\" nzTheme=\"outline\"></i>\r\n      {{ 'app.common.create' | i18n }}\r\n    </button>\r\n  </div>\r\n\r\n  <nz-table\r\n    #table\r\n    [ngStyle]=\"{ marginTop: '10px', clear: 'both' }\"\r\n    [nzData]=\"secrets\"\r\n    [nzFrontPagination]=\"false\"\r\n    [nzLoadingIndicator]=\"loadingIndicatorTpl\"\r\n    [nzLoading]=\"secretsFetching\"\r\n    [nzScroll]=\"{ x: '940px' }\"\r\n    [nzShowPagination]=\"false\"\r\n    [nzWidthConfig]=\"['260px', '160px', '160px', '260px', '100px']\"\r\n    nzSize=\"small\"\r\n  >\r\n    <thead>\r\n      <tr>\r\n        <th>{{ 'app.common.value' | i18n }}</th>\r\n        <th>\r\n          {{\r\n            'projects/fe-ng/src/lib/page/identity/clients/update/secret/identity--clients--update--secret.type' | i18n\r\n          }}\r\n        </th>\r\n        <th>\r\n          {{\r\n            'projects/fe-ng/src/lib/page/identity/clients/update/secret/identity--clients--update--secret.expiration'\r\n              | i18n\r\n          }}\r\n        </th>\r\n        <th>{{ 'app.common.description' | i18n }}</th>\r\n        <th [nzRight]=\"'0px'\" class=\"text-center\">{{ 'app.common.action' | i18n }}</th>\r\n      </tr>\r\n    </thead>\r\n\r\n    <tbody>\r\n      <ng-container *ngFor=\"let item of table.data\">\r\n        <tr>\r\n          <td [nzBreakWord]=\"true\">{{ item.value }}</td>\r\n\r\n          <td [nzBreakWord]=\"true\">{{ item.type }}</td>\r\n\r\n          <td [nzBreakWord]=\"true\">{{ item.expiration | kgDate }}</td>\r\n\r\n          <td [nzBreakWord]=\"true\">{{ item.description }}</td>\r\n\r\n          <td class=\"text-right\" [nzRight]=\"'0px'\">\r\n            <button\r\n              (nzOnConfirm)=\"deleteSecret(item)\"\r\n              [ngStyle]=\"{ height: '28px' }\"\r\n              [nzLoading]=\"item.deleting\"\r\n              [nzTitle]=\"'app.common.confirm-deletion' | i18n\"\r\n              class=\"btn-outline-warning\"\r\n              nz-button\r\n              nz-popconfirm\r\n              nzPlacement=\"topRight\"\r\n              nzSize=\"small\"\r\n            >\r\n              <i nz-icon nzType=\"delete\" nzTheme=\"outline\"></i>\r\n              {{ 'app.common.delete' | i18n }}\r\n            </button>\r\n          </td>\r\n        </tr>\r\n      </ng-container>\r\n    </tbody>\r\n\r\n    <ng-template #loadingIndicatorTpl>\r\n      <i\r\n        [ngStyle]=\"{\r\n          fontSize: '24px',\r\n          marginTop: '10px'\r\n        }\"\r\n        nz-icon\r\n        nzTheme=\"outline\"\r\n        nzType=\"loading\"\r\n      ></i>\r\n    </ng-template>\r\n  </nz-table>\r\n\r\n  <div *nzModalFooter>\r\n    <button (click)=\"handleCancel()\" nz-button nzType=\"default\">\r\n      <i nz-icon nzType=\"stop\" nzTheme=\"outline\"></i>\r\n      {{ 'app.common.cancel' | i18n }}\r\n    </button>\r\n  </div>\r\n</nz-modal>\r\n\r\n<kg---identity--clients--update--secret--create\r\n  (ok)=\"handleIdentityClientsUpdateSecretCreateComponentOk()\"\r\n  [(visible)]=\"identityClientsUpdateSecretCreateComponentProp.visible\"\r\n  [clientId]=\"clientId\"\r\n></kg---identity--clients--update--secret--create>\r\n"
                }] }
    ];
    IdentityClientsUpdateSecretComponent.propDecorators = {
        visible: [{ type: Input }],
        visibleChange: [{ type: Output }],
        clientId: [{ type: Input }]
    };
    return IdentityClientsUpdateSecretComponent;
}());
export { IdentityClientsUpdateSecretComponent };
if (false) {
    /** @type {?} */
    IdentityClientsUpdateSecretComponent.prototype.visible;
    /** @type {?} */
    IdentityClientsUpdateSecretComponent.prototype.visibleChange;
    /** @type {?} */
    IdentityClientsUpdateSecretComponent.prototype.clientId;
    /** @type {?} */
    IdentityClientsUpdateSecretComponent.prototype.secrets;
    /** @type {?} */
    IdentityClientsUpdateSecretComponent.prototype.secretsFetching;
    /** @type {?} */
    IdentityClientsUpdateSecretComponent.prototype.identityClientsUpdateSecretCreateComponentProp;
}
//# sourceMappingURL=data:application/json;base64, 