Skip to content

Commit 482f8e6

Browse files
authored
UPDATE: Unattended Updates (#2261)
1 parent a36ca1a commit 482f8e6

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

  • controls/roles/configure-updates/tasks
  • launcher/src/components/UI/server-management/components/server-settings

controls/roles/configure-updates/tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
- name: Configure unattended update
33
ansible.builtin.cron:
44
name: "stereum auto unattended update"
5-
minute: "{{ stereum.settings.updates.unattended.min | default('0') }}"
6-
hour: "{{ stereum.settings.updates.unattended.hour | default('3') }}" # default: 3:00 am
7-
day: "*/{{ stereum.settings.updates.unattended.interval_days | default(7) }}" # default: every 7 days
5+
minute: "{{ stereum.settings.updates.unattended.min | default(59 | random) }}"
6+
hour: "{{ stereum.settings.updates.unattended.hour | default(3 | random) }}" # default: 3:00 am
7+
day: "*/{{ stereum.settings.updates.unattended.interval_days | default(1) }}" # default: every day
88
job: >
99
cd "{{ stereum.settings.controls_install_path | default('/opt/stereum') }}/ansible/controls"
1010
&& ./unattended-update.sh

launcher/src/components/UI/server-management/components/server-settings/ServerSettings.vue

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
v-model="intervalDayInput"
5050
type="number"
5151
min="1"
52-
max="100"
52+
max="28"
5353
class="w-full h-7 bg-[#2a2a2c] text-white border border-gray-700 rounded-md p-2 text-sm focus:border-[#336666] focus:outline-none transition-colors"
5454
:class="!isEditActive ? 'cursor-not-allowed opacity-50' : ''"
5555
:disabled="!isEditActive"
56-
placeholder="1-100"
56+
placeholder="1-28"
5757
/>
5858
</div>
5959
</div>
@@ -92,8 +92,8 @@
9292

9393
<button
9494
class="col-start-1 col-span-full row-start-7 row-span-1 bg-gradient-to-r from-[#336666] to-[#4a8080] hover:from-[#4a8080] hover:to-[#336666] text-xs uppercase text-white font-medium py-1 px-4 rounded-md transition-all duration-300 ease-in-out transform hover:scale-[1.02] active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed"
95-
:class="!isEditActive ? 'cursor-not-allowed opacity-50 pointer-events-none' : ''"
96-
:disabled="!areInputsValid || !isEditActive"
95+
:class="!areInputsValid ? 'cursor-not-allowed opacity-50 pointer-events-none' : ''"
96+
:disabled="!areInputsValid"
9797
@click="confirmChanges"
9898
>
9999
Confirm
@@ -113,9 +113,10 @@ const t = i18n.global.t;
113113
const footerStore = useFooter();
114114
115115
const isAutoUpdateEnabled = ref(false);
116-
const intervalDayInput = ref(7);
117-
const hourInput = ref(3);
118-
const minuteInput = ref(0);
116+
const intervalDayInput = ref(1);
117+
// set random default value for hour and minute
118+
const hourInput = ref(Math.floor(Math.random() * 3));
119+
const minuteInput = ref(Math.floor(Math.random() * 60));
119120
const isChangesConfirmed = ref(false);
120121
const inputMsg = ref("");
121122
const isEditActive = ref(false);
@@ -125,7 +126,7 @@ const areInputsValid = computed(() => {
125126
return false;
126127
}
127128
128-
const dayValid = intervalDayInput.value >= 1 && intervalDayInput.value <= 100;
129+
const dayValid = intervalDayInput.value >= 1 && intervalDayInput.value <= 28;
129130
const hourValid = hourInput.value >= 0 && hourInput.value <= 23;
130131
const minuteValid = minuteInput.value >= 0 && minuteInput.value <= 59;
131132
@@ -150,8 +151,8 @@ const turnOnOff = () => {
150151
151152
const confirmChanges = async () => {
152153
if (!areInputsValid.value) {
153-
if (intervalDayInput.value < 1 || intervalDayInput.value > 100) {
154-
inputMsg.value = "Days must be between 1 and 100";
154+
if (intervalDayInput.value < 1 || intervalDayInput.value > 28) {
155+
inputMsg.value = "Days must be between 1 and 28";
155156
return;
156157
}
157158
if (hourInput.value < 0 || hourInput.value > 23) {

0 commit comments

Comments
 (0)