Skip to content

Commit 3c4930b

Browse files
committed
WIP fix issues
1 parent 56f1369 commit 3c4930b

File tree

5 files changed

+31
-27
lines changed

5 files changed

+31
-27
lines changed

browser/data-browser/src/views/DrivePage.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,23 @@ function DrivePage({ resource }: ResourcePageProps): JSX.Element {
6969
<CardRow key={child}>
7070
<ResourceInline subject={child} />
7171
</CardRow>
72-
);
73-
})}
74-
<CardRow>
75-
<AtomicLink path={paths.new}>
76-
<FaPlus /> Create new resource
77-
</AtomicLink>
78-
</CardRow>
79-
</CardInsideFull>
80-
</Card>
81-
{baseURL.includes('localhost') && (
82-
<p>
83-
You are running Atomic-Server on `localhost`, which means that it will
84-
not be available from any other machine than your current local
85-
device. If you want your Atomic-Server to be available from the web,
86-
you should set this up at a Domain on a server.
87-
</p>
88-
)}
72+
))}
73+
<CardRow>
74+
<AtomicLink path={paths.new}>
75+
<FaPlus /> Create new resource
76+
</AtomicLink>
77+
</CardRow>
78+
</CardInsideFull>
79+
</Card>
80+
{baseURL.includes('localhost') && (
81+
<p>
82+
You are running Atomic-Server on `localhost`, which means that it
83+
will not be available from any other machine than your current local
84+
device. If you want your Atomic-Server to be available from the web,
85+
you should set this up at a Domain on a server.
86+
</p>
87+
)}
88+
</Column>
8989
</ContainerNarrow>
9090
);
9191
}

browser/data-browser/src/views/OntologyPage/newClass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Resource, Store, core } from '@tomic/react';
22

3-
const DEFAULT_DESCRIPTION = 'Change me';
3+
const DEFAULT_DESCRIPTION = 'Default description - Change me';
44

55
export const subjectForClass = (parent: Resource, shortName: string): string =>
66
`${parent.subject}/class/${shortName}`;

browser/data-browser/src/views/TablePage/ExpandedRowDialog.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ export function ExpandedRowDialog({
2323
}: ExpandedRowDialogProps): JSX.Element {
2424
const { tableRef } = useTableEditorContext();
2525
const resource = useResource(subject);
26-
const [dialogProps, show] = useDialog({
26+
const { dialogProps, show } = useDialog({
2727
bindShow: bindOpen,
2828
triggerRef: tableRef,
2929
});
30-
3130
useEffect(() => {
3231
if (open) {
3332
show();

browser/lib/src/authentication.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import type { Agent } from './agent.js';
1+
import { Agent } from './agent.js';
22
import type { HeadersObject } from './client.js';
3-
import { getTimestampNow, signToBase64 } from './commit.js';
3+
import { generateKeyPair, getTimestampNow, signToBase64 } from './commit.js';
4+
import { Store } from './store.js';
5+
import { properties } from './urls.js';
46

57
/** Returns a JSON-AD resource of an Authentication */
68
export async function createAuthentication(subject: string, agent: Agent) {

lib/src/commit.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,12 @@ impl Commit {
177177
if is_new && opts.validate_subject_url_parent {
178178
if let Ok(parent) = resource_new.get(urls::PARENT) {
179179
let parent_str = parent.to_string();
180-
if !self.subject.starts_with(&parent_str) {
180+
let parent_url = url::Url::parse(&parent_str)?;
181+
let subj_host = subject_url.host_str().ok_or("No host in subject URL")?;
182+
let parent_host = parent_url.host_str().ok_or("No host in parent URL")?;
183+
if subj_host != parent_host {
181184
return Err(format!(
182-
"You cannot create a new Resource with this subject, because the parent '{}' is not part of the URL of the new subject '{}'.",
185+
"Subject URL host '{}' does not match parent host URL '{}'.",
183186
parent_str, self.subject
184187
)
185188
.into());
@@ -746,7 +749,7 @@ mod test {
746749

747750
#[test]
748751
fn agent_and_commit() {
749-
let store = crate::Store::init().unwrap();
752+
let mut store = crate::Store::init().unwrap();
750753
store.populate().unwrap();
751754
let agent = store.create_agent(Some("test_actor")).unwrap();
752755
let subject = "https://localhost/new_thing";
@@ -778,7 +781,7 @@ mod test {
778781

779782
#[test]
780783
fn serialize_commit() {
781-
let store = crate::Store::init().unwrap();
784+
let mut store = crate::Store::init().unwrap();
782785
store.populate().unwrap();
783786
let mut set: HashMap<String, Value> = HashMap::new();
784787
let shortname = Value::new("shortname", &DataType::String).unwrap();
@@ -844,7 +847,7 @@ mod test {
844847
#[test]
845848

846849
fn invalid_subjects() {
847-
let store = crate::Store::init().unwrap();
850+
let mut store = crate::Store::init().unwrap();
848851
store.populate().unwrap();
849852
let agent = store.create_agent(Some("test_actor")).unwrap();
850853
let resource = Resource::new("https://localhost/test_resource".into());

0 commit comments

Comments
 (0)