From f76c4de7f369efd109a1aba398e01deca089ff34 Mon Sep 17 00:00:00 2001 From: karantalapalli Date: Thu, 10 Mar 2022 19:01:47 +0530 Subject: [PATCH 1/9] feat: add content type visualizer extension [ECO-656] --- README.md | 3 + content-type-visualizer/.eslintrc.json | 18 + content-type-visualizer/.gitignore | 4 + content-type-visualizer/LICENSE | 21 + content-type-visualizer/README.md | 30 ++ content-type-visualizer/gulpfile.js | 50 ++ content-type-visualizer/index.html | 160 +++++++ content-type-visualizer/package.json | 27 ++ content-type-visualizer/source/index.html | 161 +++++++ content-type-visualizer/source/index.js | 510 ++++++++++++++++++++ content-type-visualizer/source/style.css | 559 ++++++++++++++++++++++ 11 files changed, 1543 insertions(+) create mode 100644 content-type-visualizer/.eslintrc.json create mode 100644 content-type-visualizer/.gitignore create mode 100644 content-type-visualizer/LICENSE create mode 100644 content-type-visualizer/README.md create mode 100644 content-type-visualizer/gulpfile.js create mode 100644 content-type-visualizer/index.html create mode 100644 content-type-visualizer/package.json create mode 100644 content-type-visualizer/source/index.html create mode 100644 content-type-visualizer/source/index.js create mode 100644 content-type-visualizer/source/style.css diff --git a/README.md b/README.md index 000fa639..29760be0 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,9 @@ This extension lets you fetch and display Youtube videos into a field of your co [External API Lookup](./external-api-lookup-template): This extension lets you fetch data from an external API and display the data as possible values for the field on an entry page in Contentstack. +[Conten Type Visualizer](./content-type-visualizer) +Content Type Visualizer Dashboard Widget offers a graphical representation of all content types, along with their fields, in a particular stack. + ### Examples of custom widgets created using Extensions Here are some examples/use cases of custom widgets that can be created using Extensions. These examples come with readme files that explain how to install and get started with these widgets. diff --git a/content-type-visualizer/.eslintrc.json b/content-type-visualizer/.eslintrc.json new file mode 100644 index 00000000..5a437149 --- /dev/null +++ b/content-type-visualizer/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "env": { + "browser": true, + "es6": true, + "jquery": true + }, + "extends": "airbnb-base/legacy", + "parserOptions": { + "ecmaVersion": 2016, + "sourceType": "module" + }, + "globals": { + "ContentstackUIExtension": false + }, + "rules": { + "no-restricted-syntax": ["error", "LabeledStatement", "WithStatement"] + } +} \ No newline at end of file diff --git a/content-type-visualizer/.gitignore b/content-type-visualizer/.gitignore new file mode 100644 index 00000000..92a6367f --- /dev/null +++ b/content-type-visualizer/.gitignore @@ -0,0 +1,4 @@ +*.log +.cache +package-lock.json +node_modules diff --git a/content-type-visualizer/LICENSE b/content-type-visualizer/LICENSE new file mode 100644 index 00000000..0302523a --- /dev/null +++ b/content-type-visualizer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Contentstack + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/content-type-visualizer/README.md b/content-type-visualizer/README.md new file mode 100644 index 00000000..04db54d5 --- /dev/null +++ b/content-type-visualizer/README.md @@ -0,0 +1,30 @@ +# Content Type Visualizer – Contentstack Extension + +#### About this extension. +Content Type Visualizer Dashboard Widget offers a graphical representation of all content types, along with their fields, in a particular stack. + +![Content Type Visualizer Screenshot](https://images.contentstack.io/v3/assets/blt83726f918894d893/bltae909a9786341bbf/5f394a3ddb5c28785b6f048d/content-type-visualizer.png) + + +#### How to use this extension +We have created a step-by-step guide on how to create a Content Type Visualizer extension for your content types. You can refer the [Content Type Visualizer extension guide]() on our documentation site for more info. + + +#### Other Documentation +- [Extensions guide](https://www.contentstack.com/docs/guide/extensions) +- [Common questions about extensions](https://www.contentstack.com/docs/faqs#extensions) + + +#### Modifying Extension + +To modify the extension, first clone this repo and install the dependencies. Then, edit the HTML, CSS and JS files from the source folder, and create a build using gulp task. + +To install dependencies, run the following command in the root folder +``` +npm install gulp-cli -g +npm install +``` +To create new build for the extension, run the following command (index.html): + + gulp build + diff --git a/content-type-visualizer/gulpfile.js b/content-type-visualizer/gulpfile.js new file mode 100644 index 00000000..b274fd76 --- /dev/null +++ b/content-type-visualizer/gulpfile.js @@ -0,0 +1,50 @@ +const gulp = require('gulp'); +const inline = require('gulp-inline'); +const uglify = require('gulp-uglify'); +const gulpStylelint = require('gulp-stylelint'); +const minifyCss = require('gulp-clean-css'); +const babel = require('gulp-babel'); +const eslint = require('gulp-eslint'); + + +gulp.task('lint-js', () => { + return gulp.src('source/*.js') + .pipe(eslint()) + .pipe(eslint.format()) + .pipe(eslint.failAfterError()); +}); + +gulp.task('lint-css', () => { + return gulp + .src('source/*.css') + .pipe(gulpStylelint({ + config: { + extends: 'stylelint-config-standard' + }, + reporters: [{ + formatter: 'string', + console: true + }], + failAfterError: false + })); +}); + +gulp.task('inline', () => { + return gulp.src('./source/index.html') + .pipe(inline({ + js: [babel({ + presets: ["@babel/preset-env"] + }), uglify], + css: [minifyCss], + disabledTypes: ['svg', 'img'] + })) + .pipe(gulp.dest('./')); +}); + +gulp.task('build', gulp.series('lint-js', 'lint-css', 'inline')); + +gulp.task('watch', () => { + gulp.watch('source/*', gulp.series('build')); +}); + +gulp.task('default', gulp.series('build')); diff --git a/content-type-visualizer/index.html b/content-type-visualizer/index.html new file mode 100644 index 00000000..0480dbbc --- /dev/null +++ b/content-type-visualizer/index.html @@ -0,0 +1,160 @@ + + + + + + External API UI Extension Sample + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ _ Content Types +
+
+ +
+
+
+ +
+ +
+
+ + + + +
+
+
+
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/content-type-visualizer/package.json b/content-type-visualizer/package.json new file mode 100644 index 00000000..db2bb5c6 --- /dev/null +++ b/content-type-visualizer/package.json @@ -0,0 +1,27 @@ +{ + "name": "@contentstack/extension-custom-dashboard-content-type-visualizer", + "version": "1.0.0", + "description": "A diagrammatic representation of all content types in a stack.", + "main": "gulpfile.js", + "scripts": { + "build": "npx gulp build" + }, + "author": "Contentstack", + "license": "MIT", + "devDependencies": { + "@babel/cli": "7.5.0", + "@babel/core": "7.5.4", + "@babel/preset-env": "7.5.4", + "eslint": "5.6.0", + "eslint-config-airbnb-base": "13.1.0", + "gulp": "4.0.0", + "gulp-babel": "8.0.0", + "gulp-clean-css": "4.2.0", + "gulp-eslint": "6.0.0", + "gulp-inline": "0.1.3", + "gulp-stylelint": "7.0.0", + "gulp-uglify": "3.0.0", + "stylelint": "13.2.0", + "stylelint-config-standard": "20.0.0" + } +} diff --git a/content-type-visualizer/source/index.html b/content-type-visualizer/source/index.html new file mode 100644 index 00000000..313aa067 --- /dev/null +++ b/content-type-visualizer/source/index.html @@ -0,0 +1,161 @@ + + + + + + External API UI Extension Sample + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ _ Content Types +
+
+ +
+
+
+ +
+ +
+
+ + + + +
+
+
+
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/content-type-visualizer/source/index.js b/content-type-visualizer/source/index.js new file mode 100644 index 00000000..aa73b604 --- /dev/null +++ b/content-type-visualizer/source/index.js @@ -0,0 +1,510 @@ +/* global Handlebars,jsPlumb,dagre,_,ClipboardJS */ +/* eslint no-undef: "error" */ +/* eslint-disable radix */ +/* eslint-disable no-param-reassign */ +/* eslint-disable default-case */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable one-var */ +/* eslint-disable no-plusplus */ +/* eslint-disable no-else-return */ +/* eslint-disable no-prototype-builtins */ + +let extensionField; +let referenceConnections = {}; +let labels = {}; +let json = {}; +let count = {}; +let entryCount = {}; +let env = []; +let loader = $('.reference-loading'); +let envArray; +let apiKey; +let appHost; +let blockLength = 0; + +// Counts number of fields in a content type +function countFields(schema, uid) { + if (count.hasOwnProperty(uid)) { + count[uid] += schema.length + blockLength; + blockLength = 0; + } else { + Object.defineProperty(count, uid, { + value: schema.length, + writable: true + }); + } +} + +// Reads the content type schema +function readSchema(schema, uid) { + schema.forEach(field => { + if (field.data_type === 'group' || field.data_type === 'global_field') { + readSchema(field.schema, uid); + } + + if (field.data_type === 'blocks') { + blockLength += field.blocks.length; + field.blocks.forEach(block => { + readSchema(block.schema, uid); + }); + } + + if (field.data_type === 'reference') { + if (referenceConnections.hasOwnProperty(uid)) { + referenceConnections[uid] = referenceConnections[uid].concat(field.reference_to); + } else { + let references = [field.reference_to]; + Object.defineProperty(referenceConnections, uid, { + value: references.flat(1), + writable: true + }); + } + } + }); + + countFields(schema, uid); +} + +// To add labels on the connections +function connectorLabel(source, target) { + let sourceLabel = (labels[source] === true) ? '1' : 'M'; + let targetLabel = (labels[target] === true) ? '1' : 'M'; + return sourceLabel + ':' + targetLabel; +} + +function removeDuplicates(originalArray, prop) { + /* eslint-disable guard-for-in */ + /* eslint-disable vars-on-top */ + var newArray = []; + var lookupObject = {}; + /* eslint-disable block-scoped-var */ + for (var i in originalArray) { + lookupObject[originalArray[i][prop]] = originalArray[i]; + } + for (i in lookupObject) { + newArray.push(lookupObject[i]); + } + return newArray; +} + +function updateSidebarDetails(id) { + envArray.forEach(envData => { + extensionField.stack.ContentType(id).Entry + .Query() + .environment(envData.env) + .includeCount() + .find() + .then(result => { + if (entryCount.hasOwnProperty(id)) { + entryCount[id][envData.env] = result.count; + } else { + entryCount[id] = { + [envData.env]: result.count + }; + } + }); + }); + + $('.copy-btn').attr('data-clipboard-text', JSON.stringify(json[id], null, 2)); + $('#json-collapsed').JSONView(json[id], { + collapsed: false + }); + $('.title').text(json[id].title); + $('.edit-icon').attr('href', `https://${appHost}/#!/stack/${apiKey}/content-type/${id}/content-type-builder`); + $('.count').text('Field count: ' + count[id]); + $('#environments').val('default').change(); + $('#entry-count').text('Entry count: _'); + $('#environments').click(function () { + let selectedEnv = $(this).children('option:selected').val(); + if (selectedEnv === 'default') { + $('#entry-count').text('Entry count: _'); + } else { + $('#entry-count').text('Entry count: ' + entryCount[id][selectedEnv]); + } + }); +} + +function init() { + let diagramSource = $('#diagram-template').html(); + let diagramTemplate = Handlebars.compile(diagramSource); + + // Helper that handles if else conditions + Handlebars.registerHelper('if_eq', function (a, b, opts) { + if (a === b) { + return opts.fn(this); + } else { + return opts.inverse(this); + } + }); + + // Helper that returns field icon image url for each field in the content type + Handlebars.registerHelper('fieldIcon', function (type, metaData, displayType) { + let iconUrl = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjI4cHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDI4IDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggNTEuMiAoNTc1MTkpIC0gaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoIC0tPg0KICAgIDx0aXRsZT5OdW1iZXIgSWNvbiBDb3B5PC90aXRsZT4NCiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4NCiAgICA8ZGVmcz48L2RlZnM+DQogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9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iAgICAgICAgICAgIDwvZz4NCiAgICAgICAgPC9nPg0KICAgIDwvZz4NCjwvc3ZnPg=='; + + if (type === 'text') { + switch (true) { + case (metaData.multiline === true): + iconUrl = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjI4cHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDI4IDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggNTEuMiAoNTc1MTkpIC0gaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoIC0tPg0KICAgIDx0aXRsZT5NdWx0aSBsaW5lIGljb248L3RpdGxlPg0KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPg0KICAgIDxkZWZzPjwvZGVmcz4NCiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4NCiAgICAgICAgPGcgaWQ9Im5ldy1idWlsZGVyLS0td2l0aC1zZWxlY3QtZmllbGQtY2hvaWNlcy1hZGRlZC1jb3B5LTUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xOTguMDAwMDAwLCAtMjQxLjAwMDAwMCkiIGZpbGwtcnVsZT0ibm9uemVybyI+DQogICAgICAgICAgICA8ZyBpZD0iRGF0YS10eXBlcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTUuMDAwMDAwLCAxOTUuMDAwMDAwKSI+DQogICAgICAgICAgICAgICAgPGcgaWQ9Ik11bHRpbGluZS1GaWVsZCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTM0LjAwMDAwMCwgMC4wMDAwMDApIj4NCiAgICAgICAgICAgICAgICAgICAgPGcgaWQ9Ikdyb3VwLTUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDM2LjAwMDAwMCwgNDYuMDAwMDAwKSI+DQogICAgICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iTXVsdGktbGluZS1pY29uIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMy4wMDAwMDAsIDAuMDAwMDAwKSI+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS00IiBzdHJva2U9IiM1QTVBNUEiIHg9IjAuNSIgeT0iMC41IiB3aWR0aD0iMjciIGhlaWdodD0iMTkiIHJ4PSIxIj48L3JlY3Q+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS01IiBmaWxsPSIjNUE1QTVBIiB4PSI2IiB5PSI2IiB3aWR0aD0iMTYiIGhlaWdodD0iMSI+PC9yZWN0Pg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtNS1Db3B5IiBmaWxsPSIjNUE1QTVBIiB4PSI2IiB5PSIxMiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjEiPjwvcmVjdD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDwvZz4NCiAgICAgICAgICAgICAgICAgICAgPC9nPg0KICAgICAgICAgICAgICAgIDwvZz4NCiAgICAgICAgICAgIDwvZz4NCiAgICAgICAgPC9nPg0KICAgIDwvZz4NCjwvc3ZnPg=='; + break; + case (metaData.allow_rich_text === true): + iconUrl = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjE1cHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDE1IDIwIiB2ZXJzaW9uPSIxL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Qtc2l6ZT0iMTgiIGZvbnQtd2VpZ2h0PSJub3JtYWwiPg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0c3BhbiB4PSIyLjAwMjQ0MTQxIiB5PSIxNiI+VDwvdHNwYW4+DQogICAgICAgICAgICAgICAgICAgICAgICA8L3RleHQ+DQogICAgICAgICAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTYiIGZpbGwtcnVsZT0ibm9uemVybyIgeD0iMCIgeT0iMTgiIHdpZHRoPSIxNSIgaGVpZ2h0PSIyIj48L3JlY3Q+DQogICAgICAgICAgICAgICAgICAgIDwvZz4NCiAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICA8L2c+DQogICAgICAgIDwvZz4NCiAgICA8L2c+DQo8L3N2Zz4='; + break; + case (metaData.markdown === true): + iconUrl = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjI4cHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDI4IDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggNTEuMiAoNTc1MTkpIC0gaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoIC0tPg0KICAgIDx0aXRsZT5NYXJrIERvd24gSUNPTjwvdGl0bGU+DQogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+DQogICAgPGRlZnM+PC9kZWZzPg0KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQi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NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHRzcGFuIHg9IjAuMjIwNDU4OTg0IiB5PSIxMiI+TTwvdHNwYW4+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPC90ZXh0Pg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxnIGlkPSJHcm91cC0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNS4wMDAwMDAsIDMuMDAwMDAwKSIgZmlsbC1ydWxlPSJub256ZXJvIj4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS03IiB4PSIyIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSI4Ij48L3JlY3Q+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJQYXRoLTIiIHBvaW50cz0iMC41NDc5NDQ2MDEgNi4wNjQzNzYwMSA0LjQ5MjQyMTI2IDYuMDY0Mzc2MDEgMi41MjAxODI5MyA5LjA3NDA2MzYzIj48L3BvbHlnb24+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9nPg0KICAgICAgICAgICAgICAgICAgICAgICAgPC9nPg0KICAgICAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICAgICAgPC9nPg0KICAgICAgICAgICAgPC9nPg0KICAgICAgICA8L2c+DQogICAgPC9nPg0KPC9zdmc+'; + break; + case (metaData.extension === true): + iconUrl = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjI4cHgiIGhlaWdodD0iMTlweCIgdmlld0JveD0iMCAwIDI4IDE5IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KICAgIDwhLS0gR2Vu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CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iR3JvdXAtNy1Db3B5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCwgNC4wMDAwMDApIj4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0xNiIgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgcng9IjEiPjwvcmVjdD4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS01IiB4PSI1IiB5PSIwLjUiIHdpZHRoPSIxMC42IiBoZWlnaHQ9IjEiPjwvcmVjdD4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPGcgaWQ9Ikdyb3VwLTctQ29weS0yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCwgOC4wMDAwMDApIj4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0xNiIgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgcng9IjEiPjwvcmVjdD4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS01IiB4PSI1IiB5PSIwLjUiIHdpZHRoPSIxMC42IiBoZWlnaHQ9IjEiPjwvcmVjdD4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICAgICAgICAgIDwvZz4NCiAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICA8L2c+DQogICAgICAgIDwvZz4NCiAgICA8L2c+DQo8L3N2Zz4='; + break; + default: + iconUrl = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVV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HJhbnNmb3JtPSJ0cmFuc2xhdGUoMTguMDAwMDAwLCAwLjAwMDAwMCkiPg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtNCIgc3Ryb2tlPSIjNUE1QTVBIiB4PSIwLjUiIHk9IjAuNSIgd2lkdGg9IjI3IiBoZWlnaHQ9IjE5IiByeD0iMSI+PC9yZWN0Pg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtNSIgZmlsbD0iIzVBNUE1QSIgeD0iNS42IiB5PSI2LjQiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxIj48L3JlY3Q+DQogICAgICAgICAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICAgICAgICAgIDwvZz4NCiAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICA8L2c+DQogICAgICAgIDwvZz4NCiAgICA8L2c+DQo8L3N2Zz4='; + } + } else { + switch (true) { + case (type === 'number'): + iconUrl = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjI4cHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDI4IDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggNTEuMiAoNTc1MTkpIC0gaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoIC0tPg0KICAgIDx0aXRsZT5OdW1iZXIgSWNvbjwvdGl0bGU+DQogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+DQogICAgPGRlZnM+PC9kZWZzPg0KICAgIDxnIGlkPSJQYWd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HJhbnNmb3JtPSJ0cmFuc2xhdGUoMTM0LjAwMDAwMCwgMzYwLjAwMDAwMCkiPg0KICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iTnVtYmVyLUljb24tQ29weSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNDkuMDAwMDAwLCA0Ni4wMDAwMDApIj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtNCIgc3Ryb2tlPSIjNUE1QTVBIiBmaWxsLXJ1bGU9Im5vbnplcm8iIHg9IjAuNSIgeT0iMC41IiB3aWR0aD0iMjciIGhlaWdodD0iMTkiIHJ4PSIxIj48L3JlY3Q+DQogICAgICAgICAgICAgICAgICAgICAgICA8dGV4dCBpZD0iMC0xIiBmb250LWZhbWlseT0iVGltZXNOZXdSb21hblBTTVQsIFRpbWVzIE5ldyBSb21hbiIgZm9udC1zaXplPSIxMyIgZm9udC13ZWlnaHQ9Im5vcm1hbCIgZmlsbD0iIzVBNUE1QSI+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHRzcGFuIHg9IjYuMzc1IiB5PSIxNCI+MCAxPC90c3Bhbj4NCiAgICAgICAgICAgICAgICAgICAgICAgIDwvdGV4dD4NCiAgICAgICAgICAgICAgICAgICAgPC9nPg0KICAgICAgICAgICAgICAgIDwvZz4NCiAgICAgICAgICAgIDwvZz4NCiAgICAgICAgPC9nPg0KICAgIDwvZz4NCjwvc3ZnPg=='; + break; + case (type === 'isodate'): + iconUrl = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjIxcHgiIGhlaWdodD0iMjFweCIgdmlld0JveD0iMCAwIDIxIDIxIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbms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SwxNS4zMTI1IEw5LjYyNSwxNy4wNjI1IEwxMS4zNzUsMTcuMDYyNSBMMTEuMzc1LDE1LjMxMjUgWiBNMTcuMDYyNSwxLjc1IEwxNy4wNjI1LDAgTDE2LjE4NzUsMCBMMTYuMTg3NSwxLjc1IEw0LjgxMjUsMS43NSBMNC44MTI1LDAgTDMuOTM3NSwwIEwzLjkzNzUsMS43NSBMMCwxLjc1IEwwLDIxIEwyMSwyMSBMMjEsMS43NSBMMTcuMDYyNSwxLjc1IFogTTIwLjEyNSwyMC4xMjUgTDAuODc1LDIwLjEyNSBMMC44NzUsNyBMMjAuMTI1LDcgTDIwLjEyNSwyMC4xMjUgWiBNMjAuMTI1LDYuMTI1IEwwLjg3NSw2LjEyNSBMMC44NzUsMi42MjUgTDMuOTM3NSwyLjYyNSBMMy45Mzc1LDMuNSBMNC44MTI1LDMuNSBMNC44MTI1LDIuNjI1IEwxNi4xODc1LDIuNjI1IEwxNi4xODc1LDMuNSBMMTcuMDYyNSwzLjUgTDE3LjA2MjUsMi42MjUgTDIwLjEyNSwyLjYyNSBMMjAuMTI1LDYuMTI1IFoiIGlkPSJTaGFwZSI+PC9wYXRoPg0KICAgICAgICAgICAgICAgICAgICA8L2c+DQogICAgICAgICAgICAgICAgPC9nPg0KICAgICAgICAgICAgPC9nPg0KICAgICAgICA8L2c+DQogICAgPC9nPg0KPC9zdmc+'; + break; + case (type === 'file' && metaData.rich_text_type === 'standard'): + iconUrl = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjVweCIgdmlld0JveD0iMCAwIDIwIDI1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KICAgIDwhLS0gR2VuZXJhdG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AiIHdpZHRoPSI1IiBoZWlnaHQ9IjEiPjwvcmVjdD4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTEzIiB4PSI0IiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSI4Ij48L3JlY3Q+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0xNCIgeD0iNCIgeT0iNyIgd2lkdGg9IjgiIGhlaWdodD0iMSI+PC9yZWN0Pg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMTUiIHg9IjExIiB5PSI3IiB3aWR0aD0iMSIgaGVpZ2h0PSI1Ij48L3JlY3Q+DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0xMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMTIiPjwvcmVjdD4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTExLUNvcHkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYuMDAwMDAwLCAxMS41MDAwMDApIHJvdGF0ZSgtMjcwLjAwMDAwMCkgdHJhbnNsYXRlKC02LjAwMDAwMCwgLTExLjUwMDAwMCkgIiB4PSI1LjUiIHk9IjUuNSIgd2lkdGg9IjEiIGhlaWdodD0iMTIiPjwvcmVjdD4NCiAgICAgICAgICAgICAgICAgICAgICAgIDwvZz4NCiAgICAgICAgICAgICAgICAgICAgPC9nPg0KICAgICAgICAgICAgICAgIDwvZz4NCiAgICAgICAgICAgIDwvZz4NCiAgICAgICAgPC9nPg0KICAgIDwvZz4NCjwvc3ZnPg=='; + break; + case (metaData.extension === true): + iconUrl = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjI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2ODY5NTYsMTYuNzg4OTMyNyBMMTkuOTc2NTIxNywxNi43ODg5MzI3IEMyMC4yNTI2NjQsMTYuNzg4OTMyNyAyMC40NzY1MjE3LDE2LjU2NTA3NTEgMjAuNDc2NTIxNywxNi4yODg5MzI3IEwyMC40NzY1MjE3LDEuOTYwODY5NTcgQzIwLjQ3NjUyMTcsMS42ODQ3MjcxOSAyMC4yNTI2NjQsMS40NjA4Njk1NyAxOS45NzY1MjE3LDEuNDYwODY5NTcgTDE1LjE2ODY5NTYsMS40NjA4Njk1NyBDMTIuMjM3MjY0MiwxLjQ2MDg2OTU3IDkuODYwODY5NTcsMy44MzcyNjQyMyA5Ljg2MDg2OTU3LDYuNzY4Njk1NjEgTDkuODYwODY5NTcsOC41MjE3MzkxMyBaIiBpZD0iMjh4MTgtZXh0ZW5zaW9uIiBmaWxsPSIjNjM3NDgwIj48L3BhdGg+DQogICAgPC9nPg0KPC9zdmc+'; + break; + } + } + return iconUrl; + }); + + // Helper that returns the url which redirects to the particular content type builder + Handlebars.registerHelper('contentTypeBuilderUrl', function (uid) { + let url; + if (uid) { + url = `https://${appHost}/#!/stack/${apiKey}/content-type/${uid}/content-type-builder`; + } + return url; + }); + + // Retrieves all the content types from the stack + extensionField.stack.getContentTypes('', { include_count: true, include_global_field_schema: true }) + .then(res => { + res.content_types.forEach((contentType) => { + labels[contentType.uid] = contentType.options.singleton; + json[contentType.uid] = contentType; + readSchema(contentType.schema, contentType.uid); + }); + + // Using handlebars to pass content type data to render in HTML template + Handlebars.registerPartial('list', $('#partial').html()); + $('#diagram-placeholder').html(diagramTemplate({ diagramData: res.content_types })); + + $('.content-type-count span').text(res.count); + + // Sidebar toggle + const sidebar = document.querySelector('.sidebar'); + const mainContainer = document.querySelector('.container'); + const button = document.querySelector('.toggle'); + + var defaultId = Object.keys(json)[0]; + updateSidebarDetails(defaultId); + + document.querySelector('.toggle').onclick = function (e) { + e.preventDefault(); + var defaultJsonId = Object.keys(json)[0]; + updateSidebarDetails(defaultJsonId); + sidebar.classList.toggle('toggle-sidebar'); + mainContainer.classList.toggle('toggle-container'); + button.classList.toggle('toggle-button'); + }; + + // Event listener for jsonview tab + $('.icon-eye-open').on('click', function () { + var id = $(this).data('id'); + updateSidebarDetails(id); + sidebar.classList.remove('toggle-sidebar'); + mainContainer.classList.remove('toggle-container'); + button.classList.remove('toggle-button'); + }); + + // Copy button text change + let clipboard = new ClipboardJS('.btn'); + + $('.copy-btn').on('click', function () { + let copyBtn = $(this); + clipboard.on('success', function (e) { + copyBtn.text('Copied'); + setTimeout(function () { + copyBtn.text('Copy'); + }, 1000); + e.clearSelection(); + }); + }); + + // Building diagram using jsplumb + jsPlumb.ready(function () { + let $container = $('.container'); + let $panzoom = null; + let sourceAnchors = [ + [0.2, 0, 0, -1, 0, 0], + [1, 0.2, 1, 0, 0, 0], + [0.8, 1, 0, 1, 0, 0], + [0, 0.8, -1, 0, 0, 0] + ], + targetAnchors = [ + [0.6, 0, 0, -1], + [1, 0.6, 1, 0], + [0.4, 1, 0, 1], + [0, 0.4, -1, 0] + ], + connector = ['Flowchart', + { + cornerRadius: 5, + stub: 16 + } + ], + connectorStyle = { + gradient: { + stops: [ + [0, '#00f'], + [0.5, '#09098e'], + [1, '#00f'] + ] + }, + strokeWidth: 3, + stroke: '#00f', + outlineStroke: 'white', + outlineWidth: 4 + }, + endpoint = ['Dot', { cssClass: 'endpointClass', radius: 10, hoverClass: 'endpointHoverClass' }], + anEndpoint = { + endpoint: endpoint, + paintStyle: { fill: '#00f' }, + isSource: true, + isTarget: true, + maxConnections: -1, + connector: connector, + connectorStyle: connectorStyle + }; + + let plumb = jsPlumb.getInstance({ + DragOptions: { cursor: 'pointer', zIndex: 2000 }, + Anchors: [['Left', 'Right', 'Bottom'], ['Top', 'Bottom']], + Container: $container.find('.diagram') + }); + + plumb.batch(function () { + let endpoints = {}, + divsWithWindowClass = jsPlumb.getSelector('.container .window'); + + // Adding endpoints for each content type element + for (let i = 0; i < divsWithWindowClass.length; i++) { + let id = plumb.getId(divsWithWindowClass[i]); + endpoints[id] = [ + plumb.addEndpoint(id, anEndpoint, { anchor: sourceAnchors }), + plumb.addEndpoint(id, anEndpoint, { anchor: targetAnchors }) + ]; + } + + // Adding connections between the content type elements + for (let e in endpoints) { + if (referenceConnections[e]) { + for (let j = 0; j < referenceConnections[e].length; j++) { + plumb.connect({ + source: endpoints[e][0], + target: endpoints[referenceConnections[e][j]][1], + overlays: [ + ['Label', { label: connectorLabel((endpoints[e][0]).elementId, (endpoints[referenceConnections[e][j]][1]).elementId), cssClass: 'aLabel', location: 0.5 }] + ] + }); + } + } + } + + plumb.draggable(divsWithWindowClass); + + // Positioning and laying out all the content type elements on the canvas + let dg = new dagre.graphlib.Graph(); + dg.setGraph({ + nodesep: 30, ranksep: 30, marginx: 50, marginy: 50 + }); + dg.setDefaultEdgeLabel(function () { return {}; }); + $container.find('.window').each( + function (idx, node) { + let $n = $(node); + let box = { + width: Math.round($n.outerWidth()), + height: Math.round($n.outerHeight()) + }; + dg.setNode($n.attr('id'), box); + } + ); + plumb.getAllConnections() + .forEach(function (edge) { dg.setEdge(edge.source.id, edge.target.id); }); + dagre.layout(dg); + dg.nodes().forEach( + function (n) { + let node = dg.node(n); + let top = Math.round(node.y - node.height / 2) + 100 + 'px'; + let left = Math.round(node.x - node.width / 2) - 400 + 'px'; + $('#' + n).css({ left: left, top: top }); + } + ); + plumb.repaintEverything(); + + // Zooming and paning the diagram + _.defer(function () { + $panzoom = $container.find('.panzoom').panzoom({ + $zoomIn: $('.zoom-in'), + $zoomOut: $('.zoom-out'), + minScale: 0.2, + maxScale: 1, + increment: 0.1, + cursor: '', + startTransform: 'scale(0.5)', + ignoreChildrensEvents: true + }).on('panzoomstart', function () { + $panzoom.css('cursor', 'move'); + }) + .on('panzoomend', function () { + $panzoom.css('cursor', ''); + }); + + $panzoom.parent() + .on('mousewheel.focal', function (e) { + if (e.ctrlKey || e.originalEvent.ctrlKey) { + e.preventDefault(); + let delta = e.delta || e.originalEvent.wheelDelta; + let zoomOut = delta ? delta < 0 : e.originalEvent.deltaY > 0; + $panzoom.panzoom('zoom', zoomOut, { + animate: true, + exponential: false + }); + } else { + e.preventDefault(); + let deltaY = e.deltaY || e.originalEvent.wheelDeltaY || (-e.originalEvent.deltaY); + let deltaX = e.deltaX || e.originalEvent.wheelDeltaX || (-e.originalEvent.deltaX); + $panzoom.panzoom('pan', deltaX / 2, deltaY / 2, { + animate: true, + relative: true + }); + } + }) + .on('mousedown touchstart', function (ev) { + let matrix = $container.find('.panzoom').panzoom('getMatrix'); + let offsetX = matrix[4]; + let offsetY = matrix[5]; + let dragstart = { + x: ev.pageX, y: ev.pageY, dx: offsetX, dy: offsetY + }; + $(ev.target).css('cursor', 'move'); + $(this).data('dragstart', dragstart); + }) + .on('mousemove touchmove', function (ev) { + let dragstart = $(this).data('dragstart'); + if (dragstart) { + let deltaX = dragstart.x - ev.pageX; + let deltaY = dragstart.y - ev.pageY; + let matrix = $container.find('.panzoom').panzoom('getMatrix'); + matrix[4] = parseInt(dragstart.dx) - deltaX; + matrix[5] = parseInt(dragstart.dy) - deltaY; + $container.find('.panzoom').panzoom('setMatrix', matrix); + } + }) + .on('mouseup touchend touchcancel', function (ev) { + $(this).data('dragstart', null); + $(ev.target).css('cursor', ''); + }); + }); + + // Dragging all the content type elements + let currentScale = 1; + $container.find('.diagram .window').draggable({ + /* eslint-disable no-unused-vars */ + start: function (e) { + let pz = $container.find('.panzoom'); + currentScale = pz.panzoom('getMatrix')[0]; + $(this).css('cursor', 'move'); + pz.panzoom('disable'); + }, + drag: function (e, ui) { + ui.position.left /= currentScale; + ui.position.top /= currentScale; + if ($(this).hasClass('jsplumb-connected')) { + plumb.repaint($(this).attr('id'), ui.position); + } + }, + stop: function (e, ui) { + let nodeId = $(this).attr('id'); + if ($(this).hasClass('jsplumb-connected')) { + plumb.repaint(nodeId, ui.position); + } + $(this).css('cursor', ''); + $container.find('.panzoom').panzoom('enable'); + } + }); + }); + }); + + loader.hide(); + $('.sidebar').show(); + $('.parent-container').css('opacity', '1'); + }); +} + +function refresh() { + loader.show(); + count = {}; + $('.parent-container').css('opacity', '0.5'); + init(); +} + +$(document).ready(() => { + ContentstackUIExtension.init().then(extension => { + extensionField = extension; + Object.assign(extensionField.config, extensionField.fieldConfig); + apiKey = extensionField.stack._data.api_key; + appHost = extensionField.config.appHost; + + extensionField.stack.getEnvironments().then(res => { + res.environments.forEach(environment => { + env.push({ + env: environment.name + }); + }); + envArray = removeDuplicates(env, 'env'); + $.each(envArray, function (i, item) { + $('#environments').append($('