Skip to content

Commit

Permalink
Merge pull request #20 from holochain/develop
Browse files Browse the repository at this point in the history
Release v0.7.0
  • Loading branch information
mjbrisebois authored Jun 16, 2022
2 parents a6cf925 + 874aac3 commit e30bc22
Show file tree
Hide file tree
Showing 21 changed files with 416 additions and 128 deletions.
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ let
holochainVersionId = "custom";
holochainVersion = {
url = "https://github.com/holochain/holochain";
rev = "holochain-0.0.139"; # May 11, 2022 - 9356749f7fecf2414d2d388f74037514f65571ef
sha256 = "0xy7hxyaliwms8p083lqn9qqpgk62f56zsl6zrgw7v0lrrd2lcfd";
rev = "holochain-0.0.143"; # Jun 8, 2022 - 7f204047c56a2c165b1442cd480828a03caadde2
sha256 = "1qcsj76i8ig1lavm1nyr50w2grnqnmxar01hmky1zsdz3a2blzsx";
cargoLock = {
outputHashes = {
};
Expand Down
6 changes: 0 additions & 6 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,5 @@ module.exports = async function () {

crux_config.upgrade( client );

const response = await client.call( "happs", "happ_library", "register_peer_dnas", {
"dnarepo": client._app_schema._dnas.dnarepo._hash,
"happs": client._app_schema._dnas.happs._hash,
"webassets": client._app_schema._dnas.webassets._hash,
});

return client;
}
38 changes: 38 additions & 0 deletions src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,44 @@ const common = {

return a[i] > b[i] ? 1 : -1;
},

sort_version ( reverse = false ) {
return (a,b) => {
if( a.version > b.version )
return reverse ? -1 : 1;
if( a.version < b.version )
return reverse ? 1 : -1;

if( a.published_at > b.published_at )
return reverse ? -1 : 1;
if( a.published_at < b.published_at )
return reverse ? 1 : -1;

return 0;
};
},

sort_published_at ( reverse = false ) {
return (a,b) => {
if( a.published_at > b.published_at )
return reverse ? -1 : 1;
if( a.published_at < b.published_at )
return reverse ? 1 : -1;

return 0;
};
},

sort_by_key ( key, reverse = false ) {
return (a,b) => {
if( a[key] > b[key] )
return reverse ? -1 : 1;
if( a[key] < b[key] )
return reverse ? 1 : -1;

return 0;
};
},
};


Expand Down
11 changes: 11 additions & 0 deletions src/components/DnaCard.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<div class="card entity-card dna-card">
<loading :when="!$dna.current">
<div class="entity-card-header">DNA: <placeholder :when="!$dna.current"><strong>{{ dna.name }}</strong></placeholder></div>
<div v-if="actions.length" class="entity-card-actions">
<template v-for="action in actions">
<a v-if="!action.hide"
class="float-start"
:title="action.title"
:alt="action.alt"
@click="action.method()">
<i :class="'bi-' + action.icon"></i>
</a>
</template>
</div>
<div class="card-body">
<div class="row mb-2">
<div class="col-auto">
Expand Down
28 changes: 25 additions & 3 deletions src/components/DnaCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,31 @@ module.exports = function ( element_local_name, component_name ) {
"type": Boolean,
"default": true,
},
"fetchVersions": {
"type": Boolean,
"default": false,
"actions": {
validator (value) {
if ( !Array.isArray(value) )
return false;

for (let action of value) {
if ( typeof action !== "object" || action === null )
return false;

if ( typeof action.method !== "function" )
return false;
if ( typeof action.icon !== "string" )
return false;

if ( action.hide && typeof action.hide !== "boolean" )
return false;
if ( action.title && typeof action.title !== "string" )
return false;
if ( action.alt && typeof action.alt !== "string" )
return false;
}

return true;
},
"default": [],
},

// Only initial value is used
Expand Down
11 changes: 11 additions & 0 deletions src/components/DnaVersionCard.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
</div>
<loading v-else :when="!$version.current">
<div class="entity-card-header">{{ header_prefix }}: <strong>{{ version.version }}</strong></div>
<div v-if="actions.length" class="entity-card-actions">
<template v-for="action in actions">
<a v-if="!action.hide"
class="float-start"
:title="action.title"
:alt="action.alt"
@click="action.method()">
<i :class="'bi-' + action.icon"></i>
</a>
</template>
</div>
<div class="card-body">
<div class="row mb-2">
<div class="col-auto">
Expand Down
26 changes: 26 additions & 0 deletions src/components/DnaVersionCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ module.exports = function ( element_local_name, component_name ) {
"type": Boolean,
"default": true,
},
"actions": {
validator (value) {
if ( !Array.isArray(value) )
return false;

for (let action of value) {
if ( typeof action !== "object" || action === null )
return false;

if ( typeof action.method !== "function" )
return false;
if ( typeof action.icon !== "string" )
return false;

if ( action.hide && typeof action.hide !== "boolean" )
return false;
if ( action.title && typeof action.title !== "string" )
return false;
if ( action.alt && typeof action.alt !== "string" )
return false;
}

return true;
},
"default": [],
},

// Only initial value is used
"expand": {
Expand Down
23 changes: 8 additions & 15 deletions src/dna_controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ module.exports = async function ( client ) {
"agent_input_cache": input_cache,
"agent_input": this.$route.query.agent || input_cache || "",
"agent_hash": null,
"order_by": "published_at",
"order_by": "last_updated",
"reverse_order": true,
"list_filter": "",
};
},
Expand All @@ -42,7 +43,7 @@ module.exports = async function ( client ) {
},

dnas () {
return (
const dnas = (
this.agent_input.length
? this.$store.getters.dnas( this.agent )
: this.$store.getters.dnas( "all" )
Expand All @@ -65,6 +66,10 @@ module.exports = async function ( client ) {

return 0;
});

dnas.sort( this.sort_by_key( this.order_by, this.reverse_order ) );

return dnas;
},
$dnas () {
return this.agent_input.length
Expand Down Expand Up @@ -286,19 +291,7 @@ module.exports = async function ( client ) {

versions () {
const versions = this.$store.getters.dna_versions( this.id );
versions.sort( (a,b) => {
if( a.version > b.version )
return -1;
if( a.version < b.version )
return 1;

if( a.published_at > b.published_at )
return -1;
if( a.published_at < b.published_at )
return 1;

return 0;
});
versions.sort( this.sort_version( true ) );
return versions;
},
$versions () {
Expand Down
22 changes: 15 additions & 7 deletions src/dna_version_controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ module.exports = async function ( client ) {

this.lock_hdk_version_input = true;

log.info("Fetch Zome versions for:", zome.$id );
this.added_zomes.push( zome );
this.input.zomes.push({
"name": zome.name.toLowerCase().replace(/[/\\?%*:|"<> ]/g, '_'),
Expand Down Expand Up @@ -398,6 +397,7 @@ module.exports = async function ( client ) {
"version": 1,
"changelog": "",
"hdk_version": null,
"properties": null,
},
"initial_step": this.$route.params.step,
"validated": false,
Expand Down Expand Up @@ -613,15 +613,18 @@ module.exports = async function ( client ) {
},

reset_file () {
for ( let zome of this.bundle.zomes ) {
zome.saving = false;
zome.validated = false;
zome.selected_zome = null;
zome.selected_zome_version = null;
if ( this.bundle.zomes ) {
for ( let zome of this.bundle.zomes ) {
zome.saving = false;
zome.validated = false;
zome.selected_zome = null;
zome.selected_zome_version = null;
}
}

this.input.changelog = "";
this.input.hdk_version = null;
this.input.properties = null;

this.validated = false;
this.lock_hdk_version_input = false;
Expand All @@ -630,6 +633,7 @@ module.exports = async function ( client ) {
this.select_version_context = null;
this.select_zome_context = null;

this.$store.dispatch("removeValue", [ "file", this.uploaded_file.hash ] );
this.$store.dispatch("removeValue", [ "file", this.file_id ] );
},
missing_zome_version ( dna ) {
Expand All @@ -653,9 +657,12 @@ module.exports = async function ( client ) {

if ( this.bundle.type !== "dna" ) {
alert(`Uploaded bundle is not a DNA bundle. found bundle type '${this.bundle.type}'`);
this.reset_file();
return this.reset_file();
}

if ( this.bundle.properties )
this.input.properties = Object.assign( {}, this.bundle.properties );

this.bundle.zomes.forEach( async zome => {
zome.version = 1;

Expand Down Expand Up @@ -805,6 +812,7 @@ module.exports = async function ( client ) {
const input = {
"version": this.input.version,
"hdk_version": this.input.hdk_version,
"properties": this.input.properties,
"changelog": this.input.changelog,
"zomes": this.bundle.zomes.map( info => {
const zome = info.selected_zome;
Expand Down
Loading

0 comments on commit e30bc22

Please sign in to comment.