Skip to content

AB#113709 - File explorer widget #2796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/file-explorer-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}
6 changes: 6 additions & 0 deletions apps/file-explorer-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from 'cypress';
import { nxE2EStorybookPreset } from '@nrwl/storybook/presets/cypress';

export default defineConfig({
e2e: nxE2EStorybookPreset(__dirname),
});
30 changes: 30 additions & 0 deletions apps/file-explorer-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "file-explorer-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/file-explorer-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/file-explorer-e2e/cypress.config.ts",
"devServerTarget": "file-explorer:storybook",
"testingType": "e2e"
},
"configurations": {
"ci": {
"devServerTarget": "file-explorer:storybook:ci"
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/file-explorer-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["file-explorer"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe('file-explorer', () => {
beforeEach(() =>
cy.visit('/iframe.html?id=fileexplorerwidgetcomponent--primary')
);
it('should render the component', () => {
cy.get('oort-front-file-explorer-widget').should('exist');
});
});
4 changes: 4 additions & 0 deletions apps/file-explorer-e2e/src/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}
33 changes: 33 additions & 0 deletions apps/file-explorer-e2e/src/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************

// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
17 changes: 17 additions & 0 deletions apps/file-explorer-e2e/src/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';
10 changes: 10 additions & 0 deletions apps/file-explorer-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"]
}
36 changes: 36 additions & 0 deletions libs/file-explorer/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "oortFront",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "oort-front",
"style": "kebab-case"
}
]
},
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {}
}
]
}
33 changes: 33 additions & 0 deletions libs/file-explorer/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { StorybookConfig } from '@storybook/angular';

/**
* Storybook configuration
*/
const config: StorybookConfig = {
stories: ['../**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: [
'@storybook/addon-mdx-gfm',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
staticDirs: [
{
from: '../../../assets',
to: '/assets',
},
{
from: '../../shared/src/i18n',
to: '/assets/i18n',
},
],
framework: {
name: '@storybook/angular',
options: {},
},
};

export default config;

// To customize your webpack configuration you can use the webpackFinal field.
// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
17 changes: 17 additions & 0 deletions libs/file-explorer/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0"
/>
</head>
</html>
10 changes: 10 additions & 0 deletions libs/file-explorer/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import '@angular/localize/init';
// import { setCompodocJson } from '@storybook/addon-docs/angular';
// import docJson from '../documentation.json';
// setCompodocJson(docJson);
import { library } from '@fortawesome/fontawesome-svg-core';
import { fas } from '@fortawesome/free-solid-svg-icons';
import { fab } from '@fortawesome/free-brands-svg-icons';

// Add font awesome icons
library.add(fas, fab);
17 changes: 17 additions & 0 deletions libs/file-explorer/.storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"emitDecoratorMetadata": true
},

"exclude": ["../**/*.spec.ts"],
"include": [
"../src/**/*.stories.ts",
"../src/**/*.stories.js",
"../src/**/*.stories.jsx",
"../src/**/*.stories.tsx",
"../src/**/*.stories.mdx",
"../src/**/*.component.ts",
"*.js"
]
}
23 changes: 23 additions & 0 deletions libs/file-explorer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# file-explorer

This library was generated with [Nx](https://nx.dev).

## Run storybook

`npx nx run file-explorer:storybook`

## Lint

`npx nx run file-explorer:lint`

## Generate new Angular files

Generate a new component:
`npx nx g c components/<name> --project=file-explorer`

Generate a new standalone component:
`npx nx g c components/<name> --standalone true --project=file-explorer`

## Running unit tests

Run `nx test file-explorer` to execute the unit tests.
22 changes: 22 additions & 0 deletions libs/file-explorer/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'file-explorer',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
coverageDirectory: '../../coverage/libs/file-explorer',
transform: {
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
82 changes: 82 additions & 0 deletions libs/file-explorer/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"name": "file-explorer",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "libs/file-explorer/src",
"prefix": "oort-front",
"targets": {
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/file-explorer/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"libs/file-explorer/**/*.ts",
"libs/file-explorer/**/*.html"
]
}
},
"storybook": {
"executor": "@storybook/angular:start-storybook",
"options": {
"port": 4400,
"configDir": "libs/file-explorer/.storybook",
"browserTarget": "file-explorer:build-storybook",
"compodoc": false,
"styles": [
"libs/shared/src/lib/style/styles.scss",
"libs/styles/src/lib/storybook/storybook.scss",
"libs/styles/src/lib/tailwind/tailwind.scss",
"libs/styles/src/lib/shared/shared.scss",
"libs/styles/src/lib/kendo/theme.scss",
"node_modules/survey-core/defaultV2.min.css",
"node_modules/survey-core/survey.min.css"
],
"stylePreprocessorOptions": {
"includePaths": ["libs/styles/src/lib/themes/default"]
}
},
"configurations": {
"ci": {
"quiet": true
}
}
},
"build-storybook": {
"executor": "@storybook/angular:build-storybook",
"outputs": ["{options.outputDir}"],
"options": {
"outputDir": "dist/storybook/file-explorer",
"configDir": "libs/file-explorer/.storybook",
"browserTarget": "file-explorer:build-storybook",
"compodoc": false,
"styles": ["libs/shared/src/lib/style/styles.scss"],
"stylePreprocessorOptions": {
"includePaths": [
"libs/styles/src/lib/themes/default",
"libs/styles/src/lib/kendo"
]
}
},
"configurations": {
"ci": {
"quiet": true
}
}
}
},
"tags": []
}
1 change: 1 addition & 0 deletions libs/file-explorer/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/file-explorer.module';
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="flex flex-col p-4 w-32 h-32 justify-between items-center">
<ui-icon [icon]="document.filename | fileIcon" [size]="32" fontFamily="fa"></ui-icon>
<div class="text-center">{{ document.filename }}</div>
</div>
Loading