@serve.zone/dcrouter 13.12.0 → 13.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.
@@ -149,6 +149,15 @@ export class OpsViewDomains extends DeesElement {
149
149
  });
150
150
  },
151
151
  },
152
+ {
153
+ name: 'Migrate',
154
+ iconName: 'lucide:arrow-right-left',
155
+ type: ['inRow', 'contextmenu'] as any,
156
+ actionFunc: async (actionData: any) => {
157
+ const domain = actionData.item as interfaces.data.IDomain;
158
+ await this.showMigrateDialog(domain);
159
+ },
160
+ },
152
161
  {
153
162
  name: 'Delete',
154
163
  iconName: 'lucide:trash2',
@@ -308,6 +317,96 @@ export class OpsViewDomains extends DeesElement {
308
317
  });
309
318
  }
310
319
 
320
+ private async showMigrateDialog(domain: interfaces.data.IDomain) {
321
+ const { DeesModal, DeesToast } = await import('@design.estate/dees-catalog');
322
+ const providers = this.domainsState.providers;
323
+
324
+ // Build target options based on current source
325
+ const targetOptions: { option: string; key: string }[] = [];
326
+ if (domain.source === 'provider') {
327
+ targetOptions.push({ option: 'DcRouter (authoritative)', key: 'dcrouter' });
328
+ }
329
+ // Add all providers (except the current one if already provider-managed)
330
+ for (const p of providers) {
331
+ if (domain.source === 'provider' && domain.providerId === p.id) continue;
332
+ targetOptions.push({ option: `${p.name} (${p.type})`, key: `provider:${p.id}` });
333
+ }
334
+ if (domain.source === 'dcrouter') {
335
+ targetOptions.unshift({ option: 'DcRouter (authoritative)', key: 'dcrouter' });
336
+ }
337
+
338
+ if (targetOptions.length === 0) {
339
+ DeesToast.show({
340
+ message: 'No migration targets available. Add a DNS provider first.',
341
+ type: 'warning',
342
+ duration: 3000,
343
+ });
344
+ return;
345
+ }
346
+
347
+ const currentLabel = domain.source === 'dcrouter'
348
+ ? 'DcRouter (authoritative)'
349
+ : providers.find((p) => p.id === domain.providerId)?.name || 'Provider';
350
+
351
+ DeesModal.createAndShow({
352
+ heading: `Migrate: ${domain.name}`,
353
+ content: html`
354
+ <dees-form>
355
+ <dees-input-text
356
+ .key=${'currentSource'}
357
+ .label=${'Current source'}
358
+ .value=${currentLabel}
359
+ .disabled=${true}
360
+ ></dees-input-text>
361
+ <dees-input-dropdown
362
+ .key=${'target'}
363
+ .label=${'Migrate to'}
364
+ .description=${'Select the target DNS management'}
365
+ .options=${targetOptions}
366
+ .required=${true}
367
+ ></dees-input-dropdown>
368
+ <dees-input-checkbox
369
+ .key=${'deleteExisting'}
370
+ .label=${'Delete existing records at provider first'}
371
+ .description=${'Removes all records at the provider before pushing migrated records'}
372
+ .value=${true}
373
+ ></dees-input-checkbox>
374
+ </dees-form>
375
+ `,
376
+ menuOptions: [
377
+ { name: 'Cancel', action: async (m: any) => m.destroy() },
378
+ {
379
+ name: 'Migrate',
380
+ action: async (m: any) => {
381
+ const form = m.shadowRoot?.querySelector('.content')?.querySelector('dees-form');
382
+ if (!form) return;
383
+ const data = await form.collectFormData();
384
+ const targetKey = typeof data.target === 'object' ? data.target.key : data.target;
385
+ if (!targetKey) return;
386
+
387
+ let targetSource: interfaces.data.TDomainSource;
388
+ let targetProviderId: string | undefined;
389
+ if (targetKey === 'dcrouter') {
390
+ targetSource = 'dcrouter';
391
+ } else {
392
+ targetSource = 'provider';
393
+ targetProviderId = targetKey.replace('provider:', '');
394
+ }
395
+
396
+ await appstate.domainsStatePart.dispatchAction(appstate.migrateDomainAction, {
397
+ id: domain.id,
398
+ targetSource,
399
+ targetProviderId,
400
+ deleteExistingProviderRecords: targetSource === 'provider' ? Boolean(data.deleteExisting) : false,
401
+ });
402
+ DeesToast.show({ message: `Domain ${domain.name} migrated successfully`, type: 'success', duration: 3000 });
403
+ m.destroy();
404
+ },
405
+ },
406
+ ],
407
+ });
408
+ }
409
+
311
410
  private async deleteDomain(domain: interfaces.data.IDomain) {
312
411
  const { DeesModal } = await import('@design.estate/dees-catalog');
313
412
  DeesModal.createAndShow({
@@ -1,3 +0,0 @@
1
- import * as fs from 'fs';
2
- import * as path from 'path';
3
- export { fs, path, };
@@ -1,4 +0,0 @@
1
- import * as fs from 'fs';
2
- import * as path from 'path';
3
- export { fs, path, };
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzX29jaV9jb250YWluZXIvcGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxNQUFNLElBQUksQ0FBQztBQUN6QixPQUFPLEtBQUssSUFBSSxNQUFNLE1BQU0sQ0FBQztBQUU3QixPQUFPLEVBQ0wsRUFBRSxFQUNGLElBQUksR0FDTCxDQUFDIn0=