-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4125ad8
commit 245c847
Showing
96 changed files
with
3,085 additions
and
4,615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import CommondrfNestedAdapter from './commondrf-nested'; | ||
|
||
export default class AvailableAutomatedDeviceAdapter extends CommondrfNestedAdapter { | ||
setNestedUrlNamespace(projectId: string) { | ||
this.namespace = `${this.namespace_v2}/projects/${projectId}`; | ||
} | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
'available-automated-device': AvailableAutomatedDeviceAdapter; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import CommondrfNestedAdapter from './commondrf-nested'; | ||
|
||
export default class AvailableManualDeviceAdapter extends CommondrfNestedAdapter { | ||
setNestedUrlNamespace(projectId: string) { | ||
this.namespace = `${this.namespace_v2}/projects/${projectId}`; | ||
} | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
'available-manual-device': AvailableManualDeviceAdapter; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import CommonDRFAdapter from './commondrf'; | ||
import { underscore } from '@ember/string'; | ||
import type ModelRegistry from 'ember-data/types/registries/model'; | ||
|
||
export default class CommondrfNestedAdapter extends CommonDRFAdapter { | ||
namespace = ''; | ||
pathTypeName: keyof ModelRegistry | null = null; | ||
|
||
pathForType(type: keyof ModelRegistry) { | ||
return underscore(super.pathForType(this.pathTypeName || type)); | ||
} | ||
|
||
handleResponse( | ||
status: number, | ||
headers: object, | ||
payload: object, | ||
requestData: object | ||
) { | ||
if (status >= 400 && this.namespace === '') { | ||
throw new Error( | ||
'setNestUrlNamespace should be called before making a request' | ||
); | ||
} | ||
|
||
// reset namespace | ||
this.namespace = ''; | ||
|
||
return super.handleResponse(status, headers, payload, requestData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import CommondrfNestedAdapter from './commondrf-nested'; | ||
|
||
export default class DsAutomatedDevicePreferenceAdapter extends CommondrfNestedAdapter { | ||
_buildURL() { | ||
return this.buildURLFromBase( | ||
`${this.namespace}/ds_automated_device_preference` | ||
); | ||
} | ||
|
||
setNestedUrlNamespace(profileId: string) { | ||
this.namespace = `${this.namespace_v2}/profiles/${profileId}`; | ||
} | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
'ds-automated-device-preference': DsAutomatedDevicePreferenceAdapter; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import CommondrfNestedAdapter from './commondrf-nested'; | ||
|
||
export default class DsAutomationPreferenceAdapter extends CommondrfNestedAdapter { | ||
_buildURL() { | ||
return this.buildURLFromBase(`${this.namespace}/automation_preference`); | ||
} | ||
|
||
setNestedUrlNamespace(profileId: string) { | ||
this.namespace = `${this.namespace_v2}/profiles/${profileId}`; | ||
} | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
'ds-automation-preference': DsAutomationPreferenceAdapter; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import CommondrfNestedAdapter from './commondrf-nested'; | ||
|
||
export default class DsManualDevicePreferenceAdapter extends CommondrfNestedAdapter { | ||
_buildURL() { | ||
return this.buildURLFromBase( | ||
`${this.namespace}/ds_manual_device_preference` | ||
); | ||
} | ||
|
||
setNestedUrlNamespace(profileId: string | number) { | ||
this.namespace = `${this.namespace_v2}/profiles/${profileId}`; | ||
} | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
'ds-manual-device-preference': DsManualDevicePreferenceAdapter; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{yield | ||
(hash | ||
dsManualDevicePreference=this.dsManualDevicePreference | ||
loadingDsManualDevicePref=this.fetchDsManualDevicePref.isRunning | ||
dsAutomatedDevicePreference=this.dsAutomatedDevicePreference | ||
loadingDsAutomatedDevicePref=this.fetchDsAutomatedDevicePref.isRunning | ||
fetchAvailableDevices=(perform this.fetchAvailableDevices) | ||
availableManualDevices=this.availableDevicesResponse | ||
loadingAvailableDevices=this.fetchAvailableDevices.isRunning | ||
updateDsManualDevicePref=this.handleUpdateDsManualDevicePreference | ||
updatingDsManualDevicePref=this.updateDsManualDevicePreference.isRunning | ||
updateDsAutomatedDevicePref=this.handleUpdateDsAutomatedDevicePreference | ||
updatingDsAutomatedDevicePref=this.updateDsAutomatedDevicePreference.isRunning | ||
) | ||
}} |
Oops, something went wrong.