Skip to content

Commit

Permalink
update submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
saikrishna321 committed Apr 29, 2024
1 parent e07072f commit 62511d4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 53 deletions.
4 changes: 2 additions & 2 deletions buildAndCopyWeb.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if [ -d "dashboard-web" ]; then
if [ -d "dashboard-frontend" ]; then
# shellcheck disable=SC2164
cd dashboard-frontend
npm install --force
Expand All @@ -10,5 +10,5 @@ if [ -d "dashboard-web" ]; then
cp -R ./dashboard-frontend/dist/* src/public/
echo "Build date - `date` by `whoami`" > src/public/version.txt
else
echo "Directory dashboard-web does not exist."
echo "Directory dashboard-frontend does not exist."
fi
2 changes: 1 addition & 1 deletion dashboard-frontend
49 changes: 0 additions & 49 deletions src/app/routers/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,9 @@ import { DeviceFarmManager } from '../../device-managers';
import Container from 'typedi';
import { IPluginArgs } from '../../interfaces/IPluginArgs';
import { IDevice } from '../../interfaces/IDevice';
import path from 'path';
import multer from 'multer';
import { saveTestExecutionMetaData } from '../../wdio-service/wdio-service';
import os from 'os';
import { DevicePlugin } from '../../plugin';
import { uploadFileRemote } from '../../modules/device-control/DeviceHelper';

const SERVER_UP_TIME = new Date().toISOString();
const uploadDir = path.join(os.homedir(), '.cache', 'appium-device-farm', 'assets');

const storage = multer.diskStorage({
destination: (req: any, file: any, cb: any) => {
cb(null, uploadDir);
},
filename: (req: any, file: any, cb: any) => {
if (file.originalname === 'wda-resign.ipa') {
cb(null, file.originalname);
} else {
cb(null, file.fieldname + '-' + Date.now() + path.extname(file.originalname));
}
},
});

//will be using this for uplading
const upload = multer({ storage: storage });
async function getDevices(request: Request, response: Response) {
let devices = (await ADTDatabase.DeviceModel).find();
const { sessionId } = request.query;
Expand Down Expand Up @@ -295,33 +273,6 @@ function register(router: Router, pluginArgs: IPluginArgs) {
router.get('/node/:host/status', _.curry(nodeAdbStatusOnOtherHost)(pluginArgs.bindHostOrIp));

//router.post('/upload', uploadFile);
router.post('/upload', upload.single('file'), async function (req: any, res) {
console.log('storage location is ', req.hostname + '/' + req.file.path);
const devices = (await ADTDatabase.DeviceModel).chain().find().data();
const uniqByHost = _.uniqBy(devices, 'host');
const appPath = path.join(
os.homedir(),
'.cache',
'appium-device-farm',
'assets',
'wda-resign.ipa',
);
const asyncCall = async (device: IDevice) => {
if (device.nodeId !== DevicePlugin.NODE_ID) {
console.log('Uploading WDA to remote machines');
await uploadFileRemote(appPath, device);
}
};
await Promise.all(uniqByHost.map((device: IDevice) => asyncCall(device)));
if (req.file) {
console.log('storage location is ', req.hostname + '/' + req.file.path);
res
.status(200)
.json({ success: true, message: 'File uploaded successfully', file: req.file });
} else {
res.status(400).json({ success: false, message: 'File upload failed' });
}
});
//router.post('/tap', clickElementFromScreen);
// node status
router.get(
Expand Down
2 changes: 1 addition & 1 deletion src/modules

0 comments on commit 62511d4

Please sign in to comment.