Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions web/__test__/components/Registration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,27 @@ describe('Registration.standalone.vue', () => {

expect(moveButton.exists()).toBe(true);
expect(moveButton.attributes('disabled')).toBeUndefined();
expect(findItemByLabel(t('registration.flashGuid'))?.props('text')).toBe(
'058F-6387-0000-0000F1F1E1C6'
);
expect(findItemByLabel(t('TPM GUID'))?.props('text')).toBe('01-V35H8S0L1QHK1SBG1XHXJNH7');
});

it('shows both licensing GUIDs when no key is installed', async () => {
serverStore.state = 'ENOKEYFILE';
serverStore.guid = '058F-6387-0000-0000F1F1E1C6';
serverStore.flashGuid = '058F-6387-0000-0000F1F1E1C6';
serverStore.tpmGuid = '01-V35H8S0L1QHK1SBG1XHXJNH7';

await wrapper.vm.$nextTick();

expect(findItemByLabel(t('registration.flashGuid'))?.props('text')).toBe(
'058F-6387-0000-0000F1F1E1C6'
);
expect(findItemByLabel(t('TPM GUID'))?.props('text')).toBe('01-V35H8S0L1QHK1SBG1XHXJNH7');
expect(wrapper.find('[data-testid="move-license-to-tpm"]').exists()).toBe(false);
});

it('shows Move License to TPM when flashGuid is missing but the active GUID is still a flash GUID', async () => {
serverStore.state = 'PRO';
serverStore.guid = '058F-6387-0000-0000F1F1E1C6';
Expand Down
34 changes: 34 additions & 0 deletions web/__test__/store/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ const getStore = () => {
description: store.description,
deviceCount: store.deviceCount,
expireTime: store.expireTime,
flashGuid: store.flashGuid || undefined,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
flashProduct: store.flashProduct,
flashVendor: store.flashVendor,
guid: store.guid,
Expand All @@ -203,6 +204,7 @@ const getStore = () => {
regTy: store.regTy,
regUpdatesExpired: store.regUpdatesExpired,
state: store.state,
tpmGuid: store.tpmGuid || undefined,
wanFQDN: store.wanFQDN,
};

Expand All @@ -218,6 +220,7 @@ const getStore = () => {
deviceCount: store.deviceCount,
description: store.description,
expireTime: store.expireTime,
flashGuid: store.flashGuid || undefined,
flashProduct: store.flashProduct,
flashVendor: store.flashVendor,
guid: store.guid,
Expand All @@ -233,6 +236,7 @@ const getStore = () => {
regTy: store.regTy,
regUpdatesExpired: store.regUpdatesExpired,
state: store.state,
tpmGuid: store.tpmGuid || undefined,
wanFQDN: store.wanFQDN,
};

Expand Down Expand Up @@ -292,6 +296,14 @@ const getStore = () => {
return store;
};

const getActualStore = () =>
useServerStore(
createTestingPinia({
createSpy: vi.fn,
stubActions: false,
})
);

// Mock dependent stores
vi.mock('~/store/account', () => ({
useAccountStore: vi.fn(() => ({
Expand Down Expand Up @@ -651,6 +663,7 @@ describe('useServerStore', () => {
deviceCount: 6,
description: 'Test Server',
expireTime: 123,
flashGuid: 'flash-guid-1',
flashProduct: 'TestFlash',
flashVendor: 'TestVendor',
guid: '123456',
Expand All @@ -675,6 +688,7 @@ describe('useServerStore', () => {
expect(payload.description).toBe('Test Server');
expect(payload.deviceCount).toBe(6);
expect(payload.expireTime).toBe(123);
expect(payload.flashGuid).toBe('flash-guid-1');
expect(payload.flashProduct).toBe('TestFlash');
expect(payload.flashVendor).toBe('TestVendor');
expect(payload.guid).toBe('123456');
Expand Down Expand Up @@ -767,6 +781,7 @@ describe('useServerStore', () => {
regGuid: 'reg-guid-1',
regTy: 'Plus',
state: 'PLUS' as ServerState,
tpmGuid: '01-TPM-GUID-1',
wanFQDN: 'test.myunraid.net',
});

Expand All @@ -777,6 +792,7 @@ describe('useServerStore', () => {
expect(payload.deviceCount).toBe(6);
expect(payload.description).toBe('Test Server');
expect(payload.expireTime).toBe(123);
expect(payload.flashGuid).toBe('flash-guid-1');
expect(payload.flashProduct).toBe('TestFlash');
expect(payload.flashVendor).toBe('TestVendor');
expect(payload.guid).toBe('123456');
Expand All @@ -792,9 +808,27 @@ describe('useServerStore', () => {
expect(payload.regTy).toBe('Plus');
expect(payload.regUpdatesExpired).toBe(true);
expect(payload.state).toBe('PLUS');
expect(payload.tpmGuid).toBe('01-TPM-GUID-1');
expect(payload.wanFQDN).toBe('test.myunraid.net');
});

it('should include physical identities in the actual callback payloads', () => {
const store = getActualStore();

store.setServer({
flashGuid: '058F-6387-0000-0000F1F1E1C6',
guid: '058F-6387-0000-0000F1F1E1C6',
tpmGuid: '01-V35H8S0L1QHK1SBG1XHXJNH7',
} as Server);

expect(store.serverPurchasePayload.flashGuid).toBe('058F-6387-0000-0000F1F1E1C6');
expect(store.serverPurchasePayload.tpmGuid).toBe('01-V35H8S0L1QHK1SBG1XHXJNH7');
expect(store.serverAccountPayload.flashGuid).toBe('058F-6387-0000-0000F1F1E1C6');
expect(store.serverAccountPayload.tpmGuid).toBe('01-V35H8S0L1QHK1SBG1XHXJNH7');
expect(store.serverReplacePayload.flashGuid).toBe('058F-6387-0000-0000F1F1E1C6');
expect(store.serverReplacePayload.tpmGuid).toBe('01-V35H8S0L1QHK1SBG1XHXJNH7');
});

it('should create serverReplacePayload with TPM guid when available on flash boot', () => {
const store = getStore();

Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"@jsonforms/vue-vuetify": "3.6.0",
"@nuxt/ui": "4.8.2",
"@tanstack/vue-table": "8.21.3",
"@unraid/shared-callbacks": "3.1.0",
"@unraid/shared-callbacks": "3.2.0",
"@unraid/ui": "link:../unraid-ui",
"@vue/apollo-composable": "4.2.2",
"@vueuse/components": "13.8.0",
Expand Down
32 changes: 24 additions & 8 deletions web/src/components/Registration.standalone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const {
hasDistinctTpmGuid,
dateTimeFormat,
deviceCount,
flashGuid,
flashProduct,
flashVendor,
guid,
Expand Down Expand Up @@ -133,25 +134,40 @@ const showTpmTransferButton = computed((): boolean =>
);
const disableTpmTransferButton = computed((): boolean => showTrialExpiration.value);

// Organize items into three sections
const bootDeviceItems = computed((): RegistrationItemProps[] => {
return [
...(guid.value
const licensingGuidItems = computed((): RegistrationItemProps[] => {
const items: RegistrationItemProps[] = [
...(flashGuid.value
? [
{
label: t('registration.deviceGuid'),
text: guid.value,
label: t('registration.flashGuid'),
text: flashGuid.value,
},
]
: []),
...(showTpmTransferButton.value && tpmGuid.value
: guid.value
? [
{
label: t('registration.deviceGuid'),
text: guid.value,
},
]
: []),
...(tpmGuid.value && (flashGuid.value || tpmGuid.value !== guid.value)
? [
{
label: t('registration.tpmGuid'),
text: tpmGuid.value,
},
]
: []),
];

return items;
});

// Organize items into three sections
const bootDeviceItems = computed((): RegistrationItemProps[] => {
return [
...licensingGuidItems.value,
...(bootDeviceType.value
? [
{
Expand Down
1 change: 1 addition & 0 deletions web/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@
"registration.bootDeviceType.internalBootMulti": "Internal Boot (Multi-device)",
"registration.bootDeviceType.tpm": "TPM",
"registration.deviceGuid": "Device GUID",
"registration.flashGuid": "USB Flash GUID",
"registration.flashProduct": "Flash Product",
"registration.flashVendor": "Flash Vendor",
"registration.general.goToToolsRegistrationToLearn": "Go to Tools > Registration to Learn More",
Expand Down
2 changes: 2 additions & 0 deletions web/src/store/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ export const useServerStore = defineStore('server', () => {
description: description.value,
deviceCount: deviceCount.value,
expireTime: expireTime.value,
flashGuid: flashGuid.value || undefined,
flashProduct: flashProduct.value,
flashVendor: flashVendor.value,
guid: guid.value,
Expand All @@ -268,6 +269,7 @@ export const useServerStore = defineStore('server', () => {
regTy: regTy.value,
regUpdatesExpired: regUpdatesExpired.value,
state: state.value,
tpmGuid: tpmGuid.value || undefined,
wanFQDN: wanFQDN.value,
...overrides,
};
Expand Down
Loading