Create skeleton

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia 2024-04-28 01:21:41 +02:00 committed by Francesco Torchia
parent 13e4e92c75
commit 56000e609e
No known key found for this signature in database
GPG Key ID: E6D011B7415D4393
19 changed files with 18089 additions and 0 deletions

18
.eslintignore Normal file
View File

@ -0,0 +1,18 @@
assets/fonts
coverage
.nyc_output
node_modules/
.npm
.eslintcache
.env
.cache
.next
.nuxt
dist
dist-pkg
.DS_Store
dynamic-importer.js
ksconfig.json
nuxt.config.js
shell/utils/dynamic-importer.js
shell/assets/fonts

173
.eslintrc.js Normal file
View File

@ -0,0 +1,173 @@
module.exports = {
root: true,
env: {
browser: true,
node: true
},
globals: { NodeJS: true, Timer: true },
extends: [
'standard',
'eslint:recommended',
'@nuxtjs/eslint-config-typescript',
'plugin:cypress/recommended'
],
// add your custom rules here
rules: {
'dot-notation': 'off',
'generator-star-spacing': 'off',
'guard-for-in': 'off',
'linebreak-style': 'off',
'new-cap': 'off',
'no-empty': 'off',
'no-extra-boolean-cast': 'off',
'no-new': 'off',
'no-plusplus': 'off',
'no-useless-escape': 'off',
'nuxt/no-cjs-in-config': 'off',
'semi-spacing': 'off',
'space-in-parens': 'off',
strict: 'off',
'unicorn/no-new-buffer': 'off',
'vue/html-self-closing': 'off',
'vue/no-unused-components': 'warn',
'vue/no-v-html': 'error',
'wrap-iife': 'off',
'array-bracket-spacing': 'warn',
'arrow-parens': 'warn',
'arrow-spacing': ['warn', { before: true, after: true }],
'block-spacing': ['warn', 'always'],
'brace-style': ['warn', '1tbs'],
'comma-dangle': ['warn', 'only-multiline'],
'comma-spacing': 'warn',
curly: 'warn',
eqeqeq: 'warn',
'func-call-spacing': ['warn', 'never'],
'implicit-arrow-linebreak': 'warn',
indent: ['warn', 2],
'keyword-spacing': 'warn',
'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
'multiline-ternary': ['warn', 'never'],
'newline-per-chained-call': ['warn', { ignoreChainWithDepth: 4 }],
'no-caller': 'warn',
'no-cond-assign': ['warn', 'except-parens'],
'no-console': 'warn',
'no-debugger': 'warn',
'no-eq-null': 'warn',
'no-eval': 'warn',
'no-trailing-spaces': 'warn',
'no-undef': 'warn',
'no-unused-vars': 'warn',
'no-whitespace-before-property': 'warn',
'object-curly-spacing': ['warn', 'always'],
'object-property-newline': 'warn',
'object-shorthand': 'warn',
'padded-blocks': ['warn', 'never'],
'prefer-arrow-callback': 'warn',
'prefer-template': 'warn',
'quote-props': 'warn',
'rest-spread-spacing': 'warn',
semi: ['warn', 'always'],
'space-before-function-paren': ['warn', 'never'],
'space-infix-ops': 'warn',
'spaced-comment': 'warn',
'switch-colon-spacing': 'warn',
'template-curly-spacing': ['warn', 'always'],
'yield-star-spacing': ['warn', 'both'],
'key-spacing': ['warn', {
align: {
beforeColon: false,
afterColon: true,
on: 'value',
mode: 'minimum'
},
multiLine: {
beforeColon: false,
afterColon: true
},
}],
'object-curly-newline': ['warn', {
ObjectExpression: {
multiline: true,
minProperties: 3
},
ObjectPattern: {
multiline: true,
minProperties: 4
},
ImportDeclaration: {
multiline: true,
minProperties: 5
},
ExportDeclaration: {
multiline: true,
minProperties: 3
}
}],
'padding-line-between-statements': [
'warn',
{
blankLine: 'always',
prev: '*',
next: 'return',
},
{
blankLine: 'always',
prev: 'function',
next: 'function',
},
// This configuration would require blank lines after every sequence of variable declarations
{
blankLine: 'always',
prev: ['const', 'let', 'var'],
next: '*'
},
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var']
}
],
quotes: [
'warn',
'single',
{
avoidEscape: true,
allowTemplateLiterals: true
},
],
'space-unary-ops': [
'warn',
{
words: true,
nonwords: false,
}
],
// FIXME: The following is disabled due to new linter and old JS code. These should all be enabled and underlying issues fixed
'vue/order-in-components': 'off',
'vue/no-lone-template': 'off',
'vue/v-slot-style': 'off',
'vue/component-tags-order': 'off',
'vue/no-mutating-props': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'array-callback-return': 'off',
},
overrides: [
{
files: ['*.js'],
rules: {
// FIXME: The following is disabled due to new linter and old JS code. These should all be enabled and underlying issues fixed
'prefer-regex-literals': 'off',
'vue/component-definition-name-casing': 'off',
'no-unreachable-loop': 'off',
'computed-property-spacing': 'off',
}
}
]
};

View File

@ -0,0 +1,28 @@
name: Build and Release Extension Catalog
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
defaults:
run:
shell: bash
working-directory: ./
jobs:
build-extension-catalog:
uses: rancher/dashboard/.github/workflows/build-extension-catalog.yml@master
permissions:
actions: write
contents: read
packages: write
with:
registry_target: ghcr.io
registry_user: ${{ github.actor }}
secrets:
registry_token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -0,0 +1,26 @@
name: Build and Release Extension Charts
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
defaults:
run:
shell: bash
working-directory: ./
jobs:
build-extension-charts:
uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master
permissions:
actions: write
contents: write
deployments: write
pages: write
with:
target_branch: gh-pages

70
.gitignore vendored Normal file
View File

@ -0,0 +1,70 @@
# compiled output
/dist
/tmp
/out-tsc
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# IDEs and editors
.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
.sass-cache
connect.lock
typings
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Dependency directories
node_modules/
jspm_packages/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# System Files
.DS_Store
Thumbs.db

22
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
"files.exclude": {
".ackrc": true,
".dockerignore": true,
".drone.yml": true,
".editorconfig": true,
".eslintcache": true,
".eslintignore": true,
".eslintrc.js": true,
".gitignore": true,
".nuxt*": true,
".nyc_output": true,
".vscode": true,
"LICENSE": true,
"node_modules": true,
"babel.config.js": true,
"jsconfig.json": true,
"yarn-error.log": true,
"pkg/**/.shell": true,
"pkg/**/node_modules": true,
}
}

1
babel.config.js Normal file
View File

@ -0,0 +1 @@
module.exports = require('@rancher/shell/babel.config.js');

28
package.json Normal file
View File

@ -0,0 +1,28 @@
{
"name": "harvester",
"version": "0.1.0",
"private": false,
"engines": {
"node": ">=16"
},
"dependencies": {
"@rancher/shell": "^0.5.3",
"core-js": "3.21.1",
"css-loader": "6.7.3",
"@types/lodash": "4.14.184",
"@rancher/components": "0.2.1-alpha.0"
},
"resolutions": {
"**/webpack": "4",
"@types/node": "^16"
},
"scripts": {
"dev": "NODE_ENV=dev ./node_modules/.bin/vue-cli-service serve",
"build": "./node_modules/.bin/vue-cli-service build",
"clean": "./node_modules/@rancher/shell/scripts/clean",
"build-pkg": "./node_modules/@rancher/shell/scripts/build-pkg.sh",
"serve-pkgs": "./node_modules/@rancher/shell/scripts/serve-pkgs",
"publish-pkgs": "./node_modules/@rancher/shell/scripts/extension/publish",
"parse-tag-name": "./node_modules/@rancher/shell/scripts/extension/parse-tag-name"
}
}

View File

@ -0,0 +1 @@
module.exports = require('./.shell/pkg/babel.config.js');

18
pkg/harvester/index.ts Normal file
View File

@ -0,0 +1,18 @@
import { importTypes } from '@rancher/auto-import';
import { IPlugin } from '@shell/core/types';
import extensionRouting from './routing/extension-routing';
// Init the package
export default function(plugin: IPlugin): void {
// Auto-import model, detail, edit from the folders
importTypes(plugin);
// Provide plugin metadata from package.json
plugin.metadata = require('./package.json');
// Load a product
plugin.addProduct(require('./product'));
// Add Vue Routes
plugin.addRoutes(extensionRouting);
}

View File

@ -0,0 +1,28 @@
{
"name": "harvester",
"description": "harvester plugin",
"version": "0.1.0",
"private": false,
"rancher": {
"annotations": {
"catalog.cattle.io/rancher-version": ">= v2.8.3"
}
},
"scripts": {
"dev": "./node_modules/.bin/nuxt dev",
"nuxt": "./node_modules/.bin/nuxt"
},
"engines": {
"node": ">=16"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.5.18",
"@vue/cli-service": "4.5.18",
"@vue/cli-plugin-typescript": "4.5.18"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

View File

@ -0,0 +1,10 @@
<script>
export default {
name: 'Dashboard',
};
</script>
<template>
<span>hello harvester</span>
</template>

23
pkg/harvester/product.ts Normal file
View File

@ -0,0 +1,23 @@
import { IPlugin } from '@shell/core/types';
export function init($plugin: IPlugin, store: any) {
const PRODUCT_NAME = 'harvester';
const BLANK_CLUSTER = '_';
const { product } = $plugin.DSL(store, PRODUCT_NAME);
product({
icon: 'gear',
inStore: 'management',
weight: 100,
to: {
name: `${ PRODUCT_NAME }-c-cluster`,
path: `/${ PRODUCT_NAME }/c/:cluster/dashboard`,
params: {
product: PRODUCT_NAME,
cluster: BLANK_CLUSTER,
pkg: PRODUCT_NAME
}
}
});
}

View File

@ -0,0 +1,20 @@
// Don't forget to create a VueJS page called index.vue in the /pages folder!!!
import Dashboard from '../pages/index.vue';
const BLANK_CLUSTER = '_';
const PRODUCT_NAME = 'harvester';
const routes = [
{
name: `${ PRODUCT_NAME }-c-cluster`,
path: `/${ PRODUCT_NAME }/c/:cluster`,
component: Dashboard,
meta: {
product: PRODUCT_NAME,
cluster: BLANK_CLUSTER,
pkg: PRODUCT_NAME
}
}
];
export default routes;

View File

@ -0,0 +1,53 @@
{
"compilerOptions": {
"allowJs": true,
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"preserveSymlinks": true,
"typeRoots": [
"../../node_modules",
"../../node_modules/@rancher/shell/types"
],
"types": [
"node",
"webpack-env",
"@types/node",
"@types/jest",
"@types/lodash",
"rancher",
"shell"
],
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
],
"paths": {
"@shell/*": [
"../../node_modules/@rancher/shell/*"
],
"@components/*": [
"@rancher/components/*"
]
}
},
"include": [
"**/*.ts",
"**/*.d.ts",
"**/*.tsx",
"**/*.vue"
],
"exclude": [
"../../node_modules"
]
}

View File

@ -0,0 +1 @@
module.exports = require('./.shell/pkg/vue.config')(__dirname);

42
tsconfig.json Normal file
View File

@ -0,0 +1,42 @@
{
"compilerOptions": {
"target": "ES2018",
"module": "ESNext",
"moduleResolution": "Node",
"lib": [
"ESNext",
"ESNext.AsyncIterable",
"DOM"
],
"esModuleInterop": true,
"allowJs": true,
"sourceMap": true,
"strict": true,
"noEmit": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./*"
],
"@/*": [
"./*"
],
"@shell/*": [
"./node_modules/@rancher/shell/*"
]
},
"typeRoots": [
"./node_modules",
"./node_modules/@rancher/shell/types"
],
"types": [
"@types/node",
"cypress",
"rancher",
"shell"
]
},
"exclude": [
"node_modules"
]
}

6
vue.config.js Normal file
View File

@ -0,0 +1,6 @@
const config = require('@rancher/shell/vue.config');
module.exports = config(__dirname, {
excludes: [],
// excludes: ['fleet', 'example']
});

17521
yarn.lock Normal file

File diff suppressed because it is too large Load Diff