UNPKG

@broadcom/endevor-bridge-for-git-for-zowe-cli

Version:

Endevor Bridge for Git plug-in for Zowe CLI

79 lines 4.36 kB
"use strict"; /* * Copyright (c) 2019 Broadcom. All Rights Reserved. The term * "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This software and all information contained therein is * confidential and proprietary and shall not be duplicated, * used, disclosed, or disseminated in any way except as * authorized by the applicable license agreement, without the * express written permission of Broadcom. All authorized * reproductions must be marked with this language. * * EXCEPT AS SET FORTH IN THE APPLICABLE LICENSE AGREEMENT, TO * THE EXTENT PERMITTED BY APPLICABLE LAW, BROADCOM PROVIDES THIS * SOFTWARE WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT * LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL BROADCOM * BE LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR * DAMAGE, DIRECT OR INDIRECT, FROM THE USE OF THIS SOFTWARE, * INCLUDING WITHOUT LIMITATION, LOST PROFITS, BUSINESS * INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF BROADCOM IS * EXPRESSLY ADVISED OF SUCH LOSS OR DAMAGE. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const BaseHandler_1 = require("../../BaseHandler"); const MappingUtils_1 = require("../../../api/utils/MappingUtils"); const object_1 = require("../../../utils/object"); const endevor_bridge_for_git_rest_api_1 = require("@broadcom/endevor-bridge-for-git-rest-api"); const BranchOptions_1 = require("../BranchOptions"); class BranchListHandler extends BaseHandler_1.BaseHandler { processWithSession() { return __awaiter(this, void 0, void 0, function* () { const context = this.getOption(BranchOptions_1.BranchOptions.CONTEXT, true); const repoName = this.getOption(BranchOptions_1.BranchOptions.MAPPING, true); this.validateRequiredOptions(); const mapping = yield MappingUtils_1.MappingUtils.getMapping(this.ebgService, context, repoName); const branches = mapping.branches; let fields; const output = []; branches.forEach(branch => { const isMultiSys = MappingUtils_1.MappingUtils.isMultiSystem(branch); fields = (0, object_1.isNil)(branch.mappingMode) ? BranchListHandler.FIELDS_V3 : BranchListHandler.FIELDS; const branchView = { branchId: branch.branchId, endevorUserName: branch.endevorUserName, environment: branch.environment, system: isMultiSys ? "multi" : branch.systems[0].name, subsystem: isMultiSys ? "multi" : branch.systems[0].subsystems[0].name, stage: branch.stage, readOnly: String(branch.readOnly), workEnvironmentOnly: String(branch.mappingMode === endevor_bridge_for_git_rest_api_1.MappingMode.full ? "false" : "true"), mappingMode: branch.mappingMode, queueStatus: branch.queueStatus }; output.push(branchView); }); this.format.output({ fields, output, format: "table", header: true }); }); } } exports.default = BranchListHandler; BranchListHandler.FIELDS = ["branchId", "endevorUserName", "environment", "system", "subsystem", "stage", "readOnly", "mappingMode", "queueStatus"]; BranchListHandler.FIELDS_V3 = ["branchId", "endevorUserName", "environment", "system", "subsystem", "stage", "readOnly", "workEnvironmentOnly", "queueStatus"]; //# sourceMappingURL=BranchList.handler.js.map