Skip to content

Commit

Permalink
feat: First checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Addon Factory template committed Apr 7, 2021
1 parent 47fa089 commit 5648478
Show file tree
Hide file tree
Showing 59 changed files with 15,852 additions and 0 deletions.
29 changes: 29 additions & 0 deletions ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contributing to UCC UI Lib

## Overview

The project contains UI framework that renders UI components dynamically based on provided `globalConfig.json`.


## Getting Started

1. Clone the repo.
2. Install yarn (>= 1.2) if you haven't already: `npm install --global yarn`.
3. Run the setup task: `yarn run setup`.

After this step, the following tasks will be available:

* `start` – Run the `start` task
* `build` – Create a production bundle
* `test` – Run unit tests
* `lint` – Run JS and CSS linters
* `format` – Run prettier to auto-format `*.js`, `*.jsx` and `*.css` files. This command will overwrite files without
asking, `format:verify` won't.

Running `yarn run setup` once is required to enable all other tasks. The command might take a few minutes to finish.


## Code Formatting

UCC UI Lib uses [prettier](https://github.com/prettier/prettier) to ensure consistent code formatting. It is recommended
to [add a prettier plugin to your editor/ide](https://github.com/prettier/prettier#editor-integration).
3 changes: 3 additions & 0 deletions ui/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
testMatch: ['**/*.unit.[jt]s?(x)'],
};
75 changes: 75 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "@splunk/ucc_ui_lib",
"version": "0.0.1",
"license": "UNLICENSED",
"private": true,
"scripts": {
"build": "cross-env NODE_ENV=production webpack --bail",
"format": "git ls-files | grep -E \"\\.(jsx?|css)$\" | xargs prettier --write",
"format:verify": "git ls-files | grep -E \"\\.(jsx?|css)$\" | xargs prettier --list-different",
"eslint": "eslint src --ext \".js,.jsx\"",
"eslint:ci": "yarn run eslint -f junit -o test-reports/lint-results.xml",
"eslint:fix": "eslint src --ext \".js, .jsx\" --fix",
"link:app": "ln -s $PWD/stage $SPLUNK_HOME/etc/apps/my-splunk-app",
"lint": "yarn run eslint && yarn run stylelint",
"lint:ci": "yarn run eslint:ci && yarn run stylelint",
"start": "webpack --watch",
"setup": "yarn && yarn run build",
"stylelint": "stylelint \"src/**/*.{js,jsx}\" --config stylelint.config.js",
"test": "jest",
"test:ci": "cross-env JEST_JUNIT_OUTPUT_DIR=./test-reports JEST_JUNIT_OUTPUT_NAME=unit-results.xml JEST_JUNIT_CLASSNAME=unit yarn run test --ci --reporters=default jest-junit --coverage --coverageDirectory=coverage_report/coverage_maps_unit --coverageReporters=json",
"test:watch": "jest --watch"
},
"dependencies": {
"css-loader": "^5.2.0",
"node-sass": "^5.0.0",
"sass-loader": "10.1.1",
"style-loader": "^2.0.0"
},
"devDependencies": {
"@babel/core": "^7.2.0",
"@splunk/babel-preset": "^3.0.0",
"@splunk/eslint-config": "^4.0.0",
"@splunk/react-page": "^5.0.0",
"@splunk/react-toast-notifications": "^0.9.0",
"@splunk/react-ui": "^4.0.0",
"@splunk/splunk-utils": "^2.0.0",
"@splunk/stylelint-config": "^4.0.0",
"@splunk/themes": "^0.7.0",
"@splunk/webpack-configs": "^5.0.0",
"axios": "^0.21.1",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.0.4",
"chai": "^3.5.0",
"copy-webpack-plugin": "^4.5.2",
"cross-env": "^7.0.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^7.14.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^6.15.0",
"eslint-import-resolver-webpack": "^0.13.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"html-webpack-plugin": "^3.2.0",
"immutability-helper": "^3.1.1",
"jest": "^25.1.0",
"jest-junit": "^10.0.0",
"jsonschema": "^1.4.0",
"prettier": "^2.0.5",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-router-dom": "^5.2.0",
"styled-components": "^5.1.1",
"stylelint": "^13.0.0",
"underscore": "^1.12.0",
"webpack": "^4.16.2",
"webpack-cli": "^3.1.0",
"webpack-merge": "^4.1.3"
},
"engines": {
"node": ">=6"
}
}
24 changes: 24 additions & 0 deletions ui/src/main/resources/splunk/appserver/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<%! app_name = cherrypy.request.path_info.split('/')[3] %>\
<!DOCTYPE html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>${_('Loading')}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
</head>

<body>
<script src="${make_url('/config?autoload=1')}" crossorigin="use-credentials"></script>
<script src="${make_url('/static/js/i18n.js')}"></script>
<script src="${make_url('/i18ncatalog?autoload=1')}"></script>
<script>
__splunkd_partials__ = ${json_decode(splunkd)};
</script>

<% page_path = "/static/app/" + app_name + "/js/build/entry_page.js" %>

<script src="${make_url(page_path)}"></script>
</body>
</html>
25 changes: 25 additions & 0 deletions ui/src/main/resources/splunk/default/app.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
######################################################
#
# ${package.name}
#
# ${copyright}
#
######################################################

[install]
is_configured = true
state = enabled
build = ${version.build}

[launcher]
author = Splunk Inc.
version = ${version.major}.${version.minor}.${version.revision}
description = ${friendly.name}

[ui]
is_visible = true
label = ${friendly.name}
docs_section_override=AddOns:released

[package]
id = ${package.name}
5 changes: 5 additions & 0 deletions ui/src/main/resources/splunk/default/data/ui/nav/default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<nav>
<view name="inputs" />
<view name="configuration" default="true" />
<view name="search" />
</nav>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<view template="${package.name}:/templates/base.html" type="html" isDashboard="False">
<label>Configuration</label>
</view>
4 changes: 4 additions & 0 deletions ui/src/main/resources/splunk/default/data/ui/views/inputs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<view template="${package.name}:/templates/base.html" type="html" isDashboard="False">
<label>Inputs</label>
</view>
Loading

0 comments on commit 5648478

Please sign in to comment.