shopify/Dashing workshop coffeescript syntax issue - dashing

i am currently working on a project which is taking an active check feed from Nagios Check_mk and displaying on a text widget. i am trying to get the widget to change colour, working through the workshop page i am stuck with the coffee script, it doesn't appear to have any effect when the value is changed. here is what i have
alert.coffee
class Dashing.Alert extends Dashing.Widget
ready: ->
# This is fired when the widget is done being rendered
onData: (data) ->
# Handle incoming data
# You can access the html node of this widget with #node
# Example: $(#node).fadeOut().fadeIn() will make the node flash each time data comes in.
#accessor 'value', Dashing.AnimatedValue
#accessor 'isTooHigh', ->
#get('value') > 200
alert scss
.widget-alert {
background: #00ff99;
font-size: 65px;
font-weight: bold;
}
.danger {
background: #ff1a00;
}
all other files are exactly as detailed in the workshop page: any help greatly appreciated.

Basically the change of color or animated flashing of color was handled by the scss #keyframe rule, you must bind it to a selector, otherwise the animation will have no effect
Here's some example
$background-alert-color-1: #FFFF66;
$background-alert-color-2: #FF9618;
$text-alert-color: #fff;
#-webkit-keyframes status-alert-background {
0% { background-color: $background-alert-color-1; }
50% { background-color: $background-alert-color-2; }
100% { background-color: $background-alert-color-1; }
}
.widget.status-alert {
color: $text-alert-color;
background-color: $background-alert-color-1;
#include animation(status-alert-background, 2s, ease, infinite);
.icon-alert-sign {
display: inline-block;
}
.title, .more-info {
color: $text-alert-color;
}
For some example and reference (also for the coffescript) you can check this one dashing_zabbix

Related

custom color in MUI dialog not working (MUI v-5)

.App {
text-align: center;
** --amenalBlue: #15426C;
--amenalOrange: #D9A460;**
}
h2,h3{
color: gray;
}
/* common table head style */
.tableHead {
*** background-color: var(--amenalOrange);***
}
.tableHead th {
color: var(--amenalBlue);
font-weight: bold;
}
Table head is not taking custom color which i have added but normal hex code is taking. This is happning in MUI table used inside MUI dialog

Display tabs in multiple rows [duplicate]

I commonly have 10+ tabs open per editor window which makes it tedious to scroll back and forth (or use ctrl+tab) to find the file I want.
Is there any way to have the tabs wrap?
Similar to Atom's multirow-tabs.
Update: Looks like it is a work in progress.
UPDATE Feb 2021: In-built support for tabs-wrapping in VSCode v1.53.0+
Just set the workbench.editor.wrapTabs to true in the settings.
I still use my configuration mentioned below to make tabs smaller as per my usage.
UPDATED 28 March 2020 for VSCode v1.43.2
Fixed CSS for tab-close button
Added CSS for smaller bread-crumbs and acion-bar (at the right of tab-bar)
I do the following for multirow tabs in visual-studio-code (until there is official support or an easier solution):
STEP 1: Install the extension VSCode Custom CSS. (Check out the extension page for proper installation instruction. It's a bit of a hack as VSCode does not officially support altering internal CSS.)
STEP 2: Create a CSS file (say, "/home/user/vscode/custom.css") and add the following contents:
/* Following CSS to wrap the tab-bar into multiple rows: */
.tabs-and-actions-container > .monaco-scrollable-element {
height: auto !important;
}
.tabs-and-actions-container > .monaco-scrollable-element > .tabs-container {
height: auto !important;
flex-wrap: wrap;
}
/* Following CSS to make the tabs thinner/smaller (so that they take lesser vertical space): */
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab {
height: 25px;
padding-left: 4px;
font-size: 0.8em; /* smaller font-size for tab icons and label */
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab .label-name {
font-size: inherit !important; /* inherit updated font-size for label */
}
/* Following CSS for smaller close button on tabs: */
.monaco-workbench .part.editor>.content .editor-group-container>.title .tabs-container>.tab>.tab-close {
width: 20px;
}
.monaco-workbench .part.editor>.content .editor-group-container>.title .tabs-container>.tab>.tab-close .action-label {
height: 12px;
width: 12px;
background-size: 12px;
}
.monaco-workbench .part.editor>.content .editor-group-container.active>.title .tabs-container>.tab>.tab-close .action-label.codicon {
font-size: 12px;
}
/* OPTIONAL: Following CSS for smaller breadcrumbs (below tab-bar) */
.monaco-breadcrumbs {
font-size:0.65em;
opacity: 0.8;
height:18px !important;
}
.tabs-breadcrumbs .breadcrumbs-control {
height: 18px !important;
}
.monaco-workbench .symbol-icon.block {
height: 8px;
width: 8px;
min-height: 8px;
min-width: 14px;
background-position: 50%;
background-size: contain;
}
.breadcrumbs-control .monaco-breadcrumb-item:before {
min-width: 12px !important;
height: 12px !important;
background-size: contain !important;
}
/* OPTIONAL: Following CSS for smaller action-bar (beside the tab-bar) with menu, split, etc. */
.monaco-workbench .part.editor>.content .editor-group-container>.title .editor-actions {
height: 20px;
padding:0;
}
.monaco-workbench .part.editor>.content .editor-group-container>.title .editor-actions .action-label, .monaco-workbench .part.editor>.content .editor-group-container>.title .title-actions .action-label {
height: 20px;
line-height: 20px;
min-width: 14px;
background-size: 8px;
}
.tabs-and-actions-container > .editor-actions > .monaco-toolbar > .monaco-action-bar > .actions-container {
max-width:60px;
flex-wrap:wrap;
}
STEP 3: Point the extension to your custom CSS. Open the VSCode settings.json [Ctrl+Shift+P > "Open Settings(JSON)"] and add the following lines (with your path to custom.css file):
"vscode_custom_css.imports": [
"file:///home/user/vscode/custom.css"
],
"vscode_custom_css.policy": true
STEP 4: Make sure you have gone through the VSCode Custom CSS extension's readme and enabled it properly. You may have to reload VSCode. Also, edit the CSS as per your preferences!
CREDIT: This solution (link to extension and the CSS to wrap tab-bar into multi-lines) was originally posted by Steven Laidlaw in this Github thread. I just extended the CSS for smaller tabs.
UPDATE: Version 1.53 includes wrap tabs!
The new "Wrap Tabs" setting is a checkbox under File > Preferences > Settings > Workbench > Editor Management.
Alternatively, you can set paste the following into your settings.json: "workbench.editor.wrapTabs": true
Significant progress has been made on this issue Allow tabs to wrap to multi-line and the feature is now in the Insiders' Build (and presumably in v1.53 Stable as it works well in my testing):
As seen in the demo, you can even drag tabs from one row to another. There is currently no limit on the number of rows until the editor itself gets too small.
You enable this functionality with
workbench.editor.wrapTabs: true or
Workbench > Editor: Wrap Tabs in the Settings gui.
A couple of notes from testing tab wrapping:
make sure you have configured workbench.editor.tabSizing: fit (this will make the last tab fill the entire row for a more homogeneous look when tabs wrap) [ed. note: you can still use shrink, it just doesn't look as nice]
if the space for the editor or editor toolbar becomes too small, wrapping turns off automatically and turns on again when the size get's larger
you can still drag and drop tabs around even when they wrap
you can still pin a tab and it shows pinned in the beginning of the tabs
when tabs wrap, the tab.border color is not only applied to the right of each tab but also below to separate tabs from each other
Also, depending on your color theme, consider modifying these settings:
"workbench.colorCustomizations": {
"tab.border": "#fff6",
"titleBar.border": "#fff6",
"editorGroupHeader.tabsBorder": "#647c64",
}
to set off the borders of each tab.
There is some hope for a second row of tabs - albeit with pinned tabs but still sounds pretty useful. See Pinned tabs: show them in a secondary tab row above others. Added to the Backlog.
By the way, pinned tabs are coming to v1.46. More on their functionality: v1.46 release notes: pinned tabs
Since multirow tabs are still not officialy supported in VSCode, I wanted to bring a feature request to your attention that I just posted on their github.
Instead of always wrapping tabs to a new row I propose to have them laid out on rows that are completely independent from each other. The user decides, they can mix short rows with long rows that still require scrolling. See the details here:
github.com/microsoft/vscode/issues/80510
My proposed solution certainly requires more work than unceremoniously wrapping tabs to a new row but in return it lets the user organize their tabs in a way that could increase productivity.
I just played with the vscode developer tools console, and looks like this CSS will be enough to do that if incorporated with an extension:
.tabs-and-actions-container .monaco-scrollable-element {
height: auto;
}
.tabs-and-actions-container .monaco-scrollable-element .tabs-container {
flex-wrap: wrap; flex: 1 1 auto;
height: auto;
}
You can add this code to file:///C:/Users/[username]/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.main.css file to use it until your application updates.
Note: When you add this to workbench.main.css file, VSCode will alert that the integrity of VScode is corrupted, ignore that message. VSCode will function as before because it's a CSS change (if any javascript doesn't use some positions of the tabs, or something else).
Otherwise as #Bene said, this is a restricted area by VSCode development team. They say:
Restrictions
There are certain restrictions we impose upon extensions.
Here are the restrictions and their purposes.
No DOM Access
Extensions have no access to the DOM of VS Code UI. You
cannot write an extension that applies custom CSS to VS Code or adds
an HTML element to VS Code UI.
At VS Code, we're continually trying to optimize use of the underlying
web technologies to deliver an always available, highly responsive
editor and we will continue to tune our use of the DOM as these
technologies and our product evolve. To ensure that extensions cannot
interfere with the stability and performance of VS Code, and that we
can continue to improve the DOM of VS Code without breaking existing
extensions, we run extensions in an Extension Host process and prevent
direct access to the DOM.
# https://code.visualstudio.com/api/extension-capabilities/overview#no-dom-access
I have found/developed a solution to display pinned tabs in their own row.. It's an addition to what people might be using already, not the answer to this thread per se.
Original reply on github: https://github.com/microsoft/vscode/issues/98160#issuecomment-989276052
vscode v1.62.3
extension: Custom CSS and JS Loader v6.0.2
settings.json
{
"workbench.editor.wrapTabs": true,
"git.decorations.enabled": false,
"workbench.editor.decorations.badges": false,
"workbench.editor.decorations.colors": false,
"vscode_custom_css.imports": ["file:///C:/temp/VScode/custom.css"],
"vscode_custom_css.policy": true
}
p.s. In config above I also disabled some git stuff from tabs to make them more readable.. not sure if it affects other places, use with caution.
custom.css
.tabs-container {
display: flex !important;
flex-wrap: wrap !important;
height: auto !important;
}
.tabs-container::before,
.tabs-container::after {
content: "" !important;
width: 100% !important;
order: 1 !important;
}
.tab {
display: flex !important;
}
.tab:not(.sticky) {
order: 1 !important;
}
Result (gif):

Make default Ionic alerts larger

I'm trying to make the default Ionic Alerts larger. I'm developing an app that needs to have easy touch points and the default alerts are too small for what I'm needing.
I've tried enlarging the font as well as expanding the width of the alerts but nothing seems to actually make the alerts larger.
Any easy/best ways to do this?
AlertController supports custom classes which could be placed in your component's scss file and there you can do necessary alterations.
For example in your component's ts file you can have this method that creates alert with reference to custom class "scaledAlert":
delete() {
let confirm = this.alertCtrl.create({
title: "Are You Sure?",
cssClass: "scaledAlert",
message: "this will remove image from your image gallery",
buttons: [
{
text: "Cancel",
handler: () => {
console.log("Canceled delete");
}
},
{
text: "Confirm",
handler: () => {
console.log("deleting...");
this.deleteImageFromGallery(this.image)
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
this.viewCtrl.dismiss();
}
}
]
});
confirm.present();
}
Now in the scss file you add class to style as you need to scale the controller, such class goes after your page or component:
home-page {
.item {
min-height: 2rem; /* <- this can be whatever you need */
}
ion-label {
margin: 0px 0px 0px 0;
}
.item-content {
padding-top: 0px;
padding-bottom: 0px;
margin-top: -12px;
margin-bottom: -12px;
height: 50px;
}
}
.scaledAlert {
transform: scale(1.5);
}
Here I used just naive "scale" function which may require you to add some cross browser compatible versions of it. But you should achieve what you want with it (it worked in my app without issues).
Alternatively you can override default styles using saas variables: https://ionicframework.com/docs/api/components/alert/AlertController/#sass-variables
You will have to alter them in theme\variables.scss" which is located in your project's folder
See more here: https://ionicframework.com/docs/theming/overriding-ionic-variables/
And third option is indeed to check elements' style via devtool and attempt to override those classes. But I don't like that way, feels a bit more hacky.
Some of the styles for alert are not getting updated if written in component SCSS file. The styles need to be written in the global scss file.

Override GWT theme body margin css attribute?

I'm using GWT. I see that the gwt "clean" theme (the default one?) makes our body element have a 10px margin:
body {
color: black;
margin: 10px; <------
border: 0px;
padding: 0px;
background: #fff;
direction: ltr;
}
In my own css file, I set the margin to 0px, but it seems that GWT's keeps winning (maybe because it gets loaded last?).
What's the right way to override their setting?
Thanks
There are several possibilities:
You can use margin: 0px !important (this is the "brute-force" approach).
Or you can give your body a class like <body class="myApp">...</body>, and then in your CSS, use body.myApp { ... }. This will take precedence, because body.myApp is a more specific selector than body.
Or you can simply not use any theme at all (which is often a good idea if you want to create a fresh layout without worrying which attributes you'll have to override)
Another option is to load your css file by using clientbundle. (assume that playground.css is your css file)
public interface Resources extends ClientBundle {
public static Resources INSTANCE = GWT.create(Resources.class);
#Source("playground.css")
CssResource getPlaygroundCSS();
}
Note: playground.css is located in the same package as the Resources interface.
in the onmoduleload:
public class Playground implements EntryPoint {
#Override
public void onModuleLoad() {
Resources.INSTANCE.getPlaygroundCSS().ensureInjected();
Label lblHelloWorld = new Label("Hello World");
RootPanel.get().add(lblHelloWorld);
}
}
In the CSS:
body {
background-color: #FFFFD2 !important; }
works fine to change the background color.

JQTOUCH - Anytime loading occurs, add a loading class?

I'm using JQTOUCH and in JQTOUCH several of the links are being loading via AJAX and then sliding in. The problem is that there is no loading indication provided to users.
I'd like a way to add a Loading class with an AJAX spinner, when ever the an ajax call is loading, and have the class removed when the loading is done, and the page is displayed.
Any ideas?
the showPageByHref() answer is partially correct.
But, instead of
$('body').append('<div id="loadinginprogress">Loading...</div>');
You need
$('.current').append('<div id="loadinginprogress">Loading...</div>');
Body is too general for jqtouch, need to be specific to the currently displayed DIV-page
showPageByHref() function in jqtouch js is a good start. i added it right into ajax call so the please wait will not flicker when you click on link that is already loaded etc.
In short - add loading div (id loadinginprogress in exmaple) right before the ajax call and remove later "success" or "error". the ajax call section would look something like that (shortened it ):
function showPageByHref(href, options) {
...
if (href != '#'){
$('body').append('<div id="loadinginprogress">Loading...</div>');
$.ajax({
url: href,
data: settings.data,
type: settings.method,
success: function (data, textStatus) {
$('#loadinginprogress').remove()
var firstPage = insertPages(data, settings.animation);
if (firstPage)
{
if (settings.method == 'GET' && jQTSettings.cacheGetRequests && settings.$referrer)
{
settings.$referrer.attr('href', '#' + firstPage.attr('id'));
}
if (settings.callback) {
settings.callback(true);
}
}
},
error: function (data) {
$('#loadinginprogress').remove()
if (settings.$referrer) settings.$referrer.unselect();
if (settings.callback) {
settings.callback(false);
}
}
});
}
...
}
css for loading div would be something like:
#loadinginprogress {
-webkit-border-radius: 10px;
background-color: rgba(0,0,0,.5);
color: white;
font-size: 18px;
font-weight: bold;
height: 80px;
left: 60px;
line-height: 80px;
margin: 0 auto;
position: absolute;
text-align: center;
top: 120px;
width: 200px;
z-index: 5000;
}
This is the basic behavior if your links are li class="arrow" elements. how are you displaying your links and where do you want the loading-spinner to display?
Thank you for your different posts. They helped me a lot.
I have a solution to propose without patching the jQtouch code on which jQTouch relies.
It uses jQuery ajax capabilities.
$(document).ready(function() {
...
$('#jqt').ajaxStart(function() {
console.log("ajaxStart");
...
}).ajaxSuccess(function() {
console.log("ajaxSuccess");
...
}).ajaxError(function() {
console.log("ajaxError");
....
});
....
});
more details available in this jQuery doc page.
You could add a custom event handler, and trigger the loading.gif everytime the click on the specific element was done.
I just answered Darin Parker's question. Just check it out it may help you.