Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@atlassian-partner-engineering/sweethub
Advanced tools
Wrapper for OpsHub API. Allows you develop your panels locally. No more "bittersweet".
What doesn't kill you, only makes you stronger
— Friedrich Nietzsche
Right now the simplest form of a devloop for building a panel is bittersweet – bitter in that you need to push changes to your Bitbucket repo and then hit the "Reload Panel" button to refresh it, but sweet in that those two steps are a heck of a lot faster than redeploying a service to Micros.
— OpsHub documentation
Such dev process makes me really, really angry after few iterations. (╯°□°)╯︵ ┻━┻
If you OK with that, or with another solution by OpsHub team - this lib is not for you.
Otherwise, I have a good news...
webpack
, webpack-dev-server
, install your modules, etc.Then, install and import this lib:
import sweethub from '@atlassian-partner-engineering/sweethub'
const OpsHub = await sweethub.opsHub()
const destUrl = OpsHub.selectedService().proxyUrl('/api/admin/users')
So, this OpsHub
object will contain dummy mock with few methods if you run it locally, or just reference to window.OpsHub
if you deploy it to OpsHub.
By the way, you don't need OpsHub
object if you only want to perform requests to your admin api, it will require some code to deal with CSRF tokens, so here is ready to use request-like wrapper:
import sweethub from '@atlassian-partner-engineering/sweethub'
const request = sweethub.request()
await request.post('/api/admin/users', {name: 'John'}) // POST JSON body
await request.get('/api/admin/users', {sort: '-name'}) // GET with query-string params
webpack-dev-server
to proxy your API requests: devServer: {
contentBase: './',
port: 8000,
proxy: {
'/api/*': { target: 'http://localhost:8080/' }
},
staticOptions: {
index: 'panel.html'
},
inline: true
},
externals: process.env['NODE_ENV'] === 'production' ? {
'react': 'React',
'react-dom': 'ReactDOM',
'graphiql': 'GraphiQL'
} : {},
That way you will have development build of react and other libs while develop locally.
panel.html
<!--
That's hack required for <script> tags, since they did not work when you have active requirejs.
See https://github.com/requirejs/requirejs/issues/947
Another option is to use requirejs instead or with webpack, but I think it will be much more painful
(requirejs in 2017? Srsly?).
-->
<script src="https://unpkg.com/requirejs-toggle"></script>
<script src="https://unpkg.com/react@15/dist/react.min.js"></script>
<script src="https://unpkg.com/react-dom@15/dist/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/graphiql/0.9.3/graphiql.min.js"></script>
<script src="https://unpkg.com/requirejs-toggle"></script>
<script src="public/bundle.js"></script>
return function checkASAP(req, res, next) {
if (process.env.NODE_ENV === 'development') {
return next()
}
// perform ASAP check
// ...
}
I think that's it. Checkout this repo for complete example https://bitbucket.org/atlassian/opshub-crm-admin-panel
FAQs
Wrapper for OpsHub API. Allows you develop your panels locally. No more "bittersweet".
The npm package @atlassian-partner-engineering/sweethub receives a total of 0 weekly downloads. As such, @atlassian-partner-engineering/sweethub popularity was classified as not popular.
We found that @atlassian-partner-engineering/sweethub demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.