dsh-apk-vm 0.12.4 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -30,7 +30,7 @@ window.__ModuleLoader__.load({
30
30
  var SWIPE_THRESHOLD_PX = 24;
31
31
  var FRAME_INTERVAL_MS = 500;
32
32
  var STATE_INTERVAL_MS = 2000;
33
- var CLIENT_VERSION = '0.12.4';
33
+ var CLIENT_VERSION = '0.13.0';
34
34
 
35
35
  /* ------------------------------------------------------------------ *
36
36
  * Optional dsh-better-sidebar integration.
@@ -110,6 +110,7 @@ window.__ModuleLoader__.load({
110
110
  'state.booting': 'Booting',
111
111
  'state.ready': 'Ready',
112
112
  'state.error': 'Error',
113
+ 'state.suspended': 'Suspended',
113
114
  'pill.boot': 'boot {s}s',
114
115
  'pill.snapshot': 'quick {s}s',
115
116
  'pill.cold': 'cold {s}s',
@@ -126,6 +127,20 @@ window.__ModuleLoader__.load({
126
127
  'owner.busy': 'in use by {label}',
127
128
  'owner.scope': 'Scope',
128
129
  'owner.forceHint': 'Another owner holds this VM; release it first.',
130
+ 'owner.reserved': 'Reserved by {label} until {time}',
131
+ 'owner.takeover': 'Take over',
132
+ 'owner.takeoverOk': 'Took over the VM',
133
+ 'owner.takeoverHint': 'Another owner holds this VM. Take it over to control it; the change is recorded in the activity log.',
134
+ 'owner.locked': 'Locked by {label} since {time}',
135
+ 'owner.lock': 'Lock',
136
+ 'owner.unlock': 'Unlock',
137
+ 'owner.lockOk': 'VM locked for {label}',
138
+ 'owner.unlockOk': 'VM unlocked',
139
+ 'owner.lockHint': 'Locked: other agents and panel input are blocked until the lock owner (or a local admin) unlocks it.',
140
+ 'owner.lockPanelHint': 'Locking blocks other agents and panel input until you unlock it.',
141
+ 'owner.lockOff': 'Locks are disabled by configuration (lockEnforcement: off).',
142
+ 'owner.lockAgentsOnly': 'Locks only block other agents; this panel can still operate (lockEnforcement: agents).',
143
+ 'owner.lockUserOnly': 'Only the user can lock or unlock a VM (lockControl: user).',
129
144
  'owner.admin': 'Administrator — can operate every VM',
130
145
  'action.start': 'Start VM',
131
146
  'action.starting': 'Starting…',
@@ -306,6 +321,9 @@ window.__ModuleLoader__.load({
306
321
  'storage.cleanTemp': 'Clean temp',
307
322
  'storage.cleanSnapshots': 'Clean snapshots',
308
323
  'storage.cleanOrphans': 'Clean orphan AVDs',
324
+ 'storage.cleanCorrupt': 'Clean corrupt snapshots',
325
+ 'storage.cleanCrash': 'Clean crash dumps',
326
+ 'storage.reclaimable': 'Reclaimable',
309
327
  'storage.confirm': 'Click again to confirm',
310
328
  'storage.freed': 'Freed {size}',
311
329
  'storage.avds': '{size} AVDs',
@@ -391,6 +409,7 @@ window.__ModuleLoader__.load({
391
409
  'instances.delete': 'Destroy VM',
392
410
  'instances.created': 'Created instance {id}',
393
411
  'instances.destroyed': 'Destroyed instance {id}',
412
+ 'instances.confirmDestroy': 'Click Delete again to confirm destroying {id} (its AVD and data are deleted)',
394
413
  'instances.manage': 'VM instances',
395
414
  'instances.rename': 'Rename',
396
415
  'instances.renamePrompt': 'Display name for this VM',
@@ -400,7 +419,14 @@ window.__ModuleLoader__.load({
400
419
  'grid.close': 'Close grid',
401
420
  'instances.stop': 'Stop',
402
421
  'instances.stopped': 'Stopped instance {id}',
422
+ 'instances.start': 'Start',
423
+ 'instances.started': 'Started instance {id}',
403
424
  'instances.idle': 'idle {seconds}s',
425
+ 'instances.hostMemory': 'Host memory: {free} free of {total}',
426
+ 'instances.cap': 'instance cap {effective}/{requested}',
427
+ 'instances.lite': 'lite mode',
428
+ 'instances.profileInfo': '{ram} MB RAM · {cores} CPU',
429
+ 'setup.retrying': 'retry {attempt}/{max} in {seconds}s',
404
430
  'devices.title': 'Physical/remote adb device',
405
431
  'devices.select': 'Select device…',
406
432
  'devices.attach': 'Attach',
@@ -516,6 +542,7 @@ window.__ModuleLoader__.load({
516
542
  'state.booting': '开机中',
517
543
  'state.ready': '已就绪',
518
544
  'state.error': '出错',
545
+ 'state.suspended': '已挂起',
519
546
  'pill.boot': '启动用时 {s} 秒',
520
547
  'pill.snapshot': '快照启动 {s} 秒',
521
548
  'pill.cold': '冷启动 {s} 秒',
@@ -532,6 +559,20 @@ window.__ModuleLoader__.load({
532
559
  'owner.busy': '被 {label} 占用',
533
560
  'owner.scope': '范围',
534
561
  'owner.forceHint': '其他使用者正在占用,请先释放。',
562
+ 'owner.reserved': '{label} 保留至 {time}',
563
+ 'owner.takeover': '接管',
564
+ 'owner.takeoverOk': '已接管虚拟机',
565
+ 'owner.takeoverHint': '其他使用者正在占用此虚拟机;点击「接管」即可操作,变更会记录到活动日志。',
566
+ 'owner.locked': '由 {label} 锁定({time} 起)',
567
+ 'owner.lock': '锁定',
568
+ 'owner.unlock': '解锁',
569
+ 'owner.lockOk': '已锁定虚拟机({label})',
570
+ 'owner.unlockOk': '已解锁虚拟机',
571
+ 'owner.lockHint': '已锁定:其他 Agent 与面板操作会被拒绝,直到锁所有者(或本地管理员)解锁。',
572
+ 'owner.lockPanelHint': '锁定后其他 Agent 与面板操作都会被拒绝,直到解锁。',
573
+ 'owner.lockOff': '配置已关闭操作锁(lockEnforcement: off)。',
574
+ 'owner.lockAgentsOnly': '操作锁只阻止其他 Agent,本面板仍可操作(lockEnforcement: agents)。',
575
+ 'owner.lockUserOnly': '只有用户可以加锁/解锁虚拟机(lockControl: user)。',
535
576
  'owner.admin': '管理员 · 可操作所有虚拟机',
536
577
  'action.start': '启动虚拟机',
537
578
  'action.starting': '正在启动…',
@@ -712,6 +753,9 @@ window.__ModuleLoader__.load({
712
753
  'storage.cleanTemp': '清理临时文件',
713
754
  'storage.cleanSnapshots': '清理快照',
714
755
  'storage.cleanOrphans': '清理孤立 AVD',
756
+ 'storage.cleanCorrupt': '清理损坏快照',
757
+ 'storage.cleanCrash': '清理崩溃转储',
758
+ 'storage.reclaimable': '可回收',
715
759
  'storage.confirm': '再点一次确认',
716
760
  'storage.freed': '已释放 {size}',
717
761
  'storage.avds': '{size} 个 AVD',
@@ -797,6 +841,7 @@ window.__ModuleLoader__.load({
797
841
  'instances.delete': '销毁虚拟机',
798
842
  'instances.created': '已创建实例 {id}',
799
843
  'instances.destroyed': '已销毁实例 {id}',
844
+ 'instances.confirmDestroy': '再次点击删除以确认销毁 {id}(该实例的 AVD 与数据会被删除)',
800
845
  'instances.manage': '虚拟机实例',
801
846
  'instances.rename': '重命名',
802
847
  'instances.renamePrompt': '为这台虚拟机设置显示名称',
@@ -806,7 +851,14 @@ window.__ModuleLoader__.load({
806
851
  'grid.close': '关闭网格',
807
852
  'instances.stop': '停止',
808
853
  'instances.stopped': '已停止实例 {id}',
854
+ 'instances.start': '启动',
855
+ 'instances.started': '已启动实例 {id}',
809
856
  'instances.idle': '空闲 {seconds}s',
857
+ 'instances.hostMemory': '主机内存:可用 {free} / 共 {total}',
858
+ 'instances.cap': '实例上限 {effective}/{requested}',
859
+ 'instances.lite': '轻量模式',
860
+ 'instances.profileInfo': '{ram} MB 内存 · {cores} 核',
861
+ 'setup.retrying': '重试 {attempt}/{max},{seconds} 秒后',
810
862
  'devices.title': '物理/远程 adb 设备',
811
863
  'devices.select': '选择设备…',
812
864
  'devices.attach': '连接',
@@ -1177,6 +1229,13 @@ window.__ModuleLoader__.load({
1177
1229
  }
1178
1230
 
1179
1231
  var bootMs = Number(vmRaw.bootMs);
1232
+ var lockPolicy = { enforcement: 'all', control: 'all' };
1233
+ if (isObject(data.lockPolicy)) {
1234
+ var lockEnforcement = String(data.lockPolicy.enforcement || '');
1235
+ var lockControl = String(data.lockPolicy.control || '');
1236
+ if (lockEnforcement === 'agents' || lockEnforcement === 'off') lockPolicy.enforcement = lockEnforcement;
1237
+ if (lockControl === 'user') lockPolicy.control = lockControl;
1238
+ }
1180
1239
  return {
1181
1240
  vm: {
1182
1241
  state: state,
@@ -1193,6 +1252,9 @@ window.__ModuleLoader__.load({
1193
1252
  apk: apk,
1194
1253
  client: isObject(data.client) ? data.client : null,
1195
1254
  origin: typeof data.origin === 'string' && data.origin ? data.origin : '',
1255
+ memory: isObject(data.memory) ? data.memory : null,
1256
+ multiInstance: data.multiInstance === true,
1257
+ lockPolicy: lockPolicy,
1196
1258
  };
1197
1259
  }
1198
1260
 
@@ -2570,6 +2632,9 @@ window.__ModuleLoader__.load({
2570
2632
  var instanceBusyState = React.useState(false);
2571
2633
  var instanceBusy = instanceBusyState[0];
2572
2634
  var setInstanceBusy = instanceBusyState[1];
2635
+ var instanceConfirmState = React.useState('');
2636
+ var instanceConfirm = instanceConfirmState[0];
2637
+ var setInstanceConfirm = instanceConfirmState[1];
2573
2638
 
2574
2639
  var textInputState = React.useState('');
2575
2640
  var textInput = textInputState[0];
@@ -2789,6 +2854,26 @@ window.__ModuleLoader__.load({
2789
2854
  var displayState = snapshot ? snapshot.vm.state : stateError ? 'error' : 'loading';
2790
2855
  var stateLabel = T('state.' + displayState);
2791
2856
  var ready = displayState === 'ready';
2857
+ // Host memory / lite-mode profile reported by GET /apk-vm/state.
2858
+ var memoryInfo = snapshot && isObject(snapshot.memory) ? snapshot.memory : null;
2859
+ var memoryHost = memoryInfo && isObject(memoryInfo.host) ? memoryInfo.host : null;
2860
+ var memoryProfile = memoryInfo && isObject(memoryInfo.profile) ? memoryInfo.profile : null;
2861
+ var memoryEffective = memoryInfo && Number.isFinite(Number(memoryInfo.effectiveMaxInstances)) ? Math.max(1, Math.round(Number(memoryInfo.effectiveMaxInstances))) : null;
2862
+ var memoryRequested = memoryInfo && Number.isFinite(Number(memoryInfo.requestedMaxInstances)) ? Math.max(1, Math.round(Number(memoryInfo.requestedMaxInstances))) : null;
2863
+ var memoryFreeMb = memoryHost && Number.isFinite(Number(memoryHost.freeMb)) ? Math.max(0, Math.round(Number(memoryHost.freeMb))) : null;
2864
+ var memoryTotalMb = memoryHost && Number.isFinite(Number(memoryHost.totalMb)) ? Math.max(0, Math.round(Number(memoryHost.totalMb))) : null;
2865
+ var memoryLimited = Boolean(memoryInfo && memoryInfo.limited === true);
2866
+ var memoryProfileName = memoryProfile && typeof memoryProfile.name === 'string' ? memoryProfile.name : '';
2867
+ var formatMemoryMb = function (mb) {
2868
+ if (mb === null) return 'n/a';
2869
+ return mb >= 1024 ? (mb / 1024).toFixed(1) + ' GB' : mb + ' MB';
2870
+ };
2871
+ var memoryLineText = memoryFreeMb !== null && memoryTotalMb !== null
2872
+ ? T('instances.hostMemory', { free: formatMemoryMb(memoryFreeMb), total: formatMemoryMb(memoryTotalMb) })
2873
+ : '';
2874
+ var memoryCapText = memoryEffective !== null
2875
+ ? T('instances.cap', { effective: memoryEffective, requested: memoryRequested || memoryEffective })
2876
+ : '';
2792
2877
  var targetFps =
2793
2878
  snapshot && isObject(snapshot.stream) && Number(snapshot.stream.fps) > 0
2794
2879
  ? Math.min(10, Math.max(1, Math.round(Number(snapshot.stream.fps))))
@@ -3403,6 +3488,16 @@ window.__ModuleLoader__.load({
3403
3488
  return Boolean(ownership && isObject(ownership.owner) && ownership.owner.key === panelOwnerKey());
3404
3489
  }
3405
3490
 
3491
+ function formatOwnerTime(value) {
3492
+ var stamp = Number(value);
3493
+ if (!isFinite(stamp) || stamp <= 0) return '';
3494
+ try {
3495
+ return new Date(stamp).toLocaleString();
3496
+ } catch (error) {
3497
+ return '';
3498
+ }
3499
+ }
3500
+
3406
3501
  function claimPanelOwner(force) {
3407
3502
  if (ownerBusy) return;
3408
3503
  var id = activeInstanceRef.current || 'default';
@@ -3425,8 +3520,66 @@ window.__ModuleLoader__.load({
3425
3520
  loadOwnership();
3426
3521
  return;
3427
3522
  }
3428
- pushToast('success', T('owner.claimOk'));
3523
+ pushToast('success', force === true ? T('owner.takeoverOk') : T('owner.claimOk'));
3524
+ loadOwnership();
3525
+ loadInstances();
3526
+ loadState();
3527
+ });
3528
+ }
3529
+
3530
+ function lockPanelOwner() {
3531
+ if (ownerBusy) return;
3532
+ var id = activeInstanceRef.current || 'default';
3533
+ setOwnerBusy(true);
3534
+ requestJson('/apk-vm/ownership', {
3535
+ method: 'POST',
3536
+ body: JSON.stringify({
3537
+ action: 'lock',
3538
+ instanceId: id,
3539
+ ownerKey: panelOwnerKey(),
3540
+ ownerScope: panelScope,
3541
+ ownerLabel: '桌面面板',
3542
+ }),
3543
+ }, T).then(function (result) {
3544
+ if (!mountedRef.current) return;
3545
+ setOwnerBusy(false);
3546
+ if (!result.ok) {
3547
+ pushToast('error', (result.error || T('err.action')).slice(0, 400));
3548
+ loadOwnership();
3549
+ return;
3550
+ }
3551
+ pushToast('success', T('owner.lockOk', { label: (result.owner && result.owner.label) || '桌面面板' }));
3429
3552
  loadOwnership();
3553
+ loadInstances();
3554
+ loadState();
3555
+ });
3556
+ }
3557
+
3558
+ function unlockPanelOwner() {
3559
+ if (ownerBusy) return;
3560
+ var id = activeInstanceRef.current || 'default';
3561
+ setOwnerBusy(true);
3562
+ requestJson('/apk-vm/ownership', {
3563
+ method: 'POST',
3564
+ body: JSON.stringify({
3565
+ action: 'unlock',
3566
+ instanceId: id,
3567
+ ownerKey: panelOwnerKey(),
3568
+ ownerScope: panelScope,
3569
+ ownerLabel: '桌面面板',
3570
+ force: true,
3571
+ }),
3572
+ }, T).then(function (result) {
3573
+ if (!mountedRef.current) return;
3574
+ setOwnerBusy(false);
3575
+ if (!result.ok) {
3576
+ pushToast('error', (result.error || T('err.action')).slice(0, 400));
3577
+ loadOwnership();
3578
+ return;
3579
+ }
3580
+ pushToast('success', T('owner.unlockOk'));
3581
+ loadOwnership();
3582
+ loadInstances();
3430
3583
  loadState();
3431
3584
  });
3432
3585
  }
@@ -3552,6 +3705,25 @@ window.__ModuleLoader__.load({
3552
3705
  });
3553
3706
  }
3554
3707
 
3708
+ function startInstanceById(id) {
3709
+ if (!id || id === 'default' || instanceBusy) return;
3710
+ setInstanceBusy(true);
3711
+ requestJson('/apk-vm/instances/' + encodeURIComponent(id) + '/vm', {
3712
+ method: 'POST',
3713
+ body: JSON.stringify({ action: 'start' }),
3714
+ }, T).then(function (result) {
3715
+ if (!mountedRef.current) return;
3716
+ setInstanceBusy(false);
3717
+ if (!result.ok) {
3718
+ pushToast('error', (result.error || T('err.action')).slice(0, 400));
3719
+ return;
3720
+ }
3721
+ pushToast('success', T('instances.started', { id: id }));
3722
+ loadInstances();
3723
+ loadState();
3724
+ });
3725
+ }
3726
+
3555
3727
  function renameInstanceById(id) {
3556
3728
  if (!id || instanceBusy) return;
3557
3729
  var entry = null;
@@ -3581,8 +3753,14 @@ window.__ModuleLoader__.load({
3581
3753
 
3582
3754
  function destroyInstanceById(id) {
3583
3755
  if (!id || id === 'default' || instanceBusy) return;
3756
+ if (instanceConfirm !== id) {
3757
+ setInstanceConfirm(id);
3758
+ pushToast('success', T('instances.confirmDestroy', { id: id }));
3759
+ return;
3760
+ }
3761
+ setInstanceConfirm('');
3584
3762
  setInstanceBusy(true);
3585
- requestJson('/apk-vm/instances/' + encodeURIComponent(id), { method: 'DELETE' }, T).then(function (result) {
3763
+ requestJson('/apk-vm/instances/' + encodeURIComponent(id) + '?confirm=1', { method: 'DELETE' }, T).then(function (result) {
3586
3764
  if (!mountedRef.current) return;
3587
3765
  setInstanceBusy(false);
3588
3766
  if (!result.ok) {
@@ -4210,7 +4388,11 @@ window.__ModuleLoader__.load({
4210
4388
 
4211
4389
  function cleanStorage(action) {
4212
4390
  if (storageBusy) return;
4213
- var destructive = action === 'snapshots' || action === 'orphan-avds';
4391
+ var destructive =
4392
+ action === 'snapshots' ||
4393
+ action === 'orphan-avds' ||
4394
+ action === 'corrupt-snapshots' ||
4395
+ action === 'crash-dumps';
4214
4396
  if (destructive && storageConfirm !== action) {
4215
4397
  setStorageConfirm(action);
4216
4398
  pushToast('success', T('storage.confirm'));
@@ -4223,7 +4405,13 @@ window.__ModuleLoader__.load({
4223
4405
  payload.avdName = storageSnapshotAvd();
4224
4406
  payload.confirm = true;
4225
4407
  }
4226
- if (action === 'orphan-avds') payload.confirm = true;
4408
+ if (
4409
+ action === 'orphan-avds' ||
4410
+ action === 'corrupt-snapshots' ||
4411
+ action === 'crash-dumps'
4412
+ ) {
4413
+ payload.confirm = true;
4414
+ }
4227
4415
  requestJson('/apk-vm/storage', { method: 'POST', body: JSON.stringify(payload) }, T).then(function (result) {
4228
4416
  if (!mountedRef.current) return;
4229
4417
  setStorageBusy('');
@@ -4414,6 +4602,12 @@ window.__ModuleLoader__.load({
4414
4602
  ? ''
4415
4603
  : autoPercent.toFixed(0) + '%' +
4416
4604
  (autoReceived !== null && autoTotal !== null ? ' · ' + autoMb(autoReceived) + ' / ' + autoMb(autoTotal) : '');
4605
+ var autoAttempt = autoDetail && Number.isFinite(Number(autoDetail.attempt)) ? Math.max(1, Math.round(Number(autoDetail.attempt))) : 1;
4606
+ var autoMaxAttempts = autoDetail && Number.isFinite(Number(autoDetail.maxAttempts)) ? Math.max(autoAttempt, Math.round(Number(autoDetail.maxAttempts))) : 0;
4607
+ var autoRetryDelayMs = autoDetail && Number.isFinite(Number(autoDetail.nextDelayMs)) ? Math.max(0, Math.round(Number(autoDetail.nextDelayMs))) : 0;
4608
+ var autoRetryText = autoAttempt > 1
4609
+ ? T('setup.retrying', { attempt: autoAttempt, max: autoMaxAttempts || autoAttempt, seconds: Math.max(1, Math.round(autoRetryDelayMs / 1000)) })
4610
+ : '';
4417
4611
  var autoRunning = autoSetupStateName === 'running';
4418
4612
  var autoReadyKey = autoSetup && autoSetup.finishedAt ? 'ready:' + String(autoSetup.finishedAt) : 'ready';
4419
4613
 
@@ -5564,7 +5758,7 @@ window.__ModuleLoader__.load({
5564
5758
  className: 'apkvm-dim',
5565
5759
  style: { flex: '1 1 auto', minWidth: 0, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' },
5566
5760
  },
5567
- autoProgressText + (autoMessage ? ' · ' + autoMessage : '') + (autoProgressSuffix ? ' · ' + autoProgressSuffix : '')
5761
+ autoProgressText + (autoMessage ? ' · ' + autoMessage : '') + (autoProgressSuffix ? ' · ' + autoProgressSuffix : '') + (autoRetryText ? ' · ' + autoRetryText : '')
5568
5762
  ),
5569
5763
  actionBtn(T('setup.autoCancel'), {
5570
5764
  key: 'auto-setup-cancel',
@@ -5945,12 +6139,23 @@ window.__ModuleLoader__.load({
5945
6139
  'summary',
5946
6140
  { className: 'apkvm-debug-summary' },
5947
6141
  h('span', { className: 'apkvm-card-title' }, T('instances.manage')),
5948
- h('span', { className: 'apkvm-dim', style: { marginLeft: 'auto' } }, String(instancesList.length)),
6142
+ h(
6143
+ 'span',
6144
+ { className: 'apkvm-dim', style: { marginLeft: 'auto' }, title: [memoryLineText, memoryCapText, memoryProfileName === 'lite' ? T('instances.lite') : ''].filter(Boolean).join(' · ') },
6145
+ String(instancesList.length) + (memoryCapText ? ' · ' + memoryCapText : '')
6146
+ ),
5949
6147
  h('span', { className: 'apkvm-chevron', 'aria-hidden': 'true' }, '▸')
5950
6148
  ),
5951
6149
  h(
5952
6150
  'div',
5953
6151
  { className: 'apkvm-instlist' },
6152
+ memoryLineText || memoryCapText || memoryProfileName === 'lite'
6153
+ ? h(
6154
+ 'div',
6155
+ { className: 'apkvm-dim', style: { padding: '0 2px 2px', whiteSpace: 'normal', overflow: 'visible' } },
6156
+ [memoryLineText, memoryCapText, memoryProfileName === 'lite' ? T('instances.lite') : '', memoryLimited ? '⚠' : ''].filter(Boolean).join(' · ')
6157
+ )
6158
+ : null,
5954
6159
  instancesList.map(function (entry) {
5955
6160
  var isDefault = entry.id === 'default';
5956
6161
  var ownerInfo = entry.ownerInfo && isObject(entry.ownerInfo) ? entry.ownerInfo : null;
@@ -5973,7 +6178,14 @@ window.__ModuleLoader__.load({
5973
6178
  h(
5974
6179
  'div',
5975
6180
  { className: 'apkvm-instmeta' },
5976
- idle !== null && !isDefault ? T('instances.idle', { seconds: idle }) : ''
6181
+ [
6182
+ Number(entry.ramSizeMb) > 0 || Number(entry.cores) > 0
6183
+ ? T('instances.profileInfo', { ram: Number(entry.ramSizeMb) || '?', cores: Number(entry.cores) || '?' })
6184
+ : isDefault && memoryProfile && (Number(memoryProfile.ramSizeMb) > 0 || Number(memoryProfile.cores) > 0)
6185
+ ? T('instances.profileInfo', { ram: Number(memoryProfile.ramSizeMb) || '?', cores: Number(memoryProfile.cores) || '?' })
6186
+ : '',
6187
+ idle !== null && !isDefault ? T('instances.idle', { seconds: idle }) : '',
6188
+ ].filter(Boolean).join(' · ')
5977
6189
  ),
5978
6190
  h(
5979
6191
  'div',
@@ -5993,19 +6205,33 @@ window.__ModuleLoader__.load({
5993
6205
  ),
5994
6206
  isDefault
5995
6207
  ? null
5996
- : h(
5997
- 'button',
5998
- {
5999
- type: 'button',
6000
- className: 'apkvm-mini',
6001
- title: T('instances.stop'),
6002
- onClick: function (event) {
6003
- event.preventDefault();
6004
- stopInstanceById(entry.id);
6208
+ : entry.state === 'ready' || entry.state === 'booting' || entry.state === 'starting'
6209
+ ? h(
6210
+ 'button',
6211
+ {
6212
+ type: 'button',
6213
+ className: 'apkvm-mini',
6214
+ title: T('instances.stop'),
6215
+ onClick: function (event) {
6216
+ event.preventDefault();
6217
+ stopInstanceById(entry.id);
6218
+ },
6005
6219
  },
6006
- },
6007
- T('instances.stop')
6008
- ),
6220
+ T('instances.stop')
6221
+ )
6222
+ : h(
6223
+ 'button',
6224
+ {
6225
+ type: 'button',
6226
+ className: 'apkvm-mini',
6227
+ title: T('instances.start'),
6228
+ onClick: function (event) {
6229
+ event.preventDefault();
6230
+ startInstanceById(entry.id);
6231
+ },
6232
+ },
6233
+ T('instances.start')
6234
+ ),
6009
6235
  isDefault
6010
6236
  ? null
6011
6237
  : h(
@@ -6031,6 +6257,14 @@ window.__ModuleLoader__.load({
6031
6257
  var currentOwner = ownership && isObject(ownership.owner) ? ownership.owner : null;
6032
6258
  var panelOwns = Boolean(currentOwner && currentOwner.key === panelOwnerKey());
6033
6259
  var ownerLabel = currentOwner ? String(currentOwner.label || currentOwner.key) : T('owner.none');
6260
+ var ownerReservedUntil = currentOwner && Number(currentOwner.reservedUntil) > 0 ? Number(currentOwner.reservedUntil) : 0;
6261
+ var ownerReservedText = ownerReservedUntil ? formatOwnerTime(ownerReservedUntil) : '';
6262
+ var ownerLocked = Boolean(currentOwner && currentOwner.locked === true);
6263
+ var ownerLockedAt = ownerLocked && Number(currentOwner.lockedAt) > 0 ? formatOwnerTime(Number(currentOwner.lockedAt)) : '';
6264
+ var lockPolicy = snapshot && isObject(snapshot.lockPolicy) ? snapshot.lockPolicy : { enforcement: 'all', control: 'all' };
6265
+ var lockDisabled = lockPolicy.enforcement === 'off';
6266
+ var lockAgentsOnly = lockPolicy.enforcement === 'agents';
6267
+ var lockUserOnly = lockPolicy.control === 'user';
6034
6268
  var ownerCard = h(
6035
6269
  'details',
6036
6270
  { className: 'apkvm-card apkvm-owner', open: true },
@@ -6053,6 +6287,19 @@ window.__ModuleLoader__.load({
6053
6287
  ? h('span', { className: 'apkvm-dim' }, ' · ' + T('owner.busy', { label: ownerLabel }))
6054
6288
  : null
6055
6289
  ),
6290
+ ownerReservedText
6291
+ ? h('div', { className: 'apkvm-dim' }, T('owner.reserved', { label: ownerLabel, time: ownerReservedText }))
6292
+ : null,
6293
+ ownerLocked
6294
+ ? h('div', { className: 'apkvm-dim' }, T('owner.locked', { label: ownerLabel, time: ownerLockedAt || '' }))
6295
+ : null,
6296
+ lockDisabled
6297
+ ? h('div', { className: 'apkvm-dim' }, T('owner.lockOff'))
6298
+ : lockAgentsOnly
6299
+ ? h('div', { className: 'apkvm-dim' }, T('owner.lockAgentsOnly'))
6300
+ : lockUserOnly
6301
+ ? h('div', { className: 'apkvm-dim' }, T('owner.lockUserOnly'))
6302
+ : null,
6056
6303
  h(
6057
6304
  'div',
6058
6305
  { className: 'apkvm-ownercontrols' },
@@ -6073,12 +6320,62 @@ window.__ModuleLoader__.load({
6073
6320
  T('owner.' + scope)
6074
6321
  );
6075
6322
  }),
6323
+ currentOwner && !panelOwns
6324
+ ? h(
6325
+ 'button',
6326
+ {
6327
+ key: 'takeover',
6328
+ type: 'button',
6329
+ className: 'apkvm-mini',
6330
+ disabled: ownerBusy,
6331
+ title: T('owner.takeoverHint'),
6332
+ onClick: function (event) {
6333
+ event.preventDefault();
6334
+ claimPanelOwner(true);
6335
+ },
6336
+ },
6337
+ T('owner.takeover')
6338
+ )
6339
+ : null,
6340
+ panelOwns && !ownerLocked && !lockDisabled
6341
+ ? h(
6342
+ 'button',
6343
+ {
6344
+ key: 'lock',
6345
+ type: 'button',
6346
+ className: 'apkvm-mini',
6347
+ disabled: ownerBusy,
6348
+ title: T('owner.lockPanelHint'),
6349
+ onClick: function (event) {
6350
+ event.preventDefault();
6351
+ lockPanelOwner();
6352
+ },
6353
+ },
6354
+ T('owner.lock')
6355
+ )
6356
+ : null,
6357
+ ownerLocked
6358
+ ? h(
6359
+ 'button',
6360
+ {
6361
+ key: 'unlock',
6362
+ type: 'button',
6363
+ className: 'apkvm-mini',
6364
+ disabled: ownerBusy,
6365
+ onClick: function (event) {
6366
+ event.preventDefault();
6367
+ unlockPanelOwner();
6368
+ },
6369
+ },
6370
+ T('owner.unlock')
6371
+ )
6372
+ : null,
6076
6373
  h(
6077
6374
  'button',
6078
6375
  {
6079
6376
  type: 'button',
6080
6377
  className: 'apkvm-mini',
6081
- disabled: ownerBusy || panelOwns,
6378
+ disabled: ownerBusy || panelOwns || Boolean(currentOwner),
6082
6379
  onClick: function (event) {
6083
6380
  event.preventDefault();
6084
6381
  claimPanelOwner(false);
@@ -6101,7 +6398,7 @@ window.__ModuleLoader__.load({
6101
6398
  )
6102
6399
  ),
6103
6400
  currentOwner && !panelOwns
6104
- ? h('div', { className: 'apkvm-dim' }, T('owner.forceHint'))
6401
+ ? h('div', { className: 'apkvm-dim' }, ownerLocked ? T('owner.lockHint') : T('owner.takeoverHint'))
6105
6402
  : null
6106
6403
  )
6107
6404
  );
@@ -6974,6 +7271,11 @@ window.__ModuleLoader__.load({
6974
7271
  h('span', null, T('storage.snapshots') + ': ' + formatBytes((storage.totals && storage.totals.snapshotBytes) || 0)),
6975
7272
  h('span', null, T('storage.sdk') + ': ' + formatBytes((storage.totals && storage.totals.sdkBytes) || 0)),
6976
7273
  h('span', null, T('storage.temp') + ': ' + formatBytes((storage.totals && storage.totals.tempBytes) || 0)),
7274
+ h(
7275
+ 'span',
7276
+ null,
7277
+ T('storage.reclaimable') + ': ' + formatBytes((storage.totals && storage.totals.reclaimableBytes) || 0)
7278
+ ),
6977
7279
  storage.disk
6978
7280
  ? h('span', null, T('storage.free') + ': ' + formatBytes(storage.disk.freeBytes))
6979
7281
  : null
@@ -7036,6 +7338,40 @@ window.__ModuleLoader__.load({
7036
7338
  },
7037
7339
  }
7038
7340
  ),
7341
+ storage.totals && storage.totals.corruptBytes
7342
+ ? actionBtn(
7343
+ storageConfirm === 'corrupt-snapshots'
7344
+ ? T('storage.confirm')
7345
+ : storageBusy === 'corrupt-snapshots'
7346
+ ? '…'
7347
+ : T('storage.cleanCorrupt'),
7348
+ {
7349
+ key: 'storage-corrupt',
7350
+ small: true,
7351
+ disabled: Boolean(storageBusy),
7352
+ onClick: function () {
7353
+ cleanStorage('corrupt-snapshots');
7354
+ },
7355
+ }
7356
+ )
7357
+ : null,
7358
+ storage.totals && storage.totals.crashBytes
7359
+ ? actionBtn(
7360
+ storageConfirm === 'crash-dumps'
7361
+ ? T('storage.confirm')
7362
+ : storageBusy === 'crash-dumps'
7363
+ ? '…'
7364
+ : T('storage.cleanCrash'),
7365
+ {
7366
+ key: 'storage-crash',
7367
+ small: true,
7368
+ disabled: Boolean(storageBusy),
7369
+ onClick: function () {
7370
+ cleanStorage('crash-dumps');
7371
+ },
7372
+ }
7373
+ )
7374
+ : null,
7039
7375
  (storage.recommendations || []).some(function (item) {
7040
7376
  return item.code === 'orphan-avds';
7041
7377
  }) || (storage.avds || []).some(function (item) {