Skip to content

Commit 34590f8

Browse files
committed
Fixes
1 parent 4663eb0 commit 34590f8

28 files changed

+1117
-119
lines changed

backend/managers/openstack.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,13 @@ async function powerOnInstance(provider, instance) {
407407
return true;
408408
} catch (error) {
409409
console.error('Error powering on instance:', error);
410+
411+
// Handle specific error cases
412+
if (error.message && error.message.includes('status code 409')) {
413+
// 409 Conflict - instance is already in the desired state
414+
throw new Error('Instance is already powered on');
415+
}
416+
410417
throw new Error('Failed to power on instance');
411418
}
412419
}
@@ -426,6 +433,13 @@ async function powerOffInstance(provider, instance) {
426433
return true;
427434
} catch (error) {
428435
console.error('Error powering off instance:', error);
436+
437+
// Handle specific error cases
438+
if (error.message && error.message.includes('status code 409')) {
439+
// 409 Conflict - instance is already in the desired state
440+
throw new Error('Instance is already powered off');
441+
}
442+
429443
throw new Error('Failed to power off instance');
430444
}
431445
}
@@ -449,6 +463,13 @@ async function restartInstance(provider, instance, hard = false) {
449463
return true;
450464
} catch (error) {
451465
console.error('Error restarting instance:', error);
466+
467+
// Handle specific error cases
468+
if (error.message && error.message.includes('status code 409')) {
469+
// 409 Conflict - instance might be in a state where reboot is not allowed
470+
throw new Error('Instance cannot be rebooted in its current state');
471+
}
472+
452473
throw new Error('Failed to restart instance');
453474
}
454475
}

backend/routes/instances.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,12 @@ router.post('/:id/power-on', authenticateToken, canAccessInstance, async (req, r
617617
res.json({ message: 'Instance powered on successfully' });
618618
} catch (error) {
619619
console.error('Error powering on instance:', error);
620+
621+
// Handle specific error cases
622+
if (error.message === 'Instance is already powered on') {
623+
return res.status(409).json({ error: 'Instance is already powered on' });
624+
}
625+
620626
res.status(500).json({ error: 'Failed to power on instance' });
621627
}
622628
});
@@ -679,6 +685,12 @@ router.post('/:id/power-off', authenticateToken, canAccessInstance, async (req,
679685
res.json({ message: 'Instance powered off successfully' });
680686
} catch (error) {
681687
console.error('Error powering off instance:', error);
688+
689+
// Handle specific error cases
690+
if (error.message === 'Instance is already powered off') {
691+
return res.status(409).json({ error: 'Instance is already powered off' });
692+
}
693+
682694
res.status(500).json({ error: 'Failed to power off instance' });
683695
}
684696
});

frontend/src/components/AddCompetitionModal.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<div v-if="show" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
2+
<Teleport to="body">
3+
<div v-if="show" class="modal-backdrop">
34
<div class="bg-gray-800 rounded-lg shadow-xl border border-gray-700 w-full max-w-md mx-4">
45
<div class="px-6 py-4 border-b border-gray-700">
56
<h3 class="text-lg font-medium text-white">Add New Competition</h3>
@@ -82,7 +83,8 @@
8283
</div>
8384
</form>
8485
</div>
85-
</div>
86+
</div>
87+
</Teleport>
8688
</template>
8789

8890
<script>

frontend/src/components/AddMemberModal.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<div v-if="show" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
2+
<Teleport to="body">
3+
<div v-if="show" class="modal-backdrop">
34
<div class="bg-gray-800 rounded-lg shadow-xl max-w-md w-full mx-4">
45
<div class="px-6 py-4 border-b border-gray-700">
56
<h3 class="text-lg font-medium text-white">Add Team Member</h3>
@@ -47,7 +48,8 @@
4748
</div>
4849
</form>
4950
</div>
50-
</div>
51+
</div>
52+
</Teleport>
5153
</template>
5254

5355
<script>

frontend/src/components/AddServiceAccountModal.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<div v-if="show" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
2+
<Teleport to="body">
3+
<div v-if="show" class="modal-backdrop">
34
<div class="bg-gray-800 rounded-lg shadow-xl border border-gray-700 w-full max-w-md mx-4">
45
<div class="px-6 py-4 border-b border-gray-700">
56
<h3 class="text-lg font-medium text-white">Add New Service Account</h3>
@@ -38,7 +39,8 @@
3839
</div>
3940
</form>
4041
</div>
41-
</div>
42+
</div>
43+
</Teleport>
4244
</template>
4345

4446
<script>

frontend/src/components/AddTeamModal.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<div v-if="show" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
2+
<Teleport to="body">
3+
<div v-if="show" class="modal-backdrop">
34
<div class="bg-gray-800 rounded-lg shadow-xl border border-gray-700 w-full max-w-md mx-4">
45
<div class="px-6 py-4 border-b border-gray-700">
56
<h3 class="text-lg font-medium text-white">Add New Team</h3>
@@ -71,7 +72,8 @@
7172
</div>
7273
</form>
7374
</div>
74-
</div>
75+
</div>
76+
</Teleport>
7577
</template>
7678

7779
<script>

frontend/src/components/AddUserModal.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<div v-if="show" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
2+
<Teleport to="body">
3+
<div v-if="show" class="modal-backdrop">
34
<div class="bg-gray-800 rounded-lg shadow-xl max-w-md w-full mx-4">
45
<div class="px-6 py-4 border-b border-gray-700">
56
<h3 class="text-lg font-medium text-white">Add New User</h3>
@@ -119,7 +120,8 @@
119120
</div>
120121
</form>
121122
</div>
122-
</div>
123+
</div>
124+
</Teleport>
123125
</template>
124126

125127
<script>

frontend/src/components/AddWorkshopModal.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<div v-if="show" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
2+
<Teleport to="body">
3+
<div v-if="show" class="modal-backdrop">
34
<div class="bg-gray-800 rounded-lg shadow-xl border border-gray-700 w-full max-w-md mx-4">
45
<div class="px-6 py-4 border-b border-gray-700">
56
<h3 class="text-lg font-medium text-white">Add New Workshop</h3>
@@ -103,7 +104,8 @@
103104
</div>
104105
</form>
105106
</div>
106-
</div>
107+
</div>
108+
</Teleport>
107109
</template>
108110

109111
<script>
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<template>
2+
<Teleport to="body">
3+
<div v-if="show" class="modal-backdrop">
4+
<div class="bg-gray-800 rounded-lg shadow-xl max-w-md w-full mx-4">
5+
<div class="px-6 py-4 border-b border-gray-700">
6+
<h3 class="text-lg font-medium text-white">Assigning VMs</h3>
7+
</div>
8+
9+
<div class="p-6">
10+
<!-- Progress Overview -->
11+
<div class="mb-6">
12+
<div class="flex justify-between items-center mb-2">
13+
<span class="text-sm text-gray-300">Progress</span>
14+
<span class="text-sm text-gray-400">{{ completed }} of {{ total }}</span>
15+
</div>
16+
<div class="w-full bg-gray-700 rounded-full h-2">
17+
<div
18+
class="bg-blue-600 h-2 rounded-full transition-all duration-300 ease-out"
19+
:style="{ width: `${progressPercentage}%` }"
20+
></div>
21+
</div>
22+
</div>
23+
24+
<!-- Current Status -->
25+
<div class="mb-4">
26+
<div class="flex items-center mb-2">
27+
<div v-if="isLoading" class="spinner w-4 h-4 mr-2"></div>
28+
<span class="text-sm text-gray-300">{{ currentStatus }}</span>
29+
</div>
30+
<div v-if="currentTeam" class="text-xs text-gray-400">
31+
Assigning to: {{ currentTeam }}
32+
</div>
33+
</div>
34+
35+
<!-- Success/Error Messages -->
36+
<div v-if="successMessage" class="mb-4 p-3 bg-green-900 border border-green-700 rounded-lg">
37+
<div class="flex items-center">
38+
<svg class="w-5 h-5 text-green-400 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
39+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
40+
</svg>
41+
<span class="text-green-400 text-sm">{{ successMessage }}</span>
42+
</div>
43+
</div>
44+
45+
<div v-if="errorMessage" class="mb-4 p-3 bg-red-900 border border-red-700 rounded-lg">
46+
<div class="flex items-center">
47+
<svg class="w-5 h-5 text-red-400 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
48+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
49+
</svg>
50+
<span class="text-red-400 text-sm">{{ errorMessage }}</span>
51+
</div>
52+
</div>
53+
54+
<!-- Action Buttons -->
55+
<div class="flex justify-end space-x-3">
56+
<button
57+
v-if="!isLoading && (successMessage || errorMessage)"
58+
@click="$emit('close')"
59+
class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-800 transition-colors duration-200"
60+
>
61+
Close
62+
</button>
63+
<button
64+
v-if="isLoading"
65+
@click="$emit('cancel')"
66+
class="px-4 py-2 text-sm font-medium text-gray-300 bg-gray-700 rounded-md hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 focus:ring-offset-gray-800 transition-colors duration-200"
67+
>
68+
Cancel
69+
</button>
70+
</div>
71+
</div>
72+
</div>
73+
</div>
74+
</Teleport>
75+
</template>
76+
77+
<script>
78+
export default {
79+
name: 'AssignmentProgressModal',
80+
props: {
81+
show: {
82+
type: Boolean,
83+
default: false
84+
},
85+
isLoading: {
86+
type: Boolean,
87+
default: false
88+
},
89+
completed: {
90+
type: Number,
91+
default: 0
92+
},
93+
total: {
94+
type: Number,
95+
default: 0
96+
},
97+
currentStatus: {
98+
type: String,
99+
default: ''
100+
},
101+
currentTeam: {
102+
type: String,
103+
default: ''
104+
},
105+
successMessage: {
106+
type: String,
107+
default: ''
108+
},
109+
errorMessage: {
110+
type: String,
111+
default: ''
112+
}
113+
},
114+
emits: ['close', 'cancel'],
115+
computed: {
116+
progressPercentage() {
117+
if (this.total === 0) return 0
118+
return Math.round((this.completed / this.total) * 100)
119+
}
120+
}
121+
}
122+
</script>

frontend/src/components/BulkAssignModal.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
2-
<div v-if="show" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
2+
<Teleport to="body">
3+
<div v-if="show" class="modal-backdrop">
34
<div class="bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[90vh] overflow-y-auto">
45
<div class="px-6 py-4 border-b border-gray-700">
56
<h3 class="text-lg font-medium text-white">Bulk Assign Instances</h3>
@@ -94,7 +95,8 @@
9495
</div>
9596
</form>
9697
</div>
97-
</div>
98+
</div>
99+
</Teleport>
98100
</template>
99101

100102
<script>

0 commit comments

Comments
 (0)