import { __awaiter } from "tslib";
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ApplicationService, ApplicationType, BillingMode, InventoryService, Isolation } from '@c8y/client';
import { packageProperties } from '../ecosystem.constants';
import { EcosystemService } from '../ecosystem.service';
import { FormBuilder, Validators } from '@angular/forms';
import { AlertService, gettext, ViewContext } from '@c8y/ngx-components';
const MICROSERVICES_BASE_PATH = '/microservices';
const APPLICATIONS_BASE_PATH = '/ecosystem';
export class ApplicationPropertiesComponent {
    constructor(activatedRoute, ecosystemService, router, formBuilder, applicationService, alertService, inventoryService) {
        this.activatedRoute = activatedRoute;
        this.ecosystemService = ecosystemService;
        this.router = router;
        this.formBuilder = formBuilder;
        this.applicationService = applicationService;
        this.alertService = alertService;
        this.inventoryService = inventoryService;
        this.singleTenant = false;
        this.subscription = false;
        this.iconMap = {
            HOSTED: 'cloud',
            EXTERNAL: 'external-link-square',
            MICROSERVICE: 'microchip'
        };
        this.isLoading = true;
        this.packageProperties = [...packageProperties];
    }
    ngOnInit() {
        return __awaiter(this, void 0, void 0, function* () {
            yield this.load();
            this.isUnpacked = this.ecosystemService.isUnpacked(this.application);
            this.isPackage = this.ecosystemService.isPackage(this.application);
            this.isFeature = this.ecosystemService.isFeature(this.application);
            this.isExternal = this.ecosystemService.isExternal(this.application);
            this.isMicroservice = this.ecosystemService.isMicroservice(this.application);
            this.appState = this.ecosystemService.getAppState(this.application);
            if (this.isUnpacked) {
                yield this.resolveSourcePackage();
            }
            this.setBreadcrumbConifg();
            if (this.isCustomMicroservice) {
                this.loadBinaryMo();
            }
        });
    }
    load() {
        return __awaiter(this, void 0, void 0, function* () {
            this.isLoading = true;
            this.initForm();
            yield this.loadApplication();
            this.isLoading = false;
        });
    }
    onApplication(app) {
        if (app.manifest) {
            this.singleTenant = app.manifest.isolation === Isolation.PER_TENANT;
            this.subscription = app.manifest.billingMode === BillingMode.SUBSCRIPTION;
        }
    }
    cancel() {
        if (this.application.type === ApplicationType.MICROSERVICE) {
            this.router.navigateByUrl(MICROSERVICES_BASE_PATH);
        }
        else {
            this.router.navigateByUrl(APPLICATIONS_BASE_PATH);
        }
    }
    openApp(app) {
        window.open(this.applicationService.getHref(app));
    }
    getPackage(entityOrId) {
        return this.applicationService.detail(entityOrId);
    }
    delete() {
        return __awaiter(this, void 0, void 0, function* () {
            try {
                yield this.ecosystemService.deleteApp(this.application);
                if (this.application.type === ApplicationType.MICROSERVICE) {
                    this.router.navigateByUrl(MICROSERVICES_BASE_PATH);
                }
                else {
                    this.router.navigateByUrl(APPLICATIONS_BASE_PATH);
                }
            }
            catch (ex) {
                if (ex) {
                    this.alertService.addServerFailure(ex);
                }
            }
        });
    }
    subscribe() {
        return __awaiter(this, void 0, void 0, function* () {
            yield this.ecosystemService.subscribeApp(this.application);
            this.loadApplication();
        });
    }
    unsubscribe() {
        return __awaiter(this, void 0, void 0, function* () {
            yield this.ecosystemService.unsubscribeApp(this.application);
            this.loadApplication();
        });
    }
    loadApplication() {
        return __awaiter(this, void 0, void 0, function* () {
            const { id } = this.activatedRoute.snapshot.parent.data.contextData;
            this.application = yield this.ecosystemService.getApplication(id);
            if (this.application.type === ApplicationType.MICROSERVICE) {
                this.formGroup.get('name').disable();
            }
            this.formGroup.patchValue(Object.assign({}, this.application));
            this.canOpenInBrowser = this.ecosystemService.canOpenAppInBrowser(this.application);
            this.disableOpenInBrowser =
                this.canOpenInBrowser &&
                    (yield this.ecosystemService.isOverwrittenByCustomApp(this.application));
            this.canDelete = this.ecosystemService.canDeleteApp(this.application);
            this.isOwner = this.ecosystemService.isOwner(this.application);
            this.isActivityLogSupported = this.isActivityLogSupportedByApp(this.application);
            this.isCustomMicroservice = this.ecosystemService.isCustomMicroservice(this.application);
            this.isSubscribed = yield this.ecosystemService.checkIfSubscribed(this.application);
            this.onApplication(this.application);
        });
    }
    save(app) {
        return __awaiter(this, void 0, void 0, function* () {
            app.id = this.application.id;
            try {
                yield this.ecosystemService.updateApp(app);
                this.alertService.success(gettext('Application saved.'));
                this.formGroup.reset();
                this.loadApplication();
            }
            catch (ex) {
                // do nothing
            }
        });
    }
    onNewArchive() {
        this.loadBinaryMo();
    }
    resolveSourcePackage() {
        return __awaiter(this, void 0, void 0, function* () {
            this.package = (yield this.getPackage(this.application.manifest.source)).data;
            if (this.package) {
                this.packageProperties.push({
                    label: gettext('Source package'),
                    value: this.package.name,
                    type: 'link',
                    action: () => this.router.navigateByUrl(ViewContext.Application.replace(':id', this.package.id.toString()))
                });
            }
        });
    }
    initForm() {
        this.formGroup = this.formBuilder.group({
            id: [{ value: '' }],
            name: [Validators.required, Validators.maxLength(120)],
            key: [Validators.required, Validators.maxLength(120)],
            contextPath: [Validators.required, Validators.maxLength(120)],
            description: ['', Validators.maxLength(200)],
            resourcesUrl: [Validators.required],
            username: [Validators.required],
            password: [Validators.required],
            externalUrl: [Validators.required]
        });
    }
    isActivityLogSupportedByApp(app) {
        return (this.ecosystemService.isOwner(app) &&
            app.type !== ApplicationType.MICROSERVICE &&
            app.type !== ApplicationType.EXTERNAL);
    }
    setBreadcrumbConifg() {
        this.breadcrumbConfig = {
            icon: this.isMicroservice ? 'microchip' : this.isFeature ? 'tab' : 'c8y-modules',
            label: this.isMicroservice
                ? gettext('Microservices')
                : this.isFeature
                    ? gettext('Features')
                    : gettext('All applications'),
            path: this.isMicroservice
                ? 'microservices'
                : this.isFeature
                    ? 'ecosystem/features'
                    : 'ecosystem/applications'
        };
    }
    loadBinaryMo() {
        return __awaiter(this, void 0, void 0, function* () {
            this.binaryMo = (yield this.inventoryService.detail(this.application.activeVersionId)).data;
        });
    }
}
ApplicationPropertiesComponent.decorators = [
    { type: Component, args: [{
                selector: 'c8y-application-properties',
                template: "<c8y-title>{{ application | humanizeAppName | async }}</c8y-title>\n\n<c8y-breadcrumb *ngIf=\"!isMicroservice\">\n  <c8y-breadcrumb-item [icon]=\"'c8y-atom'\" [label]=\"'Ecosystem' | translate\"></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item\n    [icon]=\"'c8y-modules'\"\n    [label]=\"'Applications' | translate\"\n    [path]=\"'ecosystem/applications'\"\n  ></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item\n    [icon]=\"breadcrumbConfig?.icon\"\n    [label]=\"breadcrumbConfig?.label\"\n    [path]=\"breadcrumbConfig?.path\"\n  ></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item [label]=\"application | humanizeAppName | async\"></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item [label]=\"'Properties' | translate\"></c8y-breadcrumb-item>\n</c8y-breadcrumb>\n\n<c8y-breadcrumb *ngIf=\"isMicroservice\">\n  <c8y-breadcrumb-item [icon]=\"'c8y-atom'\" [label]=\"'Ecosystem' | translate\"></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item\n    [icon]=\"breadcrumbConfig?.icon\"\n    [label]=\"breadcrumbConfig?.label\"\n    [path]=\"breadcrumbConfig?.path\"\n  ></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item [label]=\"application | humanizeAppName | async\"></c8y-breadcrumb-item>\n  <c8y-breadcrumb-item [label]=\"'Properties' | translate\"></c8y-breadcrumb-item>\n</c8y-breadcrumb>\n\n<div class=\"row\">\n  <div [ngClass]=\"{ 'col-md-8': !isActivityLogSupported, 'col-md-12': isActivityLogSupported }\">\n    <div\n      *ngIf=\"application\"\n      [ngClass]=\"{ 'd-grid grid__col--7-5--md': isActivityLogSupported }\"\n      class=\"card content-fullpage\"\n    >\n      <form\n        (ngSubmit)=\"formGroup.valid && save(formGroup.value)\"\n        [formGroup]=\"formGroup\"\n        class=\"d-flex d-col content-fullpage\"\n        novalidate\n      >\n        <div *ngIf=\"!isLoading\" class=\"d-contents\">\n          <div class=\"card-block separator-bottom large-padding flex-no-shrink\">\n            <div class=\"d-flex-md a-i-start text-center text-left-md\">\n              <c8y-app-icon\n                *ngIf=\"!isPackage && !isFeature && !isMicroservice && !isExternal\"\n                [app]=\"application\"\n                [contextPath]=\"application.contextPath\"\n                [name]=\"application.name\"\n                class=\"icon-48\"\n              ></c8y-app-icon>\n              <i *ngIf=\"isPackage\" c8yIcon=\"big-parcel\" class=\"icon-48\"></i>\n              <i *ngIf=\"isFeature\" c8yIcon=\"tab\" class=\"icon-48\"></i>\n              <i *ngIf=\"isMicroservice\" c8yIcon=\"microchip\" class=\"icon-48\"></i>\n              <i *ngIf=\"isExternal\" c8yIcon=\"globe1\" class=\"icon-48\"></i>\n\n              <div class=\"p-t-md-16 p-l-md-16 p-r-md-32 flex-grow\">\n                <h4 class=\"text-medium m-b-8\">{{ application | humanizeAppName | async }}</h4>\n                <p *ngIf=\"!isOwner\">\n                  <em class=\"text-muted\">\n                    {{ application.description || ('No description available.' | translate) }}\n                  </em>\n                </p>\n                <div *ngIf=\"isOwner\" class=\"form-group m-b-0\">\n                  <label\n                    [ngClass]=\"{ updated: formGroup?.controls?.description?.dirty }\"\n                    class=\"editable\"\n                  >\n                    <textarea\n                      c8y-textarea-autoresize\n                      class=\"form-control no-resize\"\n                      formControlName=\"description\"\n                      name=\"description\"\n                      placeholder=\"{{ 'No description available.' | translate }}\"\n                    ></textarea>\n                  </label>\n                </div>\n              </div>\n              <div class=\"text-right-md m-t-4\">\n                <span [ngClass]=\"appState?.class\" class=\"label\">{{\n                  appState?.label | translate\n                }}</span>\n                <div *ngIf=\"application.manifest?.version\" class=\"fit-w m-t-2\">\n                  <label class=\"text-label-small\" translate>Version:</label>\n                  <small class=\"p-l-4 text-bold\">{{ application.manifest?.version }}</small>\n                </div>\n                <div *ngIf=\"binaryMo?.creationTime\" class=\"fit-w m-t-2\">\n                  <label class=\"text-label-small\" translate>Creation time:</label>\n                  <small class=\"p-l-4 text-bold\">{{ binaryMo?.creationTime | c8yDate }}</small>\n                </div>\n                <div class=\"m-t-8\">\n                  <button\n                    (click)=\"openApp(application); $event.stopPropagation()\"\n                    [disabled]=\"disableOpenInBrowser\"\n                    *ngIf=\"canOpenInBrowser\"\n                    class=\"btn btn-default btn-xs\"\n                    title=\"{{ 'Open' | translate }}\"\n                  >\n                    <i [c8yIcon]=\"'external-link'\"></i>\n                    {{ 'Open' | translate }}\n                  </button>\n                  <div *ngIf=\"canOpenInBrowser && disableOpenInBrowser\">\n                    <small class=\"text-muted\" translate\n                      >The application is overwritten by a custom application sharing the same\n                      path</small\n                    >\n                  </div>\n                  <span *ngIf=\"isCustomMicroservice\">\n                    <button\n                      (click)=\"subscribe()\"\n                      *ngIf=\"!isSubscribed\"\n                      class=\"btn btn-default btn-xs\"\n                      title=\"{{ 'Subscribe' | translate }}\"\n                    >\n                      <i [c8yIcon]=\"'check-circle-o'\"></i>\n                      {{ 'Subscribe' | translate }}\n                    </button>\n                    <button\n                      (click)=\"unsubscribe()\"\n                      *ngIf=\"isSubscribed\"\n                      class=\"btn btn-default btn-xs\"\n                      title=\"{{ 'Unsubscribe' | translate }}\"\n                    >\n                      <i [c8yIcon]=\"'minus-circle'\"></i>\n                      {{ 'Unsubscribe' | translate }}\n                    </button>\n                  </span>\n                </div>\n              </div>\n            </div>\n          </div>\n          <div class=\"inner-scroll bg-white flex-grow\">\n            <div class=\"card-block large-padding\">\n              <div *ngIf=\"isPackage\" class=\"row p-16\">\n                <c8y-properties-list\n                  [data]=\"application.manifest\"\n                  [properties]=\"packageProperties\"\n                  [title]=\"'Package details' | translate\"\n                  icon=\"info\"\n                ></c8y-properties-list>\n              </div>\n              <div *ngIf=\"package\" class=\"row p-16\">\n                <c8y-properties-list\n                  [data]=\"package.manifest\"\n                  [properties]=\"packageProperties\"\n                  [title]=\"'Source package information' | translate\"\n                  icon=\"info\"\n                ></c8y-properties-list>\n              </div>\n              <div class=\"row\">\n                <div class=\"col-sm-5\">\n                  <c8y-form-group>\n                    <label>ID</label>\n                    <input\n                      [readonly]=\"true\"\n                      autocomplete=\"off\"\n                      class=\"form-control\"\n                      formControlName=\"id\"\n                      name=\"id\"\n                      type=\"text\"\n                    />\n                  </c8y-form-group>\n                </div>\n                <div class=\"col-sm-7\">\n                  <c8y-form-group>\n                    <label>{{ 'Name' | translate }}</label>\n                    <input\n                      [readonly]=\"!isOwner\"\n                      class=\"form-control\"\n                      formControlName=\"name\"\n                      name=\"name\"\n                      placeholder=\"{{ 'e.g. My application' | translate }}\"\n                      required\n                      type=\"text\"\n                    />\n                    <c8y-messages>\n                      <c8y-message *ngIf=\"formGroup?.controls?.name?.errors?.required\" translate>\n                        This field is required.\n                      </c8y-message>\n                    </c8y-messages>\n                  </c8y-form-group>\n                </div>\n              </div>\n\n              <div class=\"row\">\n                <div class=\"col-sm-5\">\n                  <c8y-form-group>\n                    <label>{{ 'Application key' | translate }}</label>\n                    <input\n                      [readonly]=\"application.id || !isOwner\"\n                      class=\"form-control\"\n                      name=\"key\"\n                      formControlName=\"key\"\n                      placeholder=\"{{ 'e.g. my-application-key' | translate }}\"\n                      required\n                      type=\"text\"\n                    />\n                    <c8y-messages>\n                      <c8y-message *ngIf=\"formGroup?.controls?.key?.errors?.required\" translate>\n                        This field is required.\n                      </c8y-message>\n                    </c8y-messages>\n                  </c8y-form-group>\n                </div>\n\n                <div class=\"col-sm-7\">\n                  <c8y-form-group>\n                    <label>{{ 'Type' | translate }}</label>\n                    <div>\n                      <div *ngIf=\"application.id\">\n                        <p class=\"form-control-static\">\n                          <i [c8yIcon]=\"iconMap[application.type]\"></i>\n                          <span>\n                            {{ application.type | translate }}\n                          </span>\n                        </p>\n                      </div>\n                    </div>\n                  </c8y-form-group>\n                </div>\n              </div>\n\n              <div [ngSwitch]=\"application.type\">\n                <div *ngSwitchCase=\"'HOSTED'\">\n                  <c8y-form-group>\n                    <label>{{ 'Path' | translate }}</label>\n                    <div class=\"input-group\">\n                      <span class=\"input-group-addon\">/apps/</span>\n                      <input\n                        [readOnly]=\"application.id || !isOwner\"\n                        class=\"form-control\"\n                        name=\"contextPath\"\n                        placeholder=\"{{ 'e.g. my-application`used in URL`' | translate }}\"\n                        required\n                        type=\"text\"\n                        formControlName=\"contextPath\"\n                      />\n                    </div>\n                    <c8y-messages>\n                      <c8y-message\n                        *ngIf=\"formGroup?.controls?.contextPath?.errors?.required\"\n                        translate\n                      >\n                        This field is required.\n                      </c8y-message>\n                    </c8y-messages>\n                  </c8y-form-group>\n                </div>\n\n                <div *ngSwitchCase=\"'MICROSERVICE'\">\n                  <c8y-form-group>\n                    <label>{{ 'Path' | translate }}</label>\n                    <div class=\"input-group\">\n                      <span class=\"input-group-addon\">/service/</span>\n                      <input\n                        [readOnly]=\"application.id || !isOwner\"\n                        class=\"form-control\"\n                        name=\"contextPath\"\n                        placeholder=\"{{ 'e.g. my-microservice`used in URL`' | translate }}\"\n                        required\n                        type=\"text\"\n                        formControlName=\"contextPath\"\n                      />\n                    </div>\n                    <c8y-messages>\n                      <c8y-message\n                        *ngIf=\"formGroup?.controls?.contextPath?.errors?.required\"\n                        translate\n                      >\n                        This field is required.\n                      </c8y-message>\n                    </c8y-messages>\n                  </c8y-form-group>\n                  <div class=\"row\">\n                    <div *ngIf=\"application.manifest.version\" class=\"col-sm-4 m-b-16 flex-auto\">\n                      <label>{{ 'Version' | translate }}</label>\n                      <p class=\"form-control-static\">\n                        {{ application.manifest.version }}\n                      </p>\n                    </div>\n                    <div *ngIf=\"application.manifest.isolation\" class=\"col-sm-4 m-b-16 flex-auto\">\n                      <label>{{ 'Isolation' | translate }}</label>\n                      <p class=\"form-control-static\">\n                        <span *ngIf=\"singleTenant\">\n                          <i [c8yIcon]=\"'c8y-enterprise'\" class=\"c8y-icon-duocolor h4\"></i>\n                          {{ 'Single tenant' | translate }}\n                        </span>\n                        <span *ngIf=\"!singleTenant\">\n                          <i [c8yIcon]=\"'c8y-sub-tenants'\" class=\"c8y-icon-duocolor h4\"></i>\n                          {{ 'Multi tenant' | translate }}\n                        </span>\n                      </p>\n                    </div>\n                    <div *ngIf=\"application.manifest.isolation\" class=\"col-sm-4 m-b-16 flex-auto\">\n                      <label>{{ 'Billing mode' | translate }}</label>\n                      <p class=\"form-control-static\">\n                        <span\n                          *ngIf=\"subscription\"\n                          [tooltip]=\"'Resources usage assigned to: Owner' | translate\"\n                        >\n                          {{ 'Subscription' | translate }}\n                        </span>\n                        <span\n                          *ngIf=\"!subscription && singleTenant\"\n                          [tooltip]=\"'Resources usage assigned to: Subscriber | translate'\"\n                        >\n                          {{ 'Resources' | translate }}\n                        </span>\n                        <span\n                          *ngIf=\"!subscription && !singleTenant\"\n                          [tooltip]=\"'Resources usage assigned to: Owner' | translate\"\n                        >\n                          {{ 'Resources' | translate }}\n                        </span>\n                      </p>\n                    </div>\n                  </div>\n\n                  <div *ngIf=\"application.manifest.provider\" class=\"legend form-block m-t-40\">\n                    {{ 'Provider' | translate }}\n                  </div>\n                  <div class=\"list-inline\" *ngIf=\"application.manifest.provider\">\n                    <div *ngIf=\"application.manifest.provider.name\">\n                      <div class=\"col-sm-4 m-b-16\">\n                        <label>{{ 'Name' | translate }}</label>\n                        <p class=\"form-control-static\">\n                          {{ application.manifest.provider.name }}\n                        </p>\n                      </div>\n                    </div>\n                    <div *ngIf=\"application.manifest.provider.domain\">\n                      <div class=\"col-sm-4 m-b-16\">\n                        <label>{{ 'Domain' | translate }}</label>\n                        <p class=\"form-control-static\">\n                          {{ application.manifest.provider.domain }}\n                        </p>\n                      </div>\n                    </div>\n                    <div *ngIf=\"application.manifest.provider.support\">\n                      <div class=\"col-sm-4 m-b-16\">\n                        <label>{{ 'Support' | translate }}</label>\n                        <p class=\"form-control-static\">\n                          {{ application.manifest.provider.support }}\n                        </p>\n                      </div>\n                    </div>\n                  </div>\n                </div>\n\n                <div *ngSwitchCase=\"'REPOSITORY'\">\n                  <c8y-form-group>\n                    <label>{{ 'Path' | translate }}</label>\n                    <div class=\"input-group\">\n                      <span class=\"input-group-addon\"> /apps/ </span>\n                      <input\n                        [readOnly]=\"application.id || !isOwner\"\n                        class=\"form-control\"\n                        formControlName=\"contextPath\"\n                        name=\"contextPath\"\n                        placeholder=\"{{ 'e.g. my-application`used in URL`' | translate }}\"\n                        required\n                        type=\"text\"\n                      />\n                    </div>\n                    <c8y-messages>\n                      <c8y-message\n                        *ngIf=\"formGroup?.controls?.contextPath?.errors?.required\"\n                        translate\n                      >\n                        This field is required.\n                      </c8y-message>\n                    </c8y-messages>\n                  </c8y-form-group>\n\n                  <c8y-form-group>\n                    <label>{{ 'Server URL' | translate }}</label>\n                    <input\n                      class=\"form-control\"\n                      name=\"resourcesUrl\"\n                      formControlName=\"resourcesUrl\"\n                      placeholder=\"{{ 'e.g. my-application`used in URL`' | translate }}\"\n                      required\n                      type=\"url\"\n                    />\n                    <c8y-messages>\n                      <c8y-message\n                        *ngIf=\"formGroup?.controls?.resourcesUrl?.errors?.required\"\n                        translate\n                      >\n                        This field is required.\n                      </c8y-message>\n                    </c8y-messages>\n                  </c8y-form-group>\n\n                  <div class=\"form-group\">\n                    <label> {{ 'Username' | translate }}</label>\n                    <input\n                      class=\"form-control\"\n                      formControlName=\"username\"\n                      name=\"username\"\n                      type=\"text\"\n                    />\n                  </div>\n\n                  <div class=\"form-group\">\n                    <label>{{ 'Password' | translate }}</label>\n                    <input\n                      class=\"form-control\"\n                      formControlName=\"password\"\n                      name=\"password\"\n                      type=\"text\"\n                    />\n                  </div>\n                </div>\n\n                <div *ngSwitchCase=\"'EXTERNAL'\">\n                  <c8y-form-group>\n                    <label>{{ 'External URL' | translate }}</label>\n                    <input\n                      [pattern]=\"'^(?!javascript:).+'\"\n                      [readOnly]=\"!isOwner\"\n                      class=\"form-control\"\n                      formControlName=\"externalUrl\"\n                      name=\"externalUrl\"\n                      placeholder=\"{{ 'e.g.' | translate }} http://www.example.com/\"\n                      required\n                      type=\"url\"\n                    />\n                    <c8y-messages>\n                      <c8y-message\n                        *ngIf=\"formGroup?.controls?.externalUrl?.errors?.required\"\n                        translate\n                      >\n                        This field is required.\n                      </c8y-message>\n                      <c8y-message\n                        *ngIf=\"formGroup?.controls?.externalUrl?.errors?.pattern\"\n                        translate\n                      >\n                        Valid URL required.\n                      </c8y-message>\n                    </c8y-messages>\n                  </c8y-form-group>\n                </div>\n              </div>\n            </div>\n          </div>\n          <ng-container *ngIf=\"isCustomMicroservice\">\n            <div *ngIf=\"!isLoading\" class=\"d-contents\">\n              <c8y-upload-archive\n                [(application)]=\"application\"\n                (refresh)=\"onNewArchive()\"\n              ></c8y-upload-archive>\n            </div>\n          </ng-container>\n          <div *ngIf=\"application && !!isOwner\" class=\"card-footer separator\">\n            <button\n              (click)=\"cancel()\"\n              class=\"btn btn-default\"\n              title=\"{{ 'Cancel' | translate }}\"\n              type=\"button\"\n            >\n              {{ 'Cancel' | translate }}\n            </button>\n            <button\n              (click)=\"delete()\"\n              *ngIf=\"canDelete\"\n              class=\"btn btn-danger\"\n              title=\"{{ 'Delete' | translate }}\"\n              type=\"button\"\n            >\n              {{ 'Delete' | translate }}\n            </button>\n            <button\n              [disabled]=\"!application.type || formGroup.invalid || formGroup.pristine\"\n              class=\"btn btn-primary btn-form\"\n              title=\"{{ 'Save' | translate }}\"\n              type=\"submit\"\n            >\n              {{ 'Save' | translate }}\n            </button>\n          </div>\n        </div>\n      </form>\n\n      <div *ngIf=\"isActivityLogSupported\" class=\"content-fullpage d-flex d-col bg-gray-white\">\n        <div class=\"card-header separator\">\n          <h4 class=\"card-title\" translate>Activity log</h4>\n          <div class=\"m-l-auto\">\n            <button\n              (click)=\"load()\"\n              class=\"btn btn-link\"\n              title=\"{{ 'Reload' | translate }}\"\n              type=\"button\"\n            >\n              <i [ngClass]=\"{ 'icon-spin': isLoading }\" c8yIcon=\"refresh\"></i>\n              {{ 'Reload' | translate }}\n            </button>\n          </div>\n        </div>\n        <div *ngIf=\"isLoading\" class=\"p-16 text-center\">\n          <c8y-loading></c8y-loading>\n        </div>\n        <c8y-activity-log\n          *ngIf=\"!isLoading\"\n          [application]=\"application\"\n          class=\"d-contents\"\n        ></c8y-activity-log>\n      </div>\n    </div>\n  </div>\n</div>\n"
            },] }
];
ApplicationPropertiesComponent.ctorParameters = () => [
    { type: ActivatedRoute },
    { type: EcosystemService },
    { type: Router },
    { type: FormBuilder },
    { type: ApplicationService },
    { type: AlertService },
    { type: InventoryService }
];
//# sourceMappingURL=data:application/json;base64, 