Skip to content

Instantly share code, notes, and snippets.

/* eslint-disable no-await-in-loop, no-console */
const { sleep } = require('../helpers');
const { createNetworkProvider } = require('../web3');
class BlocktimeMonitor {
network;
protocol;
import React from 'react';
import ForemanModal, { reducers } from './index';
import { setModalOpen, setModalClosed } from './ForemanModalActions';
import IntegrationTestHelper from '../../common/IntegrationTestHelper';
describe('ForemanModal - integration test', () => {
it('should flow', () => {
const integrationTestHelper = new IntegrationTestHelper(reducers);
@sharvit
sharvit / slot-and-fill.js
Created August 18, 2019 15:46
Slot and fill suggestion
const LayoutToolbarButtonsSlot = () => (<>
<Slot id="layout-toolbar-buttons" multi />
<Fill slot="layout-toolbar-buttons" weight={100}>
<ExportButton />
</Fill>
<Fill slot="layout-toolbar-buttons" weight={200}>
<DocumentationButton documentationURL={documentationURL} />
</Fill>
</>);

Tutorial adding npm dependencies

Foreman manage npm dependencies with a seperate project called [@theforeman/vendor] which responsible to deliver 3rd-party modules to foreman and its plugins. Foreman and its plugins consumes [@theforeman/vendor] project from npm in development and from rpm in production.

[@theforeman/vendor] lives inside a monorepo together with other foreman javascript tools in a project called [foreman-js].

In this tutorial you will learn how to add a new dependency to be available for foreman and it's plugins.

---
centos7-devel:
primary: true
box: centos7
sshfs:
host_path: '/home/asharvit/Projects/theforeman/vagrant-shares/centos7-devel'
guest_path: '/home/vagrant'
reverse: True
ansible:
playbook: 'playbooks/devel.yml'
import React from 'react';
import { connect } from 'react-redux';
const AUDITS_API = 'AUDITS_API';
const createConstTypes = (constName) => {
return {
REQUEST: `${constName}_REQUEST`,
REQUEST: `${constName}_SUCCESS`,
REQUEST: `${constName}_FAILURE`,
@sharvit
sharvit / action.js
Last active April 30, 2019 11:48
API request action
export const fetchTasksSummary = time => {
const hours = timeToHoursNumber(time);
return {
type: API_REQUEST,
action: ACTIONS.GET,
url: `/foreman_tasks/tasks/summary/${hours}`,
subType: FOREMAN_TASKS_DASHBOARD_FETCH_TASKS_SUMMARY,
normalizeResponse: (data) => data.results[0],
normalizeError: error => error.message,
@import '~bootstrap-sass/assets/stylesheets/bootstrap/_variables';
@import '~bootstrap-sass/assets/stylesheets/bootstrap/_mixins';
@mixin create-tasks-dashboard-column($columns: 12, $screen-min: 0, $gutter: $grid-gutter-width) {
@media (min-width: $screen-min) {
width: percentage(($columns / $grid-columns));
float: left;
position: relative;
min-height: 1px;
padding-right: ($gutter / 2);
@sharvit
sharvit / .eslintrc
Created March 4, 2019 07:42
.eslintrc file for foreman-plugins
{
"plugins": ["patternfly-react"],
"extends": ["plugin:patternfly-react/recommended"],
"rules": {
"prettier/prettier": ["error", {
"singleQuote": true,
"trailingComma": "es5"
}],
"import/no-unresolved": ["error", {
"ignore": ['foremanReact/.*']
@sharvit
sharvit / 99-local.yaml
Created November 28, 2018 13:10
Forklift sshfs
---
centos7-devel:
primary: true
box: centos7
sshfs:
host_path: '/home/asharvit/Projects/theforeman/vagrant-shares/centos7-devel'
guest_path: '/home/vagrant'
reverse: True
ansible:
playbook: 'playbooks/devel.yml'