mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
* chore(project): install prettier and lint-staged * chore(project): apply prettier to html too * chore(project): git ignore eslintcache * chore(project): add a comment about format script * chore(prettier): update printWidth * chore(prettier): remove useTabs option * chore(prettier): add HTML validation * refactor(prettier): fix closing tags * feat(prettier): define angular parser for html templates * style(prettier): run prettier on codebase Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
26 lines
750 B
JavaScript
26 lines
750 B
JavaScript
import { ResourceControlViewModel } from 'Portainer/models/resourceControl/resourceControl';
|
|
|
|
function b64DecodeUnicode(str) {
|
|
return decodeURIComponent(
|
|
atob(str)
|
|
.split('')
|
|
.map(function (c) {
|
|
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
})
|
|
.join('')
|
|
);
|
|
}
|
|
|
|
export function ConfigViewModel(data) {
|
|
this.Id = data.ID;
|
|
this.CreatedAt = data.CreatedAt;
|
|
this.UpdatedAt = data.UpdatedAt;
|
|
this.Version = data.Version.Index;
|
|
this.Name = data.Spec.Name;
|
|
this.Labels = data.Spec.Labels;
|
|
this.Data = b64DecodeUnicode(data.Spec.Data);
|
|
|
|
if (data.Portainer && data.Portainer.ResourceControl) {
|
|
this.ResourceControl = new ResourceControlViewModel(data.Portainer.ResourceControl);
|
|
}
|
|
}
|