forked from KarolinDuerr/CNA-ModelingApp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable direct usage of TOSCA artifacts and bump to 0.3 (#8)
* add artifacts to core * refactored property editing via dialogs * continue adjust * improved ui for artifacts and enabled saving * added TOSCA export * added artifacts to tosca parsing * switched from property to artifact key in tosca and started adding artifact types * updated tosca profile to use artifacts directly
- Loading branch information
Showing
21 changed files
with
1,326 additions
and
1,339 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
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,143 @@ | ||
|
||
|
||
// TODO parse artifact types from TOSCA profiles | ||
|
||
import { all_profiles } from "@/totypa/parsedProfiles/v2dot0-profiles/all_profiles"; | ||
|
||
function getAvailableArtifactTypes() { | ||
|
||
return all_profiles.flatMap(profile => { | ||
return Object.entries(profile.artifact_types).map(([typeKey, typeDefinition]) => { | ||
return typeKey; | ||
}) | ||
}) | ||
} | ||
|
||
|
||
// Aligned to 5.3.7.2 Artifact definition | ||
class Artifact { | ||
#type: string; | ||
#file: string; | ||
#repository: string; | ||
#description: string; | ||
#deployPath: string; | ||
#artifactVersion: string; | ||
#checksum: string; | ||
#checksumAlgorithm: string; | ||
|
||
constructor( | ||
type: string, | ||
file: string, | ||
repository: string, | ||
description: string, | ||
deployPath: string, | ||
artifactVersion: string, | ||
checksum: string, | ||
checksumAlgorithm: string, | ||
) { | ||
this.#type = type; | ||
this.#file = file; | ||
this.#repository = repository; | ||
this.#description = description; | ||
this.#deployPath = deployPath; | ||
this.#artifactVersion = artifactVersion; | ||
this.#checksum = checksum; | ||
this.#checksumAlgorithm = checksumAlgorithm; | ||
} | ||
|
||
getType(): string { | ||
return this.#type; | ||
} | ||
|
||
getFile(): string { | ||
return this.#file; | ||
} | ||
|
||
getRepository(): string { | ||
return this.#repository; | ||
} | ||
|
||
getDescription(): string { | ||
return this.#description; | ||
} | ||
|
||
getDeployPath(): string { | ||
return this.#deployPath; | ||
} | ||
|
||
getArtifactVersion(): string { | ||
return this.#artifactVersion; | ||
} | ||
|
||
getChecksum(): string { | ||
return this.#checksum; | ||
} | ||
|
||
getChecksumAlgorithm(): string { | ||
return this.#checksumAlgorithm; | ||
} | ||
|
||
setType(type: string): void { | ||
this.#type = type; | ||
} | ||
|
||
setFile(file: string): void { | ||
this.#file = file; | ||
} | ||
|
||
setRepository(repository: string): void { | ||
this.#repository = repository; | ||
} | ||
|
||
setDescription(description: string): void { | ||
this.#description = description; | ||
} | ||
|
||
setDeployPath(deployPath: string): void { | ||
this.#deployPath = deployPath; | ||
} | ||
|
||
setArtifactVersion(artifactVersion: string): void { | ||
this.#artifactVersion = artifactVersion; | ||
} | ||
|
||
setChecksum(checksum: string): void { | ||
this.#checksum = checksum; | ||
} | ||
|
||
setChecksumAlgorithm(checksumAlgorithm: string): void { | ||
this.#checksumAlgorithm = checksumAlgorithm; | ||
} | ||
|
||
getAsSimpleObject(keyToAssign: string) { | ||
if (keyToAssign) { | ||
return { | ||
key: keyToAssign, | ||
type: this.#type, | ||
file: this.#file, | ||
repository: this.#repository, | ||
description: this.#description, | ||
deploy_path: this.#deployPath, | ||
artifact_version: this.#artifactVersion, | ||
checksum: this.#checksum, | ||
checksum_algorithm: this.#checksumAlgorithm | ||
} | ||
} else { | ||
return { | ||
type: this.#type, | ||
file: this.#file, | ||
repository: this.#repository, | ||
description: this.#description, | ||
deploy_path: this.#deployPath, | ||
artifact_version: this.#artifactVersion, | ||
checksum: this.#checksum, | ||
checksum_algorithm: this.#checksumAlgorithm | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
} | ||
|
||
export { Artifact, getAvailableArtifactTypes } |
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
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
Oops, something went wrong.