Skip to content

Commit

Permalink
[skip ci] demo/docs for v0.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
azukaar committed Mar 30, 2024
1 parent 1571801 commit efc9a2f
Show file tree
Hide file tree
Showing 6 changed files with 14,939 additions and 27 deletions.
150 changes: 150 additions & 0 deletions client/src/api/cron.demo.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import wrap from './wrap';

function listen() {
}

function run(scheduler, name) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
"status": "ok",
})},
1000
);
});
}

function stop(scheduler, name) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
"status": "ok",
})},
1000
);
});
}

function deleteJob(name) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
"status": "ok",
})},
500
);
});
}

function list() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
"data": {
"Custom": {
"Long Job": {
"Disabled": false,
"Scheduler": "Custom",
"Name": "Long Job",
"Cancellable": true,
"Crontab": "0 1/2 * * * *",
"Running": true,
"LastStarted": "2024-01-01T00:00:00Z",
"LastRun": "0001-01-01T00:00:00Z",
"LastRunSuccess": false,
"Logs": [
"2024-01-01T00:00:00Z: Started",
"2024-01-01T20:00:00Z: Some stuff happening...",
"2024-01-01T30:00:00Z: Some stuff happening...",
],
"Container": ""
},
"Short job": {
"Disabled": false,
"Scheduler": "Custom",
"Name": "Short job",
"Cancellable": true,
"Crontab": "0 1 * * * *",
"Running": false,
"LastStarted": "2024-01-01T00:00:00Z",
"LastRun": "2024-01-01T00:01:10Z",
"LastRunSuccess": true,
"Logs": [
"2024-01-01T00:01:10Z: Started",
"2024-01-01T00:01:10Z: Finished"
],
"Container": ""
}
},
"SnapRAID": {
"SnapRAID scrub Storage Parity": {
"Disabled": false,
"Scheduler": "SnapRAID",
"Name": "SnapRAID scrub Storage Parity",
"Cancellable": true,
"Crontab": "* 0 4 */2 * *",
"Running": false,
"LastStarted": "0001-01-01T00:00:00Z",
"LastRun": "0001-01-01T00:00:00Z",
"LastRunSuccess": false,
"Logs": null,
"Container": ""
},
"SnapRAID sync Storage Parity": {
"Disabled": false,
"Scheduler": "SnapRAID",
"Name": "SnapRAID sync Storage Parity",
"Cancellable": true,
"Crontab": "* 0 2 * * *",
"Running": false,
"LastStarted": "0001-01-01T00:00:00Z",
"LastRun": "0001-01-01T00:00:00Z",
"LastRunSuccess": false,
"Logs": null,
"Container": ""
}
}
},
"status": "OK"
})},
500
);
});
}

function get(scheduler, name) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
"data": {
"Disabled": false,
"Scheduler": "Custom",
"Name": "Long Job",
"Cancellable": true,
"Crontab": "0 1/2 * * * *",
"Running": true,
"LastStarted": "2024-01-01T00:00:00Z",
"LastRun": "0001-01-01T00:00:00Z",
"LastRunSuccess": false,
"Logs": [
"2024-01-01T00:00:00Z: Started",
"2024-01-01T20:00:00Z: Some stuff happening...",
"2024-01-01T30:00:00Z: Some stuff happening...",
],
"Container": ""
},
"status": "ok",
})},
500
);
});
}

export {
listen,
list,
run,
stop,
get,
deleteJob,
}
46 changes: 46 additions & 0 deletions client/src/api/demo.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,18 @@
"Hostname": "xxxxxxxxxxxxx",
"SSLEmail": "[email protected]"
},
"MarketConfig": {
"Sources": [
{
"Name": "CasaOS",
"Url": "https://azukaar.github.io/cosmos-casaos-store/index.json"
},
{
"Name": "TinyActive",
"Url": "https://cosmos.manhtuong.net"
}
]
},
"MonitoringAlerts": {
"Anti Crypto-Miner": {
"Name": "Anti Crypto-Miner",
Expand Down Expand Up @@ -505,6 +517,40 @@
}
},
"ConstellationHostname": "vpn.domain.com"
},
"Storage": {
"SnapRAIDs": [
{
"Name": "Storage Parity",
"Enabled": true,
"Data": {
"disk0": "/var/mnt/sdc1",
"disk1": "/var/mnt/sdd1"
},
"Parity": [
"/var/mnt/sda1"
],
"SyncCrontab": "* 0 2 * * *",
"ScrubCrontab": "* 0 4 */2 * *",
"CheckOnFix": false
}
]
},
"CRON": {
"Long Job": {
"Enabled": true,
"Name": "Long Job",
"Crontab": "0 1/2 * * * *",
"Command": "sleep 5 \u0026\u0026 echo \"hello world 2\"",
"Container": ""
},
"Short job": {
"Enabled": true,
"Name": "Short job",
"Crontab": "0 1 * * * *",
"Command": "ls",
"Container": "memos"
}
}
},
"updates": {
Expand Down
4 changes: 4 additions & 0 deletions client/src/api/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import * as indexDemo from './index.demo';
import * as marketDemo from './market.demo';
import * as constellationDemo from './constellation.demo';
import * as metricsDemo from './metrics.demo';
import * as storageDemo from './storage.demo';
import * as cronDemo from './cron.demo';

import wrap from './wrap';
import { redirectToLocal } from '../utils/indexs';
Expand Down Expand Up @@ -236,6 +238,8 @@ if(isDemo) {
uploadImage = indexDemo.uploadImage;
constellation = constellationDemo;
metrics = metricsDemo;
storage = storageDemo;
cron = cronDemo;
}

export {
Expand Down
Loading

0 comments on commit efc9a2f

Please sign in to comment.