
* New datagrid view for product variant management (#2040) * Split simple and product with variants updates * Simplify code * Change selectedVariantsIds to availableVariants selectedVariantsIds suggested that these variants *were just* selected * Add datagrid component Add datagrid component Add actions column Add column picker Add ts-ignore comment Remove unused import Fix after rebase Add story Fix column picking Fix column dragging Add column resizing Extract components to own files Apply styles from class Improve data storage Extract state to hook Expose handlers Fix styles Fix header overflow Add select all option Add cell types Fix types Add number type cell Add min to stocks Fix types Generate columns from shop data Add number type editor Fix tests Update src/components/Datagrid/Datagrid.tsx Co-authored-by: Jonatan Witoszek <jonatanwitoszek@gmail.com> Reconstruct data after column toggling Minor fixes Add missing id Remove unused import Fix container width Keep changes in state Drop onChange usage Use glide datagrid * Add column picker * Memoize callbacks * Add right toolbar * Make toolbar as prop * Clean up code * Fix styling * Lint files * Save variant data in datagrid (#2161) * Allow rows to be deleted * Add row adding * Clean up code * Improve mutations * Add stock saving * Add sku and attribute saving * Display notification after all mutations * Fix types * Save channels in datagrid (#2197) * wip * Merge simple and variantable handlers * Move channel setting to form * Link availability card to form * Extract listing management to hook * Update only touched channels * Improve channel listing managemend * Display channel data in datagrid * Save variant channels * Save changes in channel listings * Group columns * Fix types * Display touched fields * Return errors from hook * Display errors in cells * Improve naming * Improve naming * Use reliable called/loading state * Update src/components/Datagrid/cells.ts Co-authored-by: Michał Droń <dron.official@yahoo.com> * Apply fixes from review Co-authored-by: Michał Droń <dron.official@yahoo.com> * Fix type error * Trigger CI * Trigger CI * Save added and deleted variants (#2237) * Save new variants * Update channel data * Remove bulk variant delete dialog * Do not fetch products from api after save * Extract types * Reset errors after api response * Display error when creating variants * Fix variant reordering * Remove commented code * Fix imports * Edit attributes in datagrid (#2305) * Add basic dropdown cell * Fix clickaway * Add choice customization * Add callback to fetch choices * Add attriute value search * wip * Pass getSuggestions cb using props * Fix row adding * Fix choice creation * Add styles to datagrid (#2315) * Improve cell styling * Prevent navigation when scrolling horizontally * Fix text editor styles * Remove unused variable * Update whole row after editing cell * Translate column names * Improve empty message * Highlight newly created rows * Add name editing * Add disabled context menu to added rows * Add column groups * Translate column groups names * Save edited name * Fix missing column id error * Add card to datagrid * Improve shadow on scroll * Improve fonts * Fix toolbar placement * Update api type definitions * Fix copypasting from excel * Fix editor font weight * Improve dark theme * Improve cell coloring * Drop styling from story * Add docs to datagrid (#2339) * Add docs * Add summary * Datagrid fix bugs (#2341) * Pass refetch to form to avoid double calls * Add missing prop * Remove paddings (#2352) * remove paddings * remove paddings * remove paddings * remove vertical scroll * update tests * styles, currency * Fix variants tests in datagrid (#2365) * refactor variant test after adding datagrid * adding assertion to check if datagrid table is visible * adding check for datagrid * fix flaky tests in variants * fix flaky tests in variants * small changes * amedments * update styles * refactoring, handle prices * update snapshots * messages * snap * scrolling handle, css for safari * snap, random mock * update overflow * history back hook * fix cross-price changing, scroll optimization * trigger ci * channel checking when adding new variant Co-authored-by: Michał Droń <dron.official@yahoo.com> Co-authored-by: Patryk Andrzejewski <vox3r69@gmail.com> Co-authored-by: Ewa Czerniak <ewa.czerniak@saleor.io>
179 lines
4.8 KiB
JavaScript
179 lines
4.8 KiB
JavaScript
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
const path = require("path");
|
|
const CheckerPlugin = require("fork-ts-checker-webpack-plugin");
|
|
const webpack = require("webpack");
|
|
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
const { InjectManifest } = require("workbox-webpack-plugin");
|
|
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
|
|
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
|
|
.BundleAnalyzerPlugin;
|
|
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
|
|
|
|
require("dotenv").config();
|
|
|
|
const resolve = path.resolve.bind(path, __dirname);
|
|
|
|
let bundleAnalyzerPlugin;
|
|
let speedMeasureWrapper = fn => fn;
|
|
const analyze = process.env.ANALYZE;
|
|
if (!!analyze) {
|
|
const smp = new SpeedMeasurePlugin();
|
|
speedMeasureWrapper = smp.wrap;
|
|
bundleAnalyzerPlugin = new BundleAnalyzerPlugin();
|
|
}
|
|
|
|
const pathsPlugin = new TsconfigPathsPlugin({
|
|
configFile: "./tsconfig.json",
|
|
});
|
|
|
|
const checkerPlugin = new CheckerPlugin({
|
|
eslint: true,
|
|
reportFiles: ["src/**/*.{ts,tsx}"],
|
|
});
|
|
const htmlWebpackPlugin = new HtmlWebpackPlugin({
|
|
filename: "index.html",
|
|
hash: true,
|
|
template: "./src/index.html",
|
|
});
|
|
const environmentPlugin = new webpack.EnvironmentPlugin({
|
|
API_URI: "",
|
|
MARKETPLACE_URL: "",
|
|
APP_MOUNT_URI: "/",
|
|
DEMO_MODE: false,
|
|
ENVIRONMENT: "",
|
|
GTM_ID: "",
|
|
SENTRY_DSN: "",
|
|
SW_INTERVAL: "300", // Fetch SW every 300 seconds
|
|
IS_CLOUD_INSTANCE: false,
|
|
});
|
|
|
|
const dashboardBuildPath = "build/dashboard/";
|
|
|
|
module.exports = speedMeasureWrapper((env, argv) => {
|
|
const devMode = argv.mode !== "production";
|
|
|
|
let fileLoaderPath;
|
|
let output;
|
|
|
|
if (!process.env.API_URI) {
|
|
throw new Error("Environment variable API_URI not set");
|
|
}
|
|
|
|
const publicPath = process.env.STATIC_URL || "/";
|
|
if (!devMode) {
|
|
output = {
|
|
chunkFilename: "[name].[chunkhash].js",
|
|
filename: "[name].[chunkhash].js",
|
|
path: resolve(dashboardBuildPath),
|
|
publicPath,
|
|
};
|
|
fileLoaderPath = "file-loader?name=[name].[hash].[ext]";
|
|
} else {
|
|
output = {
|
|
chunkFilename: "[name].js",
|
|
filename: "[name].js",
|
|
path: resolve(dashboardBuildPath),
|
|
publicPath,
|
|
};
|
|
fileLoaderPath = "file-loader?name=[name].[ext]";
|
|
}
|
|
|
|
// Create release if sentry config is set
|
|
let sentryPlugin;
|
|
if (
|
|
!devMode &&
|
|
process.env.SENTRY_ORG &&
|
|
process.env.SENTRY_PROJECT &&
|
|
process.env.SENTRY_DSN &&
|
|
process.env.SENTRY_AUTH_TOKEN
|
|
) {
|
|
sentryPlugin = new SentryWebpackPlugin({
|
|
include: "./build/dashboard/",
|
|
urlPrefix: process.env.SENTRY_URL_PREFIX,
|
|
});
|
|
}
|
|
|
|
let manifestPlugin;
|
|
if (!devMode) {
|
|
manifestPlugin = new InjectManifest({
|
|
swSrc: "./src/sw.js",
|
|
swDest: "sw.js",
|
|
maximumFileSizeToCacheInBytes: 5000000,
|
|
webpackCompilationPlugins: [checkerPlugin],
|
|
});
|
|
}
|
|
|
|
return {
|
|
devServer: {
|
|
compress: true,
|
|
contentBase: path.join(__dirname, dashboardBuildPath),
|
|
historyApiFallback: true,
|
|
hot: true,
|
|
port: 9000,
|
|
},
|
|
devtool: devMode ? "cheap-module-source-map" : "source-map",
|
|
entry: {
|
|
dashboard: "./src/index.tsx",
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(jsx?|tsx?)$/,
|
|
use: [
|
|
{
|
|
loader: "esbuild-loader",
|
|
options: {
|
|
loader: "tsx",
|
|
target: "es2015",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.css$/i,
|
|
use: ["style-loader", "css-loader"],
|
|
},
|
|
{
|
|
include: [
|
|
resolve("node_modules"),
|
|
resolve("assets/fonts"),
|
|
resolve("assets/images"),
|
|
resolve("assets/favicons"),
|
|
],
|
|
loader: fileLoaderPath,
|
|
test: /\.(eot|otf|png|svg|jpg|ttf|woff|woff2)(\?v=[0-9.]+)?$/,
|
|
},
|
|
],
|
|
},
|
|
optimization: {
|
|
removeAvailableModules: false,
|
|
removeEmptyChunks: false,
|
|
splitChunks: false,
|
|
},
|
|
output,
|
|
plugins: [
|
|
checkerPlugin,
|
|
environmentPlugin,
|
|
htmlWebpackPlugin,
|
|
sentryPlugin,
|
|
manifestPlugin,
|
|
bundleAnalyzerPlugin,
|
|
].filter(Boolean),
|
|
resolve: {
|
|
// Resolve macaw ui's peer dependencies to our own node_modules
|
|
// to make it work with npm link
|
|
alias: {
|
|
react: path.resolve("./node_modules/react"),
|
|
"react-dom": path.resolve("./node_modules/react-dom"),
|
|
"@material-ui/core": path.resolve("./node_modules/@material-ui/core"),
|
|
"@material-ui/icons": path.resolve("./node_modules/@material-ui/icons"),
|
|
"@material-ui/styles": path.resolve(
|
|
"./node_modules/@material-ui/styles",
|
|
),
|
|
},
|
|
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
plugins: [pathsPlugin],
|
|
},
|
|
};
|
|
});
|