diff --git a/samples/react-my-approvals/README.md b/samples/react-my-approvals/README.md index f0f2ebf3e..f907fc474 100644 --- a/samples/react-my-approvals/README.md +++ b/samples/react-my-approvals/README.md @@ -36,6 +36,7 @@ react-my-approvals|[Takashi Shinohara](https://github.com/karamem0) ([@karamem0] Version|Date|Comments -------|----|-------- +1.1|January 22, 2022|Updated to allow multiple environments to be selected 1.0|January 11, 2022|Initial release ## Help diff --git a/samples/react-my-approvals/assets/react-my-approvals.gif b/samples/react-my-approvals/assets/react-my-approvals.gif index 42f722944..6ba6fa24d 100644 Binary files a/samples/react-my-approvals/assets/react-my-approvals.gif and b/samples/react-my-approvals/assets/react-my-approvals.gif differ diff --git a/samples/react-my-approvals/config/config.json b/samples/react-my-approvals/config/config.json index ae8135309..7152ee630 100644 --- a/samples/react-my-approvals/config/config.json +++ b/samples/react-my-approvals/config/config.json @@ -14,6 +14,7 @@ "externals": {}, "localizedResources": { "MyApprovalsWebPartStrings": "lib/webparts/myApprovals/loc/{locale}.js", - "ControlStrings": "node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js" + "ControlStrings": "node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js", + "PropertyControlStrings": "node_modules/@pnp/spfx-property-controls/lib/loc/{locale}.js" } } \ No newline at end of file diff --git a/samples/react-my-approvals/config/serve.json b/samples/react-my-approvals/config/serve.json index 93af7f0f9..e4fa5083b 100644 --- a/samples/react-my-approvals/config/serve.json +++ b/samples/react-my-approvals/config/serve.json @@ -2,5 +2,5 @@ "$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json", "port": 4321, "https": true, - "initialPage": "https://karamem0test02.sharepoint.com/_layouts/workbench.aspx" + "initialPage": "https://enter-your-SharePoint-site/_layouts/workbench.aspx" } \ No newline at end of file diff --git a/samples/react-my-approvals/package-lock.json b/samples/react-my-approvals/package-lock.json index 022b71f42..065f5d2e3 100644 --- a/samples/react-my-approvals/package-lock.json +++ b/samples/react-my-approvals/package-lock.json @@ -1,19 +1,21 @@ { "name": "react-my-approvals", - "version": "0.0.1", + "version": "1.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "react-my-approvals", - "version": "0.0.1", + "version": "1.1.0", "dependencies": { "@microsoft/sp-core-library": "1.13.1", "@microsoft/sp-lodash-subset": "1.13.1", "@microsoft/sp-office-ui-fabric-core": "1.13.1", "@microsoft/sp-property-pane": "1.13.1", "@microsoft/sp-webpart-base": "1.13.1", + "@pnp/sp": "^1.3.11", "@pnp/spfx-controls-react": "^3.5.0", + "@pnp/spfx-property-controls": "^3.3.0", "office-ui-fabric-react": "7.174.1", "react": "16.13.1", "react-dom": "16.13.1", @@ -29,7 +31,8 @@ "@types/webpack-env": "1.13.1", "ajv": "~5.2.2", "gulp": "~4.0.2", - "tslint-microsoft-contrib": "^6.2.0" + "tslint-microsoft-contrib": "^6.2.0", + "typescript": "^4.5.4" } }, "node_modules/@azure/abort-controller": { @@ -3913,77 +3916,74 @@ } }, "node_modules/@pnp/common": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@pnp/common/-/common-2.5.0.tgz", - "integrity": "sha512-ea4zTNC3sjLolrHZXP+/2SrJM+yC8PygmPW/yRfgbErdvdwYMUSogT69dW+NUaqhkfYZfkkAoWn42irlLMSpdw==", + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/common/-/common-1.3.11.tgz", + "integrity": "sha512-RhYKcfMP+h0pAzORZRHSPPLOBB58djN/pfnorpWPjsx6ZxMqbiDqTzAtTF4m8z/mdNnxJr0Q3kwt4ImU3FjwnA==", "dependencies": { - "tslib": "2.2.0" - }, - "funding": { - "type": "individual", - "url": "https://github.com/sponsors/patrick-rodgers/" + "adal-angular": "1.0.17", + "tslib": "1.10.0" + } + }, + "node_modules/@pnp/common/node_modules/adal-angular": { + "version": "1.0.17", + "resolved": "https://registry.npmjs.org/adal-angular/-/adal-angular-1.0.17.tgz", + "integrity": "sha1-bpNuDkH5HTsqiOf/ypwvb29WLMQ=", + "engines": { + "node": ">=0.8.0" } }, "node_modules/@pnp/common/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" }, "node_modules/@pnp/logging": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@pnp/logging/-/logging-2.5.0.tgz", - "integrity": "sha512-SnmMCN6oADjiHKAIR23FfTqXeQZeXPBnWeVfyZAgzJfRn9uEQoUlkyET3jHjl9kkrFOVkiOD1CRI7TWMIxURbA==", + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/logging/-/logging-1.3.11.tgz", + "integrity": "sha512-hADlIXwvF/wjee7425nFJ6NhqaWpWTJ5yg02bpwBUsiSuFqEUf+LwuAcyHQre2lMs6KyNa65FWoRQok9BlZuxA==", "dependencies": { - "tslib": "2.2.0" - }, - "funding": { - "type": "individual", - "url": "https://github.com/sponsors/patrick-rodgers/" + "tslib": "1.10.0" } }, "node_modules/@pnp/logging/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" }, "node_modules/@pnp/odata": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@pnp/odata/-/odata-2.5.0.tgz", - "integrity": "sha512-AeP01jDvnkiUVn7V+4FT07chz+G/yzrJDH0Gk+qzujJ393ZO6FwJpJEiOCRh9cxF48gqSj/f7r/IIyDHe0+IpQ==", + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/odata/-/odata-1.3.11.tgz", + "integrity": "sha512-yMaRiuVZRei2pkryCOqsw3ZXD2Lw30IJv136WQmQPQPOxG4cvsS9+woXkfMqbWV2KQ1evFUqVXbitIz6eDVfNA==", "dependencies": { - "@pnp/common": "2.5.0", - "@pnp/logging": "2.5.0", - "tslib": "2.2.0" + "tslib": "1.10.0" }, - "funding": { - "type": "individual", - "url": "https://github.com/sponsors/patrick-rodgers/" + "peerDependencies": { + "@pnp/common": "1.3.11", + "@pnp/logging": "1.3.11" } }, "node_modules/@pnp/odata/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" }, "node_modules/@pnp/sp": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@pnp/sp/-/sp-2.5.0.tgz", - "integrity": "sha512-4s2p+X5qvkXR72NViKb8DIfC+pvj/a3psZ3Im5PRIan2ErMtu9ch3Lb9nkSaMCF3NTJxWOhkUQ/R6tx8ApaUkg==", + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/sp/-/sp-1.3.11.tgz", + "integrity": "sha512-NjdeGe81aukiSPelSPjgAFRC1+SrNPTXvTdEqTH+Q1ZvgNtk8bdZp6K6xf9emfeM2qZDOu9GpKZpg0W/emq++g==", "dependencies": { - "@pnp/common": "2.5.0", - "@pnp/logging": "2.5.0", - "@pnp/odata": "2.5.0", - "tslib": "2.2.0" + "tslib": "1.10.0" }, - "funding": { - "type": "individual", - "url": "https://github.com/sponsors/patrick-rodgers/" + "peerDependencies": { + "@pnp/common": "1.3.11", + "@pnp/logging": "1.3.11", + "@pnp/odata": "1.3.11" } }, "node_modules/@pnp/sp/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" }, "node_modules/@pnp/spfx-controls-react": { "version": "3.5.0", @@ -4023,6 +4023,79 @@ "spfx-uifabric-themes": "^0.8.5" } }, + "node_modules/@pnp/spfx-controls-react/node_modules/@pnp/common": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@pnp/common/-/common-2.5.0.tgz", + "integrity": "sha512-ea4zTNC3sjLolrHZXP+/2SrJM+yC8PygmPW/yRfgbErdvdwYMUSogT69dW+NUaqhkfYZfkkAoWn42irlLMSpdw==", + "dependencies": { + "tslib": "2.2.0" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/patrick-rodgers/" + } + }, + "node_modules/@pnp/spfx-controls-react/node_modules/@pnp/common/node_modules/tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + }, + "node_modules/@pnp/spfx-controls-react/node_modules/@pnp/logging": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@pnp/logging/-/logging-2.5.0.tgz", + "integrity": "sha512-SnmMCN6oADjiHKAIR23FfTqXeQZeXPBnWeVfyZAgzJfRn9uEQoUlkyET3jHjl9kkrFOVkiOD1CRI7TWMIxURbA==", + "dependencies": { + "tslib": "2.2.0" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/patrick-rodgers/" + } + }, + "node_modules/@pnp/spfx-controls-react/node_modules/@pnp/logging/node_modules/tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + }, + "node_modules/@pnp/spfx-controls-react/node_modules/@pnp/odata": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@pnp/odata/-/odata-2.5.0.tgz", + "integrity": "sha512-AeP01jDvnkiUVn7V+4FT07chz+G/yzrJDH0Gk+qzujJ393ZO6FwJpJEiOCRh9cxF48gqSj/f7r/IIyDHe0+IpQ==", + "dependencies": { + "@pnp/common": "2.5.0", + "@pnp/logging": "2.5.0", + "tslib": "2.2.0" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/patrick-rodgers/" + } + }, + "node_modules/@pnp/spfx-controls-react/node_modules/@pnp/odata/node_modules/tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + }, + "node_modules/@pnp/spfx-controls-react/node_modules/@pnp/sp": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@pnp/sp/-/sp-2.5.0.tgz", + "integrity": "sha512-4s2p+X5qvkXR72NViKb8DIfC+pvj/a3psZ3Im5PRIan2ErMtu9ch3Lb9nkSaMCF3NTJxWOhkUQ/R6tx8ApaUkg==", + "dependencies": { + "@pnp/common": "2.5.0", + "@pnp/logging": "2.5.0", + "@pnp/odata": "2.5.0", + "tslib": "2.2.0" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/patrick-rodgers/" + } + }, + "node_modules/@pnp/spfx-controls-react/node_modules/@pnp/sp/node_modules/tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + }, "node_modules/@pnp/spfx-controls-react/node_modules/@uifabric/icons": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/@uifabric/icons/-/icons-7.3.0.tgz", @@ -4033,6 +4106,77 @@ "tslib": "^1.7.1" } }, + "node_modules/@pnp/spfx-property-controls": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@pnp/spfx-property-controls/-/spfx-property-controls-3.3.0.tgz", + "integrity": "sha512-jSoAVFBnClPOiuB3D4PrBu3g9oMxSxiHdzUW7dbtf2DcKn+273+ZsvMX2Fn94RjT9dzGVu+0ODF5s0SVzmBfIA==", + "hasInstallScript": true, + "dependencies": { + "@microsoft/sp-core-library": "1.13.1", + "@microsoft/sp-lodash-subset": "1.13.1", + "@microsoft/sp-office-ui-fabric-core": "1.13.1", + "@microsoft/sp-property-pane": "1.13.1", + "@microsoft/sp-webpart-base": "1.13.1", + "@pnp/common": "1.3.11", + "@pnp/logging": "1.3.11", + "@pnp/odata": "1.3.11", + "@pnp/sp": "1.3.11", + "@pnp/sp-clientsvc": "1.3.11", + "@pnp/sp-taxonomy": "1.3.11", + "@pnp/telemetry-js": "2.0.0", + "@uifabric/icons": "7.5.17", + "lodash.omit": "4.5.0", + "markdown-to-jsx": "^6.11.4", + "office-ui-fabric-react": "7.174.1", + "react": "16.13.1", + "react-ace": "5.8.0", + "react-dom": "16.13.1" + } + }, + "node_modules/@pnp/spfx-property-controls/node_modules/@pnp/sp-clientsvc": { + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/sp-clientsvc/-/sp-clientsvc-1.3.11.tgz", + "integrity": "sha512-eIUnmDWjizcWJzhWxAbfsxEyHF1dabkGlihnDnlcYGhtvh8BwuM67A57qc5fbxzCS59c0YU57szB1EucoNmV4A==", + "dependencies": { + "tslib": "1.10.0" + }, + "peerDependencies": { + "@pnp/common": "1.3.11", + "@pnp/logging": "1.3.11", + "@pnp/odata": "1.3.11", + "@pnp/sp": "1.3.11" + } + }, + "node_modules/@pnp/spfx-property-controls/node_modules/@pnp/sp-taxonomy": { + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/sp-taxonomy/-/sp-taxonomy-1.3.11.tgz", + "integrity": "sha512-shzCSjmOlr6mojCXJkfD8Xf9lJnhphq4Fj6mdUQGwpak+VIU+Fogf6AI0j6AReCKtKsKyqfud9X7C8tH07C3DA==", + "dependencies": { + "tslib": "1.10.0" + }, + "peerDependencies": { + "@pnp/common": "1.3.11", + "@pnp/logging": "1.3.11", + "@pnp/odata": "1.3.11", + "@pnp/sp": "1.3.11", + "@pnp/sp-clientsvc": "1.3.11" + } + }, + "node_modules/@pnp/spfx-property-controls/node_modules/@uifabric/icons": { + "version": "7.5.17", + "resolved": "https://registry.npmjs.org/@uifabric/icons/-/icons-7.5.17.tgz", + "integrity": "sha512-2S1kse0gtseTuV2r59iWukLxxoOJ6GgP2Yhxt9oxzaP9QubpYdxCUepvJmfPQQvvy4GELdykDUWQ6/hbzliJyw==", + "dependencies": { + "@uifabric/set-version": "^7.0.23", + "@uifabric/styling": "^7.16.18", + "tslib": "^1.10.0" + } + }, + "node_modules/@pnp/spfx-property-controls/node_modules/tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" + }, "node_modules/@pnp/telemetry-js": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@pnp/telemetry-js/-/telemetry-js-2.0.0.tgz", @@ -6960,6 +7104,11 @@ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", "dev": true }, + "node_modules/brace": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/brace/-/brace-0.11.1.tgz", + "integrity": "sha1-SJb8ydVE7vRfS7dmDbMg07N5/lg=" + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -16668,6 +16817,11 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "node_modules/lodash.omit": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.omit/-/lodash.omit-4.5.0.tgz", + "integrity": "sha1-brGa5aHuHdnfC5aeZs4Lf6MLXmA=" + }, "node_modules/lodash.restparam": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", @@ -16865,6 +17019,21 @@ "node": ">=0.10.0" } }, + "node_modules/markdown-to-jsx": { + "version": "6.11.4", + "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-6.11.4.tgz", + "integrity": "sha512-3lRCD5Sh+tfA52iGgfs/XZiw33f7fFX9Bn55aNnVNUd2GzLDkOWyKYYD8Yju2B1Vn+feiEdgJs8T6Tg0xNokPw==", + "dependencies": { + "prop-types": "^15.6.2", + "unquote": "^1.1.0" + }, + "engines": { + "node": ">= 4" + }, + "peerDependencies": { + "react": ">= 0.14.0" + } + }, "node_modules/matchdep": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz", @@ -20752,6 +20921,21 @@ "react-dom": "^16.3.3 || ^17.0.0" } }, + "node_modules/react-ace": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/react-ace/-/react-ace-5.8.0.tgz", + "integrity": "sha1-hy2e6LZkMA7Vq57axiNLvpCDaDY=", + "dependencies": { + "brace": "^0.11.0", + "lodash.get": "^4.4.2", + "lodash.isequal": "^4.1.1", + "prop-types": "^15.5.8" + }, + "peerDependencies": { + "react": "^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0", + "react-dom": "^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0" + } + }, "node_modules/react-addons-shallow-compare": { "version": "15.6.3", "resolved": "https://registry.npmjs.org/react-addons-shallow-compare/-/react-addons-shallow-compare-15.6.3.tgz", @@ -25308,7 +25492,6 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", "devOptional": true, - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -25475,8 +25658,7 @@ "node_modules/unquote": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", - "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=", - "dev": true + "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=" }, "node_modules/unset-value": { "version": "1.0.0", @@ -31916,67 +32098,68 @@ "dev": true }, "@pnp/common": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@pnp/common/-/common-2.5.0.tgz", - "integrity": "sha512-ea4zTNC3sjLolrHZXP+/2SrJM+yC8PygmPW/yRfgbErdvdwYMUSogT69dW+NUaqhkfYZfkkAoWn42irlLMSpdw==", + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/common/-/common-1.3.11.tgz", + "integrity": "sha512-RhYKcfMP+h0pAzORZRHSPPLOBB58djN/pfnorpWPjsx6ZxMqbiDqTzAtTF4m8z/mdNnxJr0Q3kwt4ImU3FjwnA==", "requires": { - "tslib": "2.2.0" + "adal-angular": "1.0.17", + "tslib": "1.10.0" }, "dependencies": { + "adal-angular": { + "version": "1.0.17", + "resolved": "https://registry.npmjs.org/adal-angular/-/adal-angular-1.0.17.tgz", + "integrity": "sha1-bpNuDkH5HTsqiOf/ypwvb29WLMQ=" + }, "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" } } }, "@pnp/logging": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@pnp/logging/-/logging-2.5.0.tgz", - "integrity": "sha512-SnmMCN6oADjiHKAIR23FfTqXeQZeXPBnWeVfyZAgzJfRn9uEQoUlkyET3jHjl9kkrFOVkiOD1CRI7TWMIxURbA==", + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/logging/-/logging-1.3.11.tgz", + "integrity": "sha512-hADlIXwvF/wjee7425nFJ6NhqaWpWTJ5yg02bpwBUsiSuFqEUf+LwuAcyHQre2lMs6KyNa65FWoRQok9BlZuxA==", "requires": { - "tslib": "2.2.0" + "tslib": "1.10.0" }, "dependencies": { "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" } } }, "@pnp/odata": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@pnp/odata/-/odata-2.5.0.tgz", - "integrity": "sha512-AeP01jDvnkiUVn7V+4FT07chz+G/yzrJDH0Gk+qzujJ393ZO6FwJpJEiOCRh9cxF48gqSj/f7r/IIyDHe0+IpQ==", + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/odata/-/odata-1.3.11.tgz", + "integrity": "sha512-yMaRiuVZRei2pkryCOqsw3ZXD2Lw30IJv136WQmQPQPOxG4cvsS9+woXkfMqbWV2KQ1evFUqVXbitIz6eDVfNA==", "requires": { - "@pnp/common": "2.5.0", - "@pnp/logging": "2.5.0", - "tslib": "2.2.0" + "tslib": "1.10.0" }, "dependencies": { "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" } } }, "@pnp/sp": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@pnp/sp/-/sp-2.5.0.tgz", - "integrity": "sha512-4s2p+X5qvkXR72NViKb8DIfC+pvj/a3psZ3Im5PRIan2ErMtu9ch3Lb9nkSaMCF3NTJxWOhkUQ/R6tx8ApaUkg==", + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/sp/-/sp-1.3.11.tgz", + "integrity": "sha512-NjdeGe81aukiSPelSPjgAFRC1+SrNPTXvTdEqTH+Q1ZvgNtk8bdZp6K6xf9emfeM2qZDOu9GpKZpg0W/emq++g==", "requires": { - "@pnp/common": "2.5.0", - "@pnp/logging": "2.5.0", - "@pnp/odata": "2.5.0", - "tslib": "2.2.0" + "tslib": "1.10.0" }, "dependencies": { "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" } } }, @@ -32017,6 +32200,71 @@ "spfx-uifabric-themes": "^0.8.5" }, "dependencies": { + "@pnp/common": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@pnp/common/-/common-2.5.0.tgz", + "integrity": "sha512-ea4zTNC3sjLolrHZXP+/2SrJM+yC8PygmPW/yRfgbErdvdwYMUSogT69dW+NUaqhkfYZfkkAoWn42irlLMSpdw==", + "requires": { + "tslib": "2.2.0" + }, + "dependencies": { + "tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + } + } + }, + "@pnp/logging": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@pnp/logging/-/logging-2.5.0.tgz", + "integrity": "sha512-SnmMCN6oADjiHKAIR23FfTqXeQZeXPBnWeVfyZAgzJfRn9uEQoUlkyET3jHjl9kkrFOVkiOD1CRI7TWMIxURbA==", + "requires": { + "tslib": "2.2.0" + }, + "dependencies": { + "tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + } + } + }, + "@pnp/odata": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@pnp/odata/-/odata-2.5.0.tgz", + "integrity": "sha512-AeP01jDvnkiUVn7V+4FT07chz+G/yzrJDH0Gk+qzujJ393ZO6FwJpJEiOCRh9cxF48gqSj/f7r/IIyDHe0+IpQ==", + "requires": { + "@pnp/common": "2.5.0", + "@pnp/logging": "2.5.0", + "tslib": "2.2.0" + }, + "dependencies": { + "tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + } + } + }, + "@pnp/sp": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@pnp/sp/-/sp-2.5.0.tgz", + "integrity": "sha512-4s2p+X5qvkXR72NViKb8DIfC+pvj/a3psZ3Im5PRIan2ErMtu9ch3Lb9nkSaMCF3NTJxWOhkUQ/R6tx8ApaUkg==", + "requires": { + "@pnp/common": "2.5.0", + "@pnp/logging": "2.5.0", + "@pnp/odata": "2.5.0", + "tslib": "2.2.0" + }, + "dependencies": { + "tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + } + } + }, "@uifabric/icons": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/@uifabric/icons/-/icons-7.3.0.tgz", @@ -32029,6 +32277,65 @@ } } }, + "@pnp/spfx-property-controls": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@pnp/spfx-property-controls/-/spfx-property-controls-3.3.0.tgz", + "integrity": "sha512-jSoAVFBnClPOiuB3D4PrBu3g9oMxSxiHdzUW7dbtf2DcKn+273+ZsvMX2Fn94RjT9dzGVu+0ODF5s0SVzmBfIA==", + "requires": { + "@microsoft/sp-core-library": "1.13.1", + "@microsoft/sp-lodash-subset": "1.13.1", + "@microsoft/sp-office-ui-fabric-core": "1.13.1", + "@microsoft/sp-property-pane": "1.13.1", + "@microsoft/sp-webpart-base": "1.13.1", + "@pnp/common": "1.3.11", + "@pnp/logging": "1.3.11", + "@pnp/odata": "1.3.11", + "@pnp/sp": "1.3.11", + "@pnp/sp-clientsvc": "1.3.11", + "@pnp/sp-taxonomy": "1.3.11", + "@pnp/telemetry-js": "2.0.0", + "@uifabric/icons": "7.5.17", + "lodash.omit": "4.5.0", + "markdown-to-jsx": "^6.11.4", + "office-ui-fabric-react": "7.174.1", + "react": "16.13.1", + "react-ace": "5.8.0", + "react-dom": "16.13.1" + }, + "dependencies": { + "@pnp/sp-clientsvc": { + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/sp-clientsvc/-/sp-clientsvc-1.3.11.tgz", + "integrity": "sha512-eIUnmDWjizcWJzhWxAbfsxEyHF1dabkGlihnDnlcYGhtvh8BwuM67A57qc5fbxzCS59c0YU57szB1EucoNmV4A==", + "requires": { + "tslib": "1.10.0" + } + }, + "@pnp/sp-taxonomy": { + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@pnp/sp-taxonomy/-/sp-taxonomy-1.3.11.tgz", + "integrity": "sha512-shzCSjmOlr6mojCXJkfD8Xf9lJnhphq4Fj6mdUQGwpak+VIU+Fogf6AI0j6AReCKtKsKyqfud9X7C8tH07C3DA==", + "requires": { + "tslib": "1.10.0" + } + }, + "@uifabric/icons": { + "version": "7.5.17", + "resolved": "https://registry.npmjs.org/@uifabric/icons/-/icons-7.5.17.tgz", + "integrity": "sha512-2S1kse0gtseTuV2r59iWukLxxoOJ6GgP2Yhxt9oxzaP9QubpYdxCUepvJmfPQQvvy4GELdykDUWQ6/hbzliJyw==", + "requires": { + "@uifabric/set-version": "^7.0.23", + "@uifabric/styling": "^7.16.18", + "tslib": "^1.10.0" + } + }, + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" + } + } + }, "@pnp/telemetry-js": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@pnp/telemetry-js/-/telemetry-js-2.0.0.tgz", @@ -34471,6 +34778,11 @@ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", "dev": true }, + "brace": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/brace/-/brace-0.11.1.tgz", + "integrity": "sha1-SJb8ydVE7vRfS7dmDbMg07N5/lg=" + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -42381,6 +42693,11 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "lodash.omit": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.omit/-/lodash.omit-4.5.0.tgz", + "integrity": "sha1-brGa5aHuHdnfC5aeZs4Lf6MLXmA=" + }, "lodash.restparam": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", @@ -42542,6 +42859,15 @@ "object-visit": "^1.0.0" } }, + "markdown-to-jsx": { + "version": "6.11.4", + "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-6.11.4.tgz", + "integrity": "sha512-3lRCD5Sh+tfA52iGgfs/XZiw33f7fFX9Bn55aNnVNUd2GzLDkOWyKYYD8Yju2B1Vn+feiEdgJs8T6Tg0xNokPw==", + "requires": { + "prop-types": "^15.6.2", + "unquote": "^1.1.0" + } + }, "matchdep": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz", @@ -45700,6 +46026,17 @@ "integrity": "sha512-yCh3tx+jNuOPs+m58LOBFTGDEaGvM8UfuCNznr855FDAWzwV8V/ZH/TVBvgqH0npP58KrrVrHpj4jcy0EE5hEw==", "requires": {} }, + "react-ace": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/react-ace/-/react-ace-5.8.0.tgz", + "integrity": "sha1-hy2e6LZkMA7Vq57axiNLvpCDaDY=", + "requires": { + "brace": "^0.11.0", + "lodash.get": "^4.4.2", + "lodash.isequal": "^4.1.1", + "prop-types": "^15.5.8" + } + }, "react-addons-shallow-compare": { "version": "15.6.3", "resolved": "https://registry.npmjs.org/react-addons-shallow-compare/-/react-addons-shallow-compare-15.6.3.tgz", @@ -49378,8 +49715,7 @@ "version": "4.5.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", - "devOptional": true, - "peer": true + "devOptional": true }, "uglify-js": { "version": "3.4.10", @@ -49516,8 +49852,7 @@ "unquote": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", - "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=", - "dev": true + "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=" }, "unset-value": { "version": "1.0.0", diff --git a/samples/react-my-approvals/package.json b/samples/react-my-approvals/package.json index bf2bd5001..53070b221 100644 --- a/samples/react-my-approvals/package.json +++ b/samples/react-my-approvals/package.json @@ -1,6 +1,6 @@ { "name": "react-my-approvals", - "version": "0.0.1", + "version": "1.1.0", "private": true, "main": "lib/index.js", "scripts": { @@ -14,7 +14,9 @@ "@microsoft/sp-office-ui-fabric-core": "1.13.1", "@microsoft/sp-property-pane": "1.13.1", "@microsoft/sp-webpart-base": "1.13.1", + "@pnp/sp": "^1.3.11", "@pnp/spfx-controls-react": "^3.5.0", + "@pnp/spfx-property-controls": "^3.3.0", "office-ui-fabric-react": "7.174.1", "react": "16.13.1", "react-dom": "16.13.1", diff --git a/samples/react-my-approvals/src/webparts/myApprovals/MyApprovalsWebPart.manifest.json b/samples/react-my-approvals/src/webparts/myApprovals/MyApprovalsWebPart.manifest.json index 9fae31ee0..96a279df8 100644 --- a/samples/react-my-approvals/src/webparts/myApprovals/MyApprovalsWebPart.manifest.json +++ b/samples/react-my-approvals/src/webparts/myApprovals/MyApprovalsWebPart.manifest.json @@ -26,9 +26,9 @@ "description": { "default": "View approval requests for you." }, - "officeFabricIconFontName": "Page", + "officeFabricIconFontName": "DocumentApproval", "properties": { - "environment": "" + "environments": null } } ] diff --git a/samples/react-my-approvals/src/webparts/myApprovals/MyApprovalsWebPart.tsx b/samples/react-my-approvals/src/webparts/myApprovals/MyApprovalsWebPart.tsx index 1313adacb..83ba4617b 100644 --- a/samples/react-my-approvals/src/webparts/myApprovals/MyApprovalsWebPart.tsx +++ b/samples/react-my-approvals/src/webparts/myApprovals/MyApprovalsWebPart.tsx @@ -2,13 +2,9 @@ import * as React from 'react'; import * as ReactDom from 'react-dom'; import { IntlProvider } from 'react-intl'; import { Version } from '@microsoft/sp-core-library'; -import { - IPropertyPaneConfiguration, - IPropertyPaneDropdownProps, - IPropertyPaneField, - PropertyPaneDropdown -} from '@microsoft/sp-property-pane'; +import { IPropertyPaneConfiguration } from '@microsoft/sp-property-pane'; import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base'; +import { PropertyFieldMultiSelect } from '@pnp/spfx-property-controls'; import * as strings from 'MyApprovalsWebPartStrings'; import MyApprovals from './components/MyApprovals'; @@ -17,13 +13,13 @@ import HttpClientService from './services/HttpClientService'; export interface IMyApprovalsWebPartProps { title: string; - environment: string; + environments: string[] | null; } export default class MyApprovalsWebPart extends BaseClientSideWebPart { private httpService: HttpClientService; - private environmentPanelField: IPropertyPaneField; + private environments: string[]; public render(): void { const element: React.ReactElement = React.createElement( @@ -31,7 +27,7 @@ export default class MyApprovalsWebPart extends BaseClientSideWebPart { this.properties.title = value; @@ -45,35 +41,22 @@ export default class MyApprovalsWebPart extends BaseClientSideWebPart { this.httpService = await HttpClientService.create(this.context); + this.environments = await this.httpService + .getEnvironments() + .then((values) => values.map((value) => value.name)); + if (!this.properties.environments) { + this.properties.environments = this.environments; + } } protected onDispose(): void { ReactDom.unmountComponentAtNode(this.domElement); } - protected async onPropertyPaneConfigurationStart(): Promise { - const environments = await this.httpService.getEnvironments(); - this.environmentPanelField = PropertyPaneDropdown( - 'environment', - { - label: strings.EnvironmentLabel, - options: environments.map((value) => ({ - key: value.name, - text: value.name - })), - } - ); - this.context.propertyPane.refresh(); - } - protected get dataVersion(): Version { - return Version.parse('1.0'); + return Version.parse('1.1'); } protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration { @@ -86,7 +69,18 @@ export default class MyApprovalsWebPart extends BaseClientSideWebPart ({ + key: value, + text: value + })), + selectedKeys: this.properties.environments + } + ) ] } ] diff --git a/samples/react-my-approvals/src/webparts/myApprovals/components/IMyApprovalsProps.ts b/samples/react-my-approvals/src/webparts/myApprovals/components/IMyApprovalsProps.ts index 63c269c18..81e438938 100644 --- a/samples/react-my-approvals/src/webparts/myApprovals/components/IMyApprovalsProps.ts +++ b/samples/react-my-approvals/src/webparts/myApprovals/components/IMyApprovalsProps.ts @@ -4,7 +4,7 @@ import HttpClientService from '../services/HttpClientService'; export interface IMyApprovalsProps { httpService: HttpClientService; displayMode: DisplayMode; - environment: string; + environments: string[]; title: string; setTitle: (value: string) => void; } diff --git a/samples/react-my-approvals/src/webparts/myApprovals/components/IMyApprovalsState.ts b/samples/react-my-approvals/src/webparts/myApprovals/components/IMyApprovalsState.ts index f734d2dc1..55bd65931 100644 --- a/samples/react-my-approvals/src/webparts/myApprovals/components/IMyApprovalsState.ts +++ b/samples/react-my-approvals/src/webparts/myApprovals/components/IMyApprovalsState.ts @@ -1,7 +1,5 @@ -import { DisplayMode } from '@microsoft/sp-core-library'; -import HttpClientService from '../services/HttpClientService'; - export interface IMyApprovalsState { + environment: string; name: string; title: string; requestDate: string; diff --git a/samples/react-my-approvals/src/webparts/myApprovals/components/MyApprovals.tsx b/samples/react-my-approvals/src/webparts/myApprovals/components/MyApprovals.tsx index 1b824e84a..a0e287366 100644 --- a/samples/react-my-approvals/src/webparts/myApprovals/components/MyApprovals.tsx +++ b/samples/react-my-approvals/src/webparts/myApprovals/components/MyApprovals.tsx @@ -21,7 +21,7 @@ import { IMyApprovalsState } from './IMyApprovalsState'; const MyApprovals = ({ httpService, displayMode, - environment, + environments, title, setTitle }: IMyApprovalsProps) => { @@ -31,12 +31,13 @@ const MyApprovals = ({ React.useEffect(() => { if (!httpService) return; - if (!environment) return; + if (!environments.length) return; (async () => { setApprovals( await httpService - .getApprovals(environment) + .getApprovals(environments) .then(async (values) => await Promise.all(values.map(async (value) => ({ + environment: value.environment, name: value.name, title: value.properties.title, requestDate: await httpService.convertUtcToLocal(value.properties.creationDate), @@ -46,13 +47,13 @@ const MyApprovals = ({ })(); }, [ httpService, - environment + environments ]); return (
{ - environment + environments.length ? ( ( + onRender: (value: IMyApprovalsState) => ( {value.title} @@ -96,7 +97,7 @@ const MyApprovals = ({ data: 'string', minWidth: 160, isResizable: true, - onRender: (value) => + onRender: (value: IMyApprovalsState) => intl.formatDate( value.requestDate.replace(/([+-]\d{2}:\d{2}|Z)$/, ""), { diff --git a/samples/react-my-approvals/src/webparts/myApprovals/services/HttpClientService.ts b/samples/react-my-approvals/src/webparts/myApprovals/services/HttpClientService.ts index 22f47d74f..26ab58a73 100644 --- a/samples/react-my-approvals/src/webparts/myApprovals/services/HttpClientService.ts +++ b/samples/react-my-approvals/src/webparts/myApprovals/services/HttpClientService.ts @@ -10,6 +10,7 @@ interface IEnvironment { } interface IApproval { + environment: string; name: string; type: string; id: string; @@ -49,17 +50,26 @@ export default class HttpClientService { return json.value as IEnvironment[]; } - public async getApprovals(environments: string): Promise { - const response = await this.flowHttpClient.get( - `https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/environments/${environments}/approvalViews` + - '?$filter=properties/userRole eq \'Approver\' and properties/isActive eq \'true\' and properties/isDescending eq \'true\'' + - '&api-version=2016-11-01', - AadHttpClient.configurations.v1); - const json = await response.json(); - if (json.error) { - throw new Error(json.error); + public async getApprovals(environments: string[]): Promise { + const values = []; + for (const environment of environments) { + const response = await this.flowHttpClient.get( + `https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/environments/${environment}/approvalViews` + + '?$filter=properties/userRole eq \'Approver\' and properties/isActive eq \'true\' and properties/isDescending eq \'true\'' + + '&api-version=2016-11-01', + AadHttpClient.configurations.v1); + const json = await response.json(); + if (json.error) { + throw new Error(json.error); + } + for (const value of json.value) { + values.push({ + ...value, + environment: environment + }); + } } - return json.value as IEnvironment[]; + return values; } public async convertUtcToLocal(date: string): Promise {