Skip to content

Commit

Permalink
Improve blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
foivospro committed Aug 29, 2024
1 parent 91785b7 commit ac12249
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 15 deletions.
23 changes: 21 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,26 @@
colourPrimary: '#D800FF',
colourSecondary: '#ff0000',
colourTertiary: '#C5EAFF'
},
'System Monitoring': {
colourPrimary: '#9C27B0',
colourSecondary: '#ff0000',
colourTertiary: '#C5EAFF'
},
'Network Operations': {
colourPrimary: '#FFC107',
colourSecondary: '#ff0000',
colourTertiary: '#C5EAFF'
},
Variables: {
colourPrimary: '#330',
colourSecondary: '#ff0000',
colourTertiary: '#C5EAFF'
},
'Other Commands': {
colourPrimary: '#009688',
colourSecondary: '#ff0000',
colourTertiary: '#C5EAFF'
}
};

Expand Down Expand Up @@ -432,7 +452,6 @@
contents: [
{ kind: 'block', type: 'ps' },
{ kind: 'block', type: 'df' },
{ kind: 'block', type: 'du' },
{ kind: 'block', type: 'uptime' },
{ kind: 'block', type: 'who' },
{ kind: 'block', type: 'hostname' },
Expand All @@ -447,7 +466,6 @@
name: 'Network Operations',
colour: '#FFC107',
contents: [
{ kind: 'block', type: 'scp' },
{ kind: 'block', type: 'ssh' },
{ kind: 'block', type: 'curl' },
{ kind: 'block', type: 'ping' },
Expand Down Expand Up @@ -555,6 +573,7 @@
colour: '330',
custom: 'VARIABLE'
},

{
kind: 'sep'
},
Expand Down
6 changes: 3 additions & 3 deletions public/blocks/curlBlock.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var curlBlock = {
type: 'curl',
message0: 'curl %1',
category: 'Network Operations',
message0: 'curl %1',
unix_description: [
{
url: 'curl %URL'
Expand All @@ -11,10 +11,10 @@ var curlBlock = {
{
type: 'field_input',
name: 'URL',
text: 'http://example.com' // default URL
text: 'http://example.com'
}
],
style: 'network_operations',
style: 'Network Operations',
previousStatement: 'Action',
nextStatement: 'Action',
tooltip: 'Μεταφέρει δεδομένα από ή προς διακομιστές.',
Expand Down
7 changes: 4 additions & 3 deletions public/blocks/echoBlock.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
var echoBlock = {
type: 'echo',
category: 'File and Directory Operations',
message0: '%{BKY_ECHO}',
category: 'Other Commands',
unix_description: [
{
echoInput: '"str"'
command: 'str'
}
],
message0: '%{BKY_ECHO} %1',
Expand All @@ -14,7 +15,7 @@ var echoBlock = {
text: ''
}
],
style: 'Text Processing',
style: 'Other Commands',
previousStatement: 'Action',
nextStatement: 'Action',
tooltip: '%{BKY_ECHO_TOOLTIP}',
Expand Down
2 changes: 1 addition & 1 deletion public/blocks/journalctlBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var journalctlBlock = {
text: '-xe' // default options
}
],
style: 'system_monitoring',
style: 'Network Operations',
previousStatement: 'Action',
nextStatement: 'Action',
tooltip: 'Προβάλει τα logs του συστήματος.',
Expand Down
6 changes: 3 additions & 3 deletions public/blocks/killBlock.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var killBlock = {
type: 'kill',
category: 'Other Commands',
message0: 'kill %1',
message0: '%{BKY_KILL} %1',
unix_description: [
{
command: 'kill %PID'
Expand All @@ -17,8 +17,8 @@ var killBlock = {
style: 'Other Commands',
previousStatement: 'Action',
nextStatement: 'Action',
tooltip: 'Σταματάει διεργασίες βάσει του PID τους.',
helpUrl: 'https://linux.die.net/man/1/kill'
tooltip: '%{BKY_KILL_TOOLTIP}',
helpUrl: '%{BKY_KILL_HELPURL}'
};

Blockly.defineBlocksWithJsonArray([killBlock]);
Expand Down
2 changes: 1 addition & 1 deletion public/blocks/pingBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var pingBlock = {
text: 'example.com' // default address
}
],
style: 'network_operations',
style: 'Network Operations',
previousStatement: 'Action',
nextStatement: 'Action',
tooltip:
Expand Down
4 changes: 2 additions & 2 deletions public/blocks/sleepBlock.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var sleepBlock = {
type: 'sleep',
message0: '%{BKY_SLEEP_MESSAGE}',
message0: '%{BKY_SLEEP} %1',
category: 'Other Commands',
unix_description: [
{
Expand All @@ -14,7 +14,7 @@ var sleepBlock = {
text: '1' // default time in seconds
}
],
style: 'other_commands',
style: 'Other Commands',
previousStatement: 'Action',
nextStatement: 'Action',
tooltip: '%{BKY_SLEEP_TOOLTIP}',
Expand Down
54 changes: 54 additions & 0 deletions public/js/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,3 +863,57 @@ Blockly.Msg['PROCEDURES_HUE'] = '290';
Blockly.Msg['COLOUR_HUE'] = '20';
Blockly.Msg['VARIABLES_DYNAMIC_HUE'] = '310';
Blockly.Msg['CATVARIABLES'] = 'Variables';

// df command
Blockly.Msg['DF'] = 'Disk free space';
Blockly.Msg['DF_BLOCK'] = 'disk free space %1';
Blockly.Msg['DF_TOOLTIP'] = 'Display free disk space for filesystems';
Blockly.Msg['DF_HELPURL'] = 'https://man7.org/linux/man-pages/man1/df.1.html';

// uptime command
Blockly.Msg['UPTIME'] = 'System uptime';
Blockly.Msg['UPTIME_BLOCK'] = 'system uptime %1';
Blockly.Msg['UPTIME_TOOLTIP'] = 'Show how long the system has been running';
Blockly.Msg['UPTIME_HELPURL'] =
'https://man7.org/linux/man-pages/man1/uptime.1.html';

// who command
Blockly.Msg['WHO'] = 'Who is logged in';
Blockly.Msg['WHO_BLOCK'] = 'who is logged in %1';
Blockly.Msg['WHO_TOOLTIP'] = 'Show who is logged in to the system';
Blockly.Msg['WHO_HELPURL'] = 'https://man7.org/linux/man-pages/man1/who.1.html';

// hostname command
Blockly.Msg['HOSTNAME'] = 'System hostname';
Blockly.Msg['HOSTNAME_BLOCK'] = 'system hostname %1';
Blockly.Msg['HOSTNAME_TOOLTIP'] = 'Show or set the system hostname';
Blockly.Msg['HOSTNAME_HELPURL'] =
'https://man7.org/linux/man-pages/man1/hostname.1.html';

// date command
Blockly.Msg['DATE'] = 'Current date and time';
Blockly.Msg['DATE_BLOCK'] = 'current date and time %1';
Blockly.Msg['DATE_TOOLTIP'] = 'Display or set the system date and time';
Blockly.Msg['DATE_HELPURL'] =
'https://man7.org/linux/man-pages/man1/date.1.html';

// kill command
Blockly.Msg['KILL'] = 'Terminate process';
Blockly.Msg['KILL_BLOCK'] = 'terminate process %1';
Blockly.Msg['KILL_TOOLTIP'] = 'Terminate a process by its PID';
Blockly.Msg['KILL_HELPURL'] =
'https://man7.org/linux/man-pages/man1/kill.1.html';

// echo command
Blockly.Msg['ECHO'] = 'Print message';
Blockly.Msg['ECHO_BLOCK'] = 'print message %1';
Blockly.Msg['ECHO_TOOLTIP'] = 'Print a message to the terminal';
Blockly.Msg['ECHO_HELPURL'] =
'https://man7.org/linux/man-pages/man1/echo.1.html';

// sleep command
Blockly.Msg['SLEEP'] = 'Sleep for duration';
Blockly.Msg['SLEEP_BLOCK'] = 'sleep for %1 seconds';
Blockly.Msg['SLEEP_TOOLTIP'] = 'Pause for a specified amount of time';
Blockly.Msg['SLEEP_HELPURL'] =
'https://man7.org/linux/man-pages/man1/sleep.1.html';

0 comments on commit ac12249

Please sign in to comment.