From 0f716c156eed8a9db206337d1e7afee9b71922c9 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 23 Apr 2020 11:30:10 +0200 Subject: [PATCH 01/49] adding file extension to NOTICE - it's written in markdown, why not carry the extension Signed-off-by: Alexandru-Paul Dumitru --- NOTICE.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 NOTICE.md diff --git a/NOTICE.md b/NOTICE.md new file mode 100644 index 000000000..ac34c85a9 --- /dev/null +++ b/NOTICE.md @@ -0,0 +1,47 @@ +# Notices for Eclipse Che4z + +This content is produced and maintained by the Eclipse Che4z project. + +* Project home: https://projects.eclipse.org/projects/ecd.che.che4z + +## Trademarks + +Eclipse Che4z is a trademark of the Eclipse Foundation. + +## Copyright + +All content is the property of the respective authors or their employers. For +more information regarding authorship of content, please consult the listed +source code repository logs. + +## Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License v. 2.0 available at +http://www.eclipse.org/legal/epl-2.0. + +SPDX-License-Identifier: EPL-2.0 + +## Source Code + +The project maintains the following source code repositories: + +* https://github.com/eclipse/che-che4z-explorer-for-endevor + +## Third-party Content + +This project leverages the following third party content. + +request (2.88.0) + +* License: Apache-2.0 +* Project: https://www.npmjs.com/package/request + +## Cryptography + +Content may contain encryption software. The country in which you are currently +may have restrictions on the import, possession, and use, and/or re-export to +another country, of encryption software. BEFORE using any encryption software, +please check the country's laws, regulations and policies concerning the import, +possession, or use, and re-export of encryption software, to see if this is +permitted. From d837d9c049f7fd5f297804b5c6005501476cafff Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 23 Apr 2020 11:30:44 +0200 Subject: [PATCH 02/49] delete old file Signed-off-by: Alexandru-Paul Dumitru --- NOTICE | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 NOTICE diff --git a/NOTICE b/NOTICE deleted file mode 100644 index ac34c85a9..000000000 --- a/NOTICE +++ /dev/null @@ -1,47 +0,0 @@ -# Notices for Eclipse Che4z - -This content is produced and maintained by the Eclipse Che4z project. - -* Project home: https://projects.eclipse.org/projects/ecd.che.che4z - -## Trademarks - -Eclipse Che4z is a trademark of the Eclipse Foundation. - -## Copyright - -All content is the property of the respective authors or their employers. For -more information regarding authorship of content, please consult the listed -source code repository logs. - -## Declared Project Licenses - -This program and the accompanying materials are made available under the terms -of the Eclipse Public License v. 2.0 available at -http://www.eclipse.org/legal/epl-2.0. - -SPDX-License-Identifier: EPL-2.0 - -## Source Code - -The project maintains the following source code repositories: - -* https://github.com/eclipse/che-che4z-explorer-for-endevor - -## Third-party Content - -This project leverages the following third party content. - -request (2.88.0) - -* License: Apache-2.0 -* Project: https://www.npmjs.com/package/request - -## Cryptography - -Content may contain encryption software. The country in which you are currently -may have restrictions on the import, possession, and use, and/or re-export to -another country, of encryption software. BEFORE using any encryption software, -please check the country's laws, regulations and policies concerning the import, -possession, or use, and re-export of encryption software, to see if this is -permitted. From 9eb68d91a4be31650905853972597d041367491b Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 23 Apr 2020 11:32:04 +0200 Subject: [PATCH 03/49] add dependent modules to package.json Signed-off-by: Alexandru-Paul Dumitru --- package-lock.json | 686 +++++++++++++++++++++++++++++++++++++++++++--- package.json | 2 + 2 files changed, 655 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5adf4e5d5..ffdf99318 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,12 +24,129 @@ "js-tokens": "^4.0.0" } }, + "@broadcom/endevor-for-zowe-cli": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@broadcom/endevor-for-zowe-cli/-/endevor-for-zowe-cli-5.1.1.tgz", + "integrity": "sha512-7O+rtp/zbF8WCkQrYpZWyQyjURH///myEeWvhrdqgAq2LQJMdmj5dViRyb8fVctRScj4OF2kDVPi9xlgjk/QIA==", + "requires": { + "form-data": "2.5.1", + "lodash": "4.17.15" + }, + "dependencies": { + "form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + } + } + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" + }, + "@types/lodash": { + "version": "4.14.150", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.150.tgz", + "integrity": "sha512-kMNLM5JBcasgYscD9x/Gvr6lTAv2NVgsKtet/hm93qMyf/D1pt+7jeEZklKJKxMVmXjxbRVQQGfqDSfipYCO6w==" + }, + "@types/lodash-deep": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/lodash-deep/-/lodash-deep-2.0.0.tgz", + "integrity": "sha512-qkAm3ab2gbNBzKTDdlUxQLEuMhIBkQ+hU2W99asSwHQDjPTwa4bG08I0+L4cQCIMMzT4QmGPR2rXT4iYDv0YFg==", + "requires": { + "@types/lodash": "*" + } + }, "@types/node": { "version": "12.12.24", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.24.tgz", "integrity": "sha512-1Ciqv9pqwVtW6FsIUKSZNB82E5Cu1I2bBTj1xuIHXLe/1zYLl3956Nbhg2MzSYHVfl9/rmanjbQIb7LibfCnug==", "dev": true }, + "@types/yargs": { + "version": "13.0.4", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.4.tgz", + "integrity": "sha512-Ke1WmBbIkVM8bpvsNEcGgQM70XcEh/nbpxQhW7FhrsbCsXSY9BmLB1+LHtD7r9zrsOcFlLiF+a/UeJsdfw3C5A==", + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", + "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==" + }, + "@zowe/imperative": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@zowe/imperative/-/imperative-4.6.0.tgz", + "integrity": "sha512-znW7Uny7mcvKcVTUWyj0yN2w/FllSYDl76tg3TUHbX1sgcGkQlp0VVwrujgRIt+sqvz5oFpla4xd25UGr3Rr2w==", + "requires": { + "@types/lodash-deep": "2.0.0", + "@types/yargs": "13.0.4", + "@zowe/perf-timing": "1.0.6", + "chalk": "2.4.2", + "cli-table3": "0.5.1", + "dataobject-parser": "1.2.1", + "deepmerge": "3.0.0", + "find-up": "2.1.0", + "fs-extra": "8.1.0", + "glob": "7.1.6", + "js-yaml": "3.13.1", + "jsonfile": "4.0.0", + "jsonschema": "1.1.1", + "levenshtein": "1.0.5", + "lodash-deep": "2.0.0", + "log4js": "6.1.0", + "marked": "0.8.0", + "moment": "2.20.1", + "mustache": "2.3.0", + "opener": "1.5.1", + "prettyjson": "1.2.1", + "progress": "2.0.3", + "readline-sync": "1.4.10", + "rimraf": "2.6.3", + "semver": "5.7.0", + "stack-trace": "0.0.10", + "wrap-ansi": "3.0.1", + "yamljs": "0.3.0", + "yargs": "15.1.0" + }, + "dependencies": { + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + } + } + }, + "@zowe/perf-timing": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@zowe/perf-timing/-/perf-timing-1.0.6.tgz", + "integrity": "sha512-eIMKqQbb0X/Ii9aU/+0IWAl6mRi+xezT0uaCa/Dn4a1ZFloIuCeGrdlIEMe2ZyuKJ3YsmNOSzi6N0X1nxEGnRA==", + "requires": { + "fs-extra": "8.1.0", + "pkg-up": "2.0.0" + } + }, "agent-base": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", @@ -50,11 +167,15 @@ "uri-js": "^4.2.2" } }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, "requires": { "color-convert": "^1.9.0" } @@ -63,7 +184,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -99,8 +219,7 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "bcrypt-pbkdf": { "version": "1.0.2", @@ -114,7 +233,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -138,6 +256,11 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -147,18 +270,98 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, "requires": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, + "cli-table3": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.5.1.tgz", + "integrity": "sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw==", + "requires": { + "colors": "^1.1.2", + "object-assign": "^4.1.0", + "string-width": "^2.1.1" + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, "requires": { "color-name": "1.1.3" } @@ -166,8 +369,12 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" }, "combined-stream": { "version": "1.0.7", @@ -186,8 +393,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "core-util-is": { "version": "1.0.2", @@ -202,6 +408,16 @@ "assert-plus": "^1.0.0" } }, + "dataobject-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/dataobject-parser/-/dataobject-parser-1.2.1.tgz", + "integrity": "sha512-1XMF0e8Dkfano8WY9TOCWLUQqosXI/Hf6GQrPESCnIn+NbYwy5kVUto0l2L6EVOIRflq8D820QnfQgVapckmTQ==" + }, + "date-format": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-3.0.0.tgz", + "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==" + }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -211,6 +427,16 @@ "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "deepmerge": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-3.0.0.tgz", + "integrity": "sha512-a8z8bkgHsAML+uHLqmMS83HHlpy3PvZOOuiTQqaa3wu8ZVg3h0hqHk6aCsGdOnZV2XMM/FRimNGjUh0KCcmHBw==" + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -231,6 +457,11 @@ "safer-buffer": "^2.1.0" } }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, "es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", @@ -249,14 +480,12 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esutils": { "version": "2.0.3", @@ -284,6 +513,19 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "^2.0.0" + } + }, + "flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==" + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -299,11 +541,25 @@ "mime-types": "^2.1.12" } }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, "getpass": { "version": "0.1.7", @@ -317,7 +573,6 @@ "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -327,6 +582,11 @@ "path-is-absolute": "^1.0.0" } }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -350,8 +610,7 @@ "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, "he": { "version": "1.1.1", @@ -399,7 +658,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -408,8 +666,12 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, "is-typedarray": { "version": "1.0.0", @@ -431,7 +693,6 @@ "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -457,6 +718,19 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsonschema": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.1.1.tgz", + "integrity": "sha1-PO3o4+QR03eHLu+8n98mODy8Ptk=" + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -468,6 +742,65 @@ "verror": "1.10.0" } }, + "levenshtein": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/levenshtein/-/levenshtein-1.0.5.tgz", + "integrity": "sha1-ORFzepy1baNF0Aj1V4LG8TiXm6M=" + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "lodash-deep": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lodash-deep/-/lodash-deep-2.0.0.tgz", + "integrity": "sha1-ypWPW82z1o0+w3rN8cWMHMvYhlw=", + "requires": { + "lodash": ">=3.7.0" + } + }, + "log4js": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.1.0.tgz", + "integrity": "sha512-fSCHMYsMJbHwfNTuMlopVVcfkKwIRLh5mpNZGB2oBbnSmr3yUTo4tL4xGBA0/q29xowlu96eTXGghJFNhPXMnA==", + "requires": { + "date-format": "^3.0.0", + "debug": "^4.1.1", + "flatted": "^2.0.1", + "rfdc": "^1.1.4", + "streamroller": "^2.2.3" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "marked": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.8.0.tgz", + "integrity": "sha512-MyUe+T/Pw4TZufHkzAfDj6HarCBWia2y27/bhuYkTaiUnfDYFnCP3KUN+9oM7Wi6JA2rymtVYbQu3spE0GCmxQ==" + }, "mime-db": { "version": "1.38.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.38.0.tgz", @@ -485,7 +818,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -555,31 +887,75 @@ } } }, + "moment": { + "version": "2.20.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.20.1.tgz", + "integrity": "sha512-Yh9y73JRljxW5QxN08Fner68eFLxM5ynNOAw2LbIB1YAGeQzZT8QFSUvkAz609Zf+IHhhaUxqZK8dG3W/+HEvg==" + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "mustache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-2.3.0.tgz", + "integrity": "sha1-QCj3d4sXcIpImTCm5SrDvKDaQdA=" + }, "oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } }, + "opener": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.1.tgz", + "integrity": "sha512-goYSy5c2UXE4Ra1xixabeVh1guIX/ZV/YokJksb6q2lubWu6UbvPQ20p542/sFIll1nl8JnCyK9oBaOcCWXwvA==" + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-parse": { "version": "1.0.6", @@ -592,6 +968,35 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "requires": { + "find-up": "^2.1.0" + } + }, + "prettyjson": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prettyjson/-/prettyjson-1.2.1.tgz", + "integrity": "sha1-/P+rQdGcq0365eV15kJGYZsS0ok=", + "requires": { + "colors": "^1.1.2", + "minimist": "^1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + } + } + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" + }, "psl": { "version": "1.1.31", "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", @@ -613,6 +1018,11 @@ "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==", "dev": true }, + "readline-sync": { + "version": "1.4.10", + "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", + "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" + }, "request": { "version": "2.88.0", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", @@ -640,6 +1050,16 @@ "uuid": "^3.3.2" } }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -655,6 +1075,19 @@ "path-parse": "^1.0.6" } }, + "rfdc": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.4.tgz", + "integrity": "sha512-5C9HXdzK8EAqN7JDif30jqsBzavB7wLpaubisuQIGHWf2gUXSpzy6ArX/+Da8RjFpagWsCn+pIgxTMAmKw9Zug==" + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "requires": { + "glob": "^7.1.3" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -671,6 +1104,11 @@ "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", "dev": true }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -690,8 +1128,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { "version": "1.16.1", @@ -709,11 +1146,62 @@ "tweetnacl": "~0.14.0" } }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" + }, + "streamroller": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-2.2.4.tgz", + "integrity": "sha512-OG79qm3AujAM9ImoqgWEY1xG4HX+Lw+yY6qZj9R1K2mhF5bEmQ849wvrb+4vt4jLMLzwXttJlQbOdPOQVRv7DQ==", + "requires": { + "date-format": "^2.1.0", + "debug": "^4.1.1", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "date-format": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-2.1.0.tgz", + "integrity": "sha512-bYQuGLeFxhkxNOF3rcMtiZxvCBAquGzZm6oWA1oZ0g2THUzivaRhv8uOhdr19LmoobSOLoIAxeUK2RdbM8IFTA==" + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "requires": { "has-flag": "^3.0.0" } @@ -806,6 +1294,11 @@ "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", "dev": true }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", @@ -864,11 +1357,138 @@ "https-proxy-agent": "^2.2.1" } }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "wrap-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-3.0.1.tgz", + "integrity": "sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo=", + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + }, + "yamljs": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/yamljs/-/yamljs-0.3.0.tgz", + "integrity": "sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==", + "requires": { + "argparse": "^1.0.7", + "glob": "^7.0.5" + } + }, + "yargs": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.1.0.tgz", + "integrity": "sha512-T39FNN1b6hCW4SOIk1XyTOWxtXdcen0t+XYrysQmChzSipvhBO8Bj0nK1ozAasdk24dNWuMZvr4k24nz+8HHLg==", + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^16.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "yargs-parser": { + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz", + "integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } } diff --git a/package.json b/package.json index 12e090d76..c1e970735 100644 --- a/package.json +++ b/package.json @@ -258,6 +258,8 @@ "vscode": "^1.1.33" }, "dependencies": { + "@broadcom/endevor-for-zowe-cli": "^5.1.1", + "@zowe/imperative": "^4.6.0", "request": "^2.88.0" } } From 99bf20182fd9f143db9f0d3f0ef36c881f17cf1a Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 14 May 2020 17:57:39 +0200 Subject: [PATCH 04/49] switch BrowseElement to new API Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 21 ++++++++++++- src/utils.ts | 58 ++++++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index 47f70a88d..01ec1a818 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -12,10 +12,12 @@ * Broadcom, Inc. - initial API and implementation */ +import { PrintElementComponents, IEndevorRestResponse } from "@broadcom/endevor-for-zowe-cli"; import * as vscode from "vscode"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; import { EndevorRestClient } from "../service/EndevorRestClient"; +import * as utils from "../utils"; export async function browseElement(arg: any) { const repo: Repository = arg.getRepository(); @@ -29,7 +31,24 @@ export async function browseElement(arg: any) { async progress => { progress.report({ increment: 10 }); try { - const data: any = await EndevorRestClient.browseElement(repo, eq); + const session = utils.buildSession(repo); + // this needs to be + // WEBSMFTS/env/SMPLPROD/stgnum/1/sys/ADMIN/subsys/PROCESS/type/PROCESS/ele/DLODNNL + const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); + + const requestBody = utils.buildRequestBody(); + // TODO: check this with Vit + let data: any; + try { + const printResult = await PrintElementComponents.printElementComponents(session, element, requestBody); + // TODO: check this with Vit + data = printResult.data ? printResult.data.toString() : undefined; + } catch (error) { + // TODO: error handling + console.log(error); + } + + // const data: any = await EndevorRestClient.browseElement(repo, eq); progress.report({ increment: 50 }); let doc: vscode.TextDocument | undefined; doc = await vscode.workspace.openTextDocument({ content: data }); diff --git a/src/utils.ts b/src/utils.ts index a14ba9384..4634aa865 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -12,8 +12,11 @@ * Broadcom, Inc. - initial API and implementation */ -import * as vscode from "vscode"; +import { IElementActionRequest, IElementBasicData} from "@broadcom/endevor-for-zowe-cli"; +import { Session, ISession} from "@zowe/imperative"; import { EndevorElementNode } from "./ui/tree/EndevorNodes"; +import { EndevorQualifier } from "./model/IEndevorQualifier"; +import { Repository } from "./model/Repository"; export function toArray(data: any): T[] { if (Array.isArray(data)) { @@ -68,3 +71,56 @@ export function multipleElementsSelected(selection: any[]): boolean { return false; } } + +export function buildSession(repository: Repository): Session { + const protocol = repository.getUrl().split(":")[0]; + const hostname: string = repository.getUrl().split(":")[1].split("/")[2]; + // TODO: check how to enforce type (see with Vit) + const port: any = repository.getUrl().split(":")[2]; + // make this readable + // tslint:disable-next-line: max-line-length + const basePath: string = repository.getUrlString().split(":")[2].split("/")[1] + "/" + repository.getUrlString().split(":")[2].split("/")[2]; + const sessionDetails: ISession = { + basePath, + hostname, + // password: repository.getPassword(), + port, + //TODO: figure out how to cast this shit (see with Vit) + protocol: "http", + rejectUnauthorized: false, + type: "basic", + // strictSSL: true, + // secureProtocol: 'SSLv23_method', + // user: repository.getUsername(), + base64EncodedAuth: Buffer.from(repository.getUsername() + ":" + repository.getPassword()).toString("base64") + } + return new Session(sessionDetails); +} + +export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, instance: string): IElementBasicData{ + let element: IElementBasicData; + element = { + element: endevorQualifier.element ? endevorQualifier.element : "null", + environment: endevorQualifier.env ? endevorQualifier.env : "null", + instance, + stageNumber: endevorQualifier.stage ? endevorQualifier.stage : "null", + subsystem: endevorQualifier.subsystem ? endevorQualifier. subsystem : "null", + system: endevorQualifier.system ? endevorQualifier.system : "null", + type: endevorQualifier.type ? endevorQualifier.type : "null", + // TODO: see with Vit what to do here + // [key: string]: null + } + return element; +} + +export function buildRequestBody(): IElementActionRequest { + return { + expandIncludes: "", + level: "", + noSignout: "yes", + oveSign: "", + replaceMember: "", + search: "", + version: "", + }; +} From 52288fd14c3a15fb48fd942f48360928f46725a2 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 14 May 2020 18:00:28 +0200 Subject: [PATCH 05/49] remove useless comment Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index 01ec1a818..cd639af41 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -32,8 +32,6 @@ export async function browseElement(arg: any) { progress.report({ increment: 10 }); try { const session = utils.buildSession(repo); - // this needs to be - // WEBSMFTS/env/SMPLPROD/stgnum/1/sys/ADMIN/subsys/PROCESS/type/PROCESS/ele/DLODNNL const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); const requestBody = utils.buildRequestBody(); From 4846115065e9d254f9b3143283bea120cd6fab88 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Fri, 15 May 2020 09:20:11 +0200 Subject: [PATCH 06/49] cleaning code based on linting rules Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 12 ++++++------ src/extension.ts | 2 +- src/utils.ts | 23 ++++++++++++----------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index cd639af41..0a9735248 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -12,11 +12,10 @@ * Broadcom, Inc. - initial API and implementation */ -import { PrintElementComponents, IEndevorRestResponse } from "@broadcom/endevor-for-zowe-cli"; +import { PrintElementComponents } from "@broadcom/endevor-for-zowe-cli"; import * as vscode from "vscode"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import { EndevorRestClient } from "../service/EndevorRestClient"; import * as utils from "../utils"; export async function browseElement(arg: any) { @@ -38,15 +37,16 @@ export async function browseElement(arg: any) { // TODO: check this with Vit let data: any; try { - const printResult = await PrintElementComponents.printElementComponents(session, element, requestBody); + const printResult = await PrintElementComponents.printElementComponents( + session, + element, + requestBody); // TODO: check this with Vit data = printResult.data ? printResult.data.toString() : undefined; } catch (error) { // TODO: error handling - console.log(error); + vscode.window.showErrorMessage(error); } - - // const data: any = await EndevorRestClient.browseElement(repo, eq); progress.report({ increment: 50 }); let doc: vscode.TextDocument | undefined; doc = await vscode.workspace.openTextDocument({ content: data }); diff --git a/src/extension.ts b/src/extension.ts index 10b939c41..40f09499f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -19,6 +19,7 @@ import { Commands } from "./commands/Common"; import { deleteFilter } from "./commands/DeleteFilter"; import { deleteHost } from "./commands/DeleteHost"; import { editFilter } from "./commands/EditFilter"; +import { HostDialogs } from "./commands/HostDialogs"; import { retrieveElement } from "./commands/RetrieveElement"; import { retrieveWithDependencies } from "./commands/RetrieveElementWithDependencies"; import { EndevorController } from "./EndevorController"; @@ -29,7 +30,6 @@ import { HOST_SETTINGS_KEY } from "./service/SettingsFacade"; import { EndevorDataProvider } from "./ui/tree/EndevorDataProvider"; import { EndevorNode } from "./ui/tree/EndevorNodes"; import { HostPanel } from "./ui/views/HostPanel"; -import { HostDialogs } from "./commands/HostDialogs"; import { multipleElementsSelected } from "./utils"; export function activate(context: vscode.ExtensionContext) { diff --git a/src/utils.ts b/src/utils.ts index 4634aa865..aad01388d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -13,15 +13,15 @@ */ import { IElementActionRequest, IElementBasicData} from "@broadcom/endevor-for-zowe-cli"; -import { Session, ISession} from "@zowe/imperative"; -import { EndevorElementNode } from "./ui/tree/EndevorNodes"; +import { ISession, Session} from "@zowe/imperative"; import { EndevorQualifier } from "./model/IEndevorQualifier"; import { Repository } from "./model/Repository"; +import { EndevorElementNode } from "./ui/tree/EndevorNodes"; export function toArray(data: any): T[] { if (Array.isArray(data)) { return data as T[]; - } else if(data) { + } else if (data) { return [data] as T[]; } else { return []; @@ -72,32 +72,33 @@ export function multipleElementsSelected(selection: any[]): boolean { } } +// THROWAWAY: will be covered by profile implementation with Imperative profile management export function buildSession(repository: Repository): Session { const protocol = repository.getUrl().split(":")[0]; const hostname: string = repository.getUrl().split(":")[1].split("/")[2]; // TODO: check how to enforce type (see with Vit) const port: any = repository.getUrl().split(":")[2]; // make this readable - // tslint:disable-next-line: max-line-length - const basePath: string = repository.getUrlString().split(":")[2].split("/")[1] + "/" + repository.getUrlString().split(":")[2].split("/")[2]; + const basePath: string = repository.getUrlString().split(":")[2].split("/")[1] + + "/" + repository.getUrlString().split(":")[2].split("/")[2]; const sessionDetails: ISession = { + base64EncodedAuth: Buffer.from(repository.getUsername() + ":" + repository.getPassword()).toString("base64"), basePath, hostname, // password: repository.getPassword(), port, - //TODO: figure out how to cast this shit (see with Vit) - protocol: "http", + // TODO: figure out how to cast this shit (see with Vit) + protocol: "http", rejectUnauthorized: false, type: "basic", // strictSSL: true, // secureProtocol: 'SSLv23_method', // user: repository.getUsername(), - base64EncodedAuth: Buffer.from(repository.getUsername() + ":" + repository.getPassword()).toString("base64") - } + }; return new Session(sessionDetails); } -export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, instance: string): IElementBasicData{ +export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, instance: string): IElementBasicData { let element: IElementBasicData; element = { element: endevorQualifier.element ? endevorQualifier.element : "null", @@ -109,7 +110,7 @@ export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, in type: endevorQualifier.type ? endevorQualifier.type : "null", // TODO: see with Vit what to do here // [key: string]: null - } + }; return element; } From da96dcce184511962242c3c77085b1e94ec7d382 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Mon, 18 May 2020 15:25:29 +0200 Subject: [PATCH 07/49] move HostDialogs and RetrieveElementService to new API Signed-off-by: Alexandru-Paul Dumitru --- src/commands/HostDialogs.ts | 13 ++++++-- src/service/RetriveElementService.ts | 50 ++++++++++++++++++++++------ 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index 48dad1231..c0d553979 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -12,11 +12,12 @@ * Broadcom, Inc. - initial API and implementation */ +import { IEndevorInstance, ListInstance } from "@broadcom/endevor-for-zowe-cli"; import { URL } from "url"; import { ProgressLocation, window, workspace } from "vscode"; import { EndevorController } from "../EndevorController"; import { Repository } from "../model/Repository"; -import { EndevorRestClient } from "../service/EndevorRestClient"; +import * as utils from "../utils"; export class HostDialogs { /** @@ -43,9 +44,15 @@ export class HostDialogs { async progress => { progress.report({message: "Waiting for " + newRepo.getUrl() + " to respond.", increment: 10 }); try { - const datasources = await EndevorRestClient.listDatasources(newRepo); + const session = utils.buildSession(newRepo); + const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); + // tslint:disable-next-line: no-commented-code + // const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); + // TODO: wierdly enough the old implementation gives error (invalid url) with https but new one works for (const ds of datasources) { - dsNames.push(ds.name); + // TODO: slight mismatch between interfaces - check with Vit + // need to cast, since all properties defined with IEndevorInstance are optional + dsNames.push(ds.name as string); } dsNames.sort(); progress.report({ increment: 100 }); diff --git a/src/service/RetriveElementService.ts b/src/service/RetriveElementService.ts index 7ede90dd1..e5b4c3f69 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetriveElementService.ts @@ -12,6 +12,7 @@ * Broadcom, Inc. - initial API and implementation */ +import { IEndevorAcmComponents, IOptionListRequest, ListType, QueryACMComponents, RetrieveElement } from "@broadcom/endevor-for-zowe-cli"; import * as fs from "fs"; import * as path from "path"; import * as vscode from "vscode"; @@ -19,7 +20,7 @@ import { Element } from "../model/Element"; import { IElement, IType } from "../model/IEndevorEntities"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import { EndevorRestClient, Resource } from "./EndevorRestClient"; +import * as utils from "../utils"; import { GitBridgeSupport } from "./GitBridgeSupport"; export class RetrieveElementService { @@ -31,7 +32,19 @@ export class RetrieveElementService { elementName: string, eq: EndevorQualifier, ): Promise { - const data: any = await EndevorRestClient.retrieveElement(repo, eq, false); + const session = utils.buildSession(repo); + const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); + const requestBody = utils.buildRequestBody(); + // TODO: check this with Vit + let data: any; + try { + const retrieveResult = await RetrieveElement.retrieveElement(session, element, requestBody); + // TODO: check this with Vit + data = retrieveResult.data ? retrieveResult.data.toString() : undefined; + } catch (error) { + // TODO: error handling + vscode.window.showErrorMessage(error); + } const ext = await this.getExtension(repo, eq); const typeDirectory = this.gitBridge.createElementPath(workspace, eq.type!); if (!fs.existsSync(typeDirectory)) { @@ -55,7 +68,24 @@ export class RetrieveElementService { */ public async retrieveDependenciesList(repo: Repository, eq: EndevorQualifier): Promise { const result: Element[] = []; - const elements: IElement[] = await EndevorRestClient.retrieveElementDependencies(repo, eq); + const session = utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorElement = utils.endevorQualifierToElement(eq, instance); + // TODO: match this up + // const requestBody: IOptionListRequest = utils.buildRequestBody(); // the interface here was wrong + const requestBody: IOptionListRequest = { + excCirculars: "yes", + excIndirect: "no", + excRelated: "no", + }; + const queryacmCompResponse = await QueryACMComponents.queryACMComponents( + session, + instance, + endevorElement, + requestBody); + + // TODO: IEndevorAcmComponents is not on par with IElement. Should we map it? + const elements: any = queryacmCompResponse.data as IEndevorAcmComponents[]; if (elements.length === 0) { return []; } @@ -74,13 +104,13 @@ export class RetrieveElementService { } private async getExtension(repo: Repository, eq: EndevorQualifier): Promise { - const typeQualifier: EndevorQualifier = { - env: eq.env, - stage: eq.stage, - system: eq.system, - type: eq.type, - }; - const types: IType[] = await EndevorRestClient.getMetadata(repo, typeQualifier, Resource.TYPE); + const session = utils.buildSession(repo); + const instance = repo.getDatasource(); + const typeInput = utils.endevorQualifierToElement(eq, instance); + const requestBody = utils.buildRequestBody(); + let types: IType[]; + const listResponse: any = await ListType.listType(session, instance, typeInput, requestBody); + types = utils.toArray(listResponse.data); for (const type of types) { if (type.typeName === eq.type && type.fileExt) { return type.fileExt; From 47d13d8ef63c48ec818a0d2dd77d4eb0b12eeb50 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Tue, 19 May 2020 13:12:16 +0200 Subject: [PATCH 08/49] move the remaining operations to CLI api - added credential check for `utils.buildSession()` and converted it to async - converted from `null` to default `*` in `utils.endevorQualifierToElement()` - moved EndevorNodes.ts to CLI api calls. Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 2 +- src/commands/HostDialogs.ts | 4 +- src/service/RetriveElementService.ts | 6 +-- src/ui/tree/EndevorNodes.ts | 61 ++++++++++++++++++++++++---- src/ui/views/HostPanel.ts | 12 ++++-- src/utils.ts | 23 +++++++---- 6 files changed, 83 insertions(+), 25 deletions(-) diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index 0a9735248..96fc2c33f 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -30,7 +30,7 @@ export async function browseElement(arg: any) { async progress => { progress.report({ increment: 10 }); try { - const session = utils.buildSession(repo); + const session = await utils.buildSession(repo); const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); const requestBody = utils.buildRequestBody(); diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index c0d553979..26da86c6c 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -44,11 +44,11 @@ export class HostDialogs { async progress => { progress.report({message: "Waiting for " + newRepo.getUrl() + " to respond.", increment: 10 }); try { - const session = utils.buildSession(newRepo); + const session = await utils.buildSession(newRepo); const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); // tslint:disable-next-line: no-commented-code // const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); - // TODO: wierdly enough the old implementation gives error (invalid url) with https but new one works + // TODO: the old implementation weirdly gives error (invalid url) with https but new one works for (const ds of datasources) { // TODO: slight mismatch between interfaces - check with Vit // need to cast, since all properties defined with IEndevorInstance are optional diff --git a/src/service/RetriveElementService.ts b/src/service/RetriveElementService.ts index e5b4c3f69..8e38e7ffc 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetriveElementService.ts @@ -32,7 +32,7 @@ export class RetrieveElementService { elementName: string, eq: EndevorQualifier, ): Promise { - const session = utils.buildSession(repo); + const session = await utils.buildSession(repo); const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); const requestBody = utils.buildRequestBody(); // TODO: check this with Vit @@ -68,7 +68,7 @@ export class RetrieveElementService { */ public async retrieveDependenciesList(repo: Repository, eq: EndevorQualifier): Promise { const result: Element[] = []; - const session = utils.buildSession(repo); + const session = await utils.buildSession(repo); const instance = repo.getDatasource(); const endevorElement = utils.endevorQualifierToElement(eq, instance); // TODO: match this up @@ -104,7 +104,7 @@ export class RetrieveElementService { } private async getExtension(repo: Repository, eq: EndevorQualifier): Promise { - const session = utils.buildSession(repo); + const session = await utils.buildSession(repo); const instance = repo.getDatasource(); const typeInput = utils.endevorQualifierToElement(eq, instance); const requestBody = utils.buildRequestBody(); diff --git a/src/ui/tree/EndevorNodes.ts b/src/ui/tree/EndevorNodes.ts index 14253b499..9baf3eb07 100644 --- a/src/ui/tree/EndevorNodes.ts +++ b/src/ui/tree/EndevorNodes.ts @@ -13,6 +13,12 @@ */ // tslint:disable: max-classes-per-file +import { ListElement, + ListEnvironment, + ListStage, + ListSubsystem, + ListSystem, + ListType } from "@broadcom/endevor-for-zowe-cli"; import * as vscode from "vscode"; import { createEmptyNode, createPathNodes } from "../../FilterUtils"; import { Element } from "../../model/Element"; @@ -26,7 +32,7 @@ import { Stage } from "../../model/Stage"; import { SubSystem } from "../../model/SubSystem"; import { System } from "../../model/System"; import { Type } from "../../model/Type"; -import { EndevorRestClient, Resource } from "../../service/EndevorRestClient"; +import * as utils from "../../utils"; export class EndevorNode extends vscode.TreeItem { private entity?: EndevorEntity; @@ -189,7 +195,12 @@ export class EndevorBrowsingNode extends EndevorNode { try { const resultNodes: EndevorQualifiedNode[] = []; const resultEntities: Environment[] = []; - const envs: IEnvironment[] = await EndevorRestClient.getMetadata(repo, {}, Resource.ENV); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const environment = utils.endevorQualifierToElement({}, instance); + const requestBody = ListEnvironment.setupListEnvironmentRequest({}); + const envResponse = await ListEnvironment.listEnvironment(session, instance, environment, requestBody); + const envs: IEnvironment[] = envResponse.data as any[]; envs.forEach(env => { const envEntity: Environment = new Environment(repo, env); resultEntities.push(envEntity); @@ -294,7 +305,12 @@ export class FilterNode extends EndevorNode { this.needReload = false; try { - const elements: IElement[] = await EndevorRestClient.getMetadata(repo, qualifier, Resource.ELEMENT); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorElement = utils.endevorQualifierToElement(qualifier, instance); + const requestBody = ListElement.setupListElementRequest({}); + const listResponse = await ListElement.listElement(session, instance, endevorElement, requestBody); + const elements: IElement[] = utils.toArray(listResponse.data); const resultEntities: Element[] = []; let resultNodes: EndevorNode[] = []; for (const element of elements) { @@ -362,7 +378,12 @@ export class EnvironmentNode extends EndevorQualifiedNode { } this.needReload = false; try { - const stages: IStage[] = await EndevorRestClient.getMetadata(repo, nodeQualEnv, Resource.STGNUM); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const stageNumber = utils.endevorQualifierToElement(nodeQualEnv, instance); + const requestBody = ListStage.setupListStageRequest({}); + const listResponse = await ListStage.listStage(session, instance, stageNumber, requestBody); + const stages: IStage[] = utils.toArray(listResponse.data); const resultEntities: Stage[] = []; const resultNodes: EndevorQualifiedNode[] = []; stages.forEach(stage => { @@ -397,7 +418,12 @@ export class StageNode extends EndevorQualifiedNode { try { const resultEntities: System[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const systems: ISystem[] = await EndevorRestClient.getMetadata(repo, nodeQualStage, Resource.SYS); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorSystem = utils.endevorQualifierToElement(nodeQualStage, instance); + const requestBody = ListSystem.setupListSystemRequest({}); + const listSystemResponse = await ListSystem.listSystem(session, instance, endevorSystem, requestBody); + const systems: ISystem[] = utils.toArray(listSystemResponse.data); systems.forEach(system => { const systemEntity: System = new System(repo, system); resultEntities.push(systemEntity); @@ -433,7 +459,16 @@ export class SystemNode extends EndevorQualifiedNode { try { const resultEntities: SubSystem[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const subsystems: ISubsystem[] = await EndevorRestClient.getMetadata(repo, nodeQualSystem, Resource.SUBSYS); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorSubsystem = utils.endevorQualifierToElement(nodeQualSystem, instance); + const requestBody = ListSubsystem.setupListSubsystemRequest({}); + const listSubsystemResponse = await ListSubsystem.listSubsystem( + session, + instance, + endevorSubsystem, + requestBody); + const subsystems: ISubsystem[] = utils.toArray(listSubsystemResponse.data); subsystems.forEach(subsystem => { const subsysEntity: SubSystem = new SubSystem(repo, subsystem); resultEntities.push(subsysEntity); @@ -466,7 +501,12 @@ export class SubsystemNode extends EndevorQualifiedNode { try { const resultEntities: Type[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const types: IType[] = await EndevorRestClient.getMetadata(repo, nodeQualSubsys, Resource.TYPE); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorType = utils.endevorQualifierToElement(nodeQualSubsys, instance); + const requestBody = ListType.setupListTypeRequest({}); + const listTypeResponse = await ListType.listType(session, instance, endevorType, requestBody); + const types: IType[] = utils.toArray(listTypeResponse.data); types.forEach(type => { const typeEntity: Type = new Type(repo, type); resultEntities.push(typeEntity); @@ -500,7 +540,12 @@ export class TypeNode extends EndevorQualifiedNode { this.needReload = false; try { const resultNodes: EndevorNode[] = []; - const elements: IElement[] = await EndevorRestClient.getMetadata(repo, nodeQualType, Resource.ELEMENT); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorElement = utils.endevorQualifierToElement(nodeQualType, instance); + const requestBody = ListElement.setupListElementRequest({}); + const listElementResponse = await ListElement.listElement(session, instance, endevorElement, requestBody); + const elements: IElement[] = utils.toArray(listElementResponse.data); elements.forEach(element => { const eleEntity: Element = new Element(repo, element); resultNodes.push(new EndevorElementNode(eleEntity, { ...nodeQualType, element: element.fullElmName })); diff --git a/src/ui/views/HostPanel.ts b/src/ui/views/HostPanel.ts index 49fc5bcdc..e8213da09 100644 --- a/src/ui/views/HostPanel.ts +++ b/src/ui/views/HostPanel.ts @@ -12,13 +12,13 @@ * Broadcom, Inc. - initial API and implementation */ +import { IEndevorInstance, ListInstance} from "@broadcom/endevor-for-zowe-cli"; import * as fs from "fs"; import * as path from "path"; import * as vscode from "vscode"; import { EndevorController } from "../../EndevorController"; -import { DataSource } from "../../model/IEndevorInstance"; import { Repository } from "../../model/Repository"; -import { EndevorRestClient } from "../../service/EndevorRestClient"; +import * as utils from "../../utils"; export class HostPanel { public static readonly viewType = "endevorHostPanel"; @@ -64,10 +64,14 @@ export class HostPanel { const restUrl = message.data.url; const newRepo = new Repository("", restUrl, "", "", ""); try { - const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); + const session = await utils.buildSession(newRepo); + const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); + // tslint:disable-next-line: no-commented-code + // const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); + // TODO: comments in /src/commands/HostDialogs.ts apply here as well const dsNames: string[] = []; for (const ds of datasources) { - dsNames.push(ds.name); + dsNames.push(ds.name as string); } dsNames.sort(); panel.webview.postMessage({ data: dsNames }); diff --git a/src/utils.ts b/src/utils.ts index aad01388d..d454957ca 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -16,6 +16,7 @@ import { IElementActionRequest, IElementBasicData} from "@broadcom/endevor-for-z import { ISession, Session} from "@zowe/imperative"; import { EndevorQualifier } from "./model/IEndevorQualifier"; import { Repository } from "./model/Repository"; +import { CredentialsInputBox } from "./ui/tree/CredentialsInput"; import { EndevorElementNode } from "./ui/tree/EndevorNodes"; export function toArray(data: any): T[] { @@ -73,7 +74,7 @@ export function multipleElementsSelected(selection: any[]): boolean { } // THROWAWAY: will be covered by profile implementation with Imperative profile management -export function buildSession(repository: Repository): Session { +export async function buildSession(repository: Repository): Promise { const protocol = repository.getUrl().split(":")[0]; const hostname: string = repository.getUrl().split(":")[1].split("/")[2]; // TODO: check how to enforce type (see with Vit) @@ -81,6 +82,14 @@ export function buildSession(repository: Repository): Session { // make this readable const basePath: string = repository.getUrlString().split(":")[2].split("/")[1] + "/" + repository.getUrlString().split(":")[2].split("/")[2]; + + // set password if not defined + if (!repository.getPassword()) { + const creds = await CredentialsInputBox.askforCredentials(repository) + if (!creds) { + throw { cancelled: true }; + } + } const sessionDetails: ISession = { base64EncodedAuth: Buffer.from(repository.getUsername() + ":" + repository.getPassword()).toString("base64"), basePath, @@ -101,13 +110,13 @@ export function buildSession(repository: Repository): Session { export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, instance: string): IElementBasicData { let element: IElementBasicData; element = { - element: endevorQualifier.element ? endevorQualifier.element : "null", - environment: endevorQualifier.env ? endevorQualifier.env : "null", + element: endevorQualifier.element ? endevorQualifier.element : "*", + environment: endevorQualifier.env ? endevorQualifier.env : "*", instance, - stageNumber: endevorQualifier.stage ? endevorQualifier.stage : "null", - subsystem: endevorQualifier.subsystem ? endevorQualifier. subsystem : "null", - system: endevorQualifier.system ? endevorQualifier.system : "null", - type: endevorQualifier.type ? endevorQualifier.type : "null", + stageNumber: endevorQualifier.stage ? endevorQualifier.stage : "*", + subsystem: endevorQualifier.subsystem ? endevorQualifier. subsystem : "*", + system: endevorQualifier.system ? endevorQualifier.system : "*", + type: endevorQualifier.type ? endevorQualifier.type : "*", // TODO: see with Vit what to do here // [key: string]: null }; From 3c89ef1a19739c48d81826fb5f454a7743396d4a Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Wed, 20 May 2020 17:23:37 +0200 Subject: [PATCH 09/49] code cleanup - remove some TODOs by fixing some typings - remove unneeded function `buildRequestBody()` by using the `setup()` functions provided with each API Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 7 ++--- src/commands/HostDialogs.ts | 10 ++++--- src/service/RetriveElementService.ts | 18 ++++++------ src/utils.ts | 41 +++++++++++----------------- 4 files changed, 33 insertions(+), 43 deletions(-) diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index 96fc2c33f..6ede224a3 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -33,18 +33,15 @@ export async function browseElement(arg: any) { const session = await utils.buildSession(repo); const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); - const requestBody = utils.buildRequestBody(); - // TODO: check this with Vit - let data: any; + const requestBody = PrintElementComponents.setupPrintRequest({}); + let data: string | undefined; try { const printResult = await PrintElementComponents.printElementComponents( session, element, requestBody); - // TODO: check this with Vit data = printResult.data ? printResult.data.toString() : undefined; } catch (error) { - // TODO: error handling vscode.window.showErrorMessage(error); } progress.report({ increment: 50 }); diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index 26da86c6c..7c9e6e331 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -46,13 +46,15 @@ export class HostDialogs { try { const session = await utils.buildSession(newRepo); const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); - // tslint:disable-next-line: no-commented-code - // const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); - // TODO: the old implementation weirdly gives error (invalid url) with https but new one works for (const ds of datasources) { // TODO: slight mismatch between interfaces - check with Vit // need to cast, since all properties defined with IEndevorInstance are optional - dsNames.push(ds.name as string); + // Changed to type check construct since dsNames is already initialized as empty array. + // Confirm approach + // dsNames.push(ds.name as string); + if (typeof ds.name === "string") { + dsNames.push(ds.name); + } } dsNames.sort(); progress.report({ increment: 100 }); diff --git a/src/service/RetriveElementService.ts b/src/service/RetriveElementService.ts index 8e38e7ffc..076bef872 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetriveElementService.ts @@ -34,15 +34,15 @@ export class RetrieveElementService { ): Promise { const session = await utils.buildSession(repo); const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); - const requestBody = utils.buildRequestBody(); - // TODO: check this with Vit - let data: any; + const requestArgs = { + nosignout: "yes", + }; + const requestBody = RetrieveElement.setupRetrieveRequest(requestArgs); + let data: string | undefined; try { const retrieveResult = await RetrieveElement.retrieveElement(session, element, requestBody); - // TODO: check this with Vit data = retrieveResult.data ? retrieveResult.data.toString() : undefined; } catch (error) { - // TODO: error handling vscode.window.showErrorMessage(error); } const ext = await this.getExtension(repo, eq); @@ -71,13 +71,12 @@ export class RetrieveElementService { const session = await utils.buildSession(repo); const instance = repo.getDatasource(); const endevorElement = utils.endevorQualifierToElement(eq, instance); - // TODO: match this up - // const requestBody: IOptionListRequest = utils.buildRequestBody(); // the interface here was wrong - const requestBody: IOptionListRequest = { + const requestArguments = { excCirculars: "yes", excIndirect: "no", excRelated: "no", }; + const requestBody = QueryACMComponents.setupAcmComponentsRequest(requestArguments); const queryacmCompResponse = await QueryACMComponents.queryACMComponents( session, instance, @@ -85,6 +84,7 @@ export class RetrieveElementService { requestBody); // TODO: IEndevorAcmComponents is not on par with IElement. Should we map it? + // const elements: IElement[] = await EndevorRestClient.retrieveElementDependencies(repo, eq); const elements: any = queryacmCompResponse.data as IEndevorAcmComponents[]; if (elements.length === 0) { return []; @@ -107,7 +107,7 @@ export class RetrieveElementService { const session = await utils.buildSession(repo); const instance = repo.getDatasource(); const typeInput = utils.endevorQualifierToElement(eq, instance); - const requestBody = utils.buildRequestBody(); + const requestBody = ListType.setupListTypeRequest({}); let types: IType[]; const listResponse: any = await ListType.listType(session, instance, typeInput, requestBody); types = utils.toArray(listResponse.data); diff --git a/src/utils.ts b/src/utils.ts index d454957ca..385cda115 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -72,20 +72,26 @@ export function multipleElementsSelected(selection: any[]): boolean { return false; } } +function getBasePathFromRepo(repository: Repository): string { + return repository.getUrlString().split(":")[2].split("/")[1] + + "/" + repository.getUrlString().split(":")[2].split("/")[2]; +} // THROWAWAY: will be covered by profile implementation with Imperative profile management export async function buildSession(repository: Repository): Promise { - const protocol = repository.getUrl().split(":")[0]; + // TODO: create proper type + // type HTTPS_PROTOCOL = "https"; + // type HTTP_PROTOCOL = "http"; + // from ISession, only works with https + // const protocol = repository.getUrl().split(":")[0] as HTTPS_PROTOCOL; + // BUT in reality, it only works with http + const protocol = "http"; const hostname: string = repository.getUrl().split(":")[1].split("/")[2]; - // TODO: check how to enforce type (see with Vit) - const port: any = repository.getUrl().split(":")[2]; - // make this readable - const basePath: string = repository.getUrlString().split(":")[2].split("/")[1] + - "/" + repository.getUrlString().split(":")[2].split("/")[2]; - + const port = Number(repository.getUrl().split(":")[2]); + const basePath = getBasePathFromRepo(repository); // set password if not defined if (!repository.getPassword()) { - const creds = await CredentialsInputBox.askforCredentials(repository) + const creds = await CredentialsInputBox.askforCredentials(repository); if (!creds) { throw { cancelled: true }; } @@ -96,8 +102,7 @@ export async function buildSession(repository: Repository): Promise { hostname, // password: repository.getPassword(), port, - // TODO: figure out how to cast this shit (see with Vit) - protocol: "http", + protocol, rejectUnauthorized: false, type: "basic", // strictSSL: true, @@ -108,8 +113,7 @@ export async function buildSession(repository: Repository): Promise { } export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, instance: string): IElementBasicData { - let element: IElementBasicData; - element = { + return { element: endevorQualifier.element ? endevorQualifier.element : "*", environment: endevorQualifier.env ? endevorQualifier.env : "*", instance, @@ -120,17 +124,4 @@ export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, in // TODO: see with Vit what to do here // [key: string]: null }; - return element; -} - -export function buildRequestBody(): IElementActionRequest { - return { - expandIncludes: "", - level: "", - noSignout: "yes", - oveSign: "", - replaceMember: "", - search: "", - version: "", - }; } From fe1219c11d25e1227467aba154301615e4c551c5 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Wed, 20 May 2020 17:30:47 +0200 Subject: [PATCH 10/49] fix typing (remove any where possible) Signed-off-by: Alexandru-Paul Dumitru --- src/service/RetriveElementService.ts | 2 +- src/ui/tree/EndevorNodes.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/service/RetriveElementService.ts b/src/service/RetriveElementService.ts index 076bef872..c98c4f01c 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetriveElementService.ts @@ -109,7 +109,7 @@ export class RetrieveElementService { const typeInput = utils.endevorQualifierToElement(eq, instance); const requestBody = ListType.setupListTypeRequest({}); let types: IType[]; - const listResponse: any = await ListType.listType(session, instance, typeInput, requestBody); + const listResponse = await ListType.listType(session, instance, typeInput, requestBody); types = utils.toArray(listResponse.data); for (const type of types) { if (type.typeName === eq.type && type.fileExt) { diff --git a/src/ui/tree/EndevorNodes.ts b/src/ui/tree/EndevorNodes.ts index 9baf3eb07..353e3ff35 100644 --- a/src/ui/tree/EndevorNodes.ts +++ b/src/ui/tree/EndevorNodes.ts @@ -200,7 +200,7 @@ export class EndevorBrowsingNode extends EndevorNode { const environment = utils.endevorQualifierToElement({}, instance); const requestBody = ListEnvironment.setupListEnvironmentRequest({}); const envResponse = await ListEnvironment.listEnvironment(session, instance, environment, requestBody); - const envs: IEnvironment[] = envResponse.data as any[]; + const envs: IEnvironment[] = utils.toArray(envResponse.data); envs.forEach(env => { const envEntity: Environment = new Environment(repo, env); resultEntities.push(envEntity); From 7f1e08c2d9781d0b0b00e0f3a3ce3f72e9757e91 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Wed, 20 May 2020 17:32:22 +0200 Subject: [PATCH 11/49] remove EndevorRestClient.ts file, as not needed anymore Signed-off-by: Alexandru-Paul Dumitru --- src/service/EndevorRestClient.ts | 277 ------------------------------- 1 file changed, 277 deletions(-) delete mode 100644 src/service/EndevorRestClient.ts diff --git a/src/service/EndevorRestClient.ts b/src/service/EndevorRestClient.ts deleted file mode 100644 index 8b78744b6..000000000 --- a/src/service/EndevorRestClient.ts +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 2019 Broadcom. - * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Broadcom, Inc. - initial API and implementation - */ - -import * as request from "request"; -import { URL } from "url"; -import * as vscode from "vscode"; -import * as constants from "../constants"; -import { RC_SIXTEEN, RC_TWENTY } from "../constants"; -import { ActionResponse } from "../model/IActionResponse"; -import { IElement, IEnvironment } from "../model/IEndevorEntities"; -import { DataSource } from "../model/IEndevorInstance"; -import { EndevorQualifier } from "../model/IEndevorQualifier"; -import { Repository } from "../model/Repository"; -import { CredentialsInputBox } from "../ui/tree/CredentialsInput"; -import * as utils from "../utils"; - -export enum Resource { - DATASOURCES = "datasources", - ENV = "env", - STGNUM = "stgnum", - SYS = "sys", - SUBSYS = "subsys", - TYPE = "type", - ELEMENT = "ele", - DEPENDENCY = "dependency", -} - -export class EndevorRestClient { - public static async listDatasources(repo: Repository): Promise { - const url: string = EndevorRestClient.createRequestPart(repo, {}, Resource.DATASOURCES); - const result: Result = await EndevorRestClient.request(url, repo, undefined, true); - return result.value as DataSource[]; - } - - public static async getMetadata(repo: Repository, qualifier: EndevorQualifier, resource: Resource): Promise { - const url: string = EndevorRestClient.createRequestPart(repo, qualifier, resource); - const result: Result = await EndevorRestClient.request(url, repo); - return utils.toArray(result.value.data); - } - - /* Browse an existing element */ - public static async browseElement(repo: Repository, qualifier: EndevorQualifier): Promise { - const url = EndevorRestClient.createRequestPart(repo, qualifier, Resource.ELEMENT); - const result: Result = await EndevorRestClient.request(url, repo, "text/plain", false, false); - return result.value; - } - - /* Retrieves an existing element */ - public static async retrieveElement(repo: Repository, qualifier: EndevorQualifier, search: boolean) { - const seachParam: string = "&search=" + (search ? "yes" : "no"); - const url = - EndevorRestClient.createRequestPart(repo, qualifier, Resource.ELEMENT) + "?noSignout=yes" + seachParam; - const result: Result = await EndevorRestClient.request(url, repo, "application/octet-stream", false, false); - return result.value; - } - - /* Retrieves an existing element's dependencies*/ - public static async retrieveElementDependencies( - repo: Repository, - qualifier: EndevorQualifier, - ): Promise { - const url = EndevorRestClient.createRequestPart(repo, qualifier, Resource.DEPENDENCY); - const result: Result = await EndevorRestClient.request(url, repo); - return utils.toArray(result.value.data); - } - - // tslint:disable-next-line: cognitive-complexity - private static async request( - url: string, - repo: Repository, - mime?: string, - isPasswordOptional: boolean = false, - parseJson: boolean = true, - ): Promise { - const options = { - headers: { - Accept: mime ? mime : "application/json", - }, - host: new URL(url).hostname, - url, - }; - - // Process auth errors - while (true) { - if (!isPasswordOptional) { - await EndevorRestClient.updateAuth(options, repo); - } - const result = await EndevorRestClient.doRequest(options, parseJson); - if (result.status === 401) { - isPasswordOptional = false; - vscode.window.showInformationMessage("Authintification failed"); - result.authError = true; - result.error = "Authintification failed"; - } - if (result.status === 500) { - const actionResponse: ActionResponse = (parseJson - ? result.value - : JSON.parse(result.value)) as ActionResponse; - switch (actionResponse.returnCode) { - case RC_TWENTY: - isPasswordOptional = false; - vscode.window.showErrorMessage("Invalid Credentials Provided"); - result.authError = true; - result.error = "Invalid Credentials Provided"; - break; - case RC_SIXTEEN: - isPasswordOptional = false; - vscode.window.showErrorMessage("Missing Username or Password"); - result.authError = true; - result.error = "Missing Username or Password"; - break; - } - } - if (result.authError) { - repo.setPassword(""); - } - if (!result.authError || result.cancelled) { - this.processError(result); - return result; - } - } - } - - // tslint:disable-next-line:cognitive-complexity - private static async doRequest(options, parseJson: boolean = true): Promise { - return new Promise((resolve, reject) => { - request.get(options, (error, response, body) => { - if (error) { - reject({ - cancelled: false, - error: JSON.stringify(error), - }); - return; - } - const result: Result = { - cancelled: false, - status: response.statusCode, - }; - if (response && response.statusCode.toString().startsWith("4")) { - result.error = JSON.stringify(response.body); - } - if (response && !response.statusCode.toString().startsWith("2") && !result.error) { - result.error = response.statusMessage; - } - if (parseJson) { - try { - result.value = JSON.parse(body); - } catch (error) { - result.error = JSON.stringify(error); - } - } else { - result.value = body; - } - resolve(result); - }); - }); - } - - private static async updateAuth(options: any, repo: Repository) { - if (!repo.getPassword()) { - const creds = await CredentialsInputBox.askforCredentials(repo); - if (!creds) { - throw { cancelled: true }; - } - } - // tslint:disable-next-line:no-string-literal - options.headers["Authorization"] = - "Basic " + Buffer.from(repo.getUsername() + ":" + repo.getPassword()).toString("base64"); - } - - private static processError(result: Result) { - if (!result.error) { - return; - } - if (result.cancelled || !result.value) { - throw result; - } - try { - const msgs = JSON.parse(result.value).messages; - if (Array.isArray(msgs)) { - result.error = msgs.join("\n"); - } else { - result.error = JSON.stringify(msgs); - } - } catch (ignore) { - // noop - } - throw result; - } - - private static createRequestPart(repo: Repository, qualifier: EndevorQualifier, resource: Resource): string { - let url = repo.getUrlString(); - if (!url.endsWith("/")) { - url = url + "/"; - } - const prepQual: EndevorQualifier = { - env: qualifier.env ? EndevorRestClient.prepUrlSegment(qualifier.env) : constants.ASTERISK, - stage: qualifier.stage ? EndevorRestClient.prepUrlSegment(qualifier.stage) : constants.ASTERISK, - system: qualifier.system ? EndevorRestClient.prepUrlSegment(qualifier.system) : constants.ASTERISK, - // tslint:disable-next-line:object-literal-sort-keys - subsystem: qualifier.subsystem ? EndevorRestClient.prepUrlSegment(qualifier.subsystem) : constants.ASTERISK, - type: qualifier.type ? EndevorRestClient.prepUrlSegment(qualifier.type) : constants.ASTERISK, - element: qualifier.element ? EndevorRestClient.prepUrlSegment(qualifier.element) : constants.ASTERISK, - }; - switch (resource) { - case "datasources": - break; - case "env": - url = url + `env/${prepQual.env}`; - break; - case "stgnum": - url = url + `env/${prepQual.env}/stgnum/${prepQual.stage}`; - break; - case "sys": - url = url + `env/${prepQual.env}/stgnum/${prepQual.stage}/sys/${prepQual.system}`; - break; - case "subsys": - url = - url + - `env/${prepQual.env}/stgnum/${prepQual.stage}/sys/${prepQual.system}/subsys/${prepQual.subsystem}`; - break; - case "type": - url = url + `env/${prepQual.env}/stgnum/${prepQual.stage}/sys/${prepQual.system}/type/${prepQual.type}`; - break; - case "ele": - url = - url + - `env/${prepQual.env}/stgnum/${prepQual.stage}/sys/${prepQual.system}/subsys/${ - prepQual.subsystem - }/type/${prepQual.type}/ele/${prepQual.element}`; - break; - case "dependency": - url = - url + - `env/${prepQual.env}/stgnum/${prepQual.stage}/sys/${prepQual.system}/subsys/${ - prepQual.subsystem - }/type/${prepQual.type}/ele/${prepQual.element}/acm`; - break; - default: - throw new Error("Unexpected resource type: " + resource); - } - - return url; - } - - private static prepUrlSegment(seg: string): string { - if (!seg) { - throw Error("Url segment is undefined!"); - } - if (seg.toString().startsWith("/")) { - seg = seg.slice(1); - } - if (seg.toString().endsWith("/")) { - seg = seg.slice(0, -1); - } - return seg; - } -} - -interface Result { - error?: string; - authError?: boolean; - value?: any; - cancelled: boolean; - status?: number; -} From fecb38ffbbb504b4f821f40425e16d51212998b1 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Fri, 22 May 2020 17:15:33 +0200 Subject: [PATCH 12/49] moved all CLI interaction to a proxy module Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 18 +--- src/commands/HostDialogs.ts | 18 +--- src/service/EndevorCliProxy.ts | 131 +++++++++++++++++++++++++++ src/service/RetriveElementService.ts | 45 +-------- src/ui/tree/EndevorNodes.ts | 67 +++----------- src/utils.ts | 4 +- 6 files changed, 153 insertions(+), 130 deletions(-) create mode 100644 src/service/EndevorCliProxy.ts diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index 6ede224a3..01c554829 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -12,11 +12,10 @@ * Broadcom, Inc. - initial API and implementation */ -import { PrintElementComponents } from "@broadcom/endevor-for-zowe-cli"; import * as vscode from "vscode"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import * as utils from "../utils"; +import { proxyBrowseElement } from "../service/EndevorCliProxy"; export async function browseElement(arg: any) { const repo: Repository = arg.getRepository(); @@ -30,20 +29,7 @@ export async function browseElement(arg: any) { async progress => { progress.report({ increment: 10 }); try { - const session = await utils.buildSession(repo); - const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); - - const requestBody = PrintElementComponents.setupPrintRequest({}); - let data: string | undefined; - try { - const printResult = await PrintElementComponents.printElementComponents( - session, - element, - requestBody); - data = printResult.data ? printResult.data.toString() : undefined; - } catch (error) { - vscode.window.showErrorMessage(error); - } + const data = await proxyBrowseElement(repo, eq); progress.report({ increment: 50 }); let doc: vscode.TextDocument | undefined; doc = await vscode.workspace.openTextDocument({ content: data }); diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index 7c9e6e331..4e17a0b18 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -12,12 +12,11 @@ * Broadcom, Inc. - initial API and implementation */ -import { IEndevorInstance, ListInstance } from "@broadcom/endevor-for-zowe-cli"; import { URL } from "url"; import { ProgressLocation, window, workspace } from "vscode"; import { EndevorController } from "../EndevorController"; import { Repository } from "../model/Repository"; -import * as utils from "../utils"; +import { proxyGetDsNamesFromInstance } from "../service/EndevorCliProxy"; export class HostDialogs { /** @@ -37,26 +36,13 @@ export class HostDialogs { } const newRepo = new Repository("", url, "", "", ""); - const dsNames: string[] = []; window.withProgress({ location: ProgressLocation.Notification, }, async progress => { progress.report({message: "Waiting for " + newRepo.getUrl() + " to respond.", increment: 10 }); try { - const session = await utils.buildSession(newRepo); - const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); - for (const ds of datasources) { - // TODO: slight mismatch between interfaces - check with Vit - // need to cast, since all properties defined with IEndevorInstance are optional - // Changed to type check construct since dsNames is already initialized as empty array. - // Confirm approach - // dsNames.push(ds.name as string); - if (typeof ds.name === "string") { - dsNames.push(ds.name); - } - } - dsNames.sort(); + const dsNames = await proxyGetDsNamesFromInstance(newRepo); progress.report({ increment: 100 }); const dsItem = await window.showQuickPick(dsNames.map(label => ({ label })), { ignoreFocusOut: true, diff --git a/src/service/EndevorCliProxy.ts b/src/service/EndevorCliProxy.ts new file mode 100644 index 000000000..074445a6b --- /dev/null +++ b/src/service/EndevorCliProxy.ts @@ -0,0 +1,131 @@ +import { + ListElement, + ListEnvironment, + ListInstance, + ListStage, + ListSubsystem, + ListSystem, + ListType, + PrintElementComponents, + QueryACMComponents, + RetrieveElement } from "@broadcom/endevor-for-zowe-cli"; +import { IElement, IEnvironment, IStage, ISubsystem, ISystem, IType } from "../model/IEndevorEntities"; +import { EndevorQualifier } from "../model/IEndevorQualifier"; +import { Repository } from "../model/Repository"; +import { buildSession, endevorQualifierToElement, toArray} from "../utils"; + +export async function proxyBrowseElement(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const element = endevorQualifierToElement(endevorQualifier, repository.getDatasource()); + const requestBody = PrintElementComponents.setupPrintRequest({}); + const printResult = await PrintElementComponents.printElementComponents( + session, + element, + requestBody); + return printResult.data ? printResult.data.toString() : undefined; +} + +export async function proxyGetDsNamesFromInstance(repository: Repository): Promise { + const session = await buildSession(repository); + const dataSources = await ListInstance.listInstance(session); + return dataSources + .map(ds => ds.name as string) + .sort(); +} + +export async function proxyRetrieveElement(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const element = endevorQualifierToElement(endevorQualifier, repository.getDatasource()); + const requestArgs = { + nosignout: "yes", + }; + const requestBody = RetrieveElement.setupRetrieveRequest(requestArgs); + const retrieveResult = await RetrieveElement.retrieveElement(session, element, requestBody); + return retrieveResult.data ? retrieveResult.data.toString() : undefined; +} + +export async function proxyRetrieveAcmComponents(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const endevorElement = endevorQualifierToElement(endevorQualifier, instance); + const requestArguments = { + excCirculars: "yes", + excIndirect: "no", + excRelated: "no", + }; + const requestBody = QueryACMComponents.setupAcmComponentsRequest(requestArguments); + const queryacmCompResponse = await QueryACMComponents.queryACMComponents( + session, + instance, + endevorElement, + requestBody); + // TODO: IEndevorAcmComponents is not on par with IElement. Should we map it? + // const elements: IElement[] = await EndevorRestClient.retrieveElementDependencies(repo, eq); + // const elements: any = queryacmCompResponse.data as IEndevorAcmComponents[]; + return queryacmCompResponse.data as IElement[]; +} + +export async function proxyListType(repository: Repository, endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const typeInput = endevorQualifierToElement(endevorQualifier, instance); + const requestBody = ListType.setupListTypeRequest({}); + const listResponse = await ListType.listType(session, instance, typeInput, requestBody); + return toArray(listResponse.data); +} + +export async function proxyListElement(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const endevorElement = endevorQualifierToElement(endevorQualifier, instance); + const requestBody = ListElement.setupListElementRequest({}); + const listResponse = await ListElement.listElement(session, instance, endevorElement, requestBody); + return toArray(listResponse.data); +} + +export async function proxyListEnvironment(repository: Repository): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const environment = endevorQualifierToElement({}, instance); + const requestBody = ListEnvironment.setupListEnvironmentRequest({}); + const envResponse = await ListEnvironment.listEnvironment(session, instance, environment, requestBody); + return toArray(envResponse.data); +} + +export async function proxyListStage(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const stageNumber = endevorQualifierToElement(endevorQualifier, instance); + const requestBody = ListStage.setupListStageRequest({}); + const listResponse = await ListStage.listStage(session, instance, stageNumber, requestBody); + return toArray(listResponse.data); +} + +export async function proxyListSubsystem(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const endevorSubsystem = endevorQualifierToElement(endevorQualifier, instance); + const requestBody = ListSubsystem.setupListSubsystemRequest({}); + const listSubsystemResponse = await ListSubsystem.listSubsystem( + session, + instance, + endevorSubsystem, + requestBody); + return toArray(listSubsystemResponse.data); +} + +export async function proxyListSystem(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const endevorSystem = endevorQualifierToElement(endevorQualifier, instance); + const requestBody = ListSystem.setupListSystemRequest({}); + const listSystemResponse = await ListSystem.listSystem(session, instance, endevorSystem, requestBody); + return toArray(listSystemResponse.data); +} diff --git a/src/service/RetriveElementService.ts b/src/service/RetriveElementService.ts index c98c4f01c..3b03d9c2d 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetriveElementService.ts @@ -12,15 +12,13 @@ * Broadcom, Inc. - initial API and implementation */ -import { IEndevorAcmComponents, IOptionListRequest, ListType, QueryACMComponents, RetrieveElement } from "@broadcom/endevor-for-zowe-cli"; import * as fs from "fs"; import * as path from "path"; import * as vscode from "vscode"; import { Element } from "../model/Element"; -import { IElement, IType } from "../model/IEndevorEntities"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import * as utils from "../utils"; +import { proxyRetrieveAcmComponents, proxyRetrieveElement, proxyListType } from "../service/EndevorCliProxy"; import { GitBridgeSupport } from "./GitBridgeSupport"; export class RetrieveElementService { @@ -32,19 +30,7 @@ export class RetrieveElementService { elementName: string, eq: EndevorQualifier, ): Promise { - const session = await utils.buildSession(repo); - const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); - const requestArgs = { - nosignout: "yes", - }; - const requestBody = RetrieveElement.setupRetrieveRequest(requestArgs); - let data: string | undefined; - try { - const retrieveResult = await RetrieveElement.retrieveElement(session, element, requestBody); - data = retrieveResult.data ? retrieveResult.data.toString() : undefined; - } catch (error) { - vscode.window.showErrorMessage(error); - } + const data = await proxyRetrieveElement(repo, eq); const ext = await this.getExtension(repo, eq); const typeDirectory = this.gitBridge.createElementPath(workspace, eq.type!); if (!fs.existsSync(typeDirectory)) { @@ -68,24 +54,7 @@ export class RetrieveElementService { */ public async retrieveDependenciesList(repo: Repository, eq: EndevorQualifier): Promise { const result: Element[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorElement = utils.endevorQualifierToElement(eq, instance); - const requestArguments = { - excCirculars: "yes", - excIndirect: "no", - excRelated: "no", - }; - const requestBody = QueryACMComponents.setupAcmComponentsRequest(requestArguments); - const queryacmCompResponse = await QueryACMComponents.queryACMComponents( - session, - instance, - endevorElement, - requestBody); - - // TODO: IEndevorAcmComponents is not on par with IElement. Should we map it? - // const elements: IElement[] = await EndevorRestClient.retrieveElementDependencies(repo, eq); - const elements: any = queryacmCompResponse.data as IEndevorAcmComponents[]; + const elements = await proxyRetrieveAcmComponents(repo, eq); if (elements.length === 0) { return []; } @@ -104,13 +73,7 @@ export class RetrieveElementService { } private async getExtension(repo: Repository, eq: EndevorQualifier): Promise { - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const typeInput = utils.endevorQualifierToElement(eq, instance); - const requestBody = ListType.setupListTypeRequest({}); - let types: IType[]; - const listResponse = await ListType.listType(session, instance, typeInput, requestBody); - types = utils.toArray(listResponse.data); + const types = await proxyListType(repo, eq); for (const type of types) { if (type.typeName === eq.type && type.fileExt) { return type.fileExt; diff --git a/src/ui/tree/EndevorNodes.ts b/src/ui/tree/EndevorNodes.ts index 353e3ff35..beef964c3 100644 --- a/src/ui/tree/EndevorNodes.ts +++ b/src/ui/tree/EndevorNodes.ts @@ -13,26 +13,24 @@ */ // tslint:disable: max-classes-per-file -import { ListElement, - ListEnvironment, - ListStage, - ListSubsystem, - ListSystem, - ListType } from "@broadcom/endevor-for-zowe-cli"; import * as vscode from "vscode"; import { createEmptyNode, createPathNodes } from "../../FilterUtils"; import { Element } from "../../model/Element"; import { EndevorEntity } from "../../model/EndevorEntity"; import { EndevorFilter } from "../../model/EndevorFilter"; import { Environment } from "../../model/Environment"; -import { IElement, IEnvironment, IStage, ISubsystem, ISystem, IType } from "../../model/IEndevorEntities"; import { EndevorQualifier } from "../../model/IEndevorQualifier"; import { Repository } from "../../model/Repository"; import { Stage } from "../../model/Stage"; import { SubSystem } from "../../model/SubSystem"; import { System } from "../../model/System"; import { Type } from "../../model/Type"; -import * as utils from "../../utils"; +import { proxyListElement, + proxyListEnvironment, + proxyListStage, + proxyListSubsystem, + proxyListSystem, + proxyListType } from "../../service/EndevorCliProxy"; export class EndevorNode extends vscode.TreeItem { private entity?: EndevorEntity; @@ -195,12 +193,7 @@ export class EndevorBrowsingNode extends EndevorNode { try { const resultNodes: EndevorQualifiedNode[] = []; const resultEntities: Environment[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const environment = utils.endevorQualifierToElement({}, instance); - const requestBody = ListEnvironment.setupListEnvironmentRequest({}); - const envResponse = await ListEnvironment.listEnvironment(session, instance, environment, requestBody); - const envs: IEnvironment[] = utils.toArray(envResponse.data); + const envs = await proxyListEnvironment(repo); envs.forEach(env => { const envEntity: Environment = new Environment(repo, env); resultEntities.push(envEntity); @@ -305,12 +298,7 @@ export class FilterNode extends EndevorNode { this.needReload = false; try { - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorElement = utils.endevorQualifierToElement(qualifier, instance); - const requestBody = ListElement.setupListElementRequest({}); - const listResponse = await ListElement.listElement(session, instance, endevorElement, requestBody); - const elements: IElement[] = utils.toArray(listResponse.data); + const elements = await proxyListElement(repo, qualifier); const resultEntities: Element[] = []; let resultNodes: EndevorNode[] = []; for (const element of elements) { @@ -378,12 +366,7 @@ export class EnvironmentNode extends EndevorQualifiedNode { } this.needReload = false; try { - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const stageNumber = utils.endevorQualifierToElement(nodeQualEnv, instance); - const requestBody = ListStage.setupListStageRequest({}); - const listResponse = await ListStage.listStage(session, instance, stageNumber, requestBody); - const stages: IStage[] = utils.toArray(listResponse.data); + const stages = await proxyListStage(repo, nodeQualEnv); const resultEntities: Stage[] = []; const resultNodes: EndevorQualifiedNode[] = []; stages.forEach(stage => { @@ -418,12 +401,7 @@ export class StageNode extends EndevorQualifiedNode { try { const resultEntities: System[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorSystem = utils.endevorQualifierToElement(nodeQualStage, instance); - const requestBody = ListSystem.setupListSystemRequest({}); - const listSystemResponse = await ListSystem.listSystem(session, instance, endevorSystem, requestBody); - const systems: ISystem[] = utils.toArray(listSystemResponse.data); + const systems = await proxyListSystem(repo, nodeQualStage); systems.forEach(system => { const systemEntity: System = new System(repo, system); resultEntities.push(systemEntity); @@ -459,16 +437,7 @@ export class SystemNode extends EndevorQualifiedNode { try { const resultEntities: SubSystem[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorSubsystem = utils.endevorQualifierToElement(nodeQualSystem, instance); - const requestBody = ListSubsystem.setupListSubsystemRequest({}); - const listSubsystemResponse = await ListSubsystem.listSubsystem( - session, - instance, - endevorSubsystem, - requestBody); - const subsystems: ISubsystem[] = utils.toArray(listSubsystemResponse.data); + const subsystems = await proxyListSubsystem(repo, nodeQualSystem); subsystems.forEach(subsystem => { const subsysEntity: SubSystem = new SubSystem(repo, subsystem); resultEntities.push(subsysEntity); @@ -501,12 +470,7 @@ export class SubsystemNode extends EndevorQualifiedNode { try { const resultEntities: Type[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorType = utils.endevorQualifierToElement(nodeQualSubsys, instance); - const requestBody = ListType.setupListTypeRequest({}); - const listTypeResponse = await ListType.listType(session, instance, endevorType, requestBody); - const types: IType[] = utils.toArray(listTypeResponse.data); + const types = await proxyListType(repo, nodeQualSubsys); types.forEach(type => { const typeEntity: Type = new Type(repo, type); resultEntities.push(typeEntity); @@ -540,12 +504,7 @@ export class TypeNode extends EndevorQualifiedNode { this.needReload = false; try { const resultNodes: EndevorNode[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorElement = utils.endevorQualifierToElement(nodeQualType, instance); - const requestBody = ListElement.setupListElementRequest({}); - const listElementResponse = await ListElement.listElement(session, instance, endevorElement, requestBody); - const elements: IElement[] = utils.toArray(listElementResponse.data); + const elements = await proxyListElement(repo, nodeQualType) elements.forEach(element => { const eleEntity: Element = new Element(repo, element); resultNodes.push(new EndevorElementNode(eleEntity, { ...nodeQualType, element: element.fullElmName })); diff --git a/src/utils.ts b/src/utils.ts index 385cda115..75d8fee1f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -12,7 +12,7 @@ * Broadcom, Inc. - initial API and implementation */ -import { IElementActionRequest, IElementBasicData} from "@broadcom/endevor-for-zowe-cli"; +import { IElementBasicData} from "@broadcom/endevor-for-zowe-cli"; import { ISession, Session} from "@zowe/imperative"; import { EndevorQualifier } from "./model/IEndevorQualifier"; import { Repository } from "./model/Repository"; @@ -121,7 +121,5 @@ export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, in subsystem: endevorQualifier.subsystem ? endevorQualifier. subsystem : "*", system: endevorQualifier.system ? endevorQualifier.system : "*", type: endevorQualifier.type ? endevorQualifier.type : "*", - // TODO: see with Vit what to do here - // [key: string]: null }; } From df3f12bd7f288b55c1aadfc7459cb1e727904c2c Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Tue, 16 Jun 2020 17:38:48 +0200 Subject: [PATCH 13/49] remove `request` as a dependency Signed-off-by: Alexandru-Paul Dumitru --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index c1e970735..106186cc1 100644 --- a/package.json +++ b/package.json @@ -259,7 +259,6 @@ }, "dependencies": { "@broadcom/endevor-for-zowe-cli": "^5.1.1", - "@zowe/imperative": "^4.6.0", - "request": "^2.88.0" + "@zowe/imperative": "^4.6.0" } } From 66873c324903475a098aea10fe3a710b0506e692 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Wed, 17 Jun 2020 13:38:01 +0200 Subject: [PATCH 14/49] fix file name and imports Signed-off-by: Alexandru-Paul Dumitru --- src/commands/RetrieveElement.ts | 2 +- src/commands/RetrieveElementWithDependencies.ts | 2 +- src/extension.ts | 2 +- .../{RetriveElementService.ts => RetrieveElementService.ts} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename src/service/{RetriveElementService.ts => RetrieveElementService.ts} (98%) diff --git a/src/commands/RetrieveElement.ts b/src/commands/RetrieveElement.ts index 1a1426399..f8511f9d7 100644 --- a/src/commands/RetrieveElement.ts +++ b/src/commands/RetrieveElement.ts @@ -15,7 +15,7 @@ import * as vscode from "vscode"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import { RetrieveElementService } from "../service/RetriveElementService"; +import { RetrieveElementService } from "../service/RetrieveElementService"; import { EndevorElementNode, EndevorNode } from "../ui/tree/EndevorNodes"; import { prepareElementNodesForRetrieve } from "../utils"; diff --git a/src/commands/RetrieveElementWithDependencies.ts b/src/commands/RetrieveElementWithDependencies.ts index c70cf64ff..3b1cf91fe 100644 --- a/src/commands/RetrieveElementWithDependencies.ts +++ b/src/commands/RetrieveElementWithDependencies.ts @@ -17,7 +17,7 @@ import { Element } from "../model/Element"; import { IElement } from "../model/IEndevorEntities"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import { RetrieveElementService } from "../service/RetriveElementService"; +import { RetrieveElementService } from "../service/RetrieveElementService"; const RETRIEVE_ELEMENTS_LIMIT = 20; diff --git a/src/extension.ts b/src/extension.ts index 40f09499f..5083da499 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -25,7 +25,7 @@ import { retrieveWithDependencies } from "./commands/RetrieveElementWithDependen import { EndevorController } from "./EndevorController"; import { Repository } from "./model/Repository"; import { GitBridgeSupport } from "./service/GitBridgeSupport"; -import { RetrieveElementService } from "./service/RetriveElementService"; +import { RetrieveElementService } from "./service/RetrieveElementService"; import { HOST_SETTINGS_KEY } from "./service/SettingsFacade"; import { EndevorDataProvider } from "./ui/tree/EndevorDataProvider"; import { EndevorNode } from "./ui/tree/EndevorNodes"; diff --git a/src/service/RetriveElementService.ts b/src/service/RetrieveElementService.ts similarity index 98% rename from src/service/RetriveElementService.ts rename to src/service/RetrieveElementService.ts index 3b03d9c2d..b9bbc63a3 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetrieveElementService.ts @@ -18,7 +18,7 @@ import * as vscode from "vscode"; import { Element } from "../model/Element"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import { proxyRetrieveAcmComponents, proxyRetrieveElement, proxyListType } from "../service/EndevorCliProxy"; +import { proxyRetrieveAcmComponents, proxyRetrieveElement, proxyListType } from "./EndevorCliProxy"; import { GitBridgeSupport } from "./GitBridgeSupport"; export class RetrieveElementService { From 6af74427656a3fbcceb54d312d3f0537748a2faa Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 23 Apr 2020 11:30:10 +0200 Subject: [PATCH 15/49] adding file extension to NOTICE - it's written in markdown, why not carry the extension Signed-off-by: Alexandru-Paul Dumitru --- NOTICE.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 NOTICE.md diff --git a/NOTICE.md b/NOTICE.md new file mode 100644 index 000000000..ac34c85a9 --- /dev/null +++ b/NOTICE.md @@ -0,0 +1,47 @@ +# Notices for Eclipse Che4z + +This content is produced and maintained by the Eclipse Che4z project. + +* Project home: https://projects.eclipse.org/projects/ecd.che.che4z + +## Trademarks + +Eclipse Che4z is a trademark of the Eclipse Foundation. + +## Copyright + +All content is the property of the respective authors or their employers. For +more information regarding authorship of content, please consult the listed +source code repository logs. + +## Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License v. 2.0 available at +http://www.eclipse.org/legal/epl-2.0. + +SPDX-License-Identifier: EPL-2.0 + +## Source Code + +The project maintains the following source code repositories: + +* https://github.com/eclipse/che-che4z-explorer-for-endevor + +## Third-party Content + +This project leverages the following third party content. + +request (2.88.0) + +* License: Apache-2.0 +* Project: https://www.npmjs.com/package/request + +## Cryptography + +Content may contain encryption software. The country in which you are currently +may have restrictions on the import, possession, and use, and/or re-export to +another country, of encryption software. BEFORE using any encryption software, +please check the country's laws, regulations and policies concerning the import, +possession, or use, and re-export of encryption software, to see if this is +permitted. From ac573cb343ec44fd9d43641e1032228c857be325 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 23 Apr 2020 11:30:44 +0200 Subject: [PATCH 16/49] delete old file Signed-off-by: Alexandru-Paul Dumitru --- NOTICE | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 NOTICE diff --git a/NOTICE b/NOTICE deleted file mode 100644 index ac34c85a9..000000000 --- a/NOTICE +++ /dev/null @@ -1,47 +0,0 @@ -# Notices for Eclipse Che4z - -This content is produced and maintained by the Eclipse Che4z project. - -* Project home: https://projects.eclipse.org/projects/ecd.che.che4z - -## Trademarks - -Eclipse Che4z is a trademark of the Eclipse Foundation. - -## Copyright - -All content is the property of the respective authors or their employers. For -more information regarding authorship of content, please consult the listed -source code repository logs. - -## Declared Project Licenses - -This program and the accompanying materials are made available under the terms -of the Eclipse Public License v. 2.0 available at -http://www.eclipse.org/legal/epl-2.0. - -SPDX-License-Identifier: EPL-2.0 - -## Source Code - -The project maintains the following source code repositories: - -* https://github.com/eclipse/che-che4z-explorer-for-endevor - -## Third-party Content - -This project leverages the following third party content. - -request (2.88.0) - -* License: Apache-2.0 -* Project: https://www.npmjs.com/package/request - -## Cryptography - -Content may contain encryption software. The country in which you are currently -may have restrictions on the import, possession, and use, and/or re-export to -another country, of encryption software. BEFORE using any encryption software, -please check the country's laws, regulations and policies concerning the import, -possession, or use, and re-export of encryption software, to see if this is -permitted. From 23444d716ea3e5eeb364d37989951b733c76896b Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 23 Apr 2020 11:32:04 +0200 Subject: [PATCH 17/49] add dependent modules to package.json Signed-off-by: Alexandru-Paul Dumitru --- package-lock.json | 686 +++++++++++++++++++++++++++++++++++++++++++--- package.json | 2 + 2 files changed, 655 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5adf4e5d5..ffdf99318 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,12 +24,129 @@ "js-tokens": "^4.0.0" } }, + "@broadcom/endevor-for-zowe-cli": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@broadcom/endevor-for-zowe-cli/-/endevor-for-zowe-cli-5.1.1.tgz", + "integrity": "sha512-7O+rtp/zbF8WCkQrYpZWyQyjURH///myEeWvhrdqgAq2LQJMdmj5dViRyb8fVctRScj4OF2kDVPi9xlgjk/QIA==", + "requires": { + "form-data": "2.5.1", + "lodash": "4.17.15" + }, + "dependencies": { + "form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + } + } + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" + }, + "@types/lodash": { + "version": "4.14.150", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.150.tgz", + "integrity": "sha512-kMNLM5JBcasgYscD9x/Gvr6lTAv2NVgsKtet/hm93qMyf/D1pt+7jeEZklKJKxMVmXjxbRVQQGfqDSfipYCO6w==" + }, + "@types/lodash-deep": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/lodash-deep/-/lodash-deep-2.0.0.tgz", + "integrity": "sha512-qkAm3ab2gbNBzKTDdlUxQLEuMhIBkQ+hU2W99asSwHQDjPTwa4bG08I0+L4cQCIMMzT4QmGPR2rXT4iYDv0YFg==", + "requires": { + "@types/lodash": "*" + } + }, "@types/node": { "version": "12.12.24", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.24.tgz", "integrity": "sha512-1Ciqv9pqwVtW6FsIUKSZNB82E5Cu1I2bBTj1xuIHXLe/1zYLl3956Nbhg2MzSYHVfl9/rmanjbQIb7LibfCnug==", "dev": true }, + "@types/yargs": { + "version": "13.0.4", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.4.tgz", + "integrity": "sha512-Ke1WmBbIkVM8bpvsNEcGgQM70XcEh/nbpxQhW7FhrsbCsXSY9BmLB1+LHtD7r9zrsOcFlLiF+a/UeJsdfw3C5A==", + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", + "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==" + }, + "@zowe/imperative": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@zowe/imperative/-/imperative-4.6.0.tgz", + "integrity": "sha512-znW7Uny7mcvKcVTUWyj0yN2w/FllSYDl76tg3TUHbX1sgcGkQlp0VVwrujgRIt+sqvz5oFpla4xd25UGr3Rr2w==", + "requires": { + "@types/lodash-deep": "2.0.0", + "@types/yargs": "13.0.4", + "@zowe/perf-timing": "1.0.6", + "chalk": "2.4.2", + "cli-table3": "0.5.1", + "dataobject-parser": "1.2.1", + "deepmerge": "3.0.0", + "find-up": "2.1.0", + "fs-extra": "8.1.0", + "glob": "7.1.6", + "js-yaml": "3.13.1", + "jsonfile": "4.0.0", + "jsonschema": "1.1.1", + "levenshtein": "1.0.5", + "lodash-deep": "2.0.0", + "log4js": "6.1.0", + "marked": "0.8.0", + "moment": "2.20.1", + "mustache": "2.3.0", + "opener": "1.5.1", + "prettyjson": "1.2.1", + "progress": "2.0.3", + "readline-sync": "1.4.10", + "rimraf": "2.6.3", + "semver": "5.7.0", + "stack-trace": "0.0.10", + "wrap-ansi": "3.0.1", + "yamljs": "0.3.0", + "yargs": "15.1.0" + }, + "dependencies": { + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + } + } + }, + "@zowe/perf-timing": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@zowe/perf-timing/-/perf-timing-1.0.6.tgz", + "integrity": "sha512-eIMKqQbb0X/Ii9aU/+0IWAl6mRi+xezT0uaCa/Dn4a1ZFloIuCeGrdlIEMe2ZyuKJ3YsmNOSzi6N0X1nxEGnRA==", + "requires": { + "fs-extra": "8.1.0", + "pkg-up": "2.0.0" + } + }, "agent-base": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", @@ -50,11 +167,15 @@ "uri-js": "^4.2.2" } }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, "requires": { "color-convert": "^1.9.0" } @@ -63,7 +184,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -99,8 +219,7 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "bcrypt-pbkdf": { "version": "1.0.2", @@ -114,7 +233,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -138,6 +256,11 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -147,18 +270,98 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, "requires": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, + "cli-table3": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.5.1.tgz", + "integrity": "sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw==", + "requires": { + "colors": "^1.1.2", + "object-assign": "^4.1.0", + "string-width": "^2.1.1" + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, "requires": { "color-name": "1.1.3" } @@ -166,8 +369,12 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" }, "combined-stream": { "version": "1.0.7", @@ -186,8 +393,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "core-util-is": { "version": "1.0.2", @@ -202,6 +408,16 @@ "assert-plus": "^1.0.0" } }, + "dataobject-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/dataobject-parser/-/dataobject-parser-1.2.1.tgz", + "integrity": "sha512-1XMF0e8Dkfano8WY9TOCWLUQqosXI/Hf6GQrPESCnIn+NbYwy5kVUto0l2L6EVOIRflq8D820QnfQgVapckmTQ==" + }, + "date-format": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-3.0.0.tgz", + "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==" + }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -211,6 +427,16 @@ "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "deepmerge": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-3.0.0.tgz", + "integrity": "sha512-a8z8bkgHsAML+uHLqmMS83HHlpy3PvZOOuiTQqaa3wu8ZVg3h0hqHk6aCsGdOnZV2XMM/FRimNGjUh0KCcmHBw==" + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -231,6 +457,11 @@ "safer-buffer": "^2.1.0" } }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, "es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", @@ -249,14 +480,12 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esutils": { "version": "2.0.3", @@ -284,6 +513,19 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "^2.0.0" + } + }, + "flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==" + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -299,11 +541,25 @@ "mime-types": "^2.1.12" } }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, "getpass": { "version": "0.1.7", @@ -317,7 +573,6 @@ "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -327,6 +582,11 @@ "path-is-absolute": "^1.0.0" } }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -350,8 +610,7 @@ "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, "he": { "version": "1.1.1", @@ -399,7 +658,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -408,8 +666,12 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, "is-typedarray": { "version": "1.0.0", @@ -431,7 +693,6 @@ "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -457,6 +718,19 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsonschema": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.1.1.tgz", + "integrity": "sha1-PO3o4+QR03eHLu+8n98mODy8Ptk=" + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -468,6 +742,65 @@ "verror": "1.10.0" } }, + "levenshtein": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/levenshtein/-/levenshtein-1.0.5.tgz", + "integrity": "sha1-ORFzepy1baNF0Aj1V4LG8TiXm6M=" + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "lodash-deep": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lodash-deep/-/lodash-deep-2.0.0.tgz", + "integrity": "sha1-ypWPW82z1o0+w3rN8cWMHMvYhlw=", + "requires": { + "lodash": ">=3.7.0" + } + }, + "log4js": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.1.0.tgz", + "integrity": "sha512-fSCHMYsMJbHwfNTuMlopVVcfkKwIRLh5mpNZGB2oBbnSmr3yUTo4tL4xGBA0/q29xowlu96eTXGghJFNhPXMnA==", + "requires": { + "date-format": "^3.0.0", + "debug": "^4.1.1", + "flatted": "^2.0.1", + "rfdc": "^1.1.4", + "streamroller": "^2.2.3" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "marked": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.8.0.tgz", + "integrity": "sha512-MyUe+T/Pw4TZufHkzAfDj6HarCBWia2y27/bhuYkTaiUnfDYFnCP3KUN+9oM7Wi6JA2rymtVYbQu3spE0GCmxQ==" + }, "mime-db": { "version": "1.38.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.38.0.tgz", @@ -485,7 +818,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -555,31 +887,75 @@ } } }, + "moment": { + "version": "2.20.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.20.1.tgz", + "integrity": "sha512-Yh9y73JRljxW5QxN08Fner68eFLxM5ynNOAw2LbIB1YAGeQzZT8QFSUvkAz609Zf+IHhhaUxqZK8dG3W/+HEvg==" + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "mustache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-2.3.0.tgz", + "integrity": "sha1-QCj3d4sXcIpImTCm5SrDvKDaQdA=" + }, "oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, "requires": { "wrappy": "1" } }, + "opener": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.1.tgz", + "integrity": "sha512-goYSy5c2UXE4Ra1xixabeVh1guIX/ZV/YokJksb6q2lubWu6UbvPQ20p542/sFIll1nl8JnCyK9oBaOcCWXwvA==" + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-parse": { "version": "1.0.6", @@ -592,6 +968,35 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "requires": { + "find-up": "^2.1.0" + } + }, + "prettyjson": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prettyjson/-/prettyjson-1.2.1.tgz", + "integrity": "sha1-/P+rQdGcq0365eV15kJGYZsS0ok=", + "requires": { + "colors": "^1.1.2", + "minimist": "^1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + } + } + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" + }, "psl": { "version": "1.1.31", "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", @@ -613,6 +1018,11 @@ "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==", "dev": true }, + "readline-sync": { + "version": "1.4.10", + "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", + "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==" + }, "request": { "version": "2.88.0", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", @@ -640,6 +1050,16 @@ "uuid": "^3.3.2" } }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -655,6 +1075,19 @@ "path-parse": "^1.0.6" } }, + "rfdc": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.4.tgz", + "integrity": "sha512-5C9HXdzK8EAqN7JDif30jqsBzavB7wLpaubisuQIGHWf2gUXSpzy6ArX/+Da8RjFpagWsCn+pIgxTMAmKw9Zug==" + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "requires": { + "glob": "^7.1.3" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -671,6 +1104,11 @@ "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", "dev": true }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -690,8 +1128,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { "version": "1.16.1", @@ -709,11 +1146,62 @@ "tweetnacl": "~0.14.0" } }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" + }, + "streamroller": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-2.2.4.tgz", + "integrity": "sha512-OG79qm3AujAM9ImoqgWEY1xG4HX+Lw+yY6qZj9R1K2mhF5bEmQ849wvrb+4vt4jLMLzwXttJlQbOdPOQVRv7DQ==", + "requires": { + "date-format": "^2.1.0", + "debug": "^4.1.1", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "date-format": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-2.1.0.tgz", + "integrity": "sha512-bYQuGLeFxhkxNOF3rcMtiZxvCBAquGzZm6oWA1oZ0g2THUzivaRhv8uOhdr19LmoobSOLoIAxeUK2RdbM8IFTA==" + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "requires": { "has-flag": "^3.0.0" } @@ -806,6 +1294,11 @@ "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", "dev": true }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", @@ -864,11 +1357,138 @@ "https-proxy-agent": "^2.2.1" } }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "wrap-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-3.0.1.tgz", + "integrity": "sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo=", + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + }, + "yamljs": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/yamljs/-/yamljs-0.3.0.tgz", + "integrity": "sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==", + "requires": { + "argparse": "^1.0.7", + "glob": "^7.0.5" + } + }, + "yargs": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.1.0.tgz", + "integrity": "sha512-T39FNN1b6hCW4SOIk1XyTOWxtXdcen0t+XYrysQmChzSipvhBO8Bj0nK1ozAasdk24dNWuMZvr4k24nz+8HHLg==", + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^16.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "yargs-parser": { + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz", + "integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } } diff --git a/package.json b/package.json index 12e090d76..c1e970735 100644 --- a/package.json +++ b/package.json @@ -258,6 +258,8 @@ "vscode": "^1.1.33" }, "dependencies": { + "@broadcom/endevor-for-zowe-cli": "^5.1.1", + "@zowe/imperative": "^4.6.0", "request": "^2.88.0" } } From 60e0504c077e836211ea8a0f7ea123c2c804d70b Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 14 May 2020 17:57:39 +0200 Subject: [PATCH 18/49] switch BrowseElement to new API Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 21 ++++++++++++- src/utils.ts | 58 ++++++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index 47f70a88d..01ec1a818 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -12,10 +12,12 @@ * Broadcom, Inc. - initial API and implementation */ +import { PrintElementComponents, IEndevorRestResponse } from "@broadcom/endevor-for-zowe-cli"; import * as vscode from "vscode"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; import { EndevorRestClient } from "../service/EndevorRestClient"; +import * as utils from "../utils"; export async function browseElement(arg: any) { const repo: Repository = arg.getRepository(); @@ -29,7 +31,24 @@ export async function browseElement(arg: any) { async progress => { progress.report({ increment: 10 }); try { - const data: any = await EndevorRestClient.browseElement(repo, eq); + const session = utils.buildSession(repo); + // this needs to be + // WEBSMFTS/env/SMPLPROD/stgnum/1/sys/ADMIN/subsys/PROCESS/type/PROCESS/ele/DLODNNL + const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); + + const requestBody = utils.buildRequestBody(); + // TODO: check this with Vit + let data: any; + try { + const printResult = await PrintElementComponents.printElementComponents(session, element, requestBody); + // TODO: check this with Vit + data = printResult.data ? printResult.data.toString() : undefined; + } catch (error) { + // TODO: error handling + console.log(error); + } + + // const data: any = await EndevorRestClient.browseElement(repo, eq); progress.report({ increment: 50 }); let doc: vscode.TextDocument | undefined; doc = await vscode.workspace.openTextDocument({ content: data }); diff --git a/src/utils.ts b/src/utils.ts index a14ba9384..4634aa865 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -12,8 +12,11 @@ * Broadcom, Inc. - initial API and implementation */ -import * as vscode from "vscode"; +import { IElementActionRequest, IElementBasicData} from "@broadcom/endevor-for-zowe-cli"; +import { Session, ISession} from "@zowe/imperative"; import { EndevorElementNode } from "./ui/tree/EndevorNodes"; +import { EndevorQualifier } from "./model/IEndevorQualifier"; +import { Repository } from "./model/Repository"; export function toArray(data: any): T[] { if (Array.isArray(data)) { @@ -68,3 +71,56 @@ export function multipleElementsSelected(selection: any[]): boolean { return false; } } + +export function buildSession(repository: Repository): Session { + const protocol = repository.getUrl().split(":")[0]; + const hostname: string = repository.getUrl().split(":")[1].split("/")[2]; + // TODO: check how to enforce type (see with Vit) + const port: any = repository.getUrl().split(":")[2]; + // make this readable + // tslint:disable-next-line: max-line-length + const basePath: string = repository.getUrlString().split(":")[2].split("/")[1] + "/" + repository.getUrlString().split(":")[2].split("/")[2]; + const sessionDetails: ISession = { + basePath, + hostname, + // password: repository.getPassword(), + port, + //TODO: figure out how to cast this shit (see with Vit) + protocol: "http", + rejectUnauthorized: false, + type: "basic", + // strictSSL: true, + // secureProtocol: 'SSLv23_method', + // user: repository.getUsername(), + base64EncodedAuth: Buffer.from(repository.getUsername() + ":" + repository.getPassword()).toString("base64") + } + return new Session(sessionDetails); +} + +export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, instance: string): IElementBasicData{ + let element: IElementBasicData; + element = { + element: endevorQualifier.element ? endevorQualifier.element : "null", + environment: endevorQualifier.env ? endevorQualifier.env : "null", + instance, + stageNumber: endevorQualifier.stage ? endevorQualifier.stage : "null", + subsystem: endevorQualifier.subsystem ? endevorQualifier. subsystem : "null", + system: endevorQualifier.system ? endevorQualifier.system : "null", + type: endevorQualifier.type ? endevorQualifier.type : "null", + // TODO: see with Vit what to do here + // [key: string]: null + } + return element; +} + +export function buildRequestBody(): IElementActionRequest { + return { + expandIncludes: "", + level: "", + noSignout: "yes", + oveSign: "", + replaceMember: "", + search: "", + version: "", + }; +} From 6ac4268c50069cc8f6800324717249a9fcbe348a Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 14 May 2020 18:00:28 +0200 Subject: [PATCH 19/49] remove useless comment Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index 01ec1a818..cd639af41 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -32,8 +32,6 @@ export async function browseElement(arg: any) { progress.report({ increment: 10 }); try { const session = utils.buildSession(repo); - // this needs to be - // WEBSMFTS/env/SMPLPROD/stgnum/1/sys/ADMIN/subsys/PROCESS/type/PROCESS/ele/DLODNNL const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); const requestBody = utils.buildRequestBody(); From 19e26f5101338126dcb075a27e3ed481cf359884 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Fri, 15 May 2020 09:20:11 +0200 Subject: [PATCH 20/49] cleaning code based on linting rules Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 12 ++++++------ src/extension.ts | 2 +- src/utils.ts | 23 ++++++++++++----------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index cd639af41..0a9735248 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -12,11 +12,10 @@ * Broadcom, Inc. - initial API and implementation */ -import { PrintElementComponents, IEndevorRestResponse } from "@broadcom/endevor-for-zowe-cli"; +import { PrintElementComponents } from "@broadcom/endevor-for-zowe-cli"; import * as vscode from "vscode"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import { EndevorRestClient } from "../service/EndevorRestClient"; import * as utils from "../utils"; export async function browseElement(arg: any) { @@ -38,15 +37,16 @@ export async function browseElement(arg: any) { // TODO: check this with Vit let data: any; try { - const printResult = await PrintElementComponents.printElementComponents(session, element, requestBody); + const printResult = await PrintElementComponents.printElementComponents( + session, + element, + requestBody); // TODO: check this with Vit data = printResult.data ? printResult.data.toString() : undefined; } catch (error) { // TODO: error handling - console.log(error); + vscode.window.showErrorMessage(error); } - - // const data: any = await EndevorRestClient.browseElement(repo, eq); progress.report({ increment: 50 }); let doc: vscode.TextDocument | undefined; doc = await vscode.workspace.openTextDocument({ content: data }); diff --git a/src/extension.ts b/src/extension.ts index 10b939c41..40f09499f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -19,6 +19,7 @@ import { Commands } from "./commands/Common"; import { deleteFilter } from "./commands/DeleteFilter"; import { deleteHost } from "./commands/DeleteHost"; import { editFilter } from "./commands/EditFilter"; +import { HostDialogs } from "./commands/HostDialogs"; import { retrieveElement } from "./commands/RetrieveElement"; import { retrieveWithDependencies } from "./commands/RetrieveElementWithDependencies"; import { EndevorController } from "./EndevorController"; @@ -29,7 +30,6 @@ import { HOST_SETTINGS_KEY } from "./service/SettingsFacade"; import { EndevorDataProvider } from "./ui/tree/EndevorDataProvider"; import { EndevorNode } from "./ui/tree/EndevorNodes"; import { HostPanel } from "./ui/views/HostPanel"; -import { HostDialogs } from "./commands/HostDialogs"; import { multipleElementsSelected } from "./utils"; export function activate(context: vscode.ExtensionContext) { diff --git a/src/utils.ts b/src/utils.ts index 4634aa865..aad01388d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -13,15 +13,15 @@ */ import { IElementActionRequest, IElementBasicData} from "@broadcom/endevor-for-zowe-cli"; -import { Session, ISession} from "@zowe/imperative"; -import { EndevorElementNode } from "./ui/tree/EndevorNodes"; +import { ISession, Session} from "@zowe/imperative"; import { EndevorQualifier } from "./model/IEndevorQualifier"; import { Repository } from "./model/Repository"; +import { EndevorElementNode } from "./ui/tree/EndevorNodes"; export function toArray(data: any): T[] { if (Array.isArray(data)) { return data as T[]; - } else if(data) { + } else if (data) { return [data] as T[]; } else { return []; @@ -72,32 +72,33 @@ export function multipleElementsSelected(selection: any[]): boolean { } } +// THROWAWAY: will be covered by profile implementation with Imperative profile management export function buildSession(repository: Repository): Session { const protocol = repository.getUrl().split(":")[0]; const hostname: string = repository.getUrl().split(":")[1].split("/")[2]; // TODO: check how to enforce type (see with Vit) const port: any = repository.getUrl().split(":")[2]; // make this readable - // tslint:disable-next-line: max-line-length - const basePath: string = repository.getUrlString().split(":")[2].split("/")[1] + "/" + repository.getUrlString().split(":")[2].split("/")[2]; + const basePath: string = repository.getUrlString().split(":")[2].split("/")[1] + + "/" + repository.getUrlString().split(":")[2].split("/")[2]; const sessionDetails: ISession = { + base64EncodedAuth: Buffer.from(repository.getUsername() + ":" + repository.getPassword()).toString("base64"), basePath, hostname, // password: repository.getPassword(), port, - //TODO: figure out how to cast this shit (see with Vit) - protocol: "http", + // TODO: figure out how to cast this shit (see with Vit) + protocol: "http", rejectUnauthorized: false, type: "basic", // strictSSL: true, // secureProtocol: 'SSLv23_method', // user: repository.getUsername(), - base64EncodedAuth: Buffer.from(repository.getUsername() + ":" + repository.getPassword()).toString("base64") - } + }; return new Session(sessionDetails); } -export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, instance: string): IElementBasicData{ +export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, instance: string): IElementBasicData { let element: IElementBasicData; element = { element: endevorQualifier.element ? endevorQualifier.element : "null", @@ -109,7 +110,7 @@ export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, in type: endevorQualifier.type ? endevorQualifier.type : "null", // TODO: see with Vit what to do here // [key: string]: null - } + }; return element; } From 535e5c75052262c49d18f618196b396d0fd71906 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Mon, 18 May 2020 15:25:29 +0200 Subject: [PATCH 21/49] move HostDialogs and RetrieveElementService to new API Signed-off-by: Alexandru-Paul Dumitru --- src/commands/HostDialogs.ts | 13 ++++++-- src/service/RetriveElementService.ts | 50 ++++++++++++++++++++++------ 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index 48dad1231..c0d553979 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -12,11 +12,12 @@ * Broadcom, Inc. - initial API and implementation */ +import { IEndevorInstance, ListInstance } from "@broadcom/endevor-for-zowe-cli"; import { URL } from "url"; import { ProgressLocation, window, workspace } from "vscode"; import { EndevorController } from "../EndevorController"; import { Repository } from "../model/Repository"; -import { EndevorRestClient } from "../service/EndevorRestClient"; +import * as utils from "../utils"; export class HostDialogs { /** @@ -43,9 +44,15 @@ export class HostDialogs { async progress => { progress.report({message: "Waiting for " + newRepo.getUrl() + " to respond.", increment: 10 }); try { - const datasources = await EndevorRestClient.listDatasources(newRepo); + const session = utils.buildSession(newRepo); + const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); + // tslint:disable-next-line: no-commented-code + // const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); + // TODO: wierdly enough the old implementation gives error (invalid url) with https but new one works for (const ds of datasources) { - dsNames.push(ds.name); + // TODO: slight mismatch between interfaces - check with Vit + // need to cast, since all properties defined with IEndevorInstance are optional + dsNames.push(ds.name as string); } dsNames.sort(); progress.report({ increment: 100 }); diff --git a/src/service/RetriveElementService.ts b/src/service/RetriveElementService.ts index 7ede90dd1..e5b4c3f69 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetriveElementService.ts @@ -12,6 +12,7 @@ * Broadcom, Inc. - initial API and implementation */ +import { IEndevorAcmComponents, IOptionListRequest, ListType, QueryACMComponents, RetrieveElement } from "@broadcom/endevor-for-zowe-cli"; import * as fs from "fs"; import * as path from "path"; import * as vscode from "vscode"; @@ -19,7 +20,7 @@ import { Element } from "../model/Element"; import { IElement, IType } from "../model/IEndevorEntities"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import { EndevorRestClient, Resource } from "./EndevorRestClient"; +import * as utils from "../utils"; import { GitBridgeSupport } from "./GitBridgeSupport"; export class RetrieveElementService { @@ -31,7 +32,19 @@ export class RetrieveElementService { elementName: string, eq: EndevorQualifier, ): Promise { - const data: any = await EndevorRestClient.retrieveElement(repo, eq, false); + const session = utils.buildSession(repo); + const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); + const requestBody = utils.buildRequestBody(); + // TODO: check this with Vit + let data: any; + try { + const retrieveResult = await RetrieveElement.retrieveElement(session, element, requestBody); + // TODO: check this with Vit + data = retrieveResult.data ? retrieveResult.data.toString() : undefined; + } catch (error) { + // TODO: error handling + vscode.window.showErrorMessage(error); + } const ext = await this.getExtension(repo, eq); const typeDirectory = this.gitBridge.createElementPath(workspace, eq.type!); if (!fs.existsSync(typeDirectory)) { @@ -55,7 +68,24 @@ export class RetrieveElementService { */ public async retrieveDependenciesList(repo: Repository, eq: EndevorQualifier): Promise { const result: Element[] = []; - const elements: IElement[] = await EndevorRestClient.retrieveElementDependencies(repo, eq); + const session = utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorElement = utils.endevorQualifierToElement(eq, instance); + // TODO: match this up + // const requestBody: IOptionListRequest = utils.buildRequestBody(); // the interface here was wrong + const requestBody: IOptionListRequest = { + excCirculars: "yes", + excIndirect: "no", + excRelated: "no", + }; + const queryacmCompResponse = await QueryACMComponents.queryACMComponents( + session, + instance, + endevorElement, + requestBody); + + // TODO: IEndevorAcmComponents is not on par with IElement. Should we map it? + const elements: any = queryacmCompResponse.data as IEndevorAcmComponents[]; if (elements.length === 0) { return []; } @@ -74,13 +104,13 @@ export class RetrieveElementService { } private async getExtension(repo: Repository, eq: EndevorQualifier): Promise { - const typeQualifier: EndevorQualifier = { - env: eq.env, - stage: eq.stage, - system: eq.system, - type: eq.type, - }; - const types: IType[] = await EndevorRestClient.getMetadata(repo, typeQualifier, Resource.TYPE); + const session = utils.buildSession(repo); + const instance = repo.getDatasource(); + const typeInput = utils.endevorQualifierToElement(eq, instance); + const requestBody = utils.buildRequestBody(); + let types: IType[]; + const listResponse: any = await ListType.listType(session, instance, typeInput, requestBody); + types = utils.toArray(listResponse.data); for (const type of types) { if (type.typeName === eq.type && type.fileExt) { return type.fileExt; From 710d6b3cdd0beaa641c7962f194fb4f8c5ff7cd7 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Tue, 19 May 2020 13:12:16 +0200 Subject: [PATCH 22/49] move the remaining operations to CLI api - added credential check for `utils.buildSession()` and converted it to async - converted from `null` to default `*` in `utils.endevorQualifierToElement()` - moved EndevorNodes.ts to CLI api calls. Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 2 +- src/commands/HostDialogs.ts | 4 +- src/service/RetriveElementService.ts | 6 +-- src/ui/tree/EndevorNodes.ts | 61 ++++++++++++++++++++++++---- src/ui/views/HostPanel.ts | 12 ++++-- src/utils.ts | 23 +++++++---- 6 files changed, 83 insertions(+), 25 deletions(-) diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index 0a9735248..96fc2c33f 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -30,7 +30,7 @@ export async function browseElement(arg: any) { async progress => { progress.report({ increment: 10 }); try { - const session = utils.buildSession(repo); + const session = await utils.buildSession(repo); const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); const requestBody = utils.buildRequestBody(); diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index c0d553979..26da86c6c 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -44,11 +44,11 @@ export class HostDialogs { async progress => { progress.report({message: "Waiting for " + newRepo.getUrl() + " to respond.", increment: 10 }); try { - const session = utils.buildSession(newRepo); + const session = await utils.buildSession(newRepo); const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); // tslint:disable-next-line: no-commented-code // const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); - // TODO: wierdly enough the old implementation gives error (invalid url) with https but new one works + // TODO: the old implementation weirdly gives error (invalid url) with https but new one works for (const ds of datasources) { // TODO: slight mismatch between interfaces - check with Vit // need to cast, since all properties defined with IEndevorInstance are optional diff --git a/src/service/RetriveElementService.ts b/src/service/RetriveElementService.ts index e5b4c3f69..8e38e7ffc 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetriveElementService.ts @@ -32,7 +32,7 @@ export class RetrieveElementService { elementName: string, eq: EndevorQualifier, ): Promise { - const session = utils.buildSession(repo); + const session = await utils.buildSession(repo); const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); const requestBody = utils.buildRequestBody(); // TODO: check this with Vit @@ -68,7 +68,7 @@ export class RetrieveElementService { */ public async retrieveDependenciesList(repo: Repository, eq: EndevorQualifier): Promise { const result: Element[] = []; - const session = utils.buildSession(repo); + const session = await utils.buildSession(repo); const instance = repo.getDatasource(); const endevorElement = utils.endevorQualifierToElement(eq, instance); // TODO: match this up @@ -104,7 +104,7 @@ export class RetrieveElementService { } private async getExtension(repo: Repository, eq: EndevorQualifier): Promise { - const session = utils.buildSession(repo); + const session = await utils.buildSession(repo); const instance = repo.getDatasource(); const typeInput = utils.endevorQualifierToElement(eq, instance); const requestBody = utils.buildRequestBody(); diff --git a/src/ui/tree/EndevorNodes.ts b/src/ui/tree/EndevorNodes.ts index 14253b499..9baf3eb07 100644 --- a/src/ui/tree/EndevorNodes.ts +++ b/src/ui/tree/EndevorNodes.ts @@ -13,6 +13,12 @@ */ // tslint:disable: max-classes-per-file +import { ListElement, + ListEnvironment, + ListStage, + ListSubsystem, + ListSystem, + ListType } from "@broadcom/endevor-for-zowe-cli"; import * as vscode from "vscode"; import { createEmptyNode, createPathNodes } from "../../FilterUtils"; import { Element } from "../../model/Element"; @@ -26,7 +32,7 @@ import { Stage } from "../../model/Stage"; import { SubSystem } from "../../model/SubSystem"; import { System } from "../../model/System"; import { Type } from "../../model/Type"; -import { EndevorRestClient, Resource } from "../../service/EndevorRestClient"; +import * as utils from "../../utils"; export class EndevorNode extends vscode.TreeItem { private entity?: EndevorEntity; @@ -189,7 +195,12 @@ export class EndevorBrowsingNode extends EndevorNode { try { const resultNodes: EndevorQualifiedNode[] = []; const resultEntities: Environment[] = []; - const envs: IEnvironment[] = await EndevorRestClient.getMetadata(repo, {}, Resource.ENV); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const environment = utils.endevorQualifierToElement({}, instance); + const requestBody = ListEnvironment.setupListEnvironmentRequest({}); + const envResponse = await ListEnvironment.listEnvironment(session, instance, environment, requestBody); + const envs: IEnvironment[] = envResponse.data as any[]; envs.forEach(env => { const envEntity: Environment = new Environment(repo, env); resultEntities.push(envEntity); @@ -294,7 +305,12 @@ export class FilterNode extends EndevorNode { this.needReload = false; try { - const elements: IElement[] = await EndevorRestClient.getMetadata(repo, qualifier, Resource.ELEMENT); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorElement = utils.endevorQualifierToElement(qualifier, instance); + const requestBody = ListElement.setupListElementRequest({}); + const listResponse = await ListElement.listElement(session, instance, endevorElement, requestBody); + const elements: IElement[] = utils.toArray(listResponse.data); const resultEntities: Element[] = []; let resultNodes: EndevorNode[] = []; for (const element of elements) { @@ -362,7 +378,12 @@ export class EnvironmentNode extends EndevorQualifiedNode { } this.needReload = false; try { - const stages: IStage[] = await EndevorRestClient.getMetadata(repo, nodeQualEnv, Resource.STGNUM); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const stageNumber = utils.endevorQualifierToElement(nodeQualEnv, instance); + const requestBody = ListStage.setupListStageRequest({}); + const listResponse = await ListStage.listStage(session, instance, stageNumber, requestBody); + const stages: IStage[] = utils.toArray(listResponse.data); const resultEntities: Stage[] = []; const resultNodes: EndevorQualifiedNode[] = []; stages.forEach(stage => { @@ -397,7 +418,12 @@ export class StageNode extends EndevorQualifiedNode { try { const resultEntities: System[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const systems: ISystem[] = await EndevorRestClient.getMetadata(repo, nodeQualStage, Resource.SYS); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorSystem = utils.endevorQualifierToElement(nodeQualStage, instance); + const requestBody = ListSystem.setupListSystemRequest({}); + const listSystemResponse = await ListSystem.listSystem(session, instance, endevorSystem, requestBody); + const systems: ISystem[] = utils.toArray(listSystemResponse.data); systems.forEach(system => { const systemEntity: System = new System(repo, system); resultEntities.push(systemEntity); @@ -433,7 +459,16 @@ export class SystemNode extends EndevorQualifiedNode { try { const resultEntities: SubSystem[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const subsystems: ISubsystem[] = await EndevorRestClient.getMetadata(repo, nodeQualSystem, Resource.SUBSYS); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorSubsystem = utils.endevorQualifierToElement(nodeQualSystem, instance); + const requestBody = ListSubsystem.setupListSubsystemRequest({}); + const listSubsystemResponse = await ListSubsystem.listSubsystem( + session, + instance, + endevorSubsystem, + requestBody); + const subsystems: ISubsystem[] = utils.toArray(listSubsystemResponse.data); subsystems.forEach(subsystem => { const subsysEntity: SubSystem = new SubSystem(repo, subsystem); resultEntities.push(subsysEntity); @@ -466,7 +501,12 @@ export class SubsystemNode extends EndevorQualifiedNode { try { const resultEntities: Type[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const types: IType[] = await EndevorRestClient.getMetadata(repo, nodeQualSubsys, Resource.TYPE); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorType = utils.endevorQualifierToElement(nodeQualSubsys, instance); + const requestBody = ListType.setupListTypeRequest({}); + const listTypeResponse = await ListType.listType(session, instance, endevorType, requestBody); + const types: IType[] = utils.toArray(listTypeResponse.data); types.forEach(type => { const typeEntity: Type = new Type(repo, type); resultEntities.push(typeEntity); @@ -500,7 +540,12 @@ export class TypeNode extends EndevorQualifiedNode { this.needReload = false; try { const resultNodes: EndevorNode[] = []; - const elements: IElement[] = await EndevorRestClient.getMetadata(repo, nodeQualType, Resource.ELEMENT); + const session = await utils.buildSession(repo); + const instance = repo.getDatasource(); + const endevorElement = utils.endevorQualifierToElement(nodeQualType, instance); + const requestBody = ListElement.setupListElementRequest({}); + const listElementResponse = await ListElement.listElement(session, instance, endevorElement, requestBody); + const elements: IElement[] = utils.toArray(listElementResponse.data); elements.forEach(element => { const eleEntity: Element = new Element(repo, element); resultNodes.push(new EndevorElementNode(eleEntity, { ...nodeQualType, element: element.fullElmName })); diff --git a/src/ui/views/HostPanel.ts b/src/ui/views/HostPanel.ts index 49fc5bcdc..e8213da09 100644 --- a/src/ui/views/HostPanel.ts +++ b/src/ui/views/HostPanel.ts @@ -12,13 +12,13 @@ * Broadcom, Inc. - initial API and implementation */ +import { IEndevorInstance, ListInstance} from "@broadcom/endevor-for-zowe-cli"; import * as fs from "fs"; import * as path from "path"; import * as vscode from "vscode"; import { EndevorController } from "../../EndevorController"; -import { DataSource } from "../../model/IEndevorInstance"; import { Repository } from "../../model/Repository"; -import { EndevorRestClient } from "../../service/EndevorRestClient"; +import * as utils from "../../utils"; export class HostPanel { public static readonly viewType = "endevorHostPanel"; @@ -64,10 +64,14 @@ export class HostPanel { const restUrl = message.data.url; const newRepo = new Repository("", restUrl, "", "", ""); try { - const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); + const session = await utils.buildSession(newRepo); + const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); + // tslint:disable-next-line: no-commented-code + // const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); + // TODO: comments in /src/commands/HostDialogs.ts apply here as well const dsNames: string[] = []; for (const ds of datasources) { - dsNames.push(ds.name); + dsNames.push(ds.name as string); } dsNames.sort(); panel.webview.postMessage({ data: dsNames }); diff --git a/src/utils.ts b/src/utils.ts index aad01388d..d454957ca 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -16,6 +16,7 @@ import { IElementActionRequest, IElementBasicData} from "@broadcom/endevor-for-z import { ISession, Session} from "@zowe/imperative"; import { EndevorQualifier } from "./model/IEndevorQualifier"; import { Repository } from "./model/Repository"; +import { CredentialsInputBox } from "./ui/tree/CredentialsInput"; import { EndevorElementNode } from "./ui/tree/EndevorNodes"; export function toArray(data: any): T[] { @@ -73,7 +74,7 @@ export function multipleElementsSelected(selection: any[]): boolean { } // THROWAWAY: will be covered by profile implementation with Imperative profile management -export function buildSession(repository: Repository): Session { +export async function buildSession(repository: Repository): Promise { const protocol = repository.getUrl().split(":")[0]; const hostname: string = repository.getUrl().split(":")[1].split("/")[2]; // TODO: check how to enforce type (see with Vit) @@ -81,6 +82,14 @@ export function buildSession(repository: Repository): Session { // make this readable const basePath: string = repository.getUrlString().split(":")[2].split("/")[1] + "/" + repository.getUrlString().split(":")[2].split("/")[2]; + + // set password if not defined + if (!repository.getPassword()) { + const creds = await CredentialsInputBox.askforCredentials(repository) + if (!creds) { + throw { cancelled: true }; + } + } const sessionDetails: ISession = { base64EncodedAuth: Buffer.from(repository.getUsername() + ":" + repository.getPassword()).toString("base64"), basePath, @@ -101,13 +110,13 @@ export function buildSession(repository: Repository): Session { export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, instance: string): IElementBasicData { let element: IElementBasicData; element = { - element: endevorQualifier.element ? endevorQualifier.element : "null", - environment: endevorQualifier.env ? endevorQualifier.env : "null", + element: endevorQualifier.element ? endevorQualifier.element : "*", + environment: endevorQualifier.env ? endevorQualifier.env : "*", instance, - stageNumber: endevorQualifier.stage ? endevorQualifier.stage : "null", - subsystem: endevorQualifier.subsystem ? endevorQualifier. subsystem : "null", - system: endevorQualifier.system ? endevorQualifier.system : "null", - type: endevorQualifier.type ? endevorQualifier.type : "null", + stageNumber: endevorQualifier.stage ? endevorQualifier.stage : "*", + subsystem: endevorQualifier.subsystem ? endevorQualifier. subsystem : "*", + system: endevorQualifier.system ? endevorQualifier.system : "*", + type: endevorQualifier.type ? endevorQualifier.type : "*", // TODO: see with Vit what to do here // [key: string]: null }; From c9cf78c5f623768d0692f002814b6bd5c2752017 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Wed, 20 May 2020 17:23:37 +0200 Subject: [PATCH 23/49] code cleanup - remove some TODOs by fixing some typings - remove unneeded function `buildRequestBody()` by using the `setup()` functions provided with each API Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 7 ++--- src/commands/HostDialogs.ts | 10 ++++--- src/service/RetriveElementService.ts | 18 ++++++------ src/utils.ts | 41 +++++++++++----------------- 4 files changed, 33 insertions(+), 43 deletions(-) diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index 96fc2c33f..6ede224a3 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -33,18 +33,15 @@ export async function browseElement(arg: any) { const session = await utils.buildSession(repo); const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); - const requestBody = utils.buildRequestBody(); - // TODO: check this with Vit - let data: any; + const requestBody = PrintElementComponents.setupPrintRequest({}); + let data: string | undefined; try { const printResult = await PrintElementComponents.printElementComponents( session, element, requestBody); - // TODO: check this with Vit data = printResult.data ? printResult.data.toString() : undefined; } catch (error) { - // TODO: error handling vscode.window.showErrorMessage(error); } progress.report({ increment: 50 }); diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index 26da86c6c..7c9e6e331 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -46,13 +46,15 @@ export class HostDialogs { try { const session = await utils.buildSession(newRepo); const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); - // tslint:disable-next-line: no-commented-code - // const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); - // TODO: the old implementation weirdly gives error (invalid url) with https but new one works for (const ds of datasources) { // TODO: slight mismatch between interfaces - check with Vit // need to cast, since all properties defined with IEndevorInstance are optional - dsNames.push(ds.name as string); + // Changed to type check construct since dsNames is already initialized as empty array. + // Confirm approach + // dsNames.push(ds.name as string); + if (typeof ds.name === "string") { + dsNames.push(ds.name); + } } dsNames.sort(); progress.report({ increment: 100 }); diff --git a/src/service/RetriveElementService.ts b/src/service/RetriveElementService.ts index 8e38e7ffc..076bef872 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetriveElementService.ts @@ -34,15 +34,15 @@ export class RetrieveElementService { ): Promise { const session = await utils.buildSession(repo); const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); - const requestBody = utils.buildRequestBody(); - // TODO: check this with Vit - let data: any; + const requestArgs = { + nosignout: "yes", + }; + const requestBody = RetrieveElement.setupRetrieveRequest(requestArgs); + let data: string | undefined; try { const retrieveResult = await RetrieveElement.retrieveElement(session, element, requestBody); - // TODO: check this with Vit data = retrieveResult.data ? retrieveResult.data.toString() : undefined; } catch (error) { - // TODO: error handling vscode.window.showErrorMessage(error); } const ext = await this.getExtension(repo, eq); @@ -71,13 +71,12 @@ export class RetrieveElementService { const session = await utils.buildSession(repo); const instance = repo.getDatasource(); const endevorElement = utils.endevorQualifierToElement(eq, instance); - // TODO: match this up - // const requestBody: IOptionListRequest = utils.buildRequestBody(); // the interface here was wrong - const requestBody: IOptionListRequest = { + const requestArguments = { excCirculars: "yes", excIndirect: "no", excRelated: "no", }; + const requestBody = QueryACMComponents.setupAcmComponentsRequest(requestArguments); const queryacmCompResponse = await QueryACMComponents.queryACMComponents( session, instance, @@ -85,6 +84,7 @@ export class RetrieveElementService { requestBody); // TODO: IEndevorAcmComponents is not on par with IElement. Should we map it? + // const elements: IElement[] = await EndevorRestClient.retrieveElementDependencies(repo, eq); const elements: any = queryacmCompResponse.data as IEndevorAcmComponents[]; if (elements.length === 0) { return []; @@ -107,7 +107,7 @@ export class RetrieveElementService { const session = await utils.buildSession(repo); const instance = repo.getDatasource(); const typeInput = utils.endevorQualifierToElement(eq, instance); - const requestBody = utils.buildRequestBody(); + const requestBody = ListType.setupListTypeRequest({}); let types: IType[]; const listResponse: any = await ListType.listType(session, instance, typeInput, requestBody); types = utils.toArray(listResponse.data); diff --git a/src/utils.ts b/src/utils.ts index d454957ca..385cda115 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -72,20 +72,26 @@ export function multipleElementsSelected(selection: any[]): boolean { return false; } } +function getBasePathFromRepo(repository: Repository): string { + return repository.getUrlString().split(":")[2].split("/")[1] + + "/" + repository.getUrlString().split(":")[2].split("/")[2]; +} // THROWAWAY: will be covered by profile implementation with Imperative profile management export async function buildSession(repository: Repository): Promise { - const protocol = repository.getUrl().split(":")[0]; + // TODO: create proper type + // type HTTPS_PROTOCOL = "https"; + // type HTTP_PROTOCOL = "http"; + // from ISession, only works with https + // const protocol = repository.getUrl().split(":")[0] as HTTPS_PROTOCOL; + // BUT in reality, it only works with http + const protocol = "http"; const hostname: string = repository.getUrl().split(":")[1].split("/")[2]; - // TODO: check how to enforce type (see with Vit) - const port: any = repository.getUrl().split(":")[2]; - // make this readable - const basePath: string = repository.getUrlString().split(":")[2].split("/")[1] + - "/" + repository.getUrlString().split(":")[2].split("/")[2]; - + const port = Number(repository.getUrl().split(":")[2]); + const basePath = getBasePathFromRepo(repository); // set password if not defined if (!repository.getPassword()) { - const creds = await CredentialsInputBox.askforCredentials(repository) + const creds = await CredentialsInputBox.askforCredentials(repository); if (!creds) { throw { cancelled: true }; } @@ -96,8 +102,7 @@ export async function buildSession(repository: Repository): Promise { hostname, // password: repository.getPassword(), port, - // TODO: figure out how to cast this shit (see with Vit) - protocol: "http", + protocol, rejectUnauthorized: false, type: "basic", // strictSSL: true, @@ -108,8 +113,7 @@ export async function buildSession(repository: Repository): Promise { } export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, instance: string): IElementBasicData { - let element: IElementBasicData; - element = { + return { element: endevorQualifier.element ? endevorQualifier.element : "*", environment: endevorQualifier.env ? endevorQualifier.env : "*", instance, @@ -120,17 +124,4 @@ export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, in // TODO: see with Vit what to do here // [key: string]: null }; - return element; -} - -export function buildRequestBody(): IElementActionRequest { - return { - expandIncludes: "", - level: "", - noSignout: "yes", - oveSign: "", - replaceMember: "", - search: "", - version: "", - }; } From 2513ba62df1561bbb1f39fd5dc88c14732c6842f Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Wed, 20 May 2020 17:30:47 +0200 Subject: [PATCH 24/49] fix typing (remove any where possible) Signed-off-by: Alexandru-Paul Dumitru --- src/service/RetriveElementService.ts | 2 +- src/ui/tree/EndevorNodes.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/service/RetriveElementService.ts b/src/service/RetriveElementService.ts index 076bef872..c98c4f01c 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetriveElementService.ts @@ -109,7 +109,7 @@ export class RetrieveElementService { const typeInput = utils.endevorQualifierToElement(eq, instance); const requestBody = ListType.setupListTypeRequest({}); let types: IType[]; - const listResponse: any = await ListType.listType(session, instance, typeInput, requestBody); + const listResponse = await ListType.listType(session, instance, typeInput, requestBody); types = utils.toArray(listResponse.data); for (const type of types) { if (type.typeName === eq.type && type.fileExt) { diff --git a/src/ui/tree/EndevorNodes.ts b/src/ui/tree/EndevorNodes.ts index 9baf3eb07..353e3ff35 100644 --- a/src/ui/tree/EndevorNodes.ts +++ b/src/ui/tree/EndevorNodes.ts @@ -200,7 +200,7 @@ export class EndevorBrowsingNode extends EndevorNode { const environment = utils.endevorQualifierToElement({}, instance); const requestBody = ListEnvironment.setupListEnvironmentRequest({}); const envResponse = await ListEnvironment.listEnvironment(session, instance, environment, requestBody); - const envs: IEnvironment[] = envResponse.data as any[]; + const envs: IEnvironment[] = utils.toArray(envResponse.data); envs.forEach(env => { const envEntity: Environment = new Environment(repo, env); resultEntities.push(envEntity); From f719750f0f8d54a8e73ce543d4b59ec2eb09ec9a Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Wed, 20 May 2020 17:32:22 +0200 Subject: [PATCH 25/49] remove EndevorRestClient.ts file, as not needed anymore Signed-off-by: Alexandru-Paul Dumitru --- src/service/EndevorRestClient.ts | 277 ------------------------------- 1 file changed, 277 deletions(-) delete mode 100644 src/service/EndevorRestClient.ts diff --git a/src/service/EndevorRestClient.ts b/src/service/EndevorRestClient.ts deleted file mode 100644 index 8b78744b6..000000000 --- a/src/service/EndevorRestClient.ts +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 2019 Broadcom. - * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Broadcom, Inc. - initial API and implementation - */ - -import * as request from "request"; -import { URL } from "url"; -import * as vscode from "vscode"; -import * as constants from "../constants"; -import { RC_SIXTEEN, RC_TWENTY } from "../constants"; -import { ActionResponse } from "../model/IActionResponse"; -import { IElement, IEnvironment } from "../model/IEndevorEntities"; -import { DataSource } from "../model/IEndevorInstance"; -import { EndevorQualifier } from "../model/IEndevorQualifier"; -import { Repository } from "../model/Repository"; -import { CredentialsInputBox } from "../ui/tree/CredentialsInput"; -import * as utils from "../utils"; - -export enum Resource { - DATASOURCES = "datasources", - ENV = "env", - STGNUM = "stgnum", - SYS = "sys", - SUBSYS = "subsys", - TYPE = "type", - ELEMENT = "ele", - DEPENDENCY = "dependency", -} - -export class EndevorRestClient { - public static async listDatasources(repo: Repository): Promise { - const url: string = EndevorRestClient.createRequestPart(repo, {}, Resource.DATASOURCES); - const result: Result = await EndevorRestClient.request(url, repo, undefined, true); - return result.value as DataSource[]; - } - - public static async getMetadata(repo: Repository, qualifier: EndevorQualifier, resource: Resource): Promise { - const url: string = EndevorRestClient.createRequestPart(repo, qualifier, resource); - const result: Result = await EndevorRestClient.request(url, repo); - return utils.toArray(result.value.data); - } - - /* Browse an existing element */ - public static async browseElement(repo: Repository, qualifier: EndevorQualifier): Promise { - const url = EndevorRestClient.createRequestPart(repo, qualifier, Resource.ELEMENT); - const result: Result = await EndevorRestClient.request(url, repo, "text/plain", false, false); - return result.value; - } - - /* Retrieves an existing element */ - public static async retrieveElement(repo: Repository, qualifier: EndevorQualifier, search: boolean) { - const seachParam: string = "&search=" + (search ? "yes" : "no"); - const url = - EndevorRestClient.createRequestPart(repo, qualifier, Resource.ELEMENT) + "?noSignout=yes" + seachParam; - const result: Result = await EndevorRestClient.request(url, repo, "application/octet-stream", false, false); - return result.value; - } - - /* Retrieves an existing element's dependencies*/ - public static async retrieveElementDependencies( - repo: Repository, - qualifier: EndevorQualifier, - ): Promise { - const url = EndevorRestClient.createRequestPart(repo, qualifier, Resource.DEPENDENCY); - const result: Result = await EndevorRestClient.request(url, repo); - return utils.toArray(result.value.data); - } - - // tslint:disable-next-line: cognitive-complexity - private static async request( - url: string, - repo: Repository, - mime?: string, - isPasswordOptional: boolean = false, - parseJson: boolean = true, - ): Promise { - const options = { - headers: { - Accept: mime ? mime : "application/json", - }, - host: new URL(url).hostname, - url, - }; - - // Process auth errors - while (true) { - if (!isPasswordOptional) { - await EndevorRestClient.updateAuth(options, repo); - } - const result = await EndevorRestClient.doRequest(options, parseJson); - if (result.status === 401) { - isPasswordOptional = false; - vscode.window.showInformationMessage("Authintification failed"); - result.authError = true; - result.error = "Authintification failed"; - } - if (result.status === 500) { - const actionResponse: ActionResponse = (parseJson - ? result.value - : JSON.parse(result.value)) as ActionResponse; - switch (actionResponse.returnCode) { - case RC_TWENTY: - isPasswordOptional = false; - vscode.window.showErrorMessage("Invalid Credentials Provided"); - result.authError = true; - result.error = "Invalid Credentials Provided"; - break; - case RC_SIXTEEN: - isPasswordOptional = false; - vscode.window.showErrorMessage("Missing Username or Password"); - result.authError = true; - result.error = "Missing Username or Password"; - break; - } - } - if (result.authError) { - repo.setPassword(""); - } - if (!result.authError || result.cancelled) { - this.processError(result); - return result; - } - } - } - - // tslint:disable-next-line:cognitive-complexity - private static async doRequest(options, parseJson: boolean = true): Promise { - return new Promise((resolve, reject) => { - request.get(options, (error, response, body) => { - if (error) { - reject({ - cancelled: false, - error: JSON.stringify(error), - }); - return; - } - const result: Result = { - cancelled: false, - status: response.statusCode, - }; - if (response && response.statusCode.toString().startsWith("4")) { - result.error = JSON.stringify(response.body); - } - if (response && !response.statusCode.toString().startsWith("2") && !result.error) { - result.error = response.statusMessage; - } - if (parseJson) { - try { - result.value = JSON.parse(body); - } catch (error) { - result.error = JSON.stringify(error); - } - } else { - result.value = body; - } - resolve(result); - }); - }); - } - - private static async updateAuth(options: any, repo: Repository) { - if (!repo.getPassword()) { - const creds = await CredentialsInputBox.askforCredentials(repo); - if (!creds) { - throw { cancelled: true }; - } - } - // tslint:disable-next-line:no-string-literal - options.headers["Authorization"] = - "Basic " + Buffer.from(repo.getUsername() + ":" + repo.getPassword()).toString("base64"); - } - - private static processError(result: Result) { - if (!result.error) { - return; - } - if (result.cancelled || !result.value) { - throw result; - } - try { - const msgs = JSON.parse(result.value).messages; - if (Array.isArray(msgs)) { - result.error = msgs.join("\n"); - } else { - result.error = JSON.stringify(msgs); - } - } catch (ignore) { - // noop - } - throw result; - } - - private static createRequestPart(repo: Repository, qualifier: EndevorQualifier, resource: Resource): string { - let url = repo.getUrlString(); - if (!url.endsWith("/")) { - url = url + "/"; - } - const prepQual: EndevorQualifier = { - env: qualifier.env ? EndevorRestClient.prepUrlSegment(qualifier.env) : constants.ASTERISK, - stage: qualifier.stage ? EndevorRestClient.prepUrlSegment(qualifier.stage) : constants.ASTERISK, - system: qualifier.system ? EndevorRestClient.prepUrlSegment(qualifier.system) : constants.ASTERISK, - // tslint:disable-next-line:object-literal-sort-keys - subsystem: qualifier.subsystem ? EndevorRestClient.prepUrlSegment(qualifier.subsystem) : constants.ASTERISK, - type: qualifier.type ? EndevorRestClient.prepUrlSegment(qualifier.type) : constants.ASTERISK, - element: qualifier.element ? EndevorRestClient.prepUrlSegment(qualifier.element) : constants.ASTERISK, - }; - switch (resource) { - case "datasources": - break; - case "env": - url = url + `env/${prepQual.env}`; - break; - case "stgnum": - url = url + `env/${prepQual.env}/stgnum/${prepQual.stage}`; - break; - case "sys": - url = url + `env/${prepQual.env}/stgnum/${prepQual.stage}/sys/${prepQual.system}`; - break; - case "subsys": - url = - url + - `env/${prepQual.env}/stgnum/${prepQual.stage}/sys/${prepQual.system}/subsys/${prepQual.subsystem}`; - break; - case "type": - url = url + `env/${prepQual.env}/stgnum/${prepQual.stage}/sys/${prepQual.system}/type/${prepQual.type}`; - break; - case "ele": - url = - url + - `env/${prepQual.env}/stgnum/${prepQual.stage}/sys/${prepQual.system}/subsys/${ - prepQual.subsystem - }/type/${prepQual.type}/ele/${prepQual.element}`; - break; - case "dependency": - url = - url + - `env/${prepQual.env}/stgnum/${prepQual.stage}/sys/${prepQual.system}/subsys/${ - prepQual.subsystem - }/type/${prepQual.type}/ele/${prepQual.element}/acm`; - break; - default: - throw new Error("Unexpected resource type: " + resource); - } - - return url; - } - - private static prepUrlSegment(seg: string): string { - if (!seg) { - throw Error("Url segment is undefined!"); - } - if (seg.toString().startsWith("/")) { - seg = seg.slice(1); - } - if (seg.toString().endsWith("/")) { - seg = seg.slice(0, -1); - } - return seg; - } -} - -interface Result { - error?: string; - authError?: boolean; - value?: any; - cancelled: boolean; - status?: number; -} From 1770f4fd3efc90b0dad5cbae4c4530969730dc9a Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Fri, 22 May 2020 17:15:33 +0200 Subject: [PATCH 26/49] moved all CLI interaction to a proxy module Signed-off-by: Alexandru-Paul Dumitru --- src/commands/BrowseElement.ts | 18 +--- src/commands/HostDialogs.ts | 18 +--- src/service/EndevorCliProxy.ts | 131 +++++++++++++++++++++++++++ src/service/RetriveElementService.ts | 45 +-------- src/ui/tree/EndevorNodes.ts | 67 +++----------- src/utils.ts | 4 +- 6 files changed, 153 insertions(+), 130 deletions(-) create mode 100644 src/service/EndevorCliProxy.ts diff --git a/src/commands/BrowseElement.ts b/src/commands/BrowseElement.ts index 6ede224a3..01c554829 100644 --- a/src/commands/BrowseElement.ts +++ b/src/commands/BrowseElement.ts @@ -12,11 +12,10 @@ * Broadcom, Inc. - initial API and implementation */ -import { PrintElementComponents } from "@broadcom/endevor-for-zowe-cli"; import * as vscode from "vscode"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import * as utils from "../utils"; +import { proxyBrowseElement } from "../service/EndevorCliProxy"; export async function browseElement(arg: any) { const repo: Repository = arg.getRepository(); @@ -30,20 +29,7 @@ export async function browseElement(arg: any) { async progress => { progress.report({ increment: 10 }); try { - const session = await utils.buildSession(repo); - const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); - - const requestBody = PrintElementComponents.setupPrintRequest({}); - let data: string | undefined; - try { - const printResult = await PrintElementComponents.printElementComponents( - session, - element, - requestBody); - data = printResult.data ? printResult.data.toString() : undefined; - } catch (error) { - vscode.window.showErrorMessage(error); - } + const data = await proxyBrowseElement(repo, eq); progress.report({ increment: 50 }); let doc: vscode.TextDocument | undefined; doc = await vscode.workspace.openTextDocument({ content: data }); diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index 7c9e6e331..4e17a0b18 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -12,12 +12,11 @@ * Broadcom, Inc. - initial API and implementation */ -import { IEndevorInstance, ListInstance } from "@broadcom/endevor-for-zowe-cli"; import { URL } from "url"; import { ProgressLocation, window, workspace } from "vscode"; import { EndevorController } from "../EndevorController"; import { Repository } from "../model/Repository"; -import * as utils from "../utils"; +import { proxyGetDsNamesFromInstance } from "../service/EndevorCliProxy"; export class HostDialogs { /** @@ -37,26 +36,13 @@ export class HostDialogs { } const newRepo = new Repository("", url, "", "", ""); - const dsNames: string[] = []; window.withProgress({ location: ProgressLocation.Notification, }, async progress => { progress.report({message: "Waiting for " + newRepo.getUrl() + " to respond.", increment: 10 }); try { - const session = await utils.buildSession(newRepo); - const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); - for (const ds of datasources) { - // TODO: slight mismatch between interfaces - check with Vit - // need to cast, since all properties defined with IEndevorInstance are optional - // Changed to type check construct since dsNames is already initialized as empty array. - // Confirm approach - // dsNames.push(ds.name as string); - if (typeof ds.name === "string") { - dsNames.push(ds.name); - } - } - dsNames.sort(); + const dsNames = await proxyGetDsNamesFromInstance(newRepo); progress.report({ increment: 100 }); const dsItem = await window.showQuickPick(dsNames.map(label => ({ label })), { ignoreFocusOut: true, diff --git a/src/service/EndevorCliProxy.ts b/src/service/EndevorCliProxy.ts new file mode 100644 index 000000000..074445a6b --- /dev/null +++ b/src/service/EndevorCliProxy.ts @@ -0,0 +1,131 @@ +import { + ListElement, + ListEnvironment, + ListInstance, + ListStage, + ListSubsystem, + ListSystem, + ListType, + PrintElementComponents, + QueryACMComponents, + RetrieveElement } from "@broadcom/endevor-for-zowe-cli"; +import { IElement, IEnvironment, IStage, ISubsystem, ISystem, IType } from "../model/IEndevorEntities"; +import { EndevorQualifier } from "../model/IEndevorQualifier"; +import { Repository } from "../model/Repository"; +import { buildSession, endevorQualifierToElement, toArray} from "../utils"; + +export async function proxyBrowseElement(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const element = endevorQualifierToElement(endevorQualifier, repository.getDatasource()); + const requestBody = PrintElementComponents.setupPrintRequest({}); + const printResult = await PrintElementComponents.printElementComponents( + session, + element, + requestBody); + return printResult.data ? printResult.data.toString() : undefined; +} + +export async function proxyGetDsNamesFromInstance(repository: Repository): Promise { + const session = await buildSession(repository); + const dataSources = await ListInstance.listInstance(session); + return dataSources + .map(ds => ds.name as string) + .sort(); +} + +export async function proxyRetrieveElement(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const element = endevorQualifierToElement(endevorQualifier, repository.getDatasource()); + const requestArgs = { + nosignout: "yes", + }; + const requestBody = RetrieveElement.setupRetrieveRequest(requestArgs); + const retrieveResult = await RetrieveElement.retrieveElement(session, element, requestBody); + return retrieveResult.data ? retrieveResult.data.toString() : undefined; +} + +export async function proxyRetrieveAcmComponents(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const endevorElement = endevorQualifierToElement(endevorQualifier, instance); + const requestArguments = { + excCirculars: "yes", + excIndirect: "no", + excRelated: "no", + }; + const requestBody = QueryACMComponents.setupAcmComponentsRequest(requestArguments); + const queryacmCompResponse = await QueryACMComponents.queryACMComponents( + session, + instance, + endevorElement, + requestBody); + // TODO: IEndevorAcmComponents is not on par with IElement. Should we map it? + // const elements: IElement[] = await EndevorRestClient.retrieveElementDependencies(repo, eq); + // const elements: any = queryacmCompResponse.data as IEndevorAcmComponents[]; + return queryacmCompResponse.data as IElement[]; +} + +export async function proxyListType(repository: Repository, endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const typeInput = endevorQualifierToElement(endevorQualifier, instance); + const requestBody = ListType.setupListTypeRequest({}); + const listResponse = await ListType.listType(session, instance, typeInput, requestBody); + return toArray(listResponse.data); +} + +export async function proxyListElement(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const endevorElement = endevorQualifierToElement(endevorQualifier, instance); + const requestBody = ListElement.setupListElementRequest({}); + const listResponse = await ListElement.listElement(session, instance, endevorElement, requestBody); + return toArray(listResponse.data); +} + +export async function proxyListEnvironment(repository: Repository): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const environment = endevorQualifierToElement({}, instance); + const requestBody = ListEnvironment.setupListEnvironmentRequest({}); + const envResponse = await ListEnvironment.listEnvironment(session, instance, environment, requestBody); + return toArray(envResponse.data); +} + +export async function proxyListStage(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const stageNumber = endevorQualifierToElement(endevorQualifier, instance); + const requestBody = ListStage.setupListStageRequest({}); + const listResponse = await ListStage.listStage(session, instance, stageNumber, requestBody); + return toArray(listResponse.data); +} + +export async function proxyListSubsystem(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const endevorSubsystem = endevorQualifierToElement(endevorQualifier, instance); + const requestBody = ListSubsystem.setupListSubsystemRequest({}); + const listSubsystemResponse = await ListSubsystem.listSubsystem( + session, + instance, + endevorSubsystem, + requestBody); + return toArray(listSubsystemResponse.data); +} + +export async function proxyListSystem(repository: Repository, + endevorQualifier: EndevorQualifier): Promise { + const session = await buildSession(repository); + const instance = repository.getDatasource(); + const endevorSystem = endevorQualifierToElement(endevorQualifier, instance); + const requestBody = ListSystem.setupListSystemRequest({}); + const listSystemResponse = await ListSystem.listSystem(session, instance, endevorSystem, requestBody); + return toArray(listSystemResponse.data); +} diff --git a/src/service/RetriveElementService.ts b/src/service/RetriveElementService.ts index c98c4f01c..3b03d9c2d 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetriveElementService.ts @@ -12,15 +12,13 @@ * Broadcom, Inc. - initial API and implementation */ -import { IEndevorAcmComponents, IOptionListRequest, ListType, QueryACMComponents, RetrieveElement } from "@broadcom/endevor-for-zowe-cli"; import * as fs from "fs"; import * as path from "path"; import * as vscode from "vscode"; import { Element } from "../model/Element"; -import { IElement, IType } from "../model/IEndevorEntities"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import * as utils from "../utils"; +import { proxyRetrieveAcmComponents, proxyRetrieveElement, proxyListType } from "../service/EndevorCliProxy"; import { GitBridgeSupport } from "./GitBridgeSupport"; export class RetrieveElementService { @@ -32,19 +30,7 @@ export class RetrieveElementService { elementName: string, eq: EndevorQualifier, ): Promise { - const session = await utils.buildSession(repo); - const element = utils.endevorQualifierToElement(eq, repo.getDatasource()); - const requestArgs = { - nosignout: "yes", - }; - const requestBody = RetrieveElement.setupRetrieveRequest(requestArgs); - let data: string | undefined; - try { - const retrieveResult = await RetrieveElement.retrieveElement(session, element, requestBody); - data = retrieveResult.data ? retrieveResult.data.toString() : undefined; - } catch (error) { - vscode.window.showErrorMessage(error); - } + const data = await proxyRetrieveElement(repo, eq); const ext = await this.getExtension(repo, eq); const typeDirectory = this.gitBridge.createElementPath(workspace, eq.type!); if (!fs.existsSync(typeDirectory)) { @@ -68,24 +54,7 @@ export class RetrieveElementService { */ public async retrieveDependenciesList(repo: Repository, eq: EndevorQualifier): Promise { const result: Element[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorElement = utils.endevorQualifierToElement(eq, instance); - const requestArguments = { - excCirculars: "yes", - excIndirect: "no", - excRelated: "no", - }; - const requestBody = QueryACMComponents.setupAcmComponentsRequest(requestArguments); - const queryacmCompResponse = await QueryACMComponents.queryACMComponents( - session, - instance, - endevorElement, - requestBody); - - // TODO: IEndevorAcmComponents is not on par with IElement. Should we map it? - // const elements: IElement[] = await EndevorRestClient.retrieveElementDependencies(repo, eq); - const elements: any = queryacmCompResponse.data as IEndevorAcmComponents[]; + const elements = await proxyRetrieveAcmComponents(repo, eq); if (elements.length === 0) { return []; } @@ -104,13 +73,7 @@ export class RetrieveElementService { } private async getExtension(repo: Repository, eq: EndevorQualifier): Promise { - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const typeInput = utils.endevorQualifierToElement(eq, instance); - const requestBody = ListType.setupListTypeRequest({}); - let types: IType[]; - const listResponse = await ListType.listType(session, instance, typeInput, requestBody); - types = utils.toArray(listResponse.data); + const types = await proxyListType(repo, eq); for (const type of types) { if (type.typeName === eq.type && type.fileExt) { return type.fileExt; diff --git a/src/ui/tree/EndevorNodes.ts b/src/ui/tree/EndevorNodes.ts index 353e3ff35..beef964c3 100644 --- a/src/ui/tree/EndevorNodes.ts +++ b/src/ui/tree/EndevorNodes.ts @@ -13,26 +13,24 @@ */ // tslint:disable: max-classes-per-file -import { ListElement, - ListEnvironment, - ListStage, - ListSubsystem, - ListSystem, - ListType } from "@broadcom/endevor-for-zowe-cli"; import * as vscode from "vscode"; import { createEmptyNode, createPathNodes } from "../../FilterUtils"; import { Element } from "../../model/Element"; import { EndevorEntity } from "../../model/EndevorEntity"; import { EndevorFilter } from "../../model/EndevorFilter"; import { Environment } from "../../model/Environment"; -import { IElement, IEnvironment, IStage, ISubsystem, ISystem, IType } from "../../model/IEndevorEntities"; import { EndevorQualifier } from "../../model/IEndevorQualifier"; import { Repository } from "../../model/Repository"; import { Stage } from "../../model/Stage"; import { SubSystem } from "../../model/SubSystem"; import { System } from "../../model/System"; import { Type } from "../../model/Type"; -import * as utils from "../../utils"; +import { proxyListElement, + proxyListEnvironment, + proxyListStage, + proxyListSubsystem, + proxyListSystem, + proxyListType } from "../../service/EndevorCliProxy"; export class EndevorNode extends vscode.TreeItem { private entity?: EndevorEntity; @@ -195,12 +193,7 @@ export class EndevorBrowsingNode extends EndevorNode { try { const resultNodes: EndevorQualifiedNode[] = []; const resultEntities: Environment[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const environment = utils.endevorQualifierToElement({}, instance); - const requestBody = ListEnvironment.setupListEnvironmentRequest({}); - const envResponse = await ListEnvironment.listEnvironment(session, instance, environment, requestBody); - const envs: IEnvironment[] = utils.toArray(envResponse.data); + const envs = await proxyListEnvironment(repo); envs.forEach(env => { const envEntity: Environment = new Environment(repo, env); resultEntities.push(envEntity); @@ -305,12 +298,7 @@ export class FilterNode extends EndevorNode { this.needReload = false; try { - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorElement = utils.endevorQualifierToElement(qualifier, instance); - const requestBody = ListElement.setupListElementRequest({}); - const listResponse = await ListElement.listElement(session, instance, endevorElement, requestBody); - const elements: IElement[] = utils.toArray(listResponse.data); + const elements = await proxyListElement(repo, qualifier); const resultEntities: Element[] = []; let resultNodes: EndevorNode[] = []; for (const element of elements) { @@ -378,12 +366,7 @@ export class EnvironmentNode extends EndevorQualifiedNode { } this.needReload = false; try { - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const stageNumber = utils.endevorQualifierToElement(nodeQualEnv, instance); - const requestBody = ListStage.setupListStageRequest({}); - const listResponse = await ListStage.listStage(session, instance, stageNumber, requestBody); - const stages: IStage[] = utils.toArray(listResponse.data); + const stages = await proxyListStage(repo, nodeQualEnv); const resultEntities: Stage[] = []; const resultNodes: EndevorQualifiedNode[] = []; stages.forEach(stage => { @@ -418,12 +401,7 @@ export class StageNode extends EndevorQualifiedNode { try { const resultEntities: System[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorSystem = utils.endevorQualifierToElement(nodeQualStage, instance); - const requestBody = ListSystem.setupListSystemRequest({}); - const listSystemResponse = await ListSystem.listSystem(session, instance, endevorSystem, requestBody); - const systems: ISystem[] = utils.toArray(listSystemResponse.data); + const systems = await proxyListSystem(repo, nodeQualStage); systems.forEach(system => { const systemEntity: System = new System(repo, system); resultEntities.push(systemEntity); @@ -459,16 +437,7 @@ export class SystemNode extends EndevorQualifiedNode { try { const resultEntities: SubSystem[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorSubsystem = utils.endevorQualifierToElement(nodeQualSystem, instance); - const requestBody = ListSubsystem.setupListSubsystemRequest({}); - const listSubsystemResponse = await ListSubsystem.listSubsystem( - session, - instance, - endevorSubsystem, - requestBody); - const subsystems: ISubsystem[] = utils.toArray(listSubsystemResponse.data); + const subsystems = await proxyListSubsystem(repo, nodeQualSystem); subsystems.forEach(subsystem => { const subsysEntity: SubSystem = new SubSystem(repo, subsystem); resultEntities.push(subsysEntity); @@ -501,12 +470,7 @@ export class SubsystemNode extends EndevorQualifiedNode { try { const resultEntities: Type[] = []; const resultNodes: EndevorQualifiedNode[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorType = utils.endevorQualifierToElement(nodeQualSubsys, instance); - const requestBody = ListType.setupListTypeRequest({}); - const listTypeResponse = await ListType.listType(session, instance, endevorType, requestBody); - const types: IType[] = utils.toArray(listTypeResponse.data); + const types = await proxyListType(repo, nodeQualSubsys); types.forEach(type => { const typeEntity: Type = new Type(repo, type); resultEntities.push(typeEntity); @@ -540,12 +504,7 @@ export class TypeNode extends EndevorQualifiedNode { this.needReload = false; try { const resultNodes: EndevorNode[] = []; - const session = await utils.buildSession(repo); - const instance = repo.getDatasource(); - const endevorElement = utils.endevorQualifierToElement(nodeQualType, instance); - const requestBody = ListElement.setupListElementRequest({}); - const listElementResponse = await ListElement.listElement(session, instance, endevorElement, requestBody); - const elements: IElement[] = utils.toArray(listElementResponse.data); + const elements = await proxyListElement(repo, nodeQualType) elements.forEach(element => { const eleEntity: Element = new Element(repo, element); resultNodes.push(new EndevorElementNode(eleEntity, { ...nodeQualType, element: element.fullElmName })); diff --git a/src/utils.ts b/src/utils.ts index 385cda115..75d8fee1f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -12,7 +12,7 @@ * Broadcom, Inc. - initial API and implementation */ -import { IElementActionRequest, IElementBasicData} from "@broadcom/endevor-for-zowe-cli"; +import { IElementBasicData} from "@broadcom/endevor-for-zowe-cli"; import { ISession, Session} from "@zowe/imperative"; import { EndevorQualifier } from "./model/IEndevorQualifier"; import { Repository } from "./model/Repository"; @@ -121,7 +121,5 @@ export function endevorQualifierToElement(endevorQualifier: EndevorQualifier, in subsystem: endevorQualifier.subsystem ? endevorQualifier. subsystem : "*", system: endevorQualifier.system ? endevorQualifier.system : "*", type: endevorQualifier.type ? endevorQualifier.type : "*", - // TODO: see with Vit what to do here - // [key: string]: null }; } From 4c397f0538f2e941d568b9064f658c76cbfb71e4 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Fri, 12 Jun 2020 15:06:22 +0200 Subject: [PATCH 27/49] current stage: - can create profiles - Repos are under profiles in tree - add remove profiles from tree - pwd not required (taken from profiles) Signed-off-by: Alexandru-Paul Dumitru --- log4jsconfig.json | 41 ++++ package.json | 111 ++++++--- src/EndevorController.ts | 248 +++++++++++-------- src/commands/DeleteConnection.ts | 32 +++ src/commands/DeleteHost.ts | 2 +- src/commands/HostDialogs.ts | 126 ++++++++-- src/extension.ts | 68 ++++-- src/model/Connection.ts | 95 ++++++++ src/model/IConnection.ts | 22 ++ src/model/IEndevorInstance.ts | 2 + src/model/Repository.ts | 35 ++- src/service/GitBridgeSupport.ts | 6 +- src/service/Profiles.ts | 371 +++++++++++++++++++++++++++++ src/service/SettingsFacade.ts | 69 +++++- src/ui/tree/EndevorDataProvider.ts | 93 ++++++-- src/ui/tree/EndevorNodes.ts | 59 +++++ src/ui/views/HostPanel.ts | 22 +- src/utils.ts | 22 ++ 18 files changed, 1213 insertions(+), 211 deletions(-) create mode 100644 log4jsconfig.json create mode 100644 src/commands/DeleteConnection.ts create mode 100644 src/model/Connection.ts create mode 100644 src/model/IConnection.ts create mode 100644 src/service/Profiles.ts diff --git a/log4jsconfig.json b/log4jsconfig.json new file mode 100644 index 000000000..4cde8c935 --- /dev/null +++ b/log4jsconfig.json @@ -0,0 +1,41 @@ +{ + "log4jsConfig": { + "appenders": { + "default": { + "type": "fileSync", + "layout": { + "type": "pattern", + "pattern": "[%d{yyyy/MM/dd} %d{hh:mm:ss.SSS}] [%p] %m" + } + }, + "imperative": { + "type": "fileSync", + "layout": { + "type": "pattern", + "pattern": "[%d{yyyy/MM/dd} %d{hh:mm:ss.SSS}] [%p] %m" + } + }, + "app": { + "type": "fileSync", + "layout": { + "type": "pattern", + "pattern": "[%d{yyyy/MM/dd} %d{hh:mm:ss.SSS}] [%p] %m" + } + } + }, + "categories": { + "default": { + "appenders": ["default"], + "level": "DEBUG" + }, + "imperative": { + "appenders": ["imperative"], + "level": "DEBUG" + }, + "app": { + "appenders": ["app"], + "level": "DEBUG" + } + } + } +} diff --git a/package.json b/package.json index c1e970735..012451c80 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,22 @@ "dark": "resources/dark/add.svg" } }, + { + "command": "endevorexplorer.newConnection", + "title": "Create a New Session (Profile)", + "icon": { + "light": "resources/light/add.svg", + "dark": "resources/dark/add.svg" + } + }, + { + "command": "endevorexplorer.deleteConnection", + "title": "Delete Session (Profile)", + "icon": { + "light": "resources/light/delete.svg", + "dark": "resources/dark/delete.svg" + } + }, { "command": "endevorexplorer.updateHost", "title": "Update Host", @@ -126,6 +142,16 @@ "when": "view == endevorExplorer && viewItem == repository", "group": "inline" }, + { + "command": "endevorexplorer.newHost", + "when": "view == endevorExplorer && viewItem == connection", + "group": "inline" + }, + { + "command": "endevorexplorer.deleteConnection", + "when": "view == endevorExplorer && viewItem == connection", + "group": "inline" + }, { "command": "endevorexplorer.editFilter", "when": "view == endevorExplorer && viewItem == filter", @@ -166,7 +192,7 @@ "group": "navigation" }, { - "command": "endevorexplorer.newHost", + "command": "endevorexplorer.newConnection", "when": "view == endevorExplorer", "group": "navigation" } @@ -176,53 +202,78 @@ "title": "Explorer for Endevor", "scope": "resource", "properties": { - "endevor.hosts": { - "type": "array", - "title": "Host List", + "endevor.connections": { + "type":"array", + "title": "Endevor Connections", "items": { "type": "object", - "title": "Host Configuration", + "title": "Connection details", + "description": "Host Configuration", "required": [ "name", - "url", - "username", - "datasource", - "filters" + "hosts" ], "properties": { "name": { "type": "string", - "description": "Connection settings name" - }, - "url": { - "type": "string", - "description": "Connection url" + "title": "Connection Name", + "description": "Connection Name" }, - "username": { - "type": "string", - "description": "Connection User name" - }, - "datasource": { - "type": "string", - "description": "Configuration" - }, - "filters": { + "hosts": { "type": "array", - "description": "List of connection's filters", + "title": "Host List", "items": { "type": "object", - "title": "Filter", + "title": "Host Configuration", + "required": [ + "name", + "url", + "username", + "datasource", + "filters", + "profile" + ], "properties": { - "uri": { + "profile": { + "type":"string", + "description": "Profile attached to" + }, + "name": { + "type": "string", + "description": "Connection settings name" + }, + "url": { + "type": "string", + "description": "Connection url" + }, + "username": { + "type": "string", + "description": "Connection User name" + }, + "datasource": { "type": "string", - "description": "Filter uri" + "description": "Configuration" + }, + "filters": { + "type": "array", + "description": "List of connection's filters", + "items": { + "type": "object", + "title": "Filter", + "properties": { + "uri": { + "type": "string", + "description": "Filter uri" + } + } + } } } - } + }, + "description": "Endevor Hosts Configuration" } } - }, - "description": "Endevor Hosts Configuration" + } } } }, diff --git a/src/EndevorController.ts b/src/EndevorController.ts index e7ab1b343..ee7316efe 100644 --- a/src/EndevorController.ts +++ b/src/EndevorController.ts @@ -14,7 +14,14 @@ import { Repository } from './model/Repository'; import { SettingsFacade } from './service/SettingsFacade'; -import { EndevorNode, EndevorBrowsingNode, FilterNode } from './ui/tree/EndevorNodes'; +import { EndevorNode, EndevorBrowsingNode, FilterNode, ConnectionNode } from './ui/tree/EndevorNodes'; +import { Connection } from './model/Connection'; +import { Session, IProfileLoaded } from '@zowe/imperative'; +import { Profiles } from './service/Profiles'; +import { IConnection } from "./model/IConnection"; +import { timingSafeEqual } from 'crypto'; +import { EndevorDataProvider } from './ui/tree/EndevorDataProvider'; +import { Host } from './model/IEndevorInstance'; export class EndevorController { /** @@ -28,11 +35,7 @@ export class EndevorController { */ private _rootNode: EndevorNode = new EndevorNode(undefined); - /** - * Endevor model high level representing Endevor instances (repositories). - * Repositories in turn have stage and system metadata. - */ - private repositories: Map = new Map(); + private connections: Map = new Map(); private constructor() { } @@ -51,55 +54,56 @@ export class EndevorController { this._rootNode = value; } - public getRepositories(): Repository[] { - return Array.from(this.repositories.values()); - } - - public addRepository(repo: Repository) { - if (!repo.id) { - repo.id = this.findNextId(); + public addRepository(repo: Repository, connectionLabel: string) { + if (typeof repo.id === "undefined") { + repo.id = this.findNextId(connectionLabel); } - this.repositories.set(repo.getName(), repo); const newRepoNode: EndevorNode = new EndevorNode(repo); - this._rootNode.children.push(newRepoNode); + this.connections.get(connectionLabel).loadRepository(repo); + this._rootNode.children.forEach(child => { + if (child.getEntity().getName() === connectionLabel) { + child.children.push(newRepoNode); + } + }); } - public removeRepository(repoName: string) { - this.repositories.delete(repoName); + public getConnections(): Connection[] { + return Array.from(this.connections.values()); } - - public saveRepositories() { - SettingsFacade.updateRepositories(this.getRepositories()); + public addConnection(connection: Connection) { + this.connections.set(connection.name, connection); + const newConnectionNode = new EndevorNode(connection); + this._rootNode.children.push(newConnectionNode); } - public updateNeedReloadInTree(parNeedReload: boolean, refreshTreeRoot: EndevorNode) { - refreshTreeRoot.updateNeedReload(parNeedReload); + public removeConnection(connectionName: string) { + this.connections.delete(connectionName); + this._rootNode.children.forEach((connection, index) => { + if (connection.label === connectionName) { + this._rootNode.children.splice(index, 1); + } + }); } - /** - * Checks if current filters of the repository node - `repoNode` are different from the loaded ones in `loadedRepo`. - * Along with updating the filters in model (`Repository`), it also updates the tree. - * @param repoNode `EndevorNode` containing repository with current filters. - * @param repo Repository loaded from settings.json - */ - private checkAndReloadFilters(repoNode: EndevorNode, repo: Repository) { - let filtersNode: EndevorBrowsingNode = repoNode.children.find(child => (child).isFiltersNode()); - if (!filtersNode) { - return; - } - let newChildren: Map = new Map(); - repo.filters.forEach(filter => { - let newNode: EndevorNode | undefined = filtersNode.findFilterNode(filter); - if (newNode) { - newNode.updateInfo(); - newNode.needReload = !newNode.hasChildren(); - } else { - newNode = new FilterNode(filter); + public removeRepository(repoName: string, connectionLabel: string) { + this.connections.get(connectionLabel).getRepositoryMap().delete(repoName); + this._rootNode.children.forEach((connection, index) => { + if (connection.label === connectionLabel) { + this._rootNode.children[index].children = connection.children.filter(repo => repo.label !== repoName); } - newChildren.set(filter.getUri(), newNode); }); - filtersNode.children = Array.from(newChildren.values()); - filtersNode.needReload = false; + } + + public saveRepositories() { + SettingsFacade.updateSettings(this.getConnections()); + } + + public updateSettings() { + SettingsFacade.updateSettings(this.getConnections()); + } + + public updateNeedReloadInTree(parNeedReload: boolean, refreshTreeRoot: EndevorNode) { + refreshTreeRoot.updateNeedReload(parNeedReload); } /** @@ -113,80 +117,93 @@ export class EndevorController { */ // tslint:disable-next-line:member-ordering public loadRepositories() { - const reposFromSettings: Repository[] = SettingsFacade.listRepositories(); - const updatedRepos: Map = new Map(); + const connectionsFromSettings: Map = new Map(); + SettingsFacade.listConnections().forEach(conn => connectionsFromSettings.set(conn.name, conn.hosts)); this.rootNode.needReload = false; - if (this.rootNode.children.length !== this.repositories.size) { + if (this.rootNode.children.length !== this.connections.size) { this.rootNode.needReload = true; } - reposFromSettings.forEach(settingsRepo => { - let repoNode: EndevorNode | undefined = EndevorController.instance.findNodeByRepoID(settingsRepo.id); - let repoToKeep: Repository = settingsRepo; - if (repoNode) { - let modelRepo: Repository | undefined = repoNode.getRepository(); - if (modelRepo) { - if (!modelRepo.isEqual(settingsRepo)) { - this.rootNode.needReload = true; - if (modelRepo.isSameInstance(settingsRepo)) { - repoNode.needReload = !repoNode.hasChildren(); - } else { - repoNode.needReload = true; + connectionsFromSettings.forEach((hostList, connName) => { + let connNode = EndevorController.instance.findNodeByConnectionName(connName); + // if connection is defined, check all hosts and add them in the tree if missing + if (connNode) { + const reposFromSettings: Repository[] = SettingsFacade.listRepositories(connName); + const updatedRepos: Map = new Map(); + reposFromSettings.forEach(settingsRepo => { + // Check if node is already defined in root tree + let repoNode: EndevorNode | undefined = EndevorController.instance.findNodeByRepoID(settingsRepo.id, connName); + let repoToKeep: Repository = settingsRepo; + // TODO: check here what happens if there is repoNode. At load, this is empty + // this is the case when a repo is already defined in the tree and settings are loaded + if (repoNode) { + let modelRepo: Repository | undefined = repoNode.getRepository(); + if (modelRepo) { + if (modelRepo.isEqual(settingsRepo)) { + this.rootNode.needReload = true; + if (!modelRepo.isSameInstance(settingsRepo)) { + repoNode.needReload = !repoNode.hasChildren(); + } else { + repoNode.needReload = true; + } + modelRepo.loadInfoFromConfig(settingsRepo); + } + repoToKeep = modelRepo; } - modelRepo.loadInfoFromConfig(settingsRepo); + this.checkAndReloadFilters(repoNode, repoToKeep); + repoNode.updateInfo(); + } else { + this.rootNode.needReload = true; } - repoToKeep = modelRepo; - } - this.checkAndReloadFilters(repoNode, repoToKeep); - repoNode.updateInfo(); - } else { - this.rootNode.needReload = true; - } - updatedRepos.set(repoToKeep.getName(), repoToKeep); - }); - this.repositories = updatedRepos; - this.updateIDs(); - } - - /** - * In case `id` is not present in the settings.json, this function will determine it - * and store in the settings.json. - */ - private updateIDs() { - let saveRepos: boolean = false; - this.repositories.forEach(repo => { - if (repo.id === undefined) { - repo.id = EndevorController.instance.findNextId(); - saveRepos = true; + updatedRepos.set(repoToKeep.getName(), repoToKeep); + }); + // this.connections.get(connName).repositories = updatedRepos; + let currentRepos = this.connections.get(connName).repositories; + currentRepos = updatedRepos; + currentRepos.forEach(repo => EndevorController.instance.addRepository(repo, repo.getProfileLabel())); + this.updateIDs(connName); } }); - if (saveRepos) { - this.saveRepositories(); - } } - public findRepoByName(name: string): Repository | undefined { - return this.repositories.get(name); + public isRepoInConnection(repoName: string, connectionLabel: string): boolean { + const repoMap = this.connections.get(connectionLabel).getRepositoryMap(); + return repoMap.get(repoName) ? true : false ; } - public findNodeByRepoID(id: number | undefined): EndevorNode | undefined { + // tslint:disable-next-line: member-ordering + public findNodeByRepoID(id: number | undefined, connectionLabel: string): EndevorNode | undefined { if (id === undefined) { return undefined; } - for (let node of this._rootNode.children) { - let nodeRepo: Repository | undefined = node.getRepository(); + const connection = this.findNodeByConnectionName(connectionLabel); + for (const node of connection.children) { + const nodeRepo: Repository | undefined = node.getRepository(); if (nodeRepo && nodeRepo.id === id) { return node; } } } + // tslint:disable-next-line: member-ordering + public findNodeByConnectionName(name: string): EndevorNode | undefined { + if (!name) { + return undefined; + } + for (const node of this._rootNode.children) { + if (node.getEntity().getName() === name) { + return node; + } + } + } + /** * Function used to determine next available `id`. */ - private findNextId(): number { - let iDArray: boolean[] = new Array(this.repositories.size); + public findNextId(connectionLabel: string): number { + const repoMap = this.connections.get(connectionLabel).getRepositoryMap(); + let iDArray: boolean[] = new Array(repoMap.size); iDArray.fill(true); - this.repositories.forEach(repo => { + repoMap.forEach(repo => { if (repo.id !== undefined) { iDArray[repo.id] = false; } @@ -199,4 +216,47 @@ export class EndevorController { return iDArray.length; } +/** + * In case `id` is not present in the settings.json, this function will determine it + * and store in the settings.json. + */ + private updateIDs(connectionLabel: string) { + const repoMap = this.connections.get(connectionLabel).getRepositoryMap(); + let saveRepos: boolean = false; + repoMap.forEach(repo => { + if (repo.id === undefined) { + repo.id = EndevorController.instance.findNextId(connectionLabel); + saveRepos = true; + } + }); + if (saveRepos) { + this.saveRepositories(); + } + } + + /** + * Checks if current filters of the repository node - `repoNode` are different from the loaded ones in `loadedRepo`. + * Along with updating the filters in model (`Repository`), it also updates the tree. + * @param repoNode `EndevorNode` containing repository with current filters. + * @param repo Repository loaded from settings.json + */ + private checkAndReloadFilters(repoNode: EndevorNode, repo: Repository) { + const filtersNode: EndevorBrowsingNode = repoNode.children.find(child => (child).isFiltersNode()); + if (!filtersNode) { + return; + } + const newChildren: Map = new Map(); + repo.filters.forEach(filter => { + let newNode: EndevorNode | undefined = filtersNode.findFilterNode(filter); + if (newNode) { + newNode.updateInfo(); + newNode.needReload = !newNode.hasChildren(); + } else { + newNode = new FilterNode(filter); + } + newChildren.set(filter.getUri(), newNode); + }); + filtersNode.children = Array.from(newChildren.values()); + filtersNode.needReload = false; + } } diff --git a/src/commands/DeleteConnection.ts b/src/commands/DeleteConnection.ts new file mode 100644 index 000000000..b7dfbeafc --- /dev/null +++ b/src/commands/DeleteConnection.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019 Broadcom. + * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Broadcom, Inc. - initial API and implementation + */ + +import { Repository } from "../model/Repository"; +import { EndevorController } from "../EndevorController"; +import * as vscode from 'vscode'; + +export function deleteConnection(arg:any){ + if (arg.contextValue === "connection") { + vscode.window.showWarningMessage("Remove session?", "OK", "Cancel").then(selection => { + if (selection === "OK") { + EndevorController.instance.removeConnection(arg.label); + vscode.commands.executeCommand("endevorexplorer.refreshHosts"); + vscode.window.showInformationMessage("Session removed."); + EndevorController.instance.saveRepositories(); + } else { + vscode.window.showInformationMessage("Operation cancelled."); + } + }); + } +} diff --git a/src/commands/DeleteHost.ts b/src/commands/DeleteHost.ts index 2784ce0a5..115026825 100644 --- a/src/commands/DeleteHost.ts +++ b/src/commands/DeleteHost.ts @@ -22,7 +22,7 @@ export function deleteHost(arg:any){ if (repo) { vscode.window.showWarningMessage("Delete connection: " + repo.getName() + "?", "OK").then(message => { if (message === "OK") { - EndevorController.instance.removeRepository(repo.getName()); + EndevorController.instance.removeRepository(repo.getName(), repo.getProfileLabel()); EndevorController.instance.saveRepositories(); } }); diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index 4e17a0b18..9aba9162a 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -17,24 +17,102 @@ import { ProgressLocation, window, workspace } from "vscode"; import { EndevorController } from "../EndevorController"; import { Repository } from "../model/Repository"; import { proxyGetDsNamesFromInstance } from "../service/EndevorCliProxy"; +import { Profiles } from "../service/Profiles"; +import * as utils from "../utils"; +import * as vscode from "vscode"; +import { Connection } from "../model/Connection"; + export class HostDialogs { + public static async addConnection() { + const allProfiles = (Profiles.getInstance()).allProfiles; + const createNewProfile = "Create a New Connection to z/OS"; + let chosenProfile: string; + + let profileNamesList = allProfiles.map(profile => { + return profile.name; + }); + + if (profileNamesList) { + profileNamesList = profileNamesList.filter(profileNames => + !EndevorController.instance.getConnections().find((connection: Connection) => + connection.getName() === profileNames, + ), + ); + } + const createPick = new utils.FilterDescriptor("\uFF0B " + createNewProfile); + const items: vscode.QuickPickItem[] = profileNamesList.map(element => new utils.FilterItem(element)); + const placeholder = "Choose \"Create new...\" to define a new profile or select an existing profile to Add to the USS Explorer"; + + const quickpick = vscode.window.createQuickPick(); + quickpick.items = [createPick, ...items]; + quickpick.placeholder = placeholder; + quickpick.ignoreFocusOut = true; + quickpick.show(); + const choice = await utils.resolveQuickPickHelper(quickpick); + quickpick.hide(); + if (!choice) { + vscode.window.showInformationMessage("No selection made."); + return; + } + if (choice instanceof utils.FilterDescriptor) { + chosenProfile = ""; + } else { + chosenProfile = choice.label; + } + + if (chosenProfile === "") { + let newProfileName: any; + let profileName: string; + const options = { + placeHolder: "Connection Name", + prompt: "Enter a name for the connection", + value: profileName, + }; + profileName = await vscode.window.showInputBox(options); + if (!profileName) { + vscode.window.showInformationMessage("Profile Name was not supplied. Operation Cancelled"); + return; + } + chosenProfile = profileName; + try { + newProfileName = await Profiles.getInstance().createNewConnection(chosenProfile); + } catch (error) { + vscode.window.showErrorMessage(error.message); + } + if (newProfileName) { + try { + const newProfile = Profiles.getInstance().listProfiles().find( + profile => profile.name === newProfileName); + const profileToAdd = new Connection(newProfile); + EndevorController.instance.addConnection(profileToAdd); + } catch (error) { + vscode.window.showErrorMessage("Error while adding new profile"); + } + } + } else if (chosenProfile) { + const profileToAdd = new Connection(allProfiles.find(profile => profile.name === chosenProfile)); + EndevorController.instance.addConnection(profileToAdd); + } else { + vscode.window.showInformationMessage("Operation cancelled"); + } + } /** * Add host. * @param * @returns */ - public static async addHost() { + public static async addHost(connection) { if (!(workspace.workspaceFolders && workspace.workspaceFolders.length > 0)) { window.showErrorMessage("Specify workspace before creating repository."); return; } - const url = await HostDialogs.showUrlInput(); - if (url === undefined) { - return; - } - const newRepo = new Repository("", url, "", "", ""); + const profile = connection.getEntity().getProfile(); + const url = `${profile.protocol}://${profile.host}:${profile.port}`; + // TODO: add dataSource here when we import endevor-connection profile + const dataSource = ""; + const newRepo = new Repository("", url, profile.user, profile.password, dataSource, connection.label); window.withProgress({ location: ProgressLocation.Notification, @@ -50,15 +128,15 @@ export class HostDialogs { if (dsItem === undefined) { return; } - if (EndevorController.instance.findRepoByName(dsItem.label)) { - window.showErrorMessage("Host with name " + dsItem.label + " already exists"); + if (EndevorController.instance.isRepoInConnection(dsItem.label, connection.label)) { + window.showErrorMessage("Host with name " + dsItem.label + " already exists in this session"); return; } newRepo.setName(dsItem.label); newRepo.setDatasource(dsItem.label); - EndevorController.instance.addRepository(newRepo); - EndevorController.instance.saveRepositories(); + EndevorController.instance.addRepository(newRepo, connection.getEntity().getName()); + EndevorController.instance.updateSettings(); window.showInformationMessage("Connection " + dsItem.label + " was created."); } catch (error) { window.showErrorMessage("The host " + newRepo.getUrl() + " is not available."); @@ -67,21 +145,23 @@ export class HostDialogs { ); } - public static async editHost(repo: Repository) { - - const newName = await HostDialogs.showHostNameInput(repo); + public static async editHost(context) { + const repo: Repository | undefined = context.getRepository(); + if (repo) { + const newName = await HostDialogs.showHostNameInput(repo); - if (newName === undefined) { - return; - } - if (EndevorController.instance.findRepoByName(newName)) { - window.showErrorMessage("Host with name " + newName + " already exists"); - return; + if (newName === undefined) { + return; + } + if (EndevorController.instance.isRepoInConnection(newName, repo.getProfileLabel())) { + window.showErrorMessage("Host with name " + newName + " already exists"); + return; + } + const oldName = repo.getName(); + repo.setName(newName); + EndevorController.instance.saveRepositories(); + window.showInformationMessage(`Connection ${oldName} was renamed to ${newName}.`); } - const oldName = repo.getName(); - repo.setName(newName); - EndevorController.instance.saveRepositories(); - window.showInformationMessage(`Connection ${oldName} was renamed to ${newName}.`); } private static async showHostNameInput(repo: Repository): Promise { diff --git a/src/extension.ts b/src/extension.ts index 40f09499f..910610de3 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -18,22 +18,44 @@ import { browseElement } from "./commands/BrowseElement"; import { Commands } from "./commands/Common"; import { deleteFilter } from "./commands/DeleteFilter"; import { deleteHost } from "./commands/DeleteHost"; +import { deleteConnection } from "./commands/DeleteConnection"; import { editFilter } from "./commands/EditFilter"; import { HostDialogs } from "./commands/HostDialogs"; import { retrieveElement } from "./commands/RetrieveElement"; import { retrieveWithDependencies } from "./commands/RetrieveElementWithDependencies"; import { EndevorController } from "./EndevorController"; -import { Repository } from "./model/Repository"; import { GitBridgeSupport } from "./service/GitBridgeSupport"; import { RetrieveElementService } from "./service/RetriveElementService"; import { HOST_SETTINGS_KEY } from "./service/SettingsFacade"; -import { EndevorDataProvider } from "./ui/tree/EndevorDataProvider"; -import { EndevorNode } from "./ui/tree/EndevorNodes"; -import { HostPanel } from "./ui/views/HostPanel"; +import { EndevorDataProvider, createEndevorTree } from "./ui/tree/EndevorDataProvider"; +import { EndevorNode, ConnectionNode } from "./ui/tree/EndevorNodes"; import { multipleElementsSelected } from "./utils"; +import { Logger } from "@zowe/imperative"; +import * as path from "path"; +import { Profiles } from "./service/Profiles"; -export function activate(context: vscode.ExtensionContext) { - const endevorDataProvider = new EndevorDataProvider(); +let log: Logger; + +export async function activate(context: vscode.ExtensionContext) { + + try { + // Initialize Imperative Logger and load Profiles + const loggerConfig = require(path.join(context.extensionPath, "log4jsconfig.json")); + // tslint:disable-next-line: max-line-length + loggerConfig.log4jsConfig.appenders.default.filename = path.join(context.extensionPath, "logs", "imperative.log"); + loggerConfig.log4jsConfig.appenders.imperative.filename = path.join(context.extensionPath, "logs", "imperative.log"); + loggerConfig.log4jsConfig.appenders.app.filename = path.join(context.extensionPath, "logs", "zowe.log"); + Logger.initLogger(loggerConfig); + + log = Logger.getAppLogger(); + log.debug("Initialized logger from VSCode extension"); + } catch (err) { + log.error("Error encountered while activating and initializing logger! " + JSON.stringify(err)); + vscode.window.showErrorMessage(err.message); + } + + await Profiles.createInstance(log); + const endevorDataProvider = await createEndevorTree(log); const gitBridgeSupport = new GitBridgeSupport(); const retrieveElementService: RetrieveElementService = new RetrieveElementService(gitBridgeSupport); gitBridgeSupport.register(context); @@ -63,17 +85,33 @@ export function activate(context: vscode.ExtensionContext) { vscode.commands.executeCommand("setContext", "multipleSelection", false); } context.subscriptions.push( - vscode.commands.registerCommand("endevorexplorer.newHost", () => { - HostDialogs.addHost(); + vscode.commands.registerCommand("endevorexplorer.newHost", (arg: any) => { + HostDialogs.addHost(arg) + .then(() => { + vscode.commands.executeCommand("endevorexplorer.refreshHosts"); + }); }), ); context.subscriptions.push( + vscode.commands.registerCommand("endevorexplorer.newConnection", () => { + HostDialogs.addConnection() + .then(() => { + vscode.commands.executeCommand("endevorexplorer.refreshHosts"); + }); + }), + ); + context.subscriptions.push( + vscode.commands.registerCommand("endevorexplorer.deleteConnection", deleteConnection)); + + context.subscriptions.push( + // TODO: this doesn't work (not shown in tree, even after refresh) vscode.commands.registerCommand("endevorexplorer.updateHost", (arg: any) => { if (arg.contextValue === "repository") { - const repo: Repository | undefined = arg.getRepository(); - if (repo) { - HostDialogs.editHost(repo); - } + HostDialogs.editHost(arg); + // const repo: Repository | undefined = arg.getRepository(); + // if (repo) { + // HostDialogs.editHost(repo); + // } } }), ); @@ -89,6 +127,7 @@ export function activate(context: vscode.ExtensionContext) { endevorDataProvider.refresh(); }), ); + // TODO: add filter also cleans out the tree (something is wrong with reloading) context.subscriptions.push(vscode.commands.registerCommand(Commands.AddFilter, addFilter)); context.subscriptions.push(vscode.commands.registerCommand(Commands.EditFilter, editFilter)); context.subscriptions.push(vscode.commands.registerCommand(Commands.DeleteFilter, deleteFilter)); @@ -108,7 +147,8 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push( vscode.workspace.onDidChangeConfiguration(event => { if (event.affectsConfiguration(HOST_SETTINGS_KEY)) { - EndevorController.instance.loadRepositories(); + // TODO: NEED TO FIX THIS. is adding it 2 times + // EndevorController.instance.loadRepositories(); endevorDataProvider.refresh(); } }), @@ -117,4 +157,4 @@ export function activate(context: vscode.ExtensionContext) { } // tslint:disable-next-line: no-empty -export function deactivate() {} +export function deactivate() {} \ No newline at end of file diff --git a/src/model/Connection.ts b/src/model/Connection.ts new file mode 100644 index 000000000..bd6d9bb12 --- /dev/null +++ b/src/model/Connection.ts @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2019 Broadcom. + * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Broadcom, Inc. - initial API and implementation + */ + +import { IElement } from "./IEndevorEntities"; +import { IConnection } from "./IConnection"; +import { EndevorEntity } from "./EndevorEntity"; +import { Repository } from "./Repository"; +import { EndevorQualifier } from "./IEndevorQualifier"; +import { IProfileLoaded, IProfile } from "@zowe/imperative"; +import { SnippetString } from "vscode"; + +export class Connection extends EndevorEntity implements IProfileLoaded { + message: string; + type: string; + failNotFound: boolean; + name?: string; + referencedBy?: string; + profile?: IProfile; + dependenciesLoaded?: boolean; + dependencyLoadResponses?: IProfileLoaded[]; + private _repositories: Map; + + constructor(profile: IProfileLoaded) { + super(); + this.message = profile.message; + this.type = profile.type; + this.failNotFound = profile.failNotFound; + this.name = profile.name; + this.referencedBy = profile.referencedBy; + this.profile = profile.profile; + this.dependenciesLoaded = profile.dependenciesLoaded; + this.dependencyLoadResponses = profile.dependencyLoadResponses; + this._repositories = new Map(); + } + + public loadRepository(repo: Repository) { + this._repositories.set(repo.getName(), repo); + } + + public findRepository(repoName: string): Repository | undefined { + return this._repositories.get(repoName); + } + + public getRepository(): Repository { + throw new Error("Method not implemented."); + } + + public getRepositoryMap(): Map { + return this._repositories; + } + + public getRepositoryList(): Repository[] { + return Array.from(this._repositories.values()); + } + + public setRepositoryList(repos: Repository[]) { + repos.forEach(repo => { + this._repositories.set(repo.getName(), repo); + }); + } + public get repositories(): Map { + return this._repositories; + } + + public set repositories(repoMap: Map) { + this._repositories = repoMap; + } + + public getConnection(): Connection { + return this; + } + + public getName(): string { + return this.name; + } + public getDescription(): string { + return ""; + } + + public getProfile(): IProfile { + return this.profile; + } + +} diff --git a/src/model/IConnection.ts b/src/model/IConnection.ts new file mode 100644 index 000000000..584b8d292 --- /dev/null +++ b/src/model/IConnection.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019 Broadcom. + * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Broadcom, Inc. - initial API and implementation + */ + +export interface IConnection { + name: string; + host: string; + port: number; + user: string; + password: string; + rejectUnauthorized: boolean; +} diff --git a/src/model/IEndevorInstance.ts b/src/model/IEndevorInstance.ts index 0e9b760bb..b1eccfcde 100644 --- a/src/model/IEndevorInstance.ts +++ b/src/model/IEndevorInstance.ts @@ -22,6 +22,8 @@ export interface Host { password?: string; datasource: string; filters?: Filter[]; + // TODO: change this to mandatory later + profileLabel?: string; } export interface DataSource { diff --git a/src/model/Repository.ts b/src/model/Repository.ts index eb64aa8f3..43b2d363a 100644 --- a/src/model/Repository.ts +++ b/src/model/Repository.ts @@ -17,6 +17,7 @@ import { EndevorFilter, FILTER_ALL_STRING } from "./EndevorFilter"; import { Environment } from "./Environment"; import { Filter } from "./IEndevorEntities"; import { System } from "./System"; +import { Connection } from "./Connection"; export class Repository extends EndevorEntity { private _id?: number; @@ -28,8 +29,10 @@ export class Repository extends EndevorEntity { private _environments: Map; private _filters: EndevorFilter[]; private _map: EndevorFilter; + private _profileLabel: string; + // private connection: Connection; - constructor(name: string, url: string, username: string, password: string | undefined, datasource: string, id?: number) { + constructor(name: string, url: string, username: string, password: string | undefined, datasource: string, profileLabel: string, id?: number) { super(); this._id = id; this.name = name; @@ -40,6 +43,7 @@ export class Repository extends EndevorEntity { this._environments = new Map(); this._filters = []; this._map = new EndevorFilter(this, FILTER_ALL_STRING); + this._profileLabel = profileLabel; } public loadInfoFromConfig(repo: Repository) { @@ -68,21 +72,21 @@ export class Repository extends EndevorEntity { } public findSystem(envName: string, sysName: string): System | undefined { - let env: Environment | undefined = this.findEnvironment(envName); + const env: Environment | undefined = this.findEnvironment(envName); if (env) { return env.findSystem(sysName); } } public findType(typeName: string, envName: string, sysName: string) { - let system: System | undefined = this.findSystem(envName, sysName); + const system: System | undefined = this.findSystem(envName, sysName); if (system) { return system.findType(typeName); } } public findFilter(uri: string): EndevorFilter | undefined { - for (let filter of this.filters) { + for (const filter of this.filters) { if (filter.getUri() === uri) { return filter; } @@ -103,6 +107,17 @@ export class Repository extends EndevorEntity { public getName(): string { return this.name; } + public setProfileLabel(value: string) { + this._profileLabel = value; + } + + public getProfileLabel(): string { + return this._profileLabel; + } + + public isAttachedToConnection(value: string) { + return value === this._profileLabel; + } public setUsername(value: string) { this.username = value; @@ -165,12 +180,12 @@ export class Repository extends EndevorEntity { } public getUrlString(): string { - let urlPath: string = 'EndevorService/rest/' + this.datasource; + let urlPath: string = "EndevorService/rest/" + this.datasource; if (this.datasource !== "") { - urlPath = urlPath + '/'; + urlPath = urlPath + "/"; } - if (!this.url.endsWith('/')) { - urlPath = '/' + urlPath; + if (!this.url.endsWith("/")) { + urlPath = "/" + urlPath; } return this.url + urlPath; } @@ -180,7 +195,7 @@ export class Repository extends EndevorEntity { } public getIFilters(): Filter[] { - let resultFilters: Filter[] = []; + const resultFilters: Filter[] = []; this._filters.forEach(filter => { resultFilters.push({ uri: filter.getUri() }); }); @@ -223,7 +238,7 @@ export class Repository extends EndevorEntity { if (repo.filters.length !== this.filters.length) { return false; } - for (let filter of repo.filters) { + for (const filter of repo.filters) { if (!this.findFilter(filter.getUri())) { return false; } diff --git a/src/service/GitBridgeSupport.ts b/src/service/GitBridgeSupport.ts index 226237e90..9a0084aca 100644 --- a/src/service/GitBridgeSupport.ts +++ b/src/service/GitBridgeSupport.ts @@ -111,9 +111,11 @@ export class GitBridgeSupport { ); if (result === "Import") { const repos: Repository[] = SettingsFacade.listRepositories(); - const newRepo: Repository = new Repository(hostName, repoUrl, "", undefined, configuration); + // TODO: check profileLabel implications here + const newRepo: Repository = new Repository(hostName, repoUrl, "", undefined, configuration, ""); repos.push(newRepo); - SettingsFacade.updateRepositories(repos); + // TODO: FIX ME + // SettingsFacade.updateRepositories(repos); } return result; } diff --git a/src/service/Profiles.ts b/src/service/Profiles.ts new file mode 100644 index 000000000..d1777bb5f --- /dev/null +++ b/src/service/Profiles.ts @@ -0,0 +1,371 @@ +/* +* This program and the accompanying materials are made available under the terms of the * +* Eclipse Public License v2.0 which accompanies this distribution, and is available at * +* https://www.eclipse.org/legal/epl-v20.html * +* * +* SPDX-License-Identifier: EPL-2.0 * +* * +* Copyright Contributors to the Zowe Project. * +* * +*/ + +import { CliProfileManager, ImperativeConfig, IProfile, IProfileLoaded, ISession, Logger, Session } from "@zowe/imperative"; +import * as fs from "fs"; +import * as os from "os"; +import * as path from "path"; +import { URL } from "url"; +import * as vscode from "vscode"; +import { IConnection } from "../model/IConnection"; + +interface IUrlValidator { + valid: boolean; + host: string; + port: number; +} + +export class Profiles { + public static async createInstance(log: Logger) { + Profiles.loader = new Profiles(log); + await Profiles.loader.refresh(); + return Profiles.loader; + + } + public static getInstance() { + return Profiles.loader; + } + + private endevorProfileManager: CliProfileManager; + private static loader: Profiles; + public allProfiles: IProfileLoaded[] = []; + public defaultProfile: IProfileLoaded; + + private spawnValue: number = -1; + private initValue: number = -1; + private constructor(public log: Logger) {} + + public loadNamedProfile(name: string): IProfileLoaded { + for (const profile of this.allProfiles) { + if (profile.name === name && profile.type === "endevor") { + return profile; + } + } + throw new Error("Could not find profile named: " + + name + "."); + } + public getDefaultProfile(): IProfileLoaded { + return this.defaultProfile; + } + public async refresh() { + this.allProfiles = []; + const profileManager = this.getEndevorCliProfileManager(); + const endevorProfiles = (await profileManager.loadAll()).filter(profile => { + return profile.type === "endevor"; + }); + if (endevorProfiles && endevorProfiles.length > 0) { + this.allProfiles.push(...endevorProfiles); + let defaultProfile: IProfileLoaded; + try { + defaultProfile = await profileManager.load({ loadDefault: true}); + this.defaultProfile = defaultProfile ? defaultProfile : undefined; + } catch (error) { + vscode.window.showInformationMessage(error.message); + } + } + + // TODO: case for SCS, but not covered now (check in latest ZE) + // if (this.isSpawnReqd() === 0) { + // // this.allProfiles = ProfileLoader.loadAllProfiles(); + // this.allProfiles = (await this.getEndevorCliProfileManager().loadAll()).filter(profile => { + // return profile.type === "endevor"; + // }); + // try { + // this.defaultProfile = ProfileLoader.loadDefaultProfile(this.log); + // } catch (err) { + // // Unable to load a default profile + // this.log.warn("Unable to locate a default profile. CLI may not be installed. " + err.message); + // } + // } else { + // // const profileManager = new CliProfileManager({ + // // profileRootDirectory: path.join(os.homedir(), ".zowe", "profiles"), + // // type: "endevor", + // // }); + // // TODO: if the code above returns already a specific type profile, why we need to filter again? + // // this.allProfiles = (await profileManager.loadAll()).filter(profile => { + // this.allProfiles = (await this.getEndevorCliProfileManager().loadAll()).filter(profile => { + // return profile.type === "endevor"; + // }); + // if (this.allProfiles.length > 0) { + // this.defaultProfile = (await this.getEndevorCliProfileManager().load({ loadDefault: true })); + // } else { + // ProfileLoader.loadDefaultProfile(this.log); + // } + // } + } + + public listProfiles() { + return this.allProfiles; + } + + public validateAndParseUrl = (newUrl: string): IUrlValidator => { + // TODO: this is not true for endevor, need to be reviewed + let url: URL; + const validProtocols: string[] = ["https", "http"]; + // const DEFAULT_HTTPS_PORT: number = 443; + + const validationResult: IUrlValidator = { + valid: false, + host: null, + port: null, + }; + + try { + url = new URL(newUrl); + } catch (error) { + return validationResult; + } + + // overkill with only one valid protocol, but we may expand profile types and protocols in the future? + if (!validProtocols.some((validProtocol: string) => url.protocol.includes(validProtocol))) { + return validationResult; + } + + // if port is empty, return invalid + // TODO: is there a default port? need to ask Endevor or check docs + if (!url.port.trim()) { + // validationResult.port = DEFAULT_HTTPS_PORT; + return validationResult; + } else { + validationResult.port = Number(url.port); + } + + validationResult.host = url.hostname; + validationResult.valid = true; + return validationResult; + } + + public async getUrl(urlInputBox): Promise { + return new Promise (resolve => { + urlInputBox.onDidHide(() => { resolve(urlInputBox.value); }); + urlInputBox.onDidAccept(() => { + if (this.validateAndParseUrl(urlInputBox.value).valid) { + resolve(urlInputBox.value); + } else { + urlInputBox.validationMessage = "Please enter a valid URL in the format https://url:port."; + } + }); + }); + } + + public async createNewConnection(profileName: string): Promise { + let userName: string; + let passWord: string; + let endevorURL: string; + let rejectUnauthorize: boolean; + let options: vscode.InputBoxOptions; + + const urlInputBox = vscode.window.createInputBox(); + urlInputBox.ignoreFocusOut = true; + urlInputBox.placeholder = "http(s)://url:port"; + urlInputBox.prompt = "Enter an Endevor URL in the format 'http(s)://url:port'."; + + urlInputBox.show(); + endevorURL = await this.getUrl(urlInputBox); + urlInputBox.dispose(); + + if (!endevorURL) { + vscode.window.showInformationMessage("No valid value for Endevor URL. Operation Cancelled"); + return undefined; + } + + const endevorUrlParsed = this.validateAndParseUrl(endevorURL); + + options = { + placeHolder: "Optional: User Name", + prompt: "Enter the user name for the connection. Leave blank to not store.", + value: userName, + }; + userName = await vscode.window.showInputBox(options); + + if (userName === undefined) { + vscode.window.showInformationMessage("Operation Cancelled"); + return; + } + + options = { + placeHolder: "Optional: Password", + prompt: "Enter the password for the connection. Leave blank to not store.", + password: true, + value: passWord, + }; + passWord = await vscode.window.showInputBox(options); + + if (passWord === undefined) { + vscode.window.showInformationMessage("Operation Cancelled"); + return; + } + + const quickPickOptions: vscode.QuickPickOptions = { + placeHolder: "Reject Unauthorized Connections", + ignoreFocusOut: true, + canPickMany: false, + }; + + const selectRU = ["True - Reject connections with self-signed certificates", + "False - Accept connections with self-signed certificates"]; + + const ruOptions = Array.from(selectRU); + + const chosenRU = await vscode.window.showQuickPick(ruOptions, quickPickOptions); + + if (chosenRU === ruOptions[0]) { + rejectUnauthorize = true; + } else if (chosenRU === ruOptions[1]) { + rejectUnauthorize = false; + } else { + vscode.window.showInformationMessage("Operation Cancelled"); + return undefined; + } + + for (const profile of this.allProfiles) { + if (profile.name === profileName) { + vscode.window.showErrorMessage("Profile name already exists. Please create a profile using a different name"); + return undefined; + } + } + + const connection: IConnection = { + name: profileName, + host: endevorUrlParsed.host, + port: endevorUrlParsed.port, + user: userName, + password: passWord, + rejectUnauthorized: rejectUnauthorize, + }; + + let newProfile: IProfile; + + try { + newProfile = await this.saveProfile(connection, connection.name, "endevor"); + } catch (error) { + vscode.window.showErrorMessage(error.message); + } + await this.createBasicEndevorSession(newProfile); + vscode.window.showInformationMessage("Profile " + profileName + " was created."); + await this.refresh(); + return profileName; + } + + public async createBasicEndevorSession(profile) { + this.log.debug("Creating an Endevor session from the profile named %s", profile.name); + return new Session({ + // TODO: NEED TO TAYLOR FOR ENDEVOR. THIS IS FOR ZOSMF + type: "basic", + hostname: profile.host, + port: profile.port, + user: profile.user, + password: profile.password, + base64EncodedAuth: profile.auth, + rejectUnauthorized: profile.rejectUnauthorized, + basePath: profile.basePath, + }); + } + + public async promptCredentials(sessName) { + let userName: string; + let passWord: string; + let options: vscode.InputBoxOptions; + + const loadProfile = this.loadNamedProfile(sessName); + const loadSession = loadProfile.profile as ISession; + + if (!loadSession.user) { + + options = { + placeHolder: "User Name", + prompt: "Enter the user name for the connection", + value: userName, + }; + userName = await vscode.window.showInputBox(options); + + if (!userName) { + vscode.window.showErrorMessage("Please enter your z/OS username. Operation Cancelled"); + return; + } else { + loadSession.user = userName; + } + } + + if (!loadSession.password) { + passWord = loadSession.password; + + options = { + placeHolder: "Password", + prompt: "Enter a password for the connection", + password: true, + value: passWord, + }; + passWord = await vscode.window.showInputBox(options); + + if (!passWord) { + vscode.window.showErrorMessage("Please enter your z/OS password. Operation Cancelled"); + return; + } else { + loadSession.password = passWord.trim(); + } + } + const updSession = await this.createBasicEndevorSession(loadSession as IProfile); + return [updSession.ISession.user, updSession.ISession.password, updSession.ISession.base64EncodedAuth]; + } + + public getEndevorCliProfileManager(): CliProfileManager { + let profileManager = this.endevorProfileManager; + if (!profileManager) { + profileManager = new CliProfileManager({ + profileRootDirectory: path.join(this.getZoweDir(), "profiles"), + type: "endevor", + }); + if (profileManager) { + this.endevorProfileManager = profileManager; + } else { + return undefined; + } + } + return profileManager; + } + + private getZoweDir(): string { + ImperativeConfig.instance.loadedConfig = { + defaultHome: path.join(os.homedir(), ".zowe"), + envVariablePrefix: "ZOWE" + }; + return ImperativeConfig.instance.cliHome; + } + + private async saveProfile(ProfileInfo, ProfileName, ProfileType) { + let endevorProfile: IProfile; + try { + endevorProfile = await this.getEndevorCliProfileManager().save({ profile: ProfileInfo, name: ProfileName, type: ProfileType }); + } catch (error) { + vscode.window.showErrorMessage(error.message); + } + return endevorProfile.profile; + } + + // TODO: this checks for credential manager override, i.e. SCS + // private isSpawnReqd() { + // if (this.spawnValue === -1) { + // const homedir = os.homedir(); + // this.spawnValue = 0; + // try { + // const fileName = path.join(homedir, ".zowe", "settings", "imperative.json"); + // const settings = JSON.parse(fs.readFileSync(fileName).toString()); + // const value = settings.overrides.CredentialManager; + // this.spawnValue = value !== false ? 0 : 1; + // } catch (error) { + // // default to spawn + // this.spawnValue = 0; + // } + // } + // return this.spawnValue; + // } +} diff --git a/src/service/SettingsFacade.ts b/src/service/SettingsFacade.ts index 96510a04d..528805e35 100644 --- a/src/service/SettingsFacade.ts +++ b/src/service/SettingsFacade.ts @@ -13,23 +13,36 @@ */ import * as vscode from "vscode"; +import { EndevorController } from "../EndevorController"; import { EndevorFilter } from "../model/EndevorFilter"; import { Host } from "../model/IEndevorInstance"; import { Repository } from "../model/Repository"; +import { Connection } from "../model/Connection"; +import { Profiles } from "./Profiles"; -export const HOST_SETTINGS_KEY: string = "endevor.hosts"; +// export const HOST_SETTINGS_KEY: string = "endevor.hosts"; +export const HOST_SETTINGS_KEY: string = "endevor.connections"; export class SettingsFacade { - public static listRepositories(): Repository[] { + public static listConnections(): any[] { + return vscode.workspace.getConfiguration().get(HOST_SETTINGS_KEY, []); + } + + // TODO: remove optional param (call in bridge4git needs to be fixed as well) + public static listRepositories(connectionLabel?: string): Repository[] { const repos: Repository[] = []; - const hosts: Host[] = vscode.workspace.getConfiguration().get(HOST_SETTINGS_KEY, []) as Host[]; + // tslint:disable-next-line: max-line-length + const connectionInSettings = vscode.workspace.getConfiguration().get(HOST_SETTINGS_KEY, []).find(connection => connection.name === connectionLabel); + const hosts: Host[] = connectionInSettings ? connectionInSettings.hosts : []; + const profile = Profiles.getInstance().loadNamedProfile(connectionLabel).profile; hosts.forEach(host => { const repo: Repository = new Repository( host.name, - host.url, - host.username, - host.password, + `${profile.protocol}://${profile.host}:${profile.port}`, + profile.user, + profile.password, host.datasource, + host.profileLabel, host.id, ); if (host.filters) { @@ -45,7 +58,42 @@ export class SettingsFacade { return repos; } - public static async updateRepositories(repos: Repository[]) { + // create a snapshot of connections and write is to settings file + // TODO: later look into how to update only 1 connection or one host / connection + public static async updateSettings(connections: Connection[]) { + const conns = []; + connections.forEach(connection => { + const toPush = { + name: connection.getName(), + // tslint:disable-next-line: object-literal-sort-keys + hosts: [], + }; + connection.getRepositoryList().forEach(repo => { + toPush.hosts.push({ + datasource: repo.getDatasource(), + filters: repo.getIFilters(), + id: repo.id, + name: repo.getName(), + profileLabel: repo.getProfileLabel(), + url: repo.getUrl(), + username: repo.getUsername(), + }); + }); + if (toPush.hosts.length > 0) { + conns.push(toPush); + } + }); + try { + await vscode.workspace.getConfiguration().update(HOST_SETTINGS_KEY, conns); + } catch (error) { + vscode.window.showErrorMessage("Save settings error: " + error); + } + + } + + // TODO: this is not update but overwrite, so source of truth is always Repositories !!! + public static async updateRepositories(connection: Connection) { + const repos = connection.getRepositoryList(); const hosts: Host[] = []; repos.forEach(repo => { hosts.push({ @@ -53,12 +101,17 @@ export class SettingsFacade { filters: repo.getIFilters(), id: repo.id, name: repo.getName(), + profileLabel: repo.getProfileLabel(), url: repo.getUrl(), username: repo.getUsername(), }); }); + const value = { + "endevor.hosts" : hosts, + } + try { - await vscode.workspace.getConfiguration().update(HOST_SETTINGS_KEY, hosts); + await vscode.workspace.getConfiguration().update(HOST_SETTINGS_KEY, value); } catch (error) { vscode.window.showErrorMessage("Save settings error: " + error); } diff --git a/src/ui/tree/EndevorDataProvider.ts b/src/ui/tree/EndevorDataProvider.ts index 2473bdb79..f0b51305b 100644 --- a/src/ui/tree/EndevorDataProvider.ts +++ b/src/ui/tree/EndevorDataProvider.ts @@ -13,44 +13,89 @@ */ import * as vscode from 'vscode'; -import { EndevorNode, EndevorBrowsingNode, FilterNode, EndevorFilterPathNode, NewRepositoryNode } from './EndevorNodes'; +import { EndevorNode, EndevorBrowsingNode, FilterNode, EndevorFilterPathNode, NewRepositoryNode, ConnectionNode, NewConnectionButton } from './EndevorNodes'; import { EnvironmentNode, StageNode, SystemNode, SubsystemNode, TypeNode } from './EndevorNodes'; import { EndevorController } from '../../EndevorController'; import { Repository } from '../../model/Repository'; +import { Profiles } from "../../service/Profiles"; +import { Logger, IProfileLoaded } from "@zowe/imperative"; +import { Connection } from '../../model/Connection'; + +export async function createEndevorTree(log: Logger) { + const tree = new EndevorDataProvider(); + await tree.addSession(); + return tree; +} export class EndevorDataProvider implements vscode.TreeDataProvider { - private _onDidChangeTreeData: vscode.EventEmitter = new vscode.EventEmitter(); - readonly onDidChangeTreeData: vscode.Event = this._onDidChangeTreeData.event; + public _sessionNodes: EndevorNode[] = []; + public _onDidChangeTreeData: vscode.EventEmitter = new vscode.EventEmitter(); + public readonly onDidChangeTreeData: vscode.Event = this._onDidChangeTreeData.event; - constructor() { } + // constructor() {} - getTreeItem(element: EndevorNode): vscode.TreeItem { + public getTreeItem(element: EndevorNode): vscode.TreeItem { return element; } - getChildren(node?: EndevorNode): Promise { + public addSession(sessionName?: string) { + if (sessionName) { + const endevorProfile = Profiles.getInstance().loadNamedProfile(sessionName); + if (endevorProfile) { + this.addSingleSession(endevorProfile); + } + } else { + const endevorProfiles = Profiles.getInstance().allProfiles; + // TODO: check if profile is already loaded. + // This action was done from history (stuff that got saved in config file) + for (const endevorProfile of endevorProfiles) { + if (this._sessionNodes.find(tempNode => tempNode.label.trim() === endevorProfile.name)) { + continue; + } + } + if (this._sessionNodes.length === 0) { + this.addSingleSession(Profiles.getInstance().defaultProfile); + } + } + this.refresh(); + } + + public getChildren(node?: EndevorNode): EndevorNode[] | Promise { + // if (node) { + // return node.children; + // } + // return this._sessionNodes; + // init phase. need to add profiles here instead of instances + // TODO: FIX ALL THIS DOUBLE NEGATIONS !!! if (!node) { const root: EndevorNode = EndevorController.instance.rootNode; + // 1st time, this is false (!true) if (!root.needReload) { - return Promise.resolve([new NewRepositoryNode(), ...root.children]); + return Promise.resolve([new NewConnectionButton(), ...root.children]); } - let repos: Repository[] = EndevorController.instance.getRepositories(); - let newChildren: EndevorNode[] = []; - repos.forEach(repo => { - let newRepoNode: EndevorNode = new EndevorNode(repo); - let foundNode: EndevorNode | undefined = EndevorController.instance.findNodeByRepoID(repo.id); - if (foundNode && !foundNode.needReload) { - newRepoNode.children = foundNode.children; - newRepoNode.needReload = false; - newRepoNode.collapsibleState = foundNode.collapsibleState; + const connections = EndevorController.instance.getConnections(); + const newChildren: EndevorNode[] = []; + connections.forEach(connection => { + const newConnectionNode: EndevorNode = new EndevorNode(connection); + // TODO: here I get a connection without repos + const foundConnection: EndevorNode | undefined = EndevorController.instance.findNodeByConnectionName( + connection.getName()); + // TODO: Check the logic here!!! This is to fix the refresh + // if (foundConnection && !foundConnection.needReload) { + if (foundConnection && foundConnection.needReload) { + newConnectionNode.children = foundConnection.children; + newConnectionNode.needReload = false; + newConnectionNode.collapsibleState = foundConnection.collapsibleState; } - newChildren.push(newRepoNode); + newChildren.push(newConnectionNode); }); root.needReload = false; root.children = newChildren; - return Promise.resolve([new NewRepositoryNode(), ...newChildren]); + return Promise.resolve([new NewConnectionButton(), ...newChildren]); } switch (node.contextValue) { + case "connection": + return Promise.resolve((node).children); case "repository": const repo: Repository | undefined = this.getNodeRepository(node); if (!repo) { @@ -93,6 +138,7 @@ export class EndevorDataProvider implements vscode.TreeDataProvider this._onDidChangeTreeData.fire(); } + // TODO: this might need to be moved out private getNodeRepository(node: EndevorNode): Repository | undefined { let repo: Repository | undefined = node.getRepository(); if (node instanceof EndevorBrowsingNode) { @@ -100,4 +146,15 @@ export class EndevorDataProvider implements vscode.TreeDataProvider } return repo; } + + private async addSingleSession(endevorProfile: IProfileLoaded) { + if (this._sessionNodes.find(tempNode => tempNode.label.trim() === endevorProfile.name)) { + return; + } + const session = await Profiles.getInstance().createBasicEndevorSession(endevorProfile.profile); + const node = new ConnectionNode(session, endevorProfile.name); + EndevorController.instance.addConnection(new Connection(endevorProfile)); + this._sessionNodes.push(node); + + } } diff --git a/src/ui/tree/EndevorNodes.ts b/src/ui/tree/EndevorNodes.ts index beef964c3..11d524428 100644 --- a/src/ui/tree/EndevorNodes.ts +++ b/src/ui/tree/EndevorNodes.ts @@ -16,6 +16,7 @@ import * as vscode from "vscode"; import { createEmptyNode, createPathNodes } from "../../FilterUtils"; import { Element } from "../../model/Element"; +import { Connection } from "../../model/Connection"; import { EndevorEntity } from "../../model/EndevorEntity"; import { EndevorFilter } from "../../model/EndevorFilter"; import { Environment } from "../../model/Environment"; @@ -31,6 +32,7 @@ import { proxyListElement, proxyListSubsystem, proxyListSystem, proxyListType } from "../../service/EndevorCliProxy"; +import { Session } from "@zowe/imperative"; export class EndevorNode extends vscode.TreeItem { private entity?: EndevorEntity; @@ -108,6 +110,9 @@ export class EndevorNode extends vscode.TreeItem { if (this.entity instanceof Type) { return "type"; } + if (this.entity instanceof Connection) { + return "connection"; + } return "element"; } @@ -523,6 +528,60 @@ export class TypeNode extends EndevorQualifiedNode { } } +export class ConnectionNode extends EndevorNode { + private _session: Session; + private _connection: Connection; + private _connectionName: string; + + constructor(session?: Session, label?: string, connection?: Connection) { + super(); + if (session) { + this._session = session; + } + if (label) { + this._connectionName = label; + } + if (connection) { + this._connection = connection; + // this.children = connection; + } + } + + public getProfileName(): string { + return this._connectionName; + } + + public getConnection(): Connection { + return this._connection; + } + public getSession(): Session { + return this._session; + } + + get contextValue() { + return "connection"; + } +} +export class NewConnectionButton extends EndevorNode { + constructor() { + super(); + this.command = { + command: "endevorexplorer.newConnection", + title: "Create a New Session (Profile)", + }; + // TODO remove if Theis fix naming (theia/packages/plugin-ext/src/main/browser/view/tree-views-main.tsx) + // handleTreeEvents expect node.command.id with command id, but vscode - node.command.command + // issue: https://github.com/theia-ide/theia/issues/5744 + // @ts-ignore + this.command.id = "endevorexplorer.newConnection"; + + this.label = "Create a New Session (Profile)"; + this.collapsibleState = vscode.TreeItemCollapsibleState.None; + } + get contextValue() { + return "connectionButton"; + } +} export class NewRepositoryNode extends EndevorNode { constructor() { super(); diff --git a/src/ui/views/HostPanel.ts b/src/ui/views/HostPanel.ts index e8213da09..00f875c0c 100644 --- a/src/ui/views/HostPanel.ts +++ b/src/ui/views/HostPanel.ts @@ -51,18 +51,18 @@ export class HostPanel { const password = message.data.password; const datasource = message.data.configuration; - if (EndevorController.instance.findRepoByName(name)) { - vscode.window.showErrorMessage("Host with name " + name + " already exists"); - return; - } - const targetRepo: Repository = new Repository(name, url, username, password, datasource); - EndevorController.instance.addRepository(targetRepo); + // if (EndevorController.instance.findRepoByName(name)) { + // vscode.window.showErrorMessage("Host with name " + name + " already exists"); + // return; + // } + const targetRepo: Repository = new Repository(name, url, username, password, datasource, ""); + EndevorController.instance.addRepository(targetRepo, null); EndevorController.instance.saveRepositories(); panel.dispose(); break; case "configuration": const restUrl = message.data.url; - const newRepo = new Repository("", restUrl, "", "", ""); + const newRepo = new Repository("", restUrl, "", "", "", ""); try { const session = await utils.buildSession(newRepo); const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); @@ -118,10 +118,10 @@ export class HostPanel { const name = message.data.name; const username = message.data.username; const password = message.data.password; - if (EndevorController.instance.findRepoByName(name) && repo.getName() !== name) { - vscode.window.showErrorMessage("Host with name " + name + " already exists"); - return; - } + // if (EndevorController.instance.findRepoByName(name) && repo.getName() !== name) { + // vscode.window.showErrorMessage("Host with name " + name + " already exists"); + // return; + // } repo.setName(name); repo.setUsername(username); repo.setPassword(password); diff --git a/src/utils.ts b/src/utils.ts index 75d8fee1f..2325d2999 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -18,6 +18,28 @@ import { EndevorQualifier } from "./model/IEndevorQualifier"; import { Repository } from "./model/Repository"; import { CredentialsInputBox } from "./ui/tree/CredentialsInput"; import { EndevorElementNode } from "./ui/tree/EndevorNodes"; +import { QuickPickItem, QuickPick } from "vscode"; + +export async function resolveQuickPickHelper(quickpick: QuickPick): Promise { + return new Promise( + (c) => quickpick.onDidAccept(() => c(quickpick.activeItems[0]))); +} + +// tslint:disable-next-line: max-classes-per-file +export class FilterItem implements QuickPickItem { + constructor(private text: string) { } + get label(): string { return this.text; } + get description(): string { return ""; } + get alwaysShow(): boolean { return false; } +} + +// tslint:disable-next-line: max-classes-per-file +export class FilterDescriptor implements QuickPickItem { + constructor(private text: string) { } + get label(): string { return this.text; } + get description(): string { return ""; } + get alwaysShow(): boolean { return true; } +} export function toArray(data: any): T[] { if (Array.isArray(data)) { From 4e7524e258f12d5c1bff948e3a4aaa1a7edf4e31 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Fri, 12 Jun 2020 15:49:57 +0200 Subject: [PATCH 28/49] fix rename repo Signed-off-by: Alexandru-Paul Dumitru --- src/EndevorController.ts | 22 +++++++++++++++++++--- src/commands/AddFilter.ts | 2 +- src/commands/DeleteConnection.ts | 2 +- src/commands/DeleteFilter.ts | 2 +- src/commands/DeleteHost.ts | 2 +- src/commands/EditFilter.ts | 2 +- src/commands/HostDialogs.ts | 4 ++-- src/extension.ts | 4 ---- src/ui/tree/CredentialsInput.ts | 2 +- src/ui/views/HostPanel.ts | 4 ++-- 10 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/EndevorController.ts b/src/EndevorController.ts index ee7316efe..0efd5820c 100644 --- a/src/EndevorController.ts +++ b/src/EndevorController.ts @@ -94,9 +94,25 @@ export class EndevorController { }); } - public saveRepositories() { - SettingsFacade.updateSettings(this.getConnections()); + public updateRepositoryName(oldRepoName: string, newRepoName: string, connectionlabel: string) { + const newMap = new Map(); + this.connections.get(connectionlabel).getRepositoryMap().forEach((repo, name) => { + if (name === oldRepoName) { + repo.setName(newRepoName); + newMap.set(newRepoName, repo); + } else { + newMap.set(name, repo); + } + }); + this.connections.get(connectionlabel).repositories = newMap; + const cnxIdx = this.rootNode.children.findIndex(node => node.label === connectionlabel); + const repoIdx = this.rootNode.children[cnxIdx].children.findIndex(repo => repo.label === oldRepoName); + this.rootNode.children[cnxIdx].children[repoIdx].label = newRepoName; } + // TODO: delete this eventually. Name is misleading. renamed it + // public saveRepositories() { + // SettingsFacade.updateSettings(this.getConnections()); + // } public updateSettings() { SettingsFacade.updateSettings(this.getConnections()); @@ -230,7 +246,7 @@ export class EndevorController { } }); if (saveRepos) { - this.saveRepositories(); + this.updateSettings(); } } diff --git a/src/commands/AddFilter.ts b/src/commands/AddFilter.ts index 9f6706340..10a83dd20 100644 --- a/src/commands/AddFilter.ts +++ b/src/commands/AddFilter.ts @@ -38,7 +38,7 @@ export function addFilter(arg: any) { if (filterUri) { const repo: Repository = arg.getRepository(); repo.filters.push(new EndevorFilter(repo, filterUri)); - EndevorController.instance.saveRepositories(); + EndevorController.instance.updateSettings(); } }); } diff --git a/src/commands/DeleteConnection.ts b/src/commands/DeleteConnection.ts index b7dfbeafc..f2370f1db 100644 --- a/src/commands/DeleteConnection.ts +++ b/src/commands/DeleteConnection.ts @@ -23,7 +23,7 @@ export function deleteConnection(arg:any){ EndevorController.instance.removeConnection(arg.label); vscode.commands.executeCommand("endevorexplorer.refreshHosts"); vscode.window.showInformationMessage("Session removed."); - EndevorController.instance.saveRepositories(); + EndevorController.instance.updateSettings(); } else { vscode.window.showInformationMessage("Operation cancelled."); } diff --git a/src/commands/DeleteFilter.ts b/src/commands/DeleteFilter.ts index 591ce529c..7b1653436 100644 --- a/src/commands/DeleteFilter.ts +++ b/src/commands/DeleteFilter.ts @@ -24,7 +24,7 @@ export function deleteFilter(arg: any) { vscode.window.showWarningMessage("Delete filter: " + filter.getName() + "?", "OK").then(message => { if (message === "OK") { filter.deleteFilter(); - EndevorController.instance.saveRepositories(); + EndevorController.instance.updateSettings(); } }); } diff --git a/src/commands/DeleteHost.ts b/src/commands/DeleteHost.ts index 115026825..a9ece0735 100644 --- a/src/commands/DeleteHost.ts +++ b/src/commands/DeleteHost.ts @@ -23,7 +23,7 @@ export function deleteHost(arg:any){ vscode.window.showWarningMessage("Delete connection: " + repo.getName() + "?", "OK").then(message => { if (message === "OK") { EndevorController.instance.removeRepository(repo.getName(), repo.getProfileLabel()); - EndevorController.instance.saveRepositories(); + EndevorController.instance.updateSettings(); } }); } diff --git a/src/commands/EditFilter.ts b/src/commands/EditFilter.ts index c7d066e5f..c9abc3d7d 100644 --- a/src/commands/EditFilter.ts +++ b/src/commands/EditFilter.ts @@ -36,7 +36,7 @@ export function editFilter(arg: any) { if (filter.getUri() !== filterUri) { filter.editFilter(filterUri); (arg).children = []; - EndevorController.instance.saveRepositories(); + EndevorController.instance.updateSettings(); } } } diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index 9aba9162a..003a721bf 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -158,8 +158,8 @@ export class HostDialogs { return; } const oldName = repo.getName(); - repo.setName(newName); - EndevorController.instance.saveRepositories(); + EndevorController.instance.updateRepositoryName(oldName, newName, repo.getProfileLabel()); + EndevorController.instance.updateSettings(); window.showInformationMessage(`Connection ${oldName} was renamed to ${newName}.`); } } diff --git a/src/extension.ts b/src/extension.ts index 910610de3..f90d124f1 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -108,10 +108,6 @@ export async function activate(context: vscode.ExtensionContext) { vscode.commands.registerCommand("endevorexplorer.updateHost", (arg: any) => { if (arg.contextValue === "repository") { HostDialogs.editHost(arg); - // const repo: Repository | undefined = arg.getRepository(); - // if (repo) { - // HostDialogs.editHost(repo); - // } } }), ); diff --git a/src/ui/tree/CredentialsInput.ts b/src/ui/tree/CredentialsInput.ts index f3f2451f2..d6b612bac 100644 --- a/src/ui/tree/CredentialsInput.ts +++ b/src/ui/tree/CredentialsInput.ts @@ -34,7 +34,7 @@ export class CredentialsInputBox { } repo.setUsername(username); repo.setPassword(password); - EndevorController.instance.saveRepositories(); + EndevorController.instance.updateSettings(); return { password, username }; } private static async showUserName(username: string): Promise { diff --git a/src/ui/views/HostPanel.ts b/src/ui/views/HostPanel.ts index 00f875c0c..c88416e31 100644 --- a/src/ui/views/HostPanel.ts +++ b/src/ui/views/HostPanel.ts @@ -57,7 +57,7 @@ export class HostPanel { // } const targetRepo: Repository = new Repository(name, url, username, password, datasource, ""); EndevorController.instance.addRepository(targetRepo, null); - EndevorController.instance.saveRepositories(); + EndevorController.instance.updateSettings(); panel.dispose(); break; case "configuration": @@ -125,7 +125,7 @@ export class HostPanel { repo.setName(name); repo.setUsername(username); repo.setPassword(password); - EndevorController.instance.saveRepositories(); + EndevorController.instance.updateSettings(); panel.dispose(); }, undefined, From 05eda3bd367f8beeab47fc429ce63a9b343b95ce Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Mon, 15 Jun 2020 17:26:02 +0200 Subject: [PATCH 29/49] remove most of TODOs - fixed issues with protocol - not passed downstream at profile creation and also upstream when profile was used to create connection session Signed-off-by: Alexandru-Paul Dumitru --- src/EndevorController.ts | 6 --- src/extension.ts | 7 +--- src/model/IConnection.ts | 5 ++- src/model/IEndevorInstance.ts | 1 - src/service/EndevorCliProxy.ts | 3 -- src/service/Profiles.ts | 60 +++--------------------------- src/service/SettingsFacade.ts | 4 +- src/ui/tree/EndevorDataProvider.ts | 11 ------ src/ui/views/HostPanel.ts | 7 ---- src/utils.ts | 15 ++------ 10 files changed, 16 insertions(+), 103 deletions(-) diff --git a/src/EndevorController.ts b/src/EndevorController.ts index 0efd5820c..870171c3b 100644 --- a/src/EndevorController.ts +++ b/src/EndevorController.ts @@ -109,10 +109,6 @@ export class EndevorController { const repoIdx = this.rootNode.children[cnxIdx].children.findIndex(repo => repo.label === oldRepoName); this.rootNode.children[cnxIdx].children[repoIdx].label = newRepoName; } - // TODO: delete this eventually. Name is misleading. renamed it - // public saveRepositories() { - // SettingsFacade.updateSettings(this.getConnections()); - // } public updateSettings() { SettingsFacade.updateSettings(this.getConnections()); @@ -149,8 +145,6 @@ export class EndevorController { // Check if node is already defined in root tree let repoNode: EndevorNode | undefined = EndevorController.instance.findNodeByRepoID(settingsRepo.id, connName); let repoToKeep: Repository = settingsRepo; - // TODO: check here what happens if there is repoNode. At load, this is empty - // this is the case when a repo is already defined in the tree and settings are loaded if (repoNode) { let modelRepo: Repository | undefined = repoNode.getRepository(); if (modelRepo) { diff --git a/src/extension.ts b/src/extension.ts index f90d124f1..bad6e681f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -104,7 +104,6 @@ export async function activate(context: vscode.ExtensionContext) { vscode.commands.registerCommand("endevorexplorer.deleteConnection", deleteConnection)); context.subscriptions.push( - // TODO: this doesn't work (not shown in tree, even after refresh) vscode.commands.registerCommand("endevorexplorer.updateHost", (arg: any) => { if (arg.contextValue === "repository") { HostDialogs.editHost(arg); @@ -123,7 +122,6 @@ export async function activate(context: vscode.ExtensionContext) { endevorDataProvider.refresh(); }), ); - // TODO: add filter also cleans out the tree (something is wrong with reloading) context.subscriptions.push(vscode.commands.registerCommand(Commands.AddFilter, addFilter)); context.subscriptions.push(vscode.commands.registerCommand(Commands.EditFilter, editFilter)); context.subscriptions.push(vscode.commands.registerCommand(Commands.DeleteFilter, deleteFilter)); @@ -143,9 +141,8 @@ export async function activate(context: vscode.ExtensionContext) { context.subscriptions.push( vscode.workspace.onDidChangeConfiguration(event => { if (event.affectsConfiguration(HOST_SETTINGS_KEY)) { - // TODO: NEED TO FIX THIS. is adding it 2 times - // EndevorController.instance.loadRepositories(); endevorDataProvider.refresh(); + vscode.commands.executeCommand("endevorexplorer.refreshHosts"); } }), ); @@ -153,4 +150,4 @@ export async function activate(context: vscode.ExtensionContext) { } // tslint:disable-next-line: no-empty -export function deactivate() {} \ No newline at end of file +export function deactivate() {} diff --git a/src/model/IConnection.ts b/src/model/IConnection.ts index 584b8d292..b1e343b36 100644 --- a/src/model/IConnection.ts +++ b/src/model/IConnection.ts @@ -12,11 +12,14 @@ * Broadcom, Inc. - initial API and implementation */ -export interface IConnection { +import { IProfile } from "@zowe/imperative"; + +export interface IConnection extends IProfile { name: string; host: string; port: number; user: string; password: string; rejectUnauthorized: boolean; + protocol: string; } diff --git a/src/model/IEndevorInstance.ts b/src/model/IEndevorInstance.ts index b1eccfcde..7589666c5 100644 --- a/src/model/IEndevorInstance.ts +++ b/src/model/IEndevorInstance.ts @@ -22,7 +22,6 @@ export interface Host { password?: string; datasource: string; filters?: Filter[]; - // TODO: change this to mandatory later profileLabel?: string; } diff --git a/src/service/EndevorCliProxy.ts b/src/service/EndevorCliProxy.ts index 074445a6b..28a7b306b 100644 --- a/src/service/EndevorCliProxy.ts +++ b/src/service/EndevorCliProxy.ts @@ -62,9 +62,6 @@ export async function proxyRetrieveAcmComponents(repository: Repository, instance, endevorElement, requestBody); - // TODO: IEndevorAcmComponents is not on par with IElement. Should we map it? - // const elements: IElement[] = await EndevorRestClient.retrieveElementDependencies(repo, eq); - // const elements: any = queryacmCompResponse.data as IEndevorAcmComponents[]; return queryacmCompResponse.data as IElement[]; } diff --git a/src/service/Profiles.ts b/src/service/Profiles.ts index d1777bb5f..d97a44ad2 100644 --- a/src/service/Profiles.ts +++ b/src/service/Profiles.ts @@ -21,6 +21,7 @@ interface IUrlValidator { valid: boolean; host: string; port: number; + protocol: string; } export class Profiles { @@ -71,35 +72,6 @@ export class Profiles { vscode.window.showInformationMessage(error.message); } } - - // TODO: case for SCS, but not covered now (check in latest ZE) - // if (this.isSpawnReqd() === 0) { - // // this.allProfiles = ProfileLoader.loadAllProfiles(); - // this.allProfiles = (await this.getEndevorCliProfileManager().loadAll()).filter(profile => { - // return profile.type === "endevor"; - // }); - // try { - // this.defaultProfile = ProfileLoader.loadDefaultProfile(this.log); - // } catch (err) { - // // Unable to load a default profile - // this.log.warn("Unable to locate a default profile. CLI may not be installed. " + err.message); - // } - // } else { - // // const profileManager = new CliProfileManager({ - // // profileRootDirectory: path.join(os.homedir(), ".zowe", "profiles"), - // // type: "endevor", - // // }); - // // TODO: if the code above returns already a specific type profile, why we need to filter again? - // // this.allProfiles = (await profileManager.loadAll()).filter(profile => { - // this.allProfiles = (await this.getEndevorCliProfileManager().loadAll()).filter(profile => { - // return profile.type === "endevor"; - // }); - // if (this.allProfiles.length > 0) { - // this.defaultProfile = (await this.getEndevorCliProfileManager().load({ loadDefault: true })); - // } else { - // ProfileLoader.loadDefaultProfile(this.log); - // } - // } } public listProfiles() { @@ -107,15 +79,14 @@ export class Profiles { } public validateAndParseUrl = (newUrl: string): IUrlValidator => { - // TODO: this is not true for endevor, need to be reviewed let url: URL; const validProtocols: string[] = ["https", "http"]; - // const DEFAULT_HTTPS_PORT: number = 443; const validationResult: IUrlValidator = { valid: false, host: null, port: null, + protocol: null, }; try { @@ -127,12 +98,11 @@ export class Profiles { // overkill with only one valid protocol, but we may expand profile types and protocols in the future? if (!validProtocols.some((validProtocol: string) => url.protocol.includes(validProtocol))) { return validationResult; + } else { + validationResult.protocol = url.protocol.replace(":", ""); } - // if port is empty, return invalid - // TODO: is there a default port? need to ask Endevor or check docs if (!url.port.trim()) { - // validationResult.port = DEFAULT_HTTPS_PORT; return validationResult; } else { validationResult.port = Number(url.port); @@ -150,7 +120,7 @@ export class Profiles { if (this.validateAndParseUrl(urlInputBox.value).valid) { resolve(urlInputBox.value); } else { - urlInputBox.validationMessage = "Please enter a valid URL in the format https://url:port."; + urlInputBox.validationMessage = "Please enter a valid URL in the format http(s)://url:port."; } }); }); @@ -240,6 +210,7 @@ export class Profiles { user: userName, password: passWord, rejectUnauthorized: rejectUnauthorize, + protocol: endevorUrlParsed.protocol, }; let newProfile: IProfile; @@ -258,7 +229,6 @@ export class Profiles { public async createBasicEndevorSession(profile) { this.log.debug("Creating an Endevor session from the profile named %s", profile.name); return new Session({ - // TODO: NEED TO TAYLOR FOR ENDEVOR. THIS IS FOR ZOSMF type: "basic", hostname: profile.host, port: profile.port, @@ -350,22 +320,4 @@ export class Profiles { } return endevorProfile.profile; } - - // TODO: this checks for credential manager override, i.e. SCS - // private isSpawnReqd() { - // if (this.spawnValue === -1) { - // const homedir = os.homedir(); - // this.spawnValue = 0; - // try { - // const fileName = path.join(homedir, ".zowe", "settings", "imperative.json"); - // const settings = JSON.parse(fs.readFileSync(fileName).toString()); - // const value = settings.overrides.CredentialManager; - // this.spawnValue = value !== false ? 0 : 1; - // } catch (error) { - // // default to spawn - // this.spawnValue = 0; - // } - // } - // return this.spawnValue; - // } } diff --git a/src/service/SettingsFacade.ts b/src/service/SettingsFacade.ts index 528805e35..802ac7ebb 100644 --- a/src/service/SettingsFacade.ts +++ b/src/service/SettingsFacade.ts @@ -58,8 +58,6 @@ export class SettingsFacade { return repos; } - // create a snapshot of connections and write is to settings file - // TODO: later look into how to update only 1 connection or one host / connection public static async updateSettings(connections: Connection[]) { const conns = []; connections.forEach(connection => { @@ -91,7 +89,7 @@ export class SettingsFacade { } - // TODO: this is not update but overwrite, so source of truth is always Repositories !!! + // this is not update but overwrite, so source of truth is always Repositories public static async updateRepositories(connection: Connection) { const repos = connection.getRepositoryList(); const hosts: Host[] = []; diff --git a/src/ui/tree/EndevorDataProvider.ts b/src/ui/tree/EndevorDataProvider.ts index f0b51305b..11fe45506 100644 --- a/src/ui/tree/EndevorDataProvider.ts +++ b/src/ui/tree/EndevorDataProvider.ts @@ -46,8 +46,6 @@ export class EndevorDataProvider implements vscode.TreeDataProvider } } else { const endevorProfiles = Profiles.getInstance().allProfiles; - // TODO: check if profile is already loaded. - // This action was done from history (stuff that got saved in config file) for (const endevorProfile of endevorProfiles) { if (this._sessionNodes.find(tempNode => tempNode.label.trim() === endevorProfile.name)) { continue; @@ -61,12 +59,6 @@ export class EndevorDataProvider implements vscode.TreeDataProvider } public getChildren(node?: EndevorNode): EndevorNode[] | Promise { - // if (node) { - // return node.children; - // } - // return this._sessionNodes; - // init phase. need to add profiles here instead of instances - // TODO: FIX ALL THIS DOUBLE NEGATIONS !!! if (!node) { const root: EndevorNode = EndevorController.instance.rootNode; // 1st time, this is false (!true) @@ -77,10 +69,8 @@ export class EndevorDataProvider implements vscode.TreeDataProvider const newChildren: EndevorNode[] = []; connections.forEach(connection => { const newConnectionNode: EndevorNode = new EndevorNode(connection); - // TODO: here I get a connection without repos const foundConnection: EndevorNode | undefined = EndevorController.instance.findNodeByConnectionName( connection.getName()); - // TODO: Check the logic here!!! This is to fix the refresh // if (foundConnection && !foundConnection.needReload) { if (foundConnection && foundConnection.needReload) { newConnectionNode.children = foundConnection.children; @@ -138,7 +128,6 @@ export class EndevorDataProvider implements vscode.TreeDataProvider this._onDidChangeTreeData.fire(); } - // TODO: this might need to be moved out private getNodeRepository(node: EndevorNode): Repository | undefined { let repo: Repository | undefined = node.getRepository(); if (node instanceof EndevorBrowsingNode) { diff --git a/src/ui/views/HostPanel.ts b/src/ui/views/HostPanel.ts index c88416e31..20119aee2 100644 --- a/src/ui/views/HostPanel.ts +++ b/src/ui/views/HostPanel.ts @@ -51,10 +51,6 @@ export class HostPanel { const password = message.data.password; const datasource = message.data.configuration; - // if (EndevorController.instance.findRepoByName(name)) { - // vscode.window.showErrorMessage("Host with name " + name + " already exists"); - // return; - // } const targetRepo: Repository = new Repository(name, url, username, password, datasource, ""); EndevorController.instance.addRepository(targetRepo, null); EndevorController.instance.updateSettings(); @@ -67,8 +63,6 @@ export class HostPanel { const session = await utils.buildSession(newRepo); const datasources: IEndevorInstance[] = await ListInstance.listInstance(session); // tslint:disable-next-line: no-commented-code - // const datasources: DataSource[] = await EndevorRestClient.listDatasources(newRepo); - // TODO: comments in /src/commands/HostDialogs.ts apply here as well const dsNames: string[] = []; for (const ds of datasources) { dsNames.push(ds.name as string); @@ -76,7 +70,6 @@ export class HostPanel { dsNames.sort(); panel.webview.postMessage({ data: dsNames }); } catch (error) { - // TODO maybe improve error handling here panel.webview.postMessage({ data: [] }); } break; diff --git a/src/utils.ts b/src/utils.ts index 2325d2999..4460619ef 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -99,15 +99,10 @@ function getBasePathFromRepo(repository: Repository): string { "/" + repository.getUrlString().split(":")[2].split("/")[2]; } -// THROWAWAY: will be covered by profile implementation with Imperative profile management export async function buildSession(repository: Repository): Promise { - // TODO: create proper type - // type HTTPS_PROTOCOL = "https"; - // type HTTP_PROTOCOL = "http"; - // from ISession, only works with https - // const protocol = repository.getUrl().split(":")[0] as HTTPS_PROTOCOL; - // BUT in reality, it only works with http - const protocol = "http"; + // hacky solution to make ISession happy + type PROTOCOL = "http" | "https"; + const protocol = repository.getUrl().split(":")[0] as PROTOCOL; const hostname: string = repository.getUrl().split(":")[1].split("/")[2]; const port = Number(repository.getUrl().split(":")[2]); const basePath = getBasePathFromRepo(repository); @@ -122,14 +117,10 @@ export async function buildSession(repository: Repository): Promise { base64EncodedAuth: Buffer.from(repository.getUsername() + ":" + repository.getPassword()).toString("base64"), basePath, hostname, - // password: repository.getPassword(), port, protocol, rejectUnauthorized: false, type: "basic", - // strictSSL: true, - // secureProtocol: 'SSLv23_method', - // user: repository.getUsername(), }; return new Session(sessionDetails); } From da77962b15dd1c12d3dd428a52c8b1e8a6645217 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Tue, 16 Jun 2020 17:04:33 +0200 Subject: [PATCH 30/49] changed text here and there to better convey the information Signed-off-by: Alexandru-Paul Dumitru --- package.json | 12 ++++++------ src/commands/DeleteHost.ts | 2 +- src/commands/HostDialogs.ts | 16 ++++++++-------- src/extension.ts | 4 ++-- src/ui/tree/EndevorNodes.ts | 6 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 012451c80..b742e6e3b 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ }, { "command": "endevorexplorer.newHost", - "title": "New connection", + "title": "Add a New Datasource", "icon": { "light": "resources/light/add.svg", "dark": "resources/dark/add.svg" @@ -50,7 +50,7 @@ }, { "command": "endevorexplorer.newConnection", - "title": "Create a New Session (Profile)", + "title": "Create a New Profile", "icon": { "light": "resources/light/add.svg", "dark": "resources/dark/add.svg" @@ -58,7 +58,7 @@ }, { "command": "endevorexplorer.deleteConnection", - "title": "Delete Session (Profile)", + "title": "Delete Profile", "icon": { "light": "resources/light/delete.svg", "dark": "resources/dark/delete.svg" @@ -66,7 +66,7 @@ }, { "command": "endevorexplorer.updateHost", - "title": "Update Host", + "title": "Rename Datasource", "icon": { "light": "resources/light/edit.svg", "dark": "resources/dark/edit.svg" @@ -74,7 +74,7 @@ }, { "command": "endevorexplorer.refreshRepo", - "title": "Refresh Repository", + "title": "Refresh", "icon": { "light": "resources/light/refresh.svg", "dark": "resources/dark/refresh.svg" @@ -82,7 +82,7 @@ }, { "command": "endevorexplorer.deleteHost", - "title": "Delete Host", + "title": "Delete", "icon": { "light": "resources/light/delete.svg", "dark": "resources/dark/delete.svg" diff --git a/src/commands/DeleteHost.ts b/src/commands/DeleteHost.ts index a9ece0735..3a0f1fcc5 100644 --- a/src/commands/DeleteHost.ts +++ b/src/commands/DeleteHost.ts @@ -20,7 +20,7 @@ export function deleteHost(arg:any){ if (arg.contextValue === "repository") { const repo: Repository | undefined = arg.getRepository(); if (repo) { - vscode.window.showWarningMessage("Delete connection: " + repo.getName() + "?", "OK").then(message => { + vscode.window.showWarningMessage("Delete Datasource: " + repo.getName() + "?", "OK").then(message => { if (message === "OK") { EndevorController.instance.removeRepository(repo.getName(), repo.getProfileLabel()); EndevorController.instance.updateSettings(); diff --git a/src/commands/HostDialogs.ts b/src/commands/HostDialogs.ts index 003a721bf..4c8773af8 100644 --- a/src/commands/HostDialogs.ts +++ b/src/commands/HostDialogs.ts @@ -26,7 +26,7 @@ import { Connection } from "../model/Connection"; export class HostDialogs { public static async addConnection() { const allProfiles = (Profiles.getInstance()).allProfiles; - const createNewProfile = "Create a New Connection to z/OS"; + const createNewProfile = "Create a New Connection to Endevor"; let chosenProfile: string; let profileNamesList = allProfiles.map(profile => { @@ -42,7 +42,7 @@ export class HostDialogs { } const createPick = new utils.FilterDescriptor("\uFF0B " + createNewProfile); const items: vscode.QuickPickItem[] = profileNamesList.map(element => new utils.FilterItem(element)); - const placeholder = "Choose \"Create new...\" to define a new profile or select an existing profile to Add to the USS Explorer"; + const placeholder = "Choose \"Create new...\" to define a new profile or select an existing one"; const quickpick = vscode.window.createQuickPick(); quickpick.items = [createPick, ...items]; @@ -65,8 +65,8 @@ export class HostDialogs { let newProfileName: any; let profileName: string; const options = { - placeHolder: "Connection Name", - prompt: "Enter a name for the connection", + placeHolder: "Profile Name", + prompt: "Enter a name for the profile", value: profileName, }; profileName = await vscode.window.showInputBox(options); @@ -137,7 +137,7 @@ export class HostDialogs { newRepo.setDatasource(dsItem.label); EndevorController.instance.addRepository(newRepo, connection.getEntity().getName()); EndevorController.instance.updateSettings(); - window.showInformationMessage("Connection " + dsItem.label + " was created."); + window.showInformationMessage("Connection to datasource " + dsItem.label + " was created."); } catch (error) { window.showErrorMessage("The host " + newRepo.getUrl() + " is not available."); } @@ -160,15 +160,15 @@ export class HostDialogs { const oldName = repo.getName(); EndevorController.instance.updateRepositoryName(oldName, newName, repo.getProfileLabel()); EndevorController.instance.updateSettings(); - window.showInformationMessage(`Connection ${oldName} was renamed to ${newName}.`); + window.showInformationMessage(`Datasource ${oldName} was renamed to ${newName}.`); } } private static async showHostNameInput(repo: Repository): Promise { return window.showInputBox({ ignoreFocusOut: true, - placeHolder: "Connection name", - prompt: "Enter a custom name for the connection.", + placeHolder: "Datasource name", + prompt: "Enter a custom name for the datasource.", validateInput: (text: string) => (text !== "" ? "" : "Please use only characters A-z and 0-9."), value: repo.getName(), }); diff --git a/src/extension.ts b/src/extension.ts index bad6e681f..65532bb0d 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -27,8 +27,8 @@ import { EndevorController } from "./EndevorController"; import { GitBridgeSupport } from "./service/GitBridgeSupport"; import { RetrieveElementService } from "./service/RetriveElementService"; import { HOST_SETTINGS_KEY } from "./service/SettingsFacade"; -import { EndevorDataProvider, createEndevorTree } from "./ui/tree/EndevorDataProvider"; -import { EndevorNode, ConnectionNode } from "./ui/tree/EndevorNodes"; +import { createEndevorTree } from "./ui/tree/EndevorDataProvider"; +import { EndevorNode } from "./ui/tree/EndevorNodes"; import { multipleElementsSelected } from "./utils"; import { Logger } from "@zowe/imperative"; import * as path from "path"; diff --git a/src/ui/tree/EndevorNodes.ts b/src/ui/tree/EndevorNodes.ts index 11d524428..357e811c1 100644 --- a/src/ui/tree/EndevorNodes.ts +++ b/src/ui/tree/EndevorNodes.ts @@ -567,7 +567,7 @@ export class NewConnectionButton extends EndevorNode { super(); this.command = { command: "endevorexplorer.newConnection", - title: "Create a New Session (Profile)", + title: "Create a New Profile", }; // TODO remove if Theis fix naming (theia/packages/plugin-ext/src/main/browser/view/tree-views-main.tsx) // handleTreeEvents expect node.command.id with command id, but vscode - node.command.command @@ -575,7 +575,7 @@ export class NewConnectionButton extends EndevorNode { // @ts-ignore this.command.id = "endevorexplorer.newConnection"; - this.label = "Create a New Session (Profile)"; + this.label = "Create a New Profile"; this.collapsibleState = vscode.TreeItemCollapsibleState.None; } get contextValue() { @@ -595,7 +595,7 @@ export class NewRepositoryNode extends EndevorNode { // @ts-ignore this.command.id = "endevorexplorer.newHost"; - this.label = "New connection"; + this.label = "Add a New Datasource"; this.collapsibleState = vscode.TreeItemCollapsibleState.None; } get contextValue() { From 21d259fc1c7512a2fce7756dae1917ea416d85a8 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Tue, 16 Jun 2020 17:05:44 +0200 Subject: [PATCH 31/49] disable strict type checking for now - should be enabled in the future - reason is that we are using code from Zowe Explorer which doesn't have it enabled, and brings in a lot of technical debt Signed-off-by: Alexandru-Paul Dumitru --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 499002bf0..ebecf2f45 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,7 +22,7 @@ ], "sourceMap": true, "rootDir": "src", - "strict": true, /* enable all strict type-checking options */ + "strict": false, /* enable all strict type-checking options */ /* Additional Checks */ "noImplicitAny": false // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ From 36fbd4a867019711e0eca8a5b7657282a7d3f48b Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Tue, 16 Jun 2020 17:06:16 +0200 Subject: [PATCH 32/49] fixed profile manager initialization when .zowe folder is missing Signed-off-by: Alexandru-Paul Dumitru --- src/service/Profiles.ts | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/service/Profiles.ts b/src/service/Profiles.ts index d97a44ad2..39730543d 100644 --- a/src/service/Profiles.ts +++ b/src/service/Profiles.ts @@ -10,6 +10,7 @@ */ import { CliProfileManager, ImperativeConfig, IProfile, IProfileLoaded, ISession, Logger, Session } from "@zowe/imperative"; +import { EndevorProfilesConfig } from "@broadcom/endevor-for-zowe-cli"; import * as fs from "fs"; import * as os from "os"; import * as path from "path"; @@ -57,16 +58,17 @@ export class Profiles { return this.defaultProfile; } public async refresh() { + EndevorProfilesConfig this.allProfiles = []; const profileManager = this.getEndevorCliProfileManager(); - const endevorProfiles = (await profileManager.loadAll()).filter(profile => { + const endevorProfiles = (await (await profileManager).loadAll()).filter(profile => { return profile.type === "endevor"; }); if (endevorProfiles && endevorProfiles.length > 0) { this.allProfiles.push(...endevorProfiles); let defaultProfile: IProfileLoaded; try { - defaultProfile = await profileManager.load({ loadDefault: true}); + defaultProfile = await (await profileManager).load({ loadDefault: true}); this.defaultProfile = defaultProfile ? defaultProfile : undefined; } catch (error) { vscode.window.showInformationMessage(error.message); @@ -287,17 +289,23 @@ export class Profiles { return [updSession.ISession.user, updSession.ISession.password, updSession.ISession.base64EncodedAuth]; } - public getEndevorCliProfileManager(): CliProfileManager { + public async getEndevorCliProfileManager(): Promise { let profileManager = this.endevorProfileManager; if (!profileManager) { - profileManager = new CliProfileManager({ - profileRootDirectory: path.join(this.getZoweDir(), "profiles"), - type: "endevor", - }); - if (profileManager) { + try { + await CliProfileManager.initialize( + { + configuration: EndevorProfilesConfig, + profileRootDirectory: path.join(this.getZoweDir(), "profiles"), + reinitialize: false}); + profileManager = new CliProfileManager({ + profileRootDirectory: path.join(this.getZoweDir(), "profiles"), + type: "endevor", + }); this.endevorProfileManager = profileManager; - } else { - return undefined; + } catch (error) { + vscode.window.showErrorMessage("Failed to load Imperative Profile Manager."); + vscode.window.showErrorMessage(error.message); } } return profileManager; @@ -314,7 +322,7 @@ export class Profiles { private async saveProfile(ProfileInfo, ProfileName, ProfileType) { let endevorProfile: IProfile; try { - endevorProfile = await this.getEndevorCliProfileManager().save({ profile: ProfileInfo, name: ProfileName, type: ProfileType }); + endevorProfile = await (await this.getEndevorCliProfileManager()).save({ profile: ProfileInfo, name: ProfileName, type: ProfileType }); } catch (error) { vscode.window.showErrorMessage(error.message); } From e069c85baa0390235a1293e98dfe387fe7148ee1 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Tue, 16 Jun 2020 17:39:49 +0200 Subject: [PATCH 33/49] remove `request` as a dependency Signed-off-by: Alexandru-Paul Dumitru --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index b742e6e3b..64fa12d84 100644 --- a/package.json +++ b/package.json @@ -310,7 +310,6 @@ }, "dependencies": { "@broadcom/endevor-for-zowe-cli": "^5.1.1", - "@zowe/imperative": "^4.6.0", - "request": "^2.88.0" + "@zowe/imperative": "^4.6.0" } } From f8ede8f8ae94be24257c73d674131b5ad5cb4c7d Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Wed, 17 Jun 2020 14:14:05 +0200 Subject: [PATCH 34/49] fix file name and imports Signed-off-by: Alexandru-Paul Dumitru --- src/commands/RetrieveElement.ts | 2 +- src/commands/RetrieveElementWithDependencies.ts | 2 +- src/extension.ts | 2 +- .../{RetriveElementService.ts => RetrieveElementService.ts} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename src/service/{RetriveElementService.ts => RetrieveElementService.ts} (98%) diff --git a/src/commands/RetrieveElement.ts b/src/commands/RetrieveElement.ts index 1a1426399..f8511f9d7 100644 --- a/src/commands/RetrieveElement.ts +++ b/src/commands/RetrieveElement.ts @@ -15,7 +15,7 @@ import * as vscode from "vscode"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import { RetrieveElementService } from "../service/RetriveElementService"; +import { RetrieveElementService } from "../service/RetrieveElementService"; import { EndevorElementNode, EndevorNode } from "../ui/tree/EndevorNodes"; import { prepareElementNodesForRetrieve } from "../utils"; diff --git a/src/commands/RetrieveElementWithDependencies.ts b/src/commands/RetrieveElementWithDependencies.ts index c70cf64ff..3b1cf91fe 100644 --- a/src/commands/RetrieveElementWithDependencies.ts +++ b/src/commands/RetrieveElementWithDependencies.ts @@ -17,7 +17,7 @@ import { Element } from "../model/Element"; import { IElement } from "../model/IEndevorEntities"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import { RetrieveElementService } from "../service/RetriveElementService"; +import { RetrieveElementService } from "../service/RetrieveElementService"; const RETRIEVE_ELEMENTS_LIMIT = 20; diff --git a/src/extension.ts b/src/extension.ts index 65532bb0d..fdc6ddda5 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -25,7 +25,7 @@ import { retrieveElement } from "./commands/RetrieveElement"; import { retrieveWithDependencies } from "./commands/RetrieveElementWithDependencies"; import { EndevorController } from "./EndevorController"; import { GitBridgeSupport } from "./service/GitBridgeSupport"; -import { RetrieveElementService } from "./service/RetriveElementService"; +import { RetrieveElementService } from "./service/RetrieveElementService"; import { HOST_SETTINGS_KEY } from "./service/SettingsFacade"; import { createEndevorTree } from "./ui/tree/EndevorDataProvider"; import { EndevorNode } from "./ui/tree/EndevorNodes"; diff --git a/src/service/RetriveElementService.ts b/src/service/RetrieveElementService.ts similarity index 98% rename from src/service/RetriveElementService.ts rename to src/service/RetrieveElementService.ts index 3b03d9c2d..b9bbc63a3 100644 --- a/src/service/RetriveElementService.ts +++ b/src/service/RetrieveElementService.ts @@ -18,7 +18,7 @@ import * as vscode from "vscode"; import { Element } from "../model/Element"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; -import { proxyRetrieveAcmComponents, proxyRetrieveElement, proxyListType } from "../service/EndevorCliProxy"; +import { proxyRetrieveAcmComponents, proxyRetrieveElement, proxyListType } from "./EndevorCliProxy"; import { GitBridgeSupport } from "./GitBridgeSupport"; export class RetrieveElementService { From f36f4e05ce7d46079af478a8fa9c72ba469f5938 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Wed, 17 Jun 2020 17:15:24 +0200 Subject: [PATCH 35/49] remove gitbridge support Signed-off-by: Alexandru-Paul Dumitru --- src/extension.ts | 6 +- src/service/GitBridgeSupport.ts | 132 -------------------------- src/service/RetrieveElementService.ts | 6 +- 3 files changed, 4 insertions(+), 140 deletions(-) delete mode 100644 src/service/GitBridgeSupport.ts diff --git a/src/extension.ts b/src/extension.ts index fdc6ddda5..273766806 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -24,7 +24,6 @@ import { HostDialogs } from "./commands/HostDialogs"; import { retrieveElement } from "./commands/RetrieveElement"; import { retrieveWithDependencies } from "./commands/RetrieveElementWithDependencies"; import { EndevorController } from "./EndevorController"; -import { GitBridgeSupport } from "./service/GitBridgeSupport"; import { RetrieveElementService } from "./service/RetrieveElementService"; import { HOST_SETTINGS_KEY } from "./service/SettingsFacade"; import { createEndevorTree } from "./ui/tree/EndevorDataProvider"; @@ -56,9 +55,7 @@ export async function activate(context: vscode.ExtensionContext) { await Profiles.createInstance(log); const endevorDataProvider = await createEndevorTree(log); - const gitBridgeSupport = new GitBridgeSupport(); - const retrieveElementService: RetrieveElementService = new RetrieveElementService(gitBridgeSupport); - gitBridgeSupport.register(context); + const retrieveElementService: RetrieveElementService = new RetrieveElementService(); EndevorController.instance.loadRepositories(); const endevorExplorerView: vscode.TreeView = vscode.window.createTreeView("endevorExplorer", { @@ -146,7 +143,6 @@ export async function activate(context: vscode.ExtensionContext) { } }), ); - gitBridgeSupport.searchImports(context); } // tslint:disable-next-line: no-empty diff --git a/src/service/GitBridgeSupport.ts b/src/service/GitBridgeSupport.ts deleted file mode 100644 index 9a0084aca..000000000 --- a/src/service/GitBridgeSupport.ts +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2019 Broadcom. - * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Broadcom, Inc. - initial API and implementation - */ - -import * as fs from "fs"; -import * as path from "path"; -import { URL } from "url"; -import * as vscode from "vscode"; -import { Repository } from "../model/Repository"; -import { SettingsFacade } from "./SettingsFacade"; - -const METADATA_FILE: string = ".gbmapping"; - -export class GitBridgeSupport { - public static fetchGitBridgeInformation(): GitBridgeInformation | undefined { - if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) { - return undefined; - } - const metafilePath = vscode.Uri.file(path.join(vscode.workspace.workspaceFolders[0].uri.fsPath, METADATA_FILE)) - .fsPath; - if (fs.existsSync(metafilePath)) { - try { - const data = JSON.parse(fs.readFileSync(metafilePath).toString()).endevor; - // check url - // tslint:disable-next-line: no-unused-expression - new URL(data.baseUrl); - return data; - } catch (error) { - if (error.message) { - vscode.window.showWarningMessage(`${error.message} in ${metafilePath}`); - } else { - vscode.window.showWarningMessage(JSON.stringify(error)); - } - } - } - return undefined; - } - - public register(context: vscode.ExtensionContext) { - const metadataWatcher: vscode.FileSystemWatcher = vscode.workspace.createFileSystemWatcher( - "**/" + METADATA_FILE, - false, - false, - true, - ); - context.subscriptions.push(metadataWatcher.onDidCreate(this.metaimport)); - context.subscriptions.push(metadataWatcher.onDidChange(this.metaimport)); - } - - public createElementPath(workspace: vscode.WorkspaceFolder, type: string): string { - const gitBridge: GitBridgeInformation | undefined = GitBridgeSupport.fetchGitBridgeInformation(); - const wsPath: string = workspace.uri.fsPath; - if (!gitBridge) { - return path.join(wsPath, type); - } - - return path.join( - wsPath, - gitBridge.environment, - gitBridge.stageNumber, - gitBridge.system, - gitBridge.subsystem, - type, - ); - } - - public searchImports(context: vscode.ExtensionContext) { - vscode.workspace.findFiles(METADATA_FILE).then(async (uris: vscode.Uri[]) => { - for (const uri of uris) { - if ( - context.workspaceState.get("gitbridgemetaimport" + uri.path) !== "skip" && - (await this.metaimport(uri)) === "Ignore" - ) { - context.workspaceState.update("gitbridgemetaimport" + uri.path, "skip"); - } - } - }); - } - - private async metaimport(metafilePath: vscode.Uri) { - const data: GitBridgeInformation | undefined = GitBridgeSupport.fetchGitBridgeInformation(); - if (data === undefined) { - return; - } - const configuration: string = data.configuration; - const hostURL = new URL(data.baseUrl); - const repoUrl: string = hostURL.protocol + "//" + hostURL.hostname + ":" + hostURL.port; - const hostName = repoUrl; - - for (const repo of SettingsFacade.listRepositories()) { - if (repo.getUrl() === repoUrl) { - // Ignore if repository is exists - return; - } - } - - const result = await vscode.window.showInformationMessage( - `Import host(${hostName}) from ${metafilePath.fsPath}?`, - "Import", - "Ignore", - ); - if (result === "Import") { - const repos: Repository[] = SettingsFacade.listRepositories(); - // TODO: check profileLabel implications here - const newRepo: Repository = new Repository(hostName, repoUrl, "", undefined, configuration, ""); - repos.push(newRepo); - // TODO: FIX ME - // SettingsFacade.updateRepositories(repos); - } - return result; - } -} - -// tslint:disable-next-line:interface-name -export interface GitBridgeInformation { - baseUrl: string; - configuration: string; - environment: string; - stageNumber: string; - system: string; - subsystem: string; -} diff --git a/src/service/RetrieveElementService.ts b/src/service/RetrieveElementService.ts index b9bbc63a3..dbb2fa2ff 100644 --- a/src/service/RetrieveElementService.ts +++ b/src/service/RetrieveElementService.ts @@ -19,10 +19,10 @@ import { Element } from "../model/Element"; import { EndevorQualifier } from "../model/IEndevorQualifier"; import { Repository } from "../model/Repository"; import { proxyRetrieveAcmComponents, proxyRetrieveElement, proxyListType } from "./EndevorCliProxy"; -import { GitBridgeSupport } from "./GitBridgeSupport"; export class RetrieveElementService { - constructor(private gitBridge: GitBridgeSupport) {} + // tslint:disable-next-line: no-empty + constructor() {} public async retrieveElement( workspace: vscode.WorkspaceFolder, @@ -32,7 +32,7 @@ export class RetrieveElementService { ): Promise { const data = await proxyRetrieveElement(repo, eq); const ext = await this.getExtension(repo, eq); - const typeDirectory = this.gitBridge.createElementPath(workspace, eq.type!); + const typeDirectory = path.join(workspace.uri.fsPath, eq.type); if (!fs.existsSync(typeDirectory)) { fs.mkdirSync(typeDirectory); } From 4fb03cd5476807a5cb44c4fe7bfff53e52985fc5 Mon Sep 17 00:00:00 2001 From: Alexandru-Paul Dumitru Date: Thu, 18 Jun 2020 09:42:31 +0200 Subject: [PATCH 36/49] fix copyright and remove commented out code Signed-off-by: Alexandru-Paul Dumitru --- .editorconfig | 2 +- .gitignore | 2 +- .vscode/extensions.json | 2 +- .vscode/launch.json | 2 +- .vscode/settings.json | 2 +- .vscode/tasks.json | 2 +- .vscodeignore | 2 +- resources/edithost.html | 2 +- resources/hostpanel.html | 2 +- src/EndevorController.ts | 5 +---- src/FilterUtils.ts | 2 +- src/commands/AddFilter.ts | 2 +- src/commands/BrowseElement.ts | 2 +- src/commands/Common.ts | 2 +- src/commands/DeleteConnection.ts | 2 +- src/commands/DeleteFilter.ts | 2 +- src/commands/DeleteHost.ts | 2 +- src/commands/EditFilter.ts | 2 +- src/commands/HostDialogs.ts | 2 +- src/commands/RetrieveElement.ts | 2 +- src/commands/RetrieveElementWithDependencies.ts | 2 +- src/constants.ts | 2 +- src/extension.ts | 2 +- src/model/Connection.ts | 2 +- src/model/Element.ts | 2 +- src/model/EndevorEntity.ts | 2 +- src/model/EndevorFilter.ts | 2 +- src/model/Environment.ts | 2 +- src/model/IActionResponse.ts | 2 +- src/model/IConnection.ts | 2 +- src/model/IEndevorEntities.ts | 2 +- src/model/IEndevorInstance.ts | 2 +- src/model/IEndevorQualifier.ts | 2 +- src/model/Repository.ts | 3 +-- src/model/Stage.ts | 2 +- src/model/SubSystem.ts | 2 +- src/model/System.ts | 2 +- src/model/Type.ts | 2 +- src/service/RetrieveElementService.ts | 2 +- src/service/SettingsFacade.ts | 7 ++----- src/ui/tree/CredentialsInput.ts | 2 +- src/ui/tree/EndevorDataProvider.ts | 6 +----- src/ui/tree/EndevorNodes.ts | 3 +-- src/ui/views/HostPanel.ts | 6 +----- src/utils.ts | 3 +-- tsconfig.json | 2 +- tslint.json | 2 +- 47 files changed, 48 insertions(+), 65 deletions(-) diff --git a/.editorconfig b/.editorconfig index ce237edb9..aa47556a9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Broadcom. +# Copyright (c) 2020 Broadcom. # The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. # # This program and the accompanying materials are made diff --git a/.gitignore b/.gitignore index 0298de29d..da1272cf5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Broadcom. +# Copyright (c) 2020 Broadcom. # The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. # # This program and the accompanying materials are made diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 9053fd1f2..6e1a57354 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Broadcom. + * Copyright (c) 2020 Broadcom. * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This program and the accompanying materials are made diff --git a/.vscode/launch.json b/.vscode/launch.json index 95439cd95..8dc0e0b8a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Broadcom. + * Copyright (c) 2020 Broadcom. * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This program and the accompanying materials are made diff --git a/.vscode/settings.json b/.vscode/settings.json index fb03d93e3..ba4fce242 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Broadcom. + * Copyright (c) 2020 Broadcom. * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This program and the accompanying materials are made diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 89a98554f..5f30554f3 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Broadcom. + * Copyright (c) 2020 Broadcom. * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. * * This program and the accompanying materials are made diff --git a/.vscodeignore b/.vscodeignore index 88d599259..c02e9b5ea 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Broadcom. +# Copyright (c) 2020 Broadcom. # The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. # # This program and the accompanying materials are made diff --git a/resources/edithost.html b/resources/edithost.html index b6f7537c0..14ae37fbc 100644 --- a/resources/edithost.html +++ b/resources/edithost.html @@ -1,6 +1,6 @@